summaryrefslogtreecommitdiffstats
path: root/src/device
diff options
context:
space:
mode:
authorMatt DeVillier <matt.devillier@amd.corp-partner.google.com>2023-09-03 12:51:58 -0500
committerFelix Held <felix-coreboot@felixheld.de>2023-09-06 22:07:38 +0000
commit7c04d0e6fdaedaf6ee336485df939963fa6c0c1a (patch)
treee6eee54724e10cfed2147581f059447da6645c4d /src/device
parentbfd85218a72ef057a7c150358a0f6983639f86dc (diff)
downloadcoreboot-7c04d0e6fdaedaf6ee336485df939963fa6c0c1a.tar.gz
coreboot-7c04d0e6fdaedaf6ee336485df939963fa6c0c1a.tar.bz2
coreboot-7c04d0e6fdaedaf6ee336485df939963fa6c0c1a.zip
device/pci_rom: Set VBIOS checksum when filling VFCT table
AMD's Windows display drivers validate the checksum of the VBIOS data in the VFCT table (which gets modified by the FSP GOP driver), so ensure it is set correctly after copying the VBIOS into the table if the FSP GOP driver was run. Without the correct checksum, the Windows GPU drivers will fail to load with a code 43 error in Device Manager. Thanks to coolstar for root causing the issue. TEST=build/boot Win11 on google/skyrim (frostflow), ensure GPU driver loaded and functional. Change-Id: I809f87865fd2a25fb106444574b619746aec068d Signed-off-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Signed-off-by: CoolStar <coolstarorganization@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/77628 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Diffstat (limited to 'src/device')
-rw-r--r--src/device/pci_rom.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c
index a454c9e0ae02..debefb248ce3 100644
--- a/src/device/pci_rom.c
+++ b/src/device/pci_rom.c
@@ -245,10 +245,19 @@ pci_rom_acpi_fill_vfct(const struct device *device, acpi_vfct_t *vfct_struct,
header->PCIFunction = PCI_FUNC(device->path.pci.devfn);
header->PCIDevice = PCI_SLOT(device->path.pci.devfn);
header->ImageLength = rom->size * 512;
- memcpy((void *)&header->VbiosContent, rom, header->ImageLength);
+ memcpy((void *)header->VbiosContent, rom, header->ImageLength);
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;
}