soc/amd/common/graphics: Update VBIOS cache data before hashing

On the first boot after flashing, the data read from the FMAP and
stored in vbios_data is not valid, so hashing it produces a value which
will not match on the subsequent boot, requiring an additional boot
before the vbios_data and hash match / before the GOP driver can be
skipped. To fix this, update vbios_data before hashing.

BUG=b:271850970
BRANCH=skyrim
TEST=build/boot google/skyrim with USE_SELECTIVE_GOP_INIT selected,
verify that GOP driver execution is skipping on 2nd boot after flashing
when booting in normal / verified boot mode.

Change-Id: Idc10d752bfa004a34b91307a743c620fb97eeb82
Signed-off-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77727
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
This commit is contained in:
Matt DeVillier 2023-09-08 12:56:52 -05:00 committed by Felix Held
parent d5f5dd7984
commit 9f01005da0
1 changed files with 3 additions and 0 deletions

View File

@ -244,6 +244,9 @@ static void write_vbios_cache_to_fmap(void *unused)
VBIOS_CACHE_FMAP_SIZE) != VBIOS_CACHE_FMAP_SIZE)
printk(BIOS_ERR, "Failed to save vbios data to flash; rdev_writeat() failed.\n");
/* copy modified vbios data from PCI_VGA_RAM_IMAGE_START to buffer before hashing */
memcpy(vbios_data, (void *)PCI_VGA_RAM_IMAGE_START, VBIOS_CACHE_FMAP_SIZE);
/* save data hash to TPM NVRAM for validation on subsequent boots */
vbios_cache_update_hash(vbios_data, VBIOS_CACHE_FMAP_SIZE);