summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/console/cbmem_console.h1
-rw-r--r--src/lib/cbmem_console.c24
2 files changed, 24 insertions, 1 deletions
diff --git a/src/include/console/cbmem_console.h b/src/include/console/cbmem_console.h
index 3477a06b0a..65cf59c4c5 100644
--- a/src/include/console/cbmem_console.h
+++ b/src/include/console/cbmem_console.h
@@ -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
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index 719c8b5088..02de8045c2 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -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;
+}