diff options
author | marcel <marcel@FreeBSD.org> | 2005-04-28 03:33:46 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2005-04-28 03:33:46 +0000 |
commit | 9e5dc6f3e32afca1893f20762fa9356412347768 (patch) | |
tree | 6a012a63d4e28209f99cb5ae503ffc55ca1a23f2 /sys/sparc64 | |
parent | 29ec4afccda452557bd3f5f7ee86944b2ad30e45 (diff) | |
download | FreeBSD-src-9e5dc6f3e32afca1893f20762fa9356412347768.zip FreeBSD-src-9e5dc6f3e32afca1893f20762fa9356412347768.tar.gz |
Slightly reformat apb_alloc_resource() to create some horizontal space
for enhancements. Shorten apb_map_checkrange() to apb_checkrange() for
the same reason. No functional change.
Diffstat (limited to 'sys/sparc64')
-rw-r--r-- | sys/sparc64/pci/apb.c | 87 |
1 files changed, 43 insertions, 44 deletions
diff --git a/sys/sparc64/pci/apb.c b/sys/sparc64/pci/apb.c index 4fc8fd2..2dbe7d0 100644 --- a/sys/sparc64/pci/apb.c +++ b/sys/sparc64/pci/apb.c @@ -157,7 +157,7 @@ apb_map_print(u_int8_t map, u_long scale) } static int -apb_map_checkrange(u_int8_t map, u_long scale, u_long start, u_long end) +apb_checkrange(u_int8_t map, u_long scale, u_long start, u_long end) { int i, ei; @@ -213,60 +213,59 @@ apb_alloc_resource(device_t dev, device_t child, int type, int *rid, struct apb_softc *sc; sc = device_get_softc(dev); + /* * If this is a "default" allocation against this rid, we can't work * out where it's coming from (we should actually never see these) so * we just have to punt. */ - if ((start == 0) && (end == ~0)) { + if (start == 0 && end == ~0) { device_printf(dev, "can't decode default resource id %d for " "%s%d, bypassing\n", *rid, device_get_name(child), device_get_unit(child)); - } else { - /* - * Fail the allocation for this range if it's not supported. - * XXX we should probably just fix up the bridge decode and - * soldier on. - */ - switch (type) { - case SYS_RES_IOPORT: - if (!apb_map_checkrange(sc->sc_iomap, APB_IO_SCALE, - start, end)) { - device_printf(dev, "device %s%d requested " - "unsupported I/O range 0x%lx-0x%lx\n", - device_get_name(child), - device_get_unit(child), start, end); - return (NULL); - } - if (bootverbose) - device_printf(sc->sc_bsc.ops_pcib_sc.dev, - "device %s%d requested decoded I/O range " - "0x%lx-0x%lx\n", device_get_name(child), - device_get_unit(child), start, end); - break; - - case SYS_RES_MEMORY: - if (!apb_map_checkrange(sc->sc_memmap, APB_MEM_SCALE, - start, end)) { - device_printf(dev, "device %s%d requested " - "unsupported memory range 0x%lx-0x%lx\n", - device_get_name(child), - device_get_unit(child), start, end); - return (NULL); - } - if (bootverbose) - device_printf(sc->sc_bsc.ops_pcib_sc.dev, - "device %s%d requested decoded memory " - "range 0x%lx-0x%lx\n", - device_get_name(child), - device_get_unit(child), start, end); - break; - - default: - break; + goto passup; + } + + /* + * Fail the allocation for this range if it's not supported. + * XXX we should probably just fix up the bridge decode and + * soldier on. + */ + switch (type) { + case SYS_RES_IOPORT: + if (!apb_checkrange(sc->sc_iomap, APB_IO_SCALE, start, end)) { + device_printf(dev, "device %s%d requested unsupported " + "I/O range 0x%lx-0x%lx\n", device_get_name(child), + device_get_unit(child), start, end); + return (NULL); + } + if (bootverbose) + device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device " + "%s%d requested decoded I/O range 0x%lx-0x%lx\n", + device_get_name(child), device_get_unit(child), + start, end); + break; + + case SYS_RES_MEMORY: + if (!apb_checkrange(sc->sc_memmap, APB_MEM_SCALE, start, end)) { + device_printf(dev, "device %s%d requested unsupported " + "memory range 0x%lx-0x%lx\n", + device_get_name(child), device_get_unit(child), + start, end); + return (NULL); } + if (bootverbose) + device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device " + "%s%d requested decoded memory range 0x%lx-0x%lx\n", + device_get_name(child), device_get_unit(child), + start, end); + break; + + default: + break; } + passup: /* * Bridge is OK decoding this resource, so pass it up. */ |