From 42f0396a1028fa2a81a73ff6ced36585ffe219b0 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Wed, 8 Mar 2023 15:38:01 +0100 Subject: [PATCH] device/pci_rom: rework PCI ID remapping in pci_rom_probe Only call cbfs_boot_map_optionrom/cbfs_boot_map_optionrom_revision once and pass the already remapped PCI ID to it. This avoids the spurious warning that the CBFS file wasn't found from the first cbfs_boot_map_optionrom call in cases where the PCI ID needs to be remapped to get the right ID for which a file in CBFS exists. Signed-off-by: Felix Held Change-Id: If7da78c69dd702280a78996a5823972516e0319b Reviewed-on: https://review.coreboot.org/c/coreboot/+/73612 Reviewed-by: Martin Roth Tested-by: build bot (Jenkins) --- src/device/pci_rom.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 8480626056..a454c9e0ae 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -60,24 +60,14 @@ struct rom_header *pci_rom_probe(const struct device *dev) /* If the ROM is in flash, then don't check the PCI device for it. */ if (CONFIG(CHECK_REV_IN_OPROM_NAME)) { - rom_header = cbfs_boot_map_optionrom_revision(dev->vendor, dev->device, rev); map_oprom_vendev_rev(&mapped_vendev, &mapped_rev); + rom_header = cbfs_boot_map_optionrom_revision(mapped_vendev >> 16, + mapped_vendev & 0xffff, + mapped_rev); } else { - rom_header = cbfs_boot_map_optionrom(dev->vendor, dev->device); mapped_vendev = map_oprom_vendev(vendev); - } - - if (!rom_header) { - if (CONFIG(CHECK_REV_IN_OPROM_NAME) && - (vendev != mapped_vendev || rev != mapped_rev)) { - rom_header = cbfs_boot_map_optionrom_revision( - mapped_vendev >> 16, - mapped_vendev & 0xffff, mapped_rev); - } else if (vendev != mapped_vendev) { - rom_header = cbfs_boot_map_optionrom( - mapped_vendev >> 16, - mapped_vendev & 0xffff); - } + rom_header = cbfs_boot_map_optionrom(mapped_vendev >> 16, + mapped_vendev & 0xffff); } if (rom_header) {