uninorth.c (172394) | uninorth.c (174782) |
---|---|
1/*- 2 * Copyright (C) 2002 Benno Rice. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 17 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * | 1/*- 2 * Copyright (C) 2002 Benno Rice. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 17 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * |
25 * $FreeBSD: head/sys/powerpc/powermac/uninorth.c 172394 2007-09-30 11:05:18Z marius $ | 25 * $FreeBSD: head/sys/powerpc/powermac/uninorth.c 174782 2007-12-19 18:00:50Z marcel $ |
26 */ 27 28#include <sys/param.h> 29#include <sys/systm.h> 30#include <sys/module.h> 31#include <sys/bus.h> 32#include <sys/conf.h> 33#include <sys/kernel.h> 34 35#include <dev/ofw/openfirm.h> 36#include <dev/ofw/ofw_pci.h> 37 38#include <dev/pci/pcivar.h> 39#include <dev/pci/pcireg.h> 40 41#include <machine/bus.h> 42#include <machine/md_var.h> 43#include <machine/nexusvar.h> | 26 */ 27 28#include <sys/param.h> 29#include <sys/systm.h> 30#include <sys/module.h> 31#include <sys/bus.h> 32#include <sys/conf.h> 33#include <sys/kernel.h> 34 35#include <dev/ofw/openfirm.h> 36#include <dev/ofw/ofw_pci.h> 37 38#include <dev/pci/pcivar.h> 39#include <dev/pci/pcireg.h> 40 41#include <machine/bus.h> 42#include <machine/md_var.h> 43#include <machine/nexusvar.h> |
44#include <machine/pio.h> |
|
44#include <machine/resource.h> 45 46#include <sys/rman.h> 47 48#include <powerpc/ofw/ofw_pci.h> 49#include <powerpc/powermac/uninorthvar.h> 50 51#include <vm/vm.h> --- 290 unchanged lines hidden (view full) --- 342 343static struct resource * 344uninorth_alloc_resource(device_t bus, device_t child, int type, int *rid, 345 u_long start, u_long end, u_long count, u_int flags) 346{ 347 struct uninorth_softc *sc; 348 struct resource *rv; 349 struct rman *rm; | 45#include <machine/resource.h> 46 47#include <sys/rman.h> 48 49#include <powerpc/ofw/ofw_pci.h> 50#include <powerpc/powermac/uninorthvar.h> 51 52#include <vm/vm.h> --- 290 unchanged lines hidden (view full) --- 343 344static struct resource * 345uninorth_alloc_resource(device_t bus, device_t child, int type, int *rid, 346 u_long start, u_long end, u_long count, u_int flags) 347{ 348 struct uninorth_softc *sc; 349 struct resource *rv; 350 struct rman *rm; |
350 bus_space_tag_t bt; | |
351 int needactivate; 352 353 needactivate = flags & RF_ACTIVE; 354 flags &= ~RF_ACTIVE; 355 356 sc = device_get_softc(bus); 357 358 switch (type) { 359 case SYS_RES_MEMORY: 360 rm = &sc->sc_mem_rman; | 351 int needactivate; 352 353 needactivate = flags & RF_ACTIVE; 354 flags &= ~RF_ACTIVE; 355 356 sc = device_get_softc(bus); 357 358 switch (type) { 359 case SYS_RES_MEMORY: 360 rm = &sc->sc_mem_rman; |
361 bt = PPC_BUS_SPACE_MEM; | |
362 break; 363 364 case SYS_RES_IOPORT: 365 rm = &sc->sc_io_rman; | 361 break; 362 363 case SYS_RES_IOPORT: 364 rm = &sc->sc_io_rman; |
366 bt = PPC_BUS_SPACE_IO; | |
367 break; 368 369 case SYS_RES_IRQ: 370 return (bus_alloc_resource(bus, type, rid, start, end, count, 371 flags)); | 365 break; 366 367 case SYS_RES_IRQ: 368 return (bus_alloc_resource(bus, type, rid, start, end, count, 369 flags)); |
372 break; | 370 |
373 default: 374 device_printf(bus, "unknown resource request from %s\n", 375 device_get_nameunit(child)); 376 return (NULL); 377 } 378 379 rv = rman_reserve_resource(rm, start, end, count, flags, child); 380 if (rv == NULL) { 381 device_printf(bus, "failed to reserve resource for %s\n", 382 device_get_nameunit(child)); 383 return (NULL); 384 } 385 386 rman_set_rid(rv, *rid); | 371 default: 372 device_printf(bus, "unknown resource request from %s\n", 373 device_get_nameunit(child)); 374 return (NULL); 375 } 376 377 rv = rman_reserve_resource(rm, start, end, count, flags, child); 378 if (rv == NULL) { 379 device_printf(bus, "failed to reserve resource for %s\n", 380 device_get_nameunit(child)); 381 return (NULL); 382 } 383 384 rman_set_rid(rv, *rid); |
387 rman_set_bustag(rv, bt); | 385 rman_set_bustag(rv, &bs_le_tag); |
388 rman_set_bushandle(rv, rman_get_start(rv)); 389 390 if (needactivate) { 391 if (bus_activate_resource(child, type, *rid, rv) != 0) { 392 device_printf(bus, 393 "failed to activate resource for %s\n", 394 device_get_nameunit(child)); 395 rman_release_resource(rv); --- 205 unchanged lines hidden --- | 386 rman_set_bushandle(rv, rman_get_start(rv)); 387 388 if (needactivate) { 389 if (bus_activate_resource(child, type, *rid, rv) != 0) { 390 device_printf(bus, 391 "failed to activate resource for %s\n", 392 device_get_nameunit(child)); 393 rman_release_resource(rv); --- 205 unchanged lines hidden --- |