Date: Tue, 12 Apr 2011 17:25:42 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 191384 for review Message-ID: <201104121725.p3CHPgHH028613@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@191384?ac=10 Change 191384 by jhb@jhb_fiver on 2011/04/12 17:25:40 Oops, the PCI-PCI bridge driver needs a custom release resource method in the NEW_PCIB case. Affected files ... .. //depot/projects/pci/sys/dev/pci/pci_pci.c#12 edit .. //depot/projects/pci/sys/dev/pci/pcib_private.h#7 edit Differences ... ==== //depot/projects/pci/sys/dev/pci/pci_pci.c#12 (text+ko) ==== @@ -76,7 +76,11 @@ DEVMETHOD(bus_write_ivar, pcib_write_ivar), DEVMETHOD(bus_alloc_resource, pcib_alloc_resource), DEVMETHOD(bus_adjust_resource, pcib_adjust_resource), +#ifdef NEW_PCIB + DEVMETHOD(bus_release_resource, pcib_release_resource), +#else DEVMETHOD(bus_release_resource, bus_generic_release_resource), +#endif DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), @@ -1115,6 +1119,25 @@ #endif return (r); } + +int +pcib_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + struct pcib_softc *sc; + int error; + + sc = device_get_softc(dev); + if (pcib_is_resource_managed(sc, type, r)) { + if (rman_get_flags(r) & RF_ACTIVE) { + error = bus_deactivate_resource(child, type, rid, r); + if (error) + return (error); + } + return (rman_release_resource(r)); + } + return (bus_generic_release_resource(dev, child, type, rid, r)); +} #else /* * We have to trap resource allocation requests and ensure that the bridge ==== //depot/projects/pci/sys/dev/pci/pcib_private.h#7 (text+ko) ==== @@ -100,6 +100,10 @@ u_long start, u_long end, u_long count, u_int flags); int pcib_adjust_resource(device_t bus, device_t child, int type, struct resource *r, u_long start, u_long end); +#ifdef NEW_PCIB +int pcib_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r); +#endif int pcib_maxslots(device_t dev); uint32_t pcib_read_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, int width); void pcib_write_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, uint32_t val, int width);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104121725.p3CHPgHH028613>