Raul Rangel has submitted this change. ( https://review.coreboot.org/c/coreboot/+/61099 )
Change subject: lib/cbmem_console: Add cbmemc_copy_in function ......................................................................
lib/cbmem_console: Add cbmemc_copy_in function
When running in verstage before bootblock, the PSP (ARM co-processor) is running with limited SRAM. It needs to stash the verstage console data internally until DRAM is brought up. Once DRAM is brought up the data is stashed in a "transfer buffer" region. In the current design, we are using the same region for the transfer buffer and the preram_cbmem_console region. This has the following downsides:
1) The pre-x86 buffer needs to be large enough to hold all the verstage, bootblock and romstage console logs. 2) On AMD platforms, the PSP verstage is signed. Changing the size of preram_cbmem_console after the fact will result in a mismatch of the transfer buffer between verstage and bootblock.
This CL adds a new method that allows SoC specific code to copy the CBMEM console in the transfer buffer to the active CBMEM console.
BUG=b:213828947 TEST=Boot guybrush and no longer see *** Pre-CBMEM romstage console overflowed, log truncated!
Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: Idc0ab8090db740e0d1b3d21d8968f26471f2e930 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61099 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Kangheui Won khwon@chromium.org Reviewed-by: Julius Werner jwerner@chromium.org --- M src/include/console/cbmem_console.h M src/lib/cbmem_console.c 2 files changed, 16 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved Kangheui Won: Looks good to me, but someone else must approve
diff --git a/src/include/console/cbmem_console.h b/src/include/console/cbmem_console.h index 65cf59c..4f03a45 100644 --- a/src/include/console/cbmem_console.h +++ b/src/include/console/cbmem_console.h @@ -3,6 +3,7 @@ #define _CONSOLE_CBMEM_CONSOLE_H_
#include <stdint.h> +#include <stddef.h>
void cbmemc_init(void); void cbmemc_tx_byte(unsigned char data); @@ -19,6 +20,11 @@ static inline void __cbmemc_tx_byte(u8 data) {} #endif
+/* + * Copy an external cbmem_console into the active cbmem_console. + */ +void cbmemc_copy_in(void *buffer, size_t size); + void cbmem_dump_console_to_uart(void); void cbmem_dump_console(void); #endif diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c index 02de804..8e190d72 100644 --- a/src/lib/cbmem_console.c +++ b/src/lib/cbmem_console.c @@ -139,6 +139,16 @@ src_cons_p->size = 0; }
+void cbmemc_copy_in(void *buffer, size_t size) +{ + struct cbmem_console *previous = (void *)buffer; + + if (!buffer_valid(previous, size)) + return; + + copy_console_buffer(previous); +} + static void cbmemc_reinit(int is_recovery) { const size_t size = CONFIG_CONSOLE_CBMEM_BUFFER_SIZE;
4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.