]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
sandbox: Allow puts() output before global_data is set up
authorSimon Glass <sjg@chromium.org>
Fri, 16 Nov 2018 01:44:04 +0000 (18:44 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 26 Nov 2018 13:25:36 +0000 (08:25 -0500)
We support putc() in this case but not puts(), but this is more useful
since it is what printf() uses.

This particularly affects debugging early in SPL, where currently printf()
statements result in no output. Fix this by adding a special case into
puts() for sandbox, just like putc().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
common/console.c

index 9a94f32192243419c1fe98425bb657777199c047..0b0dd76256c7c865668add13a2ae89eb1530cb3f 100644 (file)
@@ -535,6 +535,13 @@ void putc(const char c)
 
 void puts(const char *s)
 {
+#ifdef CONFIG_SANDBOX
+       /* sandbox can send characters to stdout before it has a console */
+       if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
+               os_puts(s);
+               return;
+       }
+#endif
 #ifdef CONFIG_DEBUG_UART
        if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
                while (*s) {