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>
This commit is contained in:
Raul E Rangel 2022-02-28 12:43:02 -07:00 committed by Raul Rangel
parent e802d08011
commit bd58aea706
1 changed files with 9 additions and 0 deletions

View File

@ -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();