summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2022-02-28 12:43:02 -0700
committerRaul Rangel <rrangel@chromium.org>2022-03-02 21:30:06 +0000
commitbd58aea7063d286b37982bc6e1b3a66f2291d344 (patch)
treedeb36c7c96e417afea175107640816e570081b9d /src
parente802d080118a028b338602f82d29b2168dae0bea (diff)
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 <rrangel@chromium.org> Change-Id: Ida7d50bef46f280be0db1e1f185b46abb0ae5c8f Reviewed-on: https://review.coreboot.org/c/coreboot/+/62501 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/vboot/transfer_buffer.c9
1 files changed, 9 insertions, 0 deletions
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 <timestamp.h>
#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();