PERFORCE change 231064 for review
John Baldwin
jhb at FreeBSD.org
Fri Jul 12 03:17:58 UTC 2013
http://p4web.freebsd.org/@@231064?ac=10
Change 231064 by jhb at jhb_pippin on 2013/07/12 03:17:47
Move bus number allocation support code completely into the
PCI front-end.
Affected files ...
.. //depot/projects/pci/sys/dev/pccbb/pccbb.c#7 edit
.. //depot/projects/pci/sys/dev/pccbb/pccbb_pci.c#7 edit
Differences ...
==== //depot/projects/pci/sys/dev/pccbb/pccbb.c#7 (text+ko) ====
@@ -1503,11 +1503,6 @@
{
struct cbb_softc *sc = device_get_softc(brdev);
-#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
- if (type == PCI_RES_BUS)
- return (pcib_alloc_subbus(&sc->bus, child, rid, start, end,
- count, flags));
-#endif
if (sc->flags & CBB_16BIT_CARD)
return (cbb_pcic_alloc_resource(brdev, child, type, rid,
start, end, count, flags));
@@ -1521,20 +1516,7 @@
struct resource *r)
{
struct cbb_softc *sc = device_get_softc(brdev);
-#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
- int error;
- if (type == PCI_RES_BUS) {
- if (!rman_is_region_manager(r, &sc->bus.rman))
- return (EINVAL);
- if (rman_get_flags(r) & RF_ACTIVE) {
- error = bus_deactivate_resource(child, type, rid, r);
- if (error)
- return (error);
- }
- return (rman_release_resource(r));
- }
-#endif
if (sc->flags & CBB_16BIT_CARD)
return (cbb_pcic_release_resource(brdev, child, type,
rid, r));
==== //depot/projects/pci/sys/dev/pccbb/pccbb_pci.c#7 (text+ko) ====
@@ -797,6 +797,20 @@
}
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+static struct resource *
+cbb_pci_alloc_resource(device_t bus, device_t child, int type, int *rid,
+ u_long start, u_long end, u_long count, u_int flags)
+{
+ struct cbb_softc *sc;
+
+ sc = device_get_softc(bus);
+ if (type == PCI_RES_BUS)
+ return (pcib_alloc_subbus(&sc->bus, child, rid, start, end,
+ count, flags));
+ return (cbb_alloc_resource(bus, child, type, rid, start, end, count,
+ flags));
+}
+
static int
cbb_pci_adjust_resource(device_t bus, device_t child, int type,
struct resource *r, u_long start, u_long end)
@@ -811,6 +825,27 @@
}
return (bus_generic_adjust_resource(bus, child, type, r, start, end));
}
+
+static int
+cbb_pci_release_resource(device_t bus, device_t child, int type, int rid,
+ struct resource *r)
+{
+ struct cbb_softc *sc;
+ int error;
+
+ sc = device_get_softc(bus);
+ if (type == PCI_RES_BUS) {
+ if (!rman_is_region_manager(r, &sc->bus.rman))
+ return (EINVAL);
+ 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 (cbb_release_resource(bus, child, type, rid, r));
+}
#endif
/************************************************************************/
@@ -856,11 +891,14 @@
/* bus methods */
DEVMETHOD(bus_read_ivar, cbb_read_ivar),
DEVMETHOD(bus_write_ivar, cbb_write_ivar),
- DEVMETHOD(bus_alloc_resource, cbb_alloc_resource),
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+ DEVMETHOD(bus_alloc_resource, cbb_pci_alloc_resource),
DEVMETHOD(bus_adjust_resource, cbb_pci_adjust_resource),
+ DEVMETHOD(bus_release_resource, cbb_pci_release_resource),
+#else
+ DEVMETHOD(bus_alloc_resource, cbb_alloc_resource),
+ DEVMETHOD(bus_release_resource, cbb_release_resource),
#endif
- DEVMETHOD(bus_release_resource, cbb_release_resource),
DEVMETHOD(bus_activate_resource, cbb_activate_resource),
DEVMETHOD(bus_deactivate_resource, cbb_deactivate_resource),
DEVMETHOD(bus_driver_added, cbb_driver_added),
More information about the p4-projects
mailing list