]> git.baikalelectronics.ru Git - uboot.git/commit
common/console.c: prevent pre-console buffer contents from being added to itself
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Tue, 3 May 2022 13:13:27 +0000 (15:13 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 31 Aug 2022 16:16:01 +0000 (12:16 -0400)
commit6cfdcf6d438655a6f210f4a36442de7f94fb2c04
tree2440575898a261dcfaa19cc2932a5d49e1a658f8
parentd454b79a7ebde234dcbf58e013a18f8f6f63b96f
common/console.c: prevent pre-console buffer contents from being added to itself

I do not have any non-serial output devices, so a
print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL)
does nothing for me.

However, I was manually inspected the pre-console buffer using md.b,
and I noticed that the early part of it was repeated. The reason is
that the first call of print_pre_console_buffer(), from
console_init_f(), ends up invoking puts() with the contents of the
buffer at that point, and puts() at that point ends up in the else
branch of

if (gd->flags & GD_FLG_DEVINIT) {
/* Send to the standard output */
fputs(stdout, s);
} else {
/* Send directly to the handler */
pre_console_puts(s);
serial_puts(s);
}

so indeed the contents is added again.

That can be somewhat confusing (both when reading the buffer manually,
but also if it did actually come out on some device). So disable all
use of the pre-console buffer while print_pre_console_buffer() is
emitting it.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/console.c
include/asm-generic/global_data.h