On Thu, Sep 26, 2019 at 10:06 AM Kyösti Mälkki <kyosti.malkki@gmail.com> wrote:
In a nutshell:

The implementation of dev_find_slot() traverses the linked list of all
devices in the devicetree, regardless of the topology. Since PCI bus
numbers are only assigned in early ramstage, this function is not a
reliable API. Furthermore, referencing (dynamically) assigned PCI
busses by integers (>1) is also prone to errors as insertion of PCIe
add-on cards will shift these.

Now.. during PCI enumeration, missing static devices are only removed
from the PCI topology links, not the 'linked list of all devices' that
dev_find_slot(). AFAICS, this is the root cause why pcidev_on_root()
caused regressions with 903b40a. Should be easy enough to implement
platform hook telling to not remove PCI device node from topology
links (based on BDF), even when it does not respond to ID queries.

Yes, we can certainly do that. However, I also think this issue and yours and Nico's devicetree work are somewhat related as well as https://review.coreboot.org/c/coreboot/+/35621

Here's some of the requirements/issues we should resolve that come to mind:

1. Easy way to directly retrieve a device's chip config object w/o traversing the device hierarchy. Which leads to...
2. Symbol alias for accessing struct device directly (no bdf lookup)
3. Symbol alias for pci b/d/f lookup (equivalent of simple device but cleaner) so we can perform pci operations.
4. possibly hidden pci devices

Anything else I'm missing? I think a lot of the issues we're running into could be fixed w/ the above. Let me know what you think.


Kyösti