console/cbmem: Add cbmem_dump_console
This function is similar to cbmem_dump_console_to_uart except it uses the normally configured consoles. A console_paused flag was added to prevent the cbmem console from writing to itself. BUG=b:213828947 TEST=Boot guybrush Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: I3fe0f666e2e15c88b4568377923ad447c3ecf27e Reviewed-on: https://review.coreboot.org/c/coreboot/+/61011 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
This commit is contained in:
parent
2abb826312
commit
bf993110b3
|
@ -20,4 +20,5 @@ static inline void __cbmemc_tx_byte(u8 data) {}
|
|||
#endif
|
||||
|
||||
void cbmem_dump_console_to_uart(void);
|
||||
void cbmem_dump_console(void);
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <console/cbmem_console.h>
|
||||
#include <console/console.h>
|
||||
#include <console/uart.h>
|
||||
#include <cbmem.h>
|
||||
#include <symbols.h>
|
||||
#include <types.h>
|
||||
|
||||
/*
|
||||
* Structure describing console buffer. It is overlaid on a flat memory area,
|
||||
|
@ -37,6 +39,8 @@ _Static_assert(CONFIG_CONSOLE_CBMEM_BUFFER_SIZE <= MAX_SIZE,
|
|||
|
||||
static struct cbmem_console *current_console;
|
||||
|
||||
static bool console_paused;
|
||||
|
||||
/*
|
||||
* While running from ROM, before DRAM is initialized, some area in cache as
|
||||
* RAM space is used for the console buffer storage. The size and location of
|
||||
|
@ -88,7 +92,7 @@ void cbmemc_init(void)
|
|||
|
||||
void cbmemc_tx_byte(unsigned char data)
|
||||
{
|
||||
if (!current_console || !current_console->size)
|
||||
if (!current_console || !current_console->size || console_paused)
|
||||
return;
|
||||
|
||||
u32 flags = current_console->cursor & ~CURSOR_MASK;
|
||||
|
@ -169,3 +173,21 @@ void cbmem_dump_console_to_uart(void)
|
|||
uart_tx_byte(0, current_console->body[cursor]);
|
||||
}
|
||||
#endif
|
||||
|
||||
void cbmem_dump_console(void)
|
||||
{
|
||||
u32 cursor;
|
||||
if (!current_console)
|
||||
return;
|
||||
|
||||
console_paused = true;
|
||||
|
||||
if (current_console->cursor & OVERFLOW)
|
||||
for (cursor = current_console->cursor & CURSOR_MASK;
|
||||
cursor < current_console->size; cursor++)
|
||||
do_putchar(current_console->body[cursor]);
|
||||
for (cursor = 0; cursor < (current_console->cursor & CURSOR_MASK); cursor++)
|
||||
do_putchar(current_console->body[cursor]);
|
||||
|
||||
console_paused = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue