device/oprom: Replace uses of dev_find_slot()

The call to dev_find_slot() may return PCI devices that
are disabled or unaccessible, as PCI enumeration does
not remove nodes from all_devices linked list.

Use PCI topology search instead.

Change-Id: I00233177e5572ca79002a7d141cda1b94b966330
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34083
Reviewed-by: Mike Banon <mikebdp2@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kyösti Mälkki 2019-07-04 13:15:01 +03:00
parent e2f39e23e8
commit 98d19572b1
3 changed files with 5 additions and 5 deletions

View File

@ -174,7 +174,7 @@ int int1a_handler(void)
devfn = X86_EBX & 0xff;
bus = X86_EBX >> 8;
reg = X86_EDI;
dev = dev_find_slot(bus, devfn);
dev = pcidev_path_on_bus(bus, devfn);
if (!dev) {
printk(BIOS_DEBUG, "0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn);
// Or are we supposed to return PCIBIOS_NODEV?

View File

@ -409,8 +409,8 @@ handleInt1a(void)
if ((bus == bios_device.bus) && (devfn == bios_device.devfn)) {
dev = bios_device.dev;
} else if (CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)) {
dev = dev_find_slot(bus, devfn);
DEBUG_PRINTF_INTR("%s(): function: %x: dev_find_slot() returned: %s\n",
dev = pcidev_path_on_bus(bus, devfn);
DEBUG_PRINTF_INTR("%s(): function: %x: pcidev_path_on_bus() returned: %s\n",
__func__, M.x86.R_AX, dev_path(dev));
}

View File

@ -435,8 +435,8 @@ pci_cfg_read(X86EMU_pioAddr addr, u8 size)
if ((bus == bios_device.bus) && (devfn == bios_device.devfn)) {
dev = bios_device.dev;
} else if (CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)) {
dev = dev_find_slot(bus, devfn);
DEBUG_PRINTF_INTR("%s(): dev_find_slot() returned: %s\n",
dev = pcidev_path_on_bus(bus, devfn);
DEBUG_PRINTF_INTR("%s(): pcidev_path_on_bus() returned: %s\n",
__func__, dev_path(dev));
}