diff options
author | Patrick Delaunay | 2020-11-27 11:20:57 +0100 |
---|---|---|
committer | Tom Rini | 2021-01-15 14:36:11 -0500 |
commit | bf80edb91a9b7d61621c1413c15495348f8f0fcc (patch) | |
tree | 2b04517a6f10d8c7cbc51aab0b586aa1fdccb060 /common/console.c | |
parent | 93cdb52b2a06bf5fb2ea02db28a95b5524ab1e6e (diff) |
console: allow to record console output before ready
Allow to record the console output before before U-Boot
has a console ready.
This patch allows to test the console output in sandbox test
based on console record.
It is possible because GD_FLG_RECORD and GD_FLG_SERIAL_READY
are 2 independent flags.
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/console.c')
-rw-r--r-- | common/console.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/common/console.c b/common/console.c index 70579af0421..c3d552bb3ec 100644 --- a/common/console.c +++ b/common/console.c @@ -519,6 +519,10 @@ void putc(const char c) { if (!gd) return; +#ifdef CONFIG_CONSOLE_RECORD + if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) + membuff_putbyte((struct membuff *)&gd->console_out, c); +#endif #ifdef CONFIG_SANDBOX /* sandbox can send characters to stdout before it has a console */ if (!(gd->flags & GD_FLG_SERIAL_READY)) { @@ -533,10 +537,6 @@ void putc(const char c) return; } #endif -#ifdef CONFIG_CONSOLE_RECORD - if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) - membuff_putbyte((struct membuff *)&gd->console_out, c); -#endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) { if (!(gd->flags & GD_FLG_DEVINIT)) @@ -567,6 +567,10 @@ void puts(const char *s) { if (!gd) return; +#ifdef CONFIG_CONSOLE_RECORD + if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) + membuff_put((struct membuff *)&gd->console_out, s, strlen(s)); +#endif #ifdef CONFIG_SANDBOX /* sandbox can send characters to stdout before it has a console */ if (!(gd->flags & GD_FLG_SERIAL_READY)) { @@ -584,10 +588,6 @@ void puts(const char *s) return; } #endif -#ifdef CONFIG_CONSOLE_RECORD - if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) - membuff_put((struct membuff *)&gd->console_out, s, strlen(s)); -#endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) { if (!(gd->flags & GD_FLG_DEVINIT)) |