Page MenuHomeFreeBSD

D17793.diff
No OneTemporary

D17793.diff

Index: head/sys/dev/pci/pci_host_generic.c
===================================================================
--- head/sys/dev/pci/pci_host_generic.c
+++ head/sys/dev/pci/pci_host_generic.c
@@ -341,6 +341,82 @@
}
static int
+generic_pcie_activate_resource(device_t dev, device_t child, int type,
+ int rid, struct resource *r)
+{
+ struct generic_pcie_core_softc *sc;
+ uint64_t phys_base;
+ uint64_t pci_base;
+ uint64_t size;
+ int found;
+ int res;
+ int i;
+
+ sc = device_get_softc(dev);
+
+ if ((res = rman_activate_resource(r)) != 0)
+ return (res);
+
+ switch (type) {
+ case SYS_RES_IOPORT:
+ found = 0;
+ for (i = 0; i < MAX_RANGES_TUPLES; i++) {
+ pci_base = sc->ranges[i].pci_base;
+ phys_base = sc->ranges[i].phys_base;
+ size = sc->ranges[i].size;
+
+ if ((rid > pci_base) && (rid < (pci_base + size))) {
+ found = 1;
+ break;
+ }
+ }
+ if (found) {
+ rman_set_start(r, rman_get_start(r) + phys_base);
+ rman_set_end(r, rman_get_end(r) + phys_base);
+ res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev),
+ child, type, rid, r);
+ } else {
+ device_printf(dev,
+ "Failed to activate IOPORT resource\n");
+ res = 0;
+ }
+ break;
+ case SYS_RES_MEMORY:
+ case SYS_RES_IRQ:
+ res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child,
+ type, rid, r);
+ break;
+ default:
+ break;
+ }
+
+ return (res);
+}
+
+static int
+generic_pcie_deactivate_resource(device_t dev, device_t child, int type,
+ int rid, struct resource *r)
+{
+ int res;
+
+ if ((res = rman_deactivate_resource(r)) != 0)
+ return (res);
+
+ switch (type) {
+ case SYS_RES_IOPORT:
+ case SYS_RES_MEMORY:
+ case SYS_RES_IRQ:
+ res = BUS_DEACTIVATE_RESOURCE(device_get_parent(dev), child,
+ type, rid, r);
+ break;
+ default:
+ break;
+ }
+
+ return (res);
+}
+
+static int
generic_pcie_adjust_resource(device_t dev, device_t child, int type,
struct resource *res, rman_res_t start, rman_res_t end)
{
@@ -375,6 +451,8 @@
DEVMETHOD(bus_write_ivar, generic_pcie_write_ivar),
DEVMETHOD(bus_alloc_resource, pci_host_generic_core_alloc_resource),
DEVMETHOD(bus_adjust_resource, generic_pcie_adjust_resource),
+ DEVMETHOD(bus_activate_resource, generic_pcie_activate_resource),
+ DEVMETHOD(bus_deactivate_resource, generic_pcie_deactivate_resource),
DEVMETHOD(bus_release_resource, pci_host_generic_core_release_resource),
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
Index: head/sys/dev/pci/pci_host_generic_acpi.c
===================================================================
--- head/sys/dev/pci/pci_host_generic_acpi.c
+++ head/sys/dev/pci/pci_host_generic_acpi.c
@@ -348,86 +348,7 @@
return (acpi_pcib_route_interrupt(bus, dev, pin, &sc->ap_prt));
}
-/*
- * Follow logic of FDT activate
- */
static int
-generic_pcie_acpi_activate_resource(device_t dev, device_t child, int type,
- int rid, struct resource *r)
-{
- struct generic_pcie_acpi_softc *sc;
- uint64_t phys_base;
- uint64_t pci_base;
- uint64_t size;
- int found;
- int res;
- int i;
-
- sc = device_get_softc(dev);
-
- if ((res = rman_activate_resource(r)) != 0)
- return (res);
-
- switch (type) {
- case SYS_RES_IOPORT:
- found = 0;
- for (i = 0; i < MAX_RANGES_TUPLES; i++) {
- pci_base = sc->base.ranges[i].pci_base;
- phys_base = sc->base.ranges[i].phys_base;
- size = sc->base.ranges[i].size;
-
- if ((rid > pci_base) && (rid < (pci_base + size))) {
- found = 1;
- break;
- }
- }
- if (found) {
- rman_set_start(r, rman_get_start(r) + phys_base);
- rman_set_end(r, rman_get_end(r) + phys_base);
- res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev),
- child, type, rid, r);
- } else {
- device_printf(dev,
- "Failed to activate IOPORT resource\n");
- res = 0;
- }
- break;
- case SYS_RES_MEMORY:
- case SYS_RES_IRQ:
- res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child,
- type, rid, r);
- break;
- default:
- break;
- }
-
- return (res);
-}
-
-static int
-generic_pcie_acpi_deactivate_resource(device_t dev, device_t child, int type,
- int rid, struct resource *r)
-{
- int res;
-
- if ((res = rman_deactivate_resource(r)) != 0)
- return (res);
-
- switch (type) {
- case SYS_RES_IOPORT:
- case SYS_RES_MEMORY:
- case SYS_RES_IRQ:
- res = BUS_DEACTIVATE_RESOURCE(device_get_parent(dev), child,
- type, rid, r);
- break;
- default:
- break;
- }
-
- return (res);
-}
-
-static int
generic_pcie_acpi_alloc_msi(device_t pci, device_t child, int count,
int maxcount, int *irqs)
{
@@ -507,8 +428,6 @@
DEVMETHOD(device_probe, generic_pcie_acpi_probe),
DEVMETHOD(device_attach, pci_host_generic_acpi_attach),
DEVMETHOD(bus_read_ivar, generic_pcie_acpi_read_ivar),
- DEVMETHOD(bus_activate_resource, generic_pcie_acpi_activate_resource),
- DEVMETHOD(bus_deactivate_resource,generic_pcie_acpi_deactivate_resource),
/* pcib interface */
DEVMETHOD(pcib_route_interrupt, generic_pcie_acpi_route_interrupt),
Index: head/sys/dev/pci/pci_host_generic_fdt.c
===================================================================
--- head/sys/dev/pci/pci_host_generic_fdt.c
+++ head/sys/dev/pci/pci_host_generic_fdt.c
@@ -385,82 +385,6 @@
}
static int
-generic_pcie_fdt_activate_resource(device_t dev, device_t child, int type,
- int rid, struct resource *r)
-{
- struct generic_pcie_fdt_softc *sc;
- uint64_t phys_base;
- uint64_t pci_base;
- uint64_t size;
- int found;
- int res;
- int i;
-
- sc = device_get_softc(dev);
-
- if ((res = rman_activate_resource(r)) != 0)
- return (res);
-
- switch(type) {
- case SYS_RES_IOPORT:
- found = 0;
- for (i = 0; i < MAX_RANGES_TUPLES; i++) {
- pci_base = sc->base.ranges[i].pci_base;
- phys_base = sc->base.ranges[i].phys_base;
- size = sc->base.ranges[i].size;
-
- if ((rid > pci_base) && (rid < (pci_base + size))) {
- found = 1;
- break;
- }
- }
- if (found) {
- rman_set_start(r, rman_get_start(r) + phys_base);
- rman_set_end(r, rman_get_end(r) + phys_base);
- res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev),
- child, type, rid, r);
- } else {
- device_printf(dev,
- "Failed to activate IOPORT resource\n");
- res = 0;
- }
- break;
- case SYS_RES_MEMORY:
- case SYS_RES_IRQ:
- res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child,
- type, rid, r);
- break;
- default:
- break;
- }
-
- return (res);
-}
-
-static int
-generic_pcie_fdt_deactivate_resource(device_t dev, device_t child, int type,
- int rid, struct resource *r)
-{
- int res;
-
- if ((res = rman_deactivate_resource(r)) != 0)
- return (res);
-
- switch(type) {
- case SYS_RES_IOPORT:
- case SYS_RES_MEMORY:
- case SYS_RES_IRQ:
- res = BUS_DEACTIVATE_RESOURCE(device_get_parent(dev), child,
- type, rid, r);
- break;
- default:
- break;
- }
-
- return (res);
-}
-
-static int
generic_pcie_fdt_alloc_msi(device_t pci, device_t child, int count,
int maxcount, int *irqs)
{
@@ -630,8 +554,6 @@
DEVMETHOD(device_attach, pci_host_generic_attach),
DEVMETHOD(bus_alloc_resource, pci_host_generic_alloc_resource),
DEVMETHOD(bus_release_resource, generic_pcie_fdt_release_resource),
- DEVMETHOD(bus_activate_resource, generic_pcie_fdt_activate_resource),
- DEVMETHOD(bus_deactivate_resource,generic_pcie_fdt_deactivate_resource),
/* pcib interface */
DEVMETHOD(pcib_route_interrupt, generic_pcie_fdt_route_interrupt),

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 12, 1:50 PM (20 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15769880
Default Alt Text
D17793.diff (7 KB)

Event Timeline