diff options
author | Tom Rini <trini@konsulko.com> | 2022-08-31 19:32:31 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-08-31 19:32:31 -0400 |
commit | 4e10c1227aa879af809b3073bf917289f23e17d7 (patch) | |
tree | 682c915d732c07d017a00278ae76fdea6f00b003 /common/console.c | |
parent | 1573b6a86993fcf80d4badc866a46b78df7e6bda (diff) | |
parent | f4b540e25c5c63fd55a80c78a22b2f69ecb848f8 (diff) |
Merge branch '2022-08-31-assorted-fixes'
- Assorted bugfixes including re-working the i2c command CVE and fixing
some TI reference platforms with different EEPROMs.
Diffstat (limited to 'common/console.c')
-rw-r--r-- | common/console.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/common/console.c b/common/console.c index bde94122399..e783f309bf0 100644 --- a/common/console.c +++ b/common/console.c @@ -600,6 +600,9 @@ static void pre_console_putc(const char c) { char *buffer; + if (gd->precon_buf_idx < 0) + return; + buffer = map_sysmem(CONFIG_VAL(PRE_CON_BUF_ADDR), CONFIG_VAL(PRE_CON_BUF_SZ)); buffer[CIRC_BUF_IDX(gd->precon_buf_idx++)] = c; @@ -609,13 +612,16 @@ static void pre_console_putc(const char c) static void pre_console_puts(const char *s) { + if (gd->precon_buf_idx < 0) + return; + while (*s) pre_console_putc(*s++); } static void print_pre_console_buffer(int flushpoint) { - unsigned long in = 0, out = 0; + long in = 0, out = 0; char buf_out[CONFIG_VAL(PRE_CON_BUF_SZ) + 1]; char *buf_in; @@ -632,6 +638,7 @@ static void print_pre_console_buffer(int flushpoint) buf_out[out] = 0; + gd->precon_buf_idx = -1; switch (flushpoint) { case PRE_CONSOLE_FLUSHPOINT1_SERIAL: puts(buf_out); @@ -640,6 +647,7 @@ static void print_pre_console_buffer(int flushpoint) console_puts_select(stdout, false, buf_out); break; } + gd->precon_buf_idx = in; } #else static inline void pre_console_putc(const char c) {} |