diff options
author | Raul Rangel <rrangel@chromium.org> | 2022-01-21 16:46:55 +0000 |
---|---|---|
committer | Raul Rangel <rrangel@chromium.org> | 2022-01-21 20:45:22 +0000 |
commit | 03b1d3ef48f20cc80d2fab1f4da9f5b90e6a0ffe (patch) | |
tree | b7c8b9c0b6631e128ec804c900eaee70a817e426 | |
parent | c7018cc009ee8e876307d17ff80e20b69483afa1 (diff) |
Revert "lib/cbmem_console: Move copy_console_buffer up in the file"
This reverts commit 6a3bdf9aa5da6b620952c915330ce70702735456.
Reason for revert: Oops, I thought I abandoned this. It's been replaced by https://review.coreboot.org/c/coreboot/+/61099/3
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Id18e8e69481bdd78fdd70116940ea435922a9e77
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60853
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Rob Barnes <robbarnes@google.com>
-rw-r--r-- | src/lib/cbmem_console.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c index 0d8534264b..02de8045c2 100644 --- a/src/lib/cbmem_console.c +++ b/src/lib/cbmem_console.c @@ -55,38 +55,6 @@ static bool console_paused; #define STATIC_CONSOLE_SIZE 1024 static u8 static_console[STATIC_CONSOLE_SIZE]; -/* - * Copy the current console buffer (either from the cache as RAM area or from - * the static buffer, pointed at by src_cons_p) into the newly initialized CBMEM - * console. The use of cbmemc_tx_byte() ensures that all special cases for the - * target console (e.g. overflow) will be handled. If there had been an - * overflow in the source console, log a message to that effect. - */ -static void copy_console_buffer(struct cbmem_console *src_cons_p) -{ - u32 c; - - if (!src_cons_p) - return; - - if (src_cons_p->cursor & OVERFLOW) { - const char overflow_warning[] = "\n*** Pre-CBMEM " ENV_STRING - " console overflowed, log truncated! ***\n"; - for (c = 0; c < sizeof(overflow_warning) - 1; c++) - cbmemc_tx_byte(overflow_warning[c]); - for (c = src_cons_p->cursor & CURSOR_MASK; - c < src_cons_p->size; c++) - cbmemc_tx_byte(src_cons_p->body[c]); - } - - for (c = 0; c < (src_cons_p->cursor & CURSOR_MASK); c++) - cbmemc_tx_byte(src_cons_p->body[c]); - - /* Invalidate the source console, so it will be reinitialized on the - next reboot. Otherwise, we might copy the same bytes again. */ - src_cons_p->size = 0; -} - static int buffer_valid(struct cbmem_console *cbm_cons_p, u32 total_space) { return (cbm_cons_p->cursor & CURSOR_MASK) < cbm_cons_p->size && @@ -139,6 +107,38 @@ void cbmemc_tx_byte(unsigned char data) current_console->cursor = flags | cursor; } +/* + * Copy the current console buffer (either from the cache as RAM area or from + * the static buffer, pointed at by src_cons_p) into the newly initialized CBMEM + * console. The use of cbmemc_tx_byte() ensures that all special cases for the + * target console (e.g. overflow) will be handled. If there had been an + * overflow in the source console, log a message to that effect. + */ +static void copy_console_buffer(struct cbmem_console *src_cons_p) +{ + u32 c; + + if (!src_cons_p) + return; + + if (src_cons_p->cursor & OVERFLOW) { + const char overflow_warning[] = "\n*** Pre-CBMEM " ENV_STRING + " console overflowed, log truncated! ***\n"; + for (c = 0; c < sizeof(overflow_warning) - 1; c++) + cbmemc_tx_byte(overflow_warning[c]); + for (c = src_cons_p->cursor & CURSOR_MASK; + c < src_cons_p->size; c++) + cbmemc_tx_byte(src_cons_p->body[c]); + } + + for (c = 0; c < (src_cons_p->cursor & CURSOR_MASK); c++) + cbmemc_tx_byte(src_cons_p->body[c]); + + /* Invalidate the source console, so it will be reinitialized on the + next reboot. Otherwise, we might copy the same bytes again. */ + src_cons_p->size = 0; +} + static void cbmemc_reinit(int is_recovery) { const size_t size = CONFIG_CONSOLE_CBMEM_BUFFER_SIZE; |