diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 7e19646d52..0fe94dbb56 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -242,15 +242,6 @@ ati_rom_acpi_fill_vfct(const struct device *device, acpi_vfct_t *vfct_struct, 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 3e082e66ac..776711bd69 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 +#include #include #include #include @@ -15,4 +16,23 @@ void fsp_graphics_init(struct device *const dev) 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); }