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 <felix-coreboot@felixheld.de>
Change-Id: If7da78c69dd702280a78996a5823972516e0319b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73612
Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Felix Held 2023-03-08 15:38:01 +01:00
parent dd40122fd6
commit 42f0396a10
1 changed files with 5 additions and 15 deletions

View File

@ -60,25 +60,15 @@ 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,
rom_header = cbfs_boot_map_optionrom(mapped_vendev >> 16,
mapped_vendev & 0xffff);
}
}
if (rom_header) {
printk(BIOS_DEBUG, "In CBFS, ROM address for %s = %p\n",