Lines Matching +full:a +full:- +full:child +full:- +full:node +full:- +full:property

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
67 static int ofw_pcibus_child_pnpinfo_method(device_t cbdev, device_t child,
113 if (ofw_bus_get_node(dev) == -1)
141 * OF device tree on some Grackle-based hardware can also miss
142 * functions on multi-function cards.
158 return (&dinfo->opd_dinfo);
167 phandle_t node, child;
172 node = ofw_bus_get_node(dev);
174 for (child = OF_child(node); child != 0; child = OF_peer(child)) {
175 if (OF_getencprop(child, "reg", (pcell_t *)&pcir,
176 sizeof(pcir)) == -1)
192 if (OF_getproplen(child, "interrupts") > 0)
206 if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) !=
211 dinfo->opd_dma_tag = NULL;
217 * interrupts property, so add that value to the device's
220 if (dinfo->opd_dinfo.cfg.intpin == 0)
221 ofw_bus_intr_to_rl(dev, child,
222 &dinfo->opd_dinfo.resources, NULL);
228 * addition that it (a) will not add children that have already been added,
230 * to handle non-enumerated PCI children as exist in FDT and on the second
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;
289 ofw_pcibus_child_deleted(device_t dev, device_t child)
293 dinfo = device_get_ivars(child);
294 ofw_bus_gen_destroy_devinfo(&dinfo->opd_obdinfo);
295 pci_child_deleted(dev, child);
299 ofw_pcibus_child_pnpinfo_method(device_t cbdev, device_t child, struct sbuf *sb)
301 pci_child_pnpinfo_method(cbdev, child, sb);
303 if (ofw_bus_get_node(child) != -1) {
305 ofw_bus_gen_child_pnpinfo(cbdev, child, sb);
312 ofw_pcibus_assign_interrupt(device_t dev, device_t child)
315 phandle_t node, iparent;
318 node = ofw_bus_get_node(child);
320 if (node == -1) {
321 /* Non-firmware enumerated child, use standard routing */
323 intr[0] = pci_get_intpin(child);
324 return (PCIB_ROUTE_INTERRUPT(device_get_parent(dev), child,
329 * Try to determine the node's interrupt parent so we know which
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",
343 * Any AAPL,interrupts property gets priority and is
347 isz = OF_getencprop(node, "AAPL,interrupts", intr, sizeof(intr));
349 return ((iparent == -1) ? intr[0] : ofw_bus_map_intr(dev,
352 isz = OF_getencprop(node, "interrupts", intr, sizeof(intr));
354 if (iparent != -1)
357 /* No property: our best guess is the intpin. */
358 intr[0] = pci_get_intpin(child);
362 * If we got intr from a property, it may or may not be an intpin.
363 * For on-board devices, it frequently is not, and is completely out
365 * otherwise we will have trouble interfacing with non-OFW buses
371 return (PCIB_ROUTE_INTERRUPT(device_get_parent(dev), child, intr[0]));
380 return (&dinfo->opd_obdinfo);
384 ofw_pcibus_get_cpus(device_t dev, device_t child, enum cpu_sets op, size_t setsize,
398 error = bus_generic_get_cpus(dev, child, op, setsize, cpuset);
406 return (bus_generic_get_cpus(dev, child, op, setsize, cpuset));
414 * If a device has a _PXM method, map that to a NUMA domain.
420 ofw_pcibus_get_domain(device_t dev, device_t child, int *domain)
422 *domain = platform_node_numa_domain(ofw_bus_get_node(child));