summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/ofw/ofw_pcib_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/powerpc/ofw/ofw_pcib_pci.c')
-rw-r--r--sys/powerpc/ofw/ofw_pcib_pci.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/sys/powerpc/ofw/ofw_pcib_pci.c b/sys/powerpc/ofw/ofw_pcib_pci.c
index 4cc73c4..5d6fba6 100644
--- a/sys/powerpc/ofw/ofw_pcib_pci.c
+++ b/sys/powerpc/ofw/ofw_pcib_pci.c
@@ -35,8 +35,7 @@
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_pci.h>
-
-#include <powerpc/ofw/ofw_pci.h>
+#include <dev/ofw/ofw_bus.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
@@ -46,6 +45,7 @@
static int ofw_pcib_pci_probe(device_t bus);
static int ofw_pcib_pci_attach(device_t bus);
+static phandle_t ofw_pcib_pci_get_node(device_t bus, device_t dev);
static device_method_t ofw_pcib_pci_methods[] = {
/* Device interface */
@@ -72,6 +72,9 @@ static device_method_t ofw_pcib_pci_methods[] = {
DEVMETHOD(pcib_write_config, pcib_write_config),
DEVMETHOD(pcib_route_interrupt, pcib_route_interrupt),
+ /* ofw_bus interface */
+ DEVMETHOD(ofw_bus_get_node, ofw_pcib_pci_get_node),
+
{0, 0}
};
@@ -89,29 +92,29 @@ ofw_pcib_pci_probe(device_t dev)
(pci_get_subclass(dev) != PCIS_BRIDGE_PCI)) {
return (ENXIO);
}
- if (ofw_pci_find_node(dev) == 0) {
+
+ if (ofw_bus_get_node(dev) == 0)
return (ENXIO);
- }
- device_set_desc(dev, "Open Firmware PCI-PCI bridge");
- return (-1000);
+ device_set_desc(dev, "OFW PCI-PCI bridge");
+ return (0);
}
static int
ofw_pcib_pci_attach(device_t dev)
{
- phandle_t node;
- uint32_t busrange[2];
-
- node = ofw_pci_find_node(dev);
- if (OF_getprop(node, "bus-range", busrange, sizeof(busrange)) != 8)
- return (ENXIO);
-
pcib_attach_common(dev);
- ofw_pci_fixup(dev, busrange[0], node);
-
device_add_child(dev, "pci", -1);
return (bus_generic_attach(dev));
}
+
+phandle_t
+ofw_pcib_pci_get_node(device_t bridge, device_t dev)
+{
+ /* We have only one child, the PCI bus, so pass it our node */
+
+ return (ofw_bus_get_node(bridge));
+}
+
OpenPOWER on IntegriCloud