From bd58aea7063d286b37982bc6e1b3a66f2291d344 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Mon, 28 Feb 2022 12:43:02 -0700 Subject: soc/amd/common/vboot: Verify location of CBMEMC transfer buffer Since we want to read the non-x86 CBMEMC from SMM we need to be stricter on where we read from. This change forces the verstage binary and x86 code to agree on the CBMEMC transfer buffer location and size. BUG=b:221231786 TEST=Boot guybrush and verify verstage transfer buffer still ends up in cbmem Signed-off-by: Raul E Rangel Change-Id: Ida7d50bef46f280be0db1e1f185b46abb0ae5c8f Reviewed-on: https://review.coreboot.org/c/coreboot/+/62501 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian --- src/soc/amd/common/vboot/transfer_buffer.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/soc/amd/common/vboot/transfer_buffer.c b/src/soc/amd/common/vboot/transfer_buffer.c index 63b4f8efe6..e08847e8ca 100644 --- a/src/soc/amd/common/vboot/transfer_buffer.c +++ b/src/soc/amd/common/vboot/transfer_buffer.c @@ -10,6 +10,8 @@ #include #include <2struct.h> +DECLARE_REGION(cbmemc_transfer) + int transfer_buffer_valid(const struct transfer_info_struct *ptr) { if (ptr->magic_val == TRANSFER_MAGIC_VAL && ptr->struct_bytes == sizeof(*ptr)) @@ -85,6 +87,13 @@ void replay_transfer_buffer_cbmemc(void) cbmemc = (void *)((uintptr_t)info + info->console_offset); + /* Verify the cbmemc transfer buffer is where we expect it to be. */ + if ((void *)_cbmemc_transfer != (void *)cbmemc) + return; + + if (REGION_SIZE(cbmemc_transfer) != cbmemc_size) + return; + /* We need to manually initialize cbmemc so we can fill the new buffer. cbmemc_init() * will also be called later in console_hw_init(), but it will be a no-op. */ cbmemc_init(); -- cgit v1.2.3