]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/console.c
tpm: Drop two unused options
[karo-tx-uboot.git] / common / console.c
index 00582224d463272b43647af31f8dcba519b2c61c..ace206ca4ff5dd87651c32da857fae762916f41c 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <debug_uart.h>
 #include <stdarg.h>
 #include <iomux.h>
 #include <malloc.h>
@@ -455,11 +456,19 @@ static inline void print_pre_console_buffer(int flushpoint) {}
 void putc(const char c)
 {
 #ifdef CONFIG_SANDBOX
+       /* sandbox can send characters to stdout before it has a console */
        if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
                os_putc(c);
                return;
        }
 #endif
+#ifdef CONFIG_DEBUG_UART
+       /* if we don't have a console yet, use the debug UART */
+       if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
+               printch(c);
+               return;
+       }
+#endif
 #ifdef CONFIG_SILENT_CONSOLE
        if (gd->flags & GD_FLG_SILENT)
                return;
@@ -491,7 +500,18 @@ void puts(const char *s)
                return;
        }
 #endif
+#ifdef CONFIG_DEBUG_UART
+       if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
+               while (*s) {
+                       int ch = *s++;
 
+                       printch(ch);
+                       if (ch == '\n')
+                               printch('\r');
+               }
+               return;
+       }
+#endif
 #ifdef CONFIG_SILENT_CONSOLE
        if (gd->flags & GD_FLG_SILENT)
                return;
@@ -521,11 +541,6 @@ int printf(const char *fmt, ...)
        uint i;
        char printbuffer[CONFIG_SYS_PBSIZE];
 
-#if !defined(CONFIG_SANDBOX) && !defined(CONFIG_PRE_CONSOLE_BUFFER)
-       if (!gd->have_console)
-               return 0;
-#endif
-
        va_start(args, fmt);
 
        /* For this to work, printbuffer must be larger than