aboutsummaryrefslogtreecommitdiff
path: root/sys/sparc64/central
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2011-10-02 23:22:38 +0000
committerMarius Strobl <marius@FreeBSD.org>2011-10-02 23:22:38 +0000
commitbda8e754a1ac3be73c297bf03353d56c7ab81ce3 (patch)
tree8a3ccb0c4cbe92ab406722848f03d20132c1e280 /sys/sparc64/central
parent6ec3cd078c13e2240339c436c71968304fb7c211 (diff)
downloadsrc-bda8e754a1ac3be73c297bf03353d56c7ab81ce3.tar.gz
src-bda8e754a1ac3be73c297bf03353d56c7ab81ce3.zip
Make sparc64 compatible with NEW_PCIB and enable it:
- Implement bus_adjust_resource() methods as far as necessary and in non-PCI bridge drivers as far as feasible without rototilling them. - As NEW_PCIB does a layering violation by activating resources at layers above pci(4) without previously bubbling up their allocation there, move the assignment of bus tags and handles from the bus_alloc_resource() to the bus_activate_resource() methods like at least the other NEW_PCIB enabled architectures do. This is somewhat unfortunate as previously sparc64 (ab)used resource activation to indicate whether SYS_RES_MEMORY resources should be mapped into KVA, which is only necessary if their going to be accessed via the pointer returned from rman_get_virtual() but not for bus_space(9) as the later always uses physical access on sparc64. Besides wasting KVA if we always map in SYS_RES_MEMORY resources, a driver also may deliberately not map them in if the firmware already has done so, possibly in a special way. So in order to still allow a driver to decide whether a SYS_RES_MEMORY resource should be mapped into KVA we let it indicate that by calling bus_space_map(9) with BUS_SPACE_MAP_LINEAR as actually documented in the bus_space(9) page. This is implemented by allocating a separate bus tag per SYS_RES_MEMORY resource and passing the resource via the previously unused bus tag cookie so we later on can call rman_set_virtual() in sparc64_bus_mem_map(). As a side effect this now also allows to actually indicate that a SYS_RES_MEMORY resource should be mapped in as cacheable and/or read-only via BUS_SPACE_MAP_CACHEABLE and BUS_SPACE_MAP_READONLY respectively. - Do some minor cleanup like taking advantage of rman_init_from_resource(), factor out the common part of bus tag allocation into a newly added sparc64_alloc_bus_tag(), hook up some missing newbus methods and replace some homegrown versions with the generic counterparts etc. - While at it, let apb_attach() (which can't use the generic NEW_PCIB code as APB bridges just don't have the base and limit registers implemented) regarding the config space registers cached in pcib_softc and the SYSCTL reporting nodes set up.
Notes
Notes: svn path=/head/; revision=225931
Diffstat (limited to 'sys/sparc64/central')
-rw-r--r--sys/sparc64/central/central.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/sparc64/central/central.c b/sys/sparc64/central/central.c
index 777660fdfebb..e418a8be458d 100644
--- a/sys/sparc64/central/central.c
+++ b/sys/sparc64/central/central.c
@@ -60,6 +60,7 @@ static device_attach_t central_attach;
static bus_print_child_t central_print_child;
static bus_probe_nomatch_t central_probe_nomatch;
static bus_alloc_resource_t central_alloc_resource;
+static bus_adjust_resource_t central_adjust_resource;
static bus_get_resource_list_t central_get_resource_list;
static ofw_bus_get_devinfo_t central_get_devinfo;
@@ -79,6 +80,7 @@ static device_method_t central_methods[] = {
DEVMETHOD(bus_alloc_resource, central_alloc_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
+ DEVMETHOD(bus_adjust_resource, central_adjust_resource),
DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource),
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
@@ -180,6 +182,15 @@ central_attach(device_t dev)
}
static int
+central_adjust_resource(device_t bus __unused, device_t child __unused,
+ int type __unused, struct resource *r __unused, u_long start __unused,
+ u_long end __unused)
+{
+
+ return (ENXIO);
+}
+
+static int
central_print_child(device_t dev, device_t child)
{
int rv;