Karthik Ramasubramanian has submitted this change. ( https://review.coreboot.org/c/coreboot/+/62402 )
Change subject: soc/amd/{common/vboot,cezanne}: Copy S0i3 verstage logs into cbmem ......................................................................
soc/amd/{common/vboot,cezanne}: Copy S0i3 verstage logs into cbmem
Now that SMM can write to CBMEM we can simply replay the transfer buffer cbmem console to move it into the main cbmem console.
replay_transfer_buffer_cbmemc() relies on the EARLY_RAM linker symbols. Since the SMM rmodule get linked with a different linker script than bootblock/romstage it doesn't have access to these symbols. In order to pass these symbols into SMM, we parse the bootblock.map file and generate an early_ram.ld script. This script is then used when linking SMM.
I replay the buffer in `smm_soc_early_init` because this call happens before `console_init()`. `console_init()` prints the SMM header and we want to append the verstage contents before printing the header to avoid confusion.
BUG=b:221231786 TEST=Perform S0i3 cycles and verify PSP verstage logs now show up when doing `cbmem -c`.
Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: I64d33ccdee9863270cfbcaef5d7c614349bd895c Reviewed-on: https://review.coreboot.org/c/coreboot/+/62402 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Karthik Ramasubramanian kramasub@google.com --- M src/soc/amd/cezanne/smihandler.c M src/soc/amd/common/vboot/Makefile.inc A src/soc/amd/common/vboot/early_ram_symbols.awk 3 files changed, 34 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Karthik Ramasubramanian: Looks good to me, approved
diff --git a/src/soc/amd/cezanne/smihandler.c b/src/soc/amd/cezanne/smihandler.c index 509a1d4..a149e57 100644 --- a/src/soc/amd/cezanne/smihandler.c +++ b/src/soc/amd/cezanne/smihandler.c @@ -9,9 +9,11 @@ #include <arch/hlt.h> #include <arch/io.h> #include <console/console.h> +#include <console/cbmem_console.h> #include <cpu/x86/cache.h> #include <cpu/x86/smm.h> #include <elog.h> +#include <soc/psp_transfer.h> #include <soc/smi.h> #include <soc/smu.h> #include <soc/southbridge.h> @@ -150,3 +152,9 @@
return NULL; } + +void smm_soc_early_init(void) +{ + if (CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK) && __CBMEM_CONSOLE_ENABLE__) + replay_transfer_buffer_cbmemc(); +} diff --git a/src/soc/amd/common/vboot/Makefile.inc b/src/soc/amd/common/vboot/Makefile.inc index 6938d16..e3486ab 100644 --- a/src/soc/amd/common/vboot/Makefile.inc +++ b/src/soc/amd/common/vboot/Makefile.inc @@ -7,3 +7,13 @@
bootblock-$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK) += vboot_bootblock.c bootblock-$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK) += transfer_buffer.c +smm-$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK) += transfer_buffer.c + +# We don't use the early RAM memlayout linker for SMM, so we don't have access +# to the early RAM symbols. We manually generate a file that defines the symbols +# for us. +$(obj)/smm/early_ram_symbols.ld: $(objcbfs)/bootblock.map $(src)/soc/amd/common/vboot/early_ram_symbols.awk + awk -f $(src)/soc/amd/common/vboot/early_ram_symbols.awk -- "$<" > "$@" + +$(obj)/smm/smm.elf: $(obj)/smm/early_ram_symbols.ld +$(obj)/smm/smm.elf-ldflags += -T $(obj)/smm/early_ram_symbols.ld diff --git a/src/soc/amd/common/vboot/early_ram_symbols.awk b/src/soc/amd/common/vboot/early_ram_symbols.awk new file mode 100644 index 0000000..85a1627 --- /dev/null +++ b/src/soc/amd/common/vboot/early_ram_symbols.awk @@ -0,0 +1,16 @@ +#!/usr/bin/awk -F +# +# SPDX-License-Identifier: GPL-2.0-only +# +# Generates a linker script to provide early RAM symbols. +# +# e.g., +# _cbmemc_transfer = 0x02014040; +# _ecbmemc_transfer = 0x02015640; +# _cbmemc_transfer_size = 0x00001600; + +$3 ~ /^_e?transfer_buffer$/ { printf("%s = 0x%s;\n", $3, $1)} +$3 ~ /^_transfer_buffer_size$/ { printf("%s = 0x%s;\n", $3, $1)} + +$3 ~ /^_e?cbmemc_transfer$/ { printf("%s = 0x%s;\n", $3, $1)} +$3 ~ /^_cbmemc_transfer_size$/ { printf("%s = 0x%s;\n", $3, $1)}
5 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.