summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2022-01-18 15:09:03 -0700
committerFelix Held <felix-coreboot@felixheld.de>2022-01-21 16:04:29 +0000
commit6a3bdf9aa5da6b620952c915330ce70702735456 (patch)
tree2a67bba454f1eebb63ea376860875703787665a5
parent6fb126773f538ea4467b1abfde6cb8c6fc3cc9bb (diff)
lib/cbmem_console: Move copy_console_buffer up in the file
This will make the method available earlier. This is needed for the next CL. BUG=b:213828947 TEST=Build guybrush Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: Iee911a2debcfbf4309d2e866401b74f2a6c18feb Reviewed-on: https://review.coreboot.org/c/coreboot/+/61188 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--src/lib/cbmem_console.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index 02de8045c2..0d8534264b 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -55,6 +55,38 @@ 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 &&
@@ -107,38 +139,6 @@ 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;