Attention is currently required from: Felix Held, Fred Reitberger, Jason Glenesk, Matt DeVillier.
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/86384?usp=email )
Change subject: device/pci_rom: Move VBIOS checksum fix ......................................................................
device/pci_rom: Move VBIOS checksum fix
Move the VBIOS checksum code into the soc/amd folder, as it's specific to AMD's FSP. The code now fixes the VBIOS in place instead only fixing it for the VFCT table.
Change-Id: I63aaaefaf01ea456e2ed39cd0891e552a7fb5135 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/device/pci_rom.c M src/soc/amd/common/fsp/fsp_graphics.c 2 files changed, 20 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/86384/1
diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 7e19646d..0fe94db 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -242,15 +242,6 @@
vfct_struct->VBIOSImageOffset = (size_t)header - (size_t)vfct_struct;
- /* Calculate and set checksum for VBIOS data if FSP GOP driver used, - Since GOP driver modifies ATOMBIOS tables at end of VBIOS */ - if (CONFIG(RUN_FSP_GOP)) { - /* Clear existing checksum before recalculating */ - header->VbiosContent[VFCT_VBIOS_CHECKSUM_OFFSET] = 0; - header->VbiosContent[VFCT_VBIOS_CHECKSUM_OFFSET] = - acpi_checksum(header->VbiosContent, header->ImageLength); - } - current += header->ImageLength; return current; } diff --git a/src/soc/amd/common/fsp/fsp_graphics.c b/src/soc/amd/common/fsp/fsp_graphics.c index 3e082e6..776711b 100644 --- a/src/soc/amd/common/fsp/fsp_graphics.c +++ b/src/soc/amd/common/fsp/fsp_graphics.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */
#include <amdblocks/graphics.h> +#include <amdblocks/vbt.h> #include <console/console.h> #include <device/device.h> #include <device/pci.h> @@ -15,4 +16,23 @@ else printk(BIOS_ERR, "%s: Unable to find resource for %s\n", __func__, dev_path(dev)); + + /* + * Calculate and set checksum for VBIOS data if FSP GOP driver used, + * Since GOP driver modifies ATOMBIOS tables at end of BS_DEV_RESOURCES. + * While Linux does not verify the checksum the Windows kernel driver does. + */ + struct rom_header *vbios = (struct rom_header *)vbt_get(); + if (!vbios || !vbios->size) { + printk(BIOS_ERR, "%s: No VGA BIOS loaded for %s\n", + __func__, dev_path(dev)); + return; + } + + uint8_t *data = (uint8_t *)vbios; + + /* Clear existing checksum before recalculating */ + data[VFCT_VBIOS_CHECKSUM_OFFSET] = 0; + data[VFCT_VBIOS_CHECKSUM_OFFSET] = + acpi_checksum(data, vbios->size * 512); }