aboutsummaryrefslogtreecommitdiff
path: root/common/console.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-09-19 13:19:39 -0400
committerTom Rini <trini@konsulko.com>2022-09-19 16:07:12 -0400
commite9a1ff9724348408144c7f1c5b5cc26130ba46e5 (patch)
tree68b56f117206d121b4a7e567b0209c02283c98e6 /common/console.c
parentb6c50e5831f6ce3800d4b3cf3c7aa35dde8c48d9 (diff)
parentf76f3e3b44328fe6229650540109af93750fd5f0 (diff)
downloadu-boot-e9a1ff9724348408144c7f1c5b5cc26130ba46e5.zip
u-boot-e9a1ff9724348408144c7f1c5b5cc26130ba46e5.tar.gz
u-boot-e9a1ff9724348408144c7f1c5b5cc26130ba46e5.tar.bz2
Merge branch 'master' into next
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/common/console.c b/common/console.c
index 66b9813..e5be6ff 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) {}