iobus.c (157895) | iobus.c (174782) |
---|---|
1/*- 2 * Copyright 2002 by Peter Grehan. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright 2002 by Peter Grehan. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/powerpc/psim/iobus.c 157895 2006-04-20 04:19:10Z imp $ | 27 * $FreeBSD: head/sys/powerpc/psim/iobus.c 174782 2007-12-19 18:00:50Z marcel $ |
28 */ 29 30/* 31 * PSIM 'iobus' local bus. Should be set up in the device tree like: 32 * 33 * /iobus@0x80000000/name psim-iobus 34 * 35 * Code borrowed from various nexus.c and uninorth.c :-) --- 270 unchanged lines hidden (view full) --- 306static struct resource * 307iobus_alloc_resource(device_t bus, device_t child, int type, int *rid, 308 u_long start, u_long end, u_long count, u_int flags) 309{ 310 struct iobus_softc *sc; 311 int needactivate; 312 struct resource *rv; 313 struct rman *rm; | 28 */ 29 30/* 31 * PSIM 'iobus' local bus. Should be set up in the device tree like: 32 * 33 * /iobus@0x80000000/name psim-iobus 34 * 35 * Code borrowed from various nexus.c and uninorth.c :-) --- 270 unchanged lines hidden (view full) --- 306static struct resource * 307iobus_alloc_resource(device_t bus, device_t child, int type, int *rid, 308 u_long start, u_long end, u_long count, u_int flags) 309{ 310 struct iobus_softc *sc; 311 int needactivate; 312 struct resource *rv; 313 struct rman *rm; |
314 bus_space_tag_t tagval; | |
315 316 sc = device_get_softc(bus); 317 318 needactivate = flags & RF_ACTIVE; 319 flags &= ~RF_ACTIVE; 320 321 switch (type) { 322 case SYS_RES_MEMORY: 323 case SYS_RES_IOPORT: 324 rm = &sc->sc_mem_rman; | 314 315 sc = device_get_softc(bus); 316 317 needactivate = flags & RF_ACTIVE; 318 flags &= ~RF_ACTIVE; 319 320 switch (type) { 321 case SYS_RES_MEMORY: 322 case SYS_RES_IOPORT: 323 rm = &sc->sc_mem_rman; |
325 tagval = PPC_BUS_SPACE_MEM; | |
326 break; 327 case SYS_RES_IRQ: 328 return (bus_alloc_resource(bus, type, rid, start, end, count, | 324 break; 325 case SYS_RES_IRQ: 326 return (bus_alloc_resource(bus, type, rid, start, end, count, |
329 flags)); 330 break; | 327 flags)); |
331 default: 332 device_printf(bus, "unknown resource request from %s\n", | 328 default: 329 device_printf(bus, "unknown resource request from %s\n", |
333 device_get_nameunit(child)); | 330 device_get_nameunit(child)); |
334 return (NULL); 335 } 336 337 rv = rman_reserve_resource(rm, start, end, count, flags, child); 338 if (rv == NULL) { 339 device_printf(bus, "failed to reserve resource for %s\n", 340 device_get_nameunit(child)); 341 return (NULL); 342 } 343 344 rman_set_rid(rv, *rid); | 331 return (NULL); 332 } 333 334 rv = rman_reserve_resource(rm, start, end, count, flags, child); 335 if (rv == NULL) { 336 device_printf(bus, "failed to reserve resource for %s\n", 337 device_get_nameunit(child)); 338 return (NULL); 339 } 340 341 rman_set_rid(rv, *rid); |
345 rman_set_bustag(rv, tagval); | 342 rman_set_bustag(rv, &bs_le_tag); |
346 rman_set_bushandle(rv, rman_get_start(rv)); 347 348 if (needactivate) { 349 if (bus_activate_resource(child, type, *rid, rv) != 0) { 350 device_printf(bus, 351 "failed to activate resource for %s\n", 352 device_get_nameunit(child)); 353 rman_release_resource(rv); --- 63 unchanged lines hidden --- | 343 rman_set_bushandle(rv, rman_get_start(rv)); 344 345 if (needactivate) { 346 if (bus_activate_resource(child, type, *rid, rv) != 0) { 347 device_printf(bus, 348 "failed to activate resource for %s\n", 349 device_get_nameunit(child)); 350 rman_release_resource(rv); --- 63 unchanged lines hidden --- |