diff options
author | marius <marius@FreeBSD.org> | 2005-03-04 22:21:11 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2005-03-04 22:21:11 +0000 |
commit | ee7224dfdd43a3858556ec007e57d600e6150a93 (patch) | |
tree | 5a65ca09e58d5d118628b55cd127bfeba404a087 /sys/sparc64/fhc | |
parent | dc76d87d6cf1e65acf625f1318d62e725a550400 (diff) | |
download | FreeBSD-src-ee7224dfdd43a3858556ec007e57d600e6150a93.zip FreeBSD-src-ee7224dfdd43a3858556ec007e57d600e6150a93.tar.gz |
Let central(4) manage the resources of its children so they don't need
to fiddle with OFW themselves.
Thanks to: joerg for providing access to an E3500
Diffstat (limited to 'sys/sparc64/fhc')
-rw-r--r-- | sys/sparc64/fhc/fhc_central.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/sys/sparc64/fhc/fhc_central.c b/sys/sparc64/fhc/fhc_central.c index 0fe5eba..1d698ea 100644 --- a/sys/sparc64/fhc/fhc_central.c +++ b/sys/sparc64/fhc/fhc_central.c @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include <sys/module.h> #include <dev/ofw/ofw_bus.h> -#include <dev/ofw/openfirm.h> #include <machine/bus.h> #include <machine/resource.h> @@ -44,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include <sparc64/fhc/fhcreg.h> #include <sparc64/fhc/fhcvar.h> -#include <sparc64/sbus/ofw_sbus.h> static device_probe_t fhc_central_probe; static device_attach_t fhc_central_attach; @@ -98,13 +96,9 @@ fhc_central_probe(device_t dev) static int fhc_central_attach(device_t dev) { - struct sbus_regs *reg; struct fhc_softc *sc; - bus_addr_t size; - bus_addr_t off; phandle_t node; int board; - int nreg; int rid; int i; @@ -113,23 +107,15 @@ fhc_central_attach(device_t dev) sc->sc_node = node; sc->sc_flags |= FHC_CENTRAL; - nreg = OF_getprop_alloc(node, "reg", sizeof(*reg), (void **)®); - if (nreg != FHC_NREG) { - device_printf(dev, "can't get registers\n"); - return (ENXIO); - } - for (i = 0; i < nreg; i++) { - off = reg[i].sbr_offset; - size = reg[i].sbr_size; - rid = 0; - sc->sc_memres[i] = bus_alloc_resource(dev, SYS_RES_MEMORY, - &rid, off, off + size - 1, size, RF_ACTIVE); + for (i = 0; i < FHC_NREG; i++) { + rid = i; + sc->sc_memres[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE); if (sc->sc_memres[i] == NULL) panic("%s: can't allocate registers", __func__); sc->sc_bt[i] = rman_get_bustag(sc->sc_memres[i]); sc->sc_bh[i] = rman_get_bushandle(sc->sc_memres[i]); } - free(reg, M_OFWPROP); board = bus_space_read_4(sc->sc_bt[FHC_INTERNAL], sc->sc_bh[FHC_INTERNAL], FHC_BSR); |