device/pci_rom: handle non-remapped VGA_BIOS_ID

While the SoC-level defaults for VGA_BIOS_ID are the expected correctly
remapped PCI VID/PID of the GPU which matches the PCI VID/DID inside the
VBIOS file, some mainboards override the VGA_BIOS_ID setting to the
non-remapped PCI ID. This resulted in coreboot not finding the VBIOS
file after commit 42f0396a1028 ("device/pci_rom: rework PCI ID remapping
in pci_rom_probe"). The proper solution would be to not override this
SoC-level config in neither the mainboard code nor some external config
file. This however requires adding/using some mechanism to tell SeaBIOS
which VBIOS image to use for the GPU device. Once this is implemented,
the SoC default for VGA_BIOS_ID shouldn't be overridden any more and
this patch can be reverted again.

This sort-of reverts parts of commit 42f0396a1028 ("device/pci_rom:
rework PCI ID remapping in pci_rom_probe"), but it still tries to find
the VBIOS image with the expected remapped PCI ID and only adds trying
the non-remapped PCI ID as a fallback when the file with the remapped
PCI ID doesn't exist and prints a notice in that case. Before the patch
referenced above, using the correct remapped PCI VID/DID resulted in a
warning about the CBFS file with the non-remapped name not being found,
but first checking the remapped version solves that problem.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I7cd8e2036250f4ca2239b04cd070bbf0778b13aa
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82592
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
This commit is contained in:
Felix Held 2024-05-21 19:22:35 +02:00
parent ebfb285085
commit 8ed95c3d2b

View File

@ -49,6 +49,17 @@ struct rom_header *pci_rom_probe(const struct device *dev)
mapped_vendev = map_oprom_vendev(vendev);
rom_header = cbfs_boot_map_optionrom(mapped_vendev >> 16, mapped_vendev & 0xffff);
/* Handle the case of VGA_BIOS_ID not being set to the remapped PCI ID. This is a
workaround that should be removed once the underlying issue is fixed. */
if (!rom_header && vendev != mapped_vendev) {
rom_header = cbfs_boot_map_optionrom(vendev >> 16, vendev & 0xffff);
if (rom_header) {
printk(BIOS_NOTICE, "VGA_BIOS_ID should be the remapped PCI ID "
"%04hx,%04hx in the VBIOS file\n",
mapped_vendev >> 16, mapped_vendev & 0xffff);
}
}
if (rom_header) {
printk(BIOS_DEBUG, "In CBFS, ROM address for %s = %p\n",
dev_path(dev), rom_header);