Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35985 )
Change subject: intel/skylake: Implement PCIe RP devicetree update based on LCAP ......................................................................
Patch Set 18:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35985/18/src/soc/intel/common/block... File src/soc/intel/common/block/pcie/pcie_rp.c:
https://review.coreboot.org/c/coreboot/+/35985/18/src/soc/intel/common/block... PS18, Line 141: for (dev = *ptr; dev; dev = *ptr) { : if (dev->path.type != DEVICE_PATH_PCI) { : ptr = &dev->sibling; : continue; : } : : offset = 0; : for (group = groups; group->count; ++group) { : if (group->slot == PCI_SLOT(dev->path.pci.devfn)) : break; : offset += group->count; : } : if (!group->count) { : ptr = &dev->sibling; : continue; : } : : if (pcie_rp_update_dev(dev, offset, mapping) < 0) { : /* Unlink disabled device. */ : *ptr = dev->sibling; : dev->sibling = NULL; : } : } Is it something like the following you had in mind? Since this runs before enumeration it might be possible to simply skip the unlinking as this is done elsewhere? struct device *dev; struct device *prev_dev = NULL; for (dev = *ptr; dev; prev_dev = dev, dev = dev->sibling) { if (dev->path.type != DEVICE_PATH_PCI) { continue; }
offset = 0; for (group = groups; group->count; ++group) { if (group->slot == PCI_SLOT(dev->path.pci.devfn)) break; offset += group->count; } if (!group->count) { continue; }
if (pcie_rp_update_dev(dev, offset, mapping) < 0) { /* Unlink disabled device. */ prev_dev->sibling = dev->sibling; } }