From 095a7d32861f45dbc848a8f17be82fe915334a88 Mon Sep 17 00:00:00 2001 From: nwhitehorn Date: Sun, 5 Feb 2012 00:51:59 +0000 Subject: [PATCH] Add support for bus_adjust_resource() on all PowerPC/AIM PCI bridges. With this change, NEW_PCIB appears to work without incident at least on a G5 iMac. More testing will be required before it is turned on in GENERIC. --- sys/powerpc/ofw/ofw_pci.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sys/powerpc/ofw/ofw_pci.c b/sys/powerpc/ofw/ofw_pci.c index f70340bbbec8..56f8f4a86e75 100644 --- a/sys/powerpc/ofw/ofw_pci.c +++ b/sys/powerpc/ofw/ofw_pci.c @@ -71,6 +71,9 @@ static int ofw_pci_activate_resource(device_t bus, device_t child, static int ofw_pci_deactivate_resource(device_t bus, device_t child, int type, int rid, struct resource *res); +static int ofw_pci_adjust_resource(device_t bus, device_t child, + int type, struct resource *res, u_long start, + u_long end); /* * pcib interface. @@ -106,6 +109,7 @@ static device_method_t ofw_pci_methods[] = { DEVMETHOD(bus_release_resource, ofw_pci_release_resource), DEVMETHOD(bus_activate_resource, ofw_pci_activate_resource), DEVMETHOD(bus_deactivate_resource, ofw_pci_deactivate_resource), + DEVMETHOD(bus_adjust_resource, ofw_pci_adjust_resource), /* pcib interface */ DEVMETHOD(pcib_maxslots, ofw_pci_maxslots), @@ -421,6 +425,30 @@ ofw_pci_deactivate_resource(device_t bus, device_t child, int type, int rid, return (rman_deactivate_resource(res)); } +static int +ofw_pci_adjust_resource(device_t bus, device_t child, int type, + struct resource *res, u_long start, u_long end) +{ + struct rman *rm = NULL; + struct ofw_pci_softc *sc = device_get_softc(bus); + + switch (type) { + case SYS_RES_MEMORY: + rm = &sc->sc_mem_rman; + break; + case SYS_RES_IOPORT: + rm = &sc->sc_io_rman; + break; + default: + return (ENXIO); + } + + if (!rman_is_region_manager(res, rm)) + return (EINVAL); + return (rman_adjust_resource(res, start, end)); +} + + static phandle_t ofw_pci_get_node(device_t bus, device_t dev) {