From 8ed95c3d2b349c6fb105c8b72bd99b0b584073af Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 21 May 2024 19:22:35 +0200 Subject: 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 Change-Id: I7cd8e2036250f4ca2239b04cd070bbf0778b13aa Reviewed-on: https://review.coreboot.org/c/coreboot/+/82592 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/device/pci_rom.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index b9210b0d65..7679552c59 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -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); -- cgit v1.2.3