Lines Matching +full:pci +full:- +full:dev

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
37 #include <dev/ofw/openfirm.h>
38 #include <dev/ofw/ofw_pci.h>
39 #include <dev/ofw/ofw_bus.h>
40 #include <dev/ofw/ofw_bus_subr.h>
42 #include <dev/pci/pcivar.h>
43 #include <dev/pci/pcireg.h>
44 #include <dev/pci/pcib_private.h>
52 static phandle_t ofw_pcib_pci_get_node(device_t bus, device_t dev);
53 static int ofw_pcib_pci_route_interrupt(device_t bridge, device_t dev,
73 * This is here so that we can use pci bridge methods, too - the
74 * generic routines only need the dev, secbus and subbus members
84 EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_pci_driver, 0, 0, BUS_PASS_BUS);
87 ofw_pcib_pci_probe(device_t dev) in ofw_pcib_pci_probe() argument
90 if ((pci_get_class(dev) != PCIC_BRIDGE) || in ofw_pcib_pci_probe()
91 (pci_get_subclass(dev) != PCIS_BRIDGE_PCI)) { in ofw_pcib_pci_probe()
95 if (ofw_bus_get_node(dev) == -1) in ofw_pcib_pci_probe()
98 device_set_desc(dev, "OFW PCI-PCI bridge"); in ofw_pcib_pci_probe()
103 ofw_pcib_pci_attach(device_t dev) in ofw_pcib_pci_attach() argument
107 sc = device_get_softc(dev); in ofw_pcib_pci_attach()
108 sc->ops_pcib_sc.dev = dev; in ofw_pcib_pci_attach()
109 sc->ops_node = ofw_bus_get_node(dev); in ofw_pcib_pci_attach()
111 ofw_bus_setup_iinfo(sc->ops_node, &sc->ops_iinfo, in ofw_pcib_pci_attach()
114 pcib_attach_common(dev); in ofw_pcib_pci_attach()
115 return (pcib_attach_child(dev)); in ofw_pcib_pci_attach()
119 ofw_pcib_pci_get_node(device_t bridge, device_t dev) in ofw_pcib_pci_get_node() argument
121 /* We have only one child, the PCI bus, so pass it our node */ in ofw_pcib_pci_get_node()
127 ofw_pcib_pci_route_interrupt(device_t bridge, device_t dev, int intpin) in ofw_pcib_pci_route_interrupt() argument
137 ii = &sc->ops_iinfo; in ofw_pcib_pci_route_interrupt()
138 if (ii->opi_imapsz > 0) { in ofw_pcib_pci_route_interrupt()
143 reg.phys_hi = (pci_get_bus(dev) << OFW_PCI_PHYS_HI_BUSSHIFT) | in ofw_pcib_pci_route_interrupt()
144 (pci_get_slot(dev) << OFW_PCI_PHYS_HI_DEVICESHIFT) | in ofw_pcib_pci_route_interrupt()
145 (pci_get_function(dev) << OFW_PCI_PHYS_HI_FUNCTIONSHIFT); in ofw_pcib_pci_route_interrupt()
147 intrcells = ofw_bus_lookup_imap(ofw_bus_get_node(dev), ii, &reg, in ofw_pcib_pci_route_interrupt()
153 * it again on higher levels - that causes problems in ofw_pcib_pci_route_interrupt()
156 mintr[0] = ofw_bus_map_intr(dev, iparent, intrcells, in ofw_pcib_pci_route_interrupt()
163 * standard PCI swizzle and continue mapping at the parent. in ofw_pcib_pci_route_interrupt()
165 return (pcib_route_interrupt(bridge, dev, intpin)); in ofw_pcib_pci_route_interrupt()