Nico Huber has posted comments on this change. ( https://review.coreboot.org/19526 )
Change subject: Obtain correct virtual address for 32-bit BARs on PPC ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/#/c/19526/1/pcidev.c File pcidev.c:
Line 106: addr = dev->base_addr[(bar - 0x10) / 0x4] & PCI_BASE_ADDRESS_MEM_MASK;
From my understanding of the libpci API (which is sparsely docu-
mented), the usage of `base_addr` should be preceded by a check of `dev->known_fields` and a call to pci_fill_info() if it's not filled yet.
Also, I guess, your assumption that `base_addr` works is only true when an appropriate libpci access method is used. Which we leave at the default PCI_ACCESS_AUTO before the call to pci_init(). I would expect that PCI_ACCESS_SYS_BUS_PCI works, but enforcing that might not work on all OS.
I guess what we need is to check with pci_get_method_name() if PCI_ACCESS_SYS_BUS_PCI (or whatever you need) is available (it will return "" if not) and fallback to PCI_ACCESS_AUTO if not.