summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/console/cbmem_console.h6
-rw-r--r--src/lib/cbmem_console.c10
2 files changed, 16 insertions, 0 deletions
diff --git a/src/include/console/cbmem_console.h b/src/include/console/cbmem_console.h
index 65cf59c4c5..4f03a45e74 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_init(void) {}
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 02de8045c2..8e190d7264 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -139,6 +139,16 @@ static void copy_console_buffer(struct cbmem_console *src_cons_p)
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;