Lines Matching +full:pci +full:- +full:domain

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
50 #include <dev/pci/pcireg.h>
51 #include <dev/pci/pcivar.h>
52 #include <dev/pci/pci_private.h>
70 static void ofw_pcibus_enum_devtree(device_t dev, u_int domain, u_int busno);
71 static void ofw_pcibus_enum_bus(device_t dev, u_int domain, u_int busno);
85 /* PCI interface */
100 DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods,
104 MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1);
107 TUNABLE_INT("hw.pci.ofw_devices_only", &ofw_devices_only);
113 if (ofw_bus_get_node(dev) == -1)
115 device_set_desc(dev, "OFW PCI bus");
123 u_int busno, domain;
129 domain = pcib_get_domain(dev);
136 ofw_pcibus_enum_devtree(dev, domain, busno);
140 * the device tree to enumerate only some PCI devices. Apple's
141 * OF device tree on some Grackle-based hardware can also miss
142 * functions on multi-function cards.
146 ofw_pcibus_enum_bus(dev, domain, busno);
158 return (&dinfo->opd_dinfo);
162 ofw_pcibus_enum_devtree(device_t dev, u_int domain, u_int busno)
176 sizeof(pcir)) == -1)
182 if (pci_find_dbsf(domain, busno, slot, func) != NULL)
187 * it such that the PCI code will reroute the interrupt if
198 * Now set up the PCI and OFW bus layer devinfo and add it
199 * to the PCI bus.
203 domain, busno, slot, func);
206 if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) !=
211 dinfo->opd_dma_tag = NULL;
220 if (dinfo->opd_dinfo.cfg.intpin == 0)
222 &dinfo->opd_dinfo.resources, NULL);
230 * to handle non-enumerated PCI children as exist in FDT and on the second
235 ofw_pcibus_enum_bus(device_t dev, u_int domain, u_int busno)
257 if (pci_find_dbsf(domain, busno, s, f) != NULL)
261 pcib, dev, domain, busno, s, f);
265 dinfo->opd_dma_tag = NULL;
266 dinfo->opd_obdinfo.obd_node = -1;
268 dinfo->opd_obdinfo.obd_name = NULL;
269 dinfo->opd_obdinfo.obd_compat = NULL;
270 dinfo->opd_obdinfo.obd_type = NULL;
271 dinfo->opd_obdinfo.obd_model = NULL;
274 * For non OFW-devices, don't believe 0
277 if (dinfo->opd_dinfo.cfg.intline == 0) {
278 dinfo->opd_dinfo.cfg.intline = PCI_INVALID_IRQ;
294 ofw_bus_gen_destroy_devinfo(&dinfo->opd_obdinfo);
303 if (ofw_bus_get_node(child) != -1) {
320 if (node == -1) {
321 /* Non-firmware enumerated child, use standard routing */
333 iparent = -1;
334 if (OF_getencprop(node, "interrupt-parent", &iparent,
336 iparent = -1;
338 if (iparent != -1)
339 OF_getencprop(OF_node_from_xref(iparent), "#interrupt-cells",
349 return ((iparent == -1) ? intr[0] : ofw_bus_map_intr(dev,
354 if (iparent != -1)
363 * For on-board devices, it frequently is not, and is completely out
364 * of the valid intpin range. For PCI slots, it hopefully is,
365 * otherwise we will have trouble interfacing with non-OFW buses
380 return (&dinfo->opd_obdinfo);
412 * Fetch the NUMA domain for the given device 'dev'.
414 * If a device has a _PXM method, map that to a NUMA domain.
416 * If there's no matching domain or the domain cannot be
420 ofw_pcibus_get_domain(device_t dev, device_t child, int *domain)
422 *domain = platform_node_numa_domain(ofw_bus_get_node(child));