]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - common/console.c
Added config option CONFIG_SILENT_CONSOLE. See doc/README.silent
[karo-tx-uboot.git] / common / console.c
index 86ed5842115177a696340d6b32e907c64cac0e85..da49c968272068235ac79edbd9ef7a520eea3d68 100644 (file)
@@ -25,9 +25,7 @@
 #include <stdarg.h>
 #include <malloc.h>
 #include <console.h>
-#include <syscall.h>
-
-void **syscall_tbl;
+#include <exports.h>
 
 #ifdef CONFIG_AMIGAONEG3SE
 int console_changed = 0;
@@ -52,6 +50,7 @@ int overwrite_console (void)
 
 static int console_setfile (int file, device_t * dev)
 {
+       DECLARE_GLOBAL_DATA_PTR;
        int error = 0;
 
        if (dev == NULL)
@@ -78,13 +77,13 @@ static int console_setfile (int file, device_t * dev)
                 */
                switch (file) {
                case stdin:
-                       syscall_tbl[SYSCALL_GETC] = dev->getc;
-                       syscall_tbl[SYSCALL_TSTC] = dev->tstc;
+                       gd->jt[XF_getc] = dev->getc;
+                       gd->jt[XF_tstc] = dev->tstc;
                        break;
                case stdout:
-                       syscall_tbl[SYSCALL_PUTC] = dev->putc;
-                       syscall_tbl[SYSCALL_PUTS] = dev->puts;
-                       syscall_tbl[SYSCALL_PRINTF] = printf;
+                       gd->jt[XF_putc] = dev->putc;
+                       gd->jt[XF_puts] = dev->puts;
+                       gd->jt[XF_printf] = printf;
                        break;
                }
                break;
@@ -232,6 +231,20 @@ void printf (const char *fmt, ...)
        puts (printbuffer);
 }
 
+void vprintf (const char *fmt, va_list args)
+{
+       uint i;
+       char printbuffer[CFG_PBSIZE];
+
+       /* For this to work, printbuffer must be larger than
+        * anything we ever want to print.
+        */
+       i = vsprintf (printbuffer, fmt, args);
+
+       /* Print the string */
+       puts (printbuffer);
+}
+
 /* test if ctrl-c was pressed */
 static int ctrlc_disabled = 0; /* see disable_ctrl() */
 static int ctrlc_was_pressed = 0;
@@ -352,10 +365,16 @@ int console_init_f (void)
        DECLARE_GLOBAL_DATA_PTR;
 
        gd->have_console = 1;
+
+#ifdef CONFIG_SILENT_CONSOLE
+       if (getenv("silent") != NULL)
+               gd->flags |= GD_FLG_SILENT;
+#endif
+
        return (0);
 }
 
-#if defined(CFG_CONSOLE_IS_IN_ENV) || defined(CONFIG_SPLASH_SCREEN)
+#if defined(CFG_CONSOLE_IS_IN_ENV) || defined(CONFIG_SPLASH_SCREEN) || defined(CONFIG_SILENT_CONSOLE)
 /* search a device */
 device_t *search_device (int flags, char *name)
 {
@@ -380,15 +399,16 @@ device_t *search_device (int flags, char *name)
 /* Called after the relocation - use desired console functions */
 int console_init_r (void)
 {
+       DECLARE_GLOBAL_DATA_PTR;
        char *stdinname, *stdoutname, *stderrname;
        device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
 
        /* set default handlers at first */
-       syscall_tbl[SYSCALL_GETC] = serial_getc;
-       syscall_tbl[SYSCALL_TSTC] = serial_tstc;
-       syscall_tbl[SYSCALL_PUTC] = serial_putc;
-       syscall_tbl[SYSCALL_PUTS] = serial_puts;
-       syscall_tbl[SYSCALL_PRINTF] = serial_printf;
+       gd->jt[XF_getc] = serial_getc;
+       gd->jt[XF_tstc] = serial_tstc;
+       gd->jt[XF_putc] = serial_putc;
+       gd->jt[XF_puts] = serial_puts;
+       gd->jt[XF_printf] = serial_printf;
 
        /* stdin stdout and stderr are in environment */
        /* scan for it */
@@ -422,6 +442,8 @@ int console_init_r (void)
                console_setfile (stdin, inputdev);
        }
 
+       gd->flags |= GD_FLG_DEVINIT;    /* device initialization completed */
+
 #ifndef CFG_CONSOLE_INFO_QUIET
        /* Print information */
        printf ("In:    ");
@@ -466,12 +488,22 @@ int console_init_r (void)
 /* Called after the relocation - use desired console functions */
 int console_init_r (void)
 {
+       DECLARE_GLOBAL_DATA_PTR;
+
        device_t *inputdev = NULL, *outputdev = NULL;
        int i, items = ListNumItems (devlist);
 
 #ifdef CONFIG_SPLASH_SCREEN
-       /* suppress all output if splash screen is enabled */
-       outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev");
+       /* suppress all output if splash screen is enabled and we have
+           a bmp to display                                            */
+       if (getenv("splashimage") != NULL)
+               outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev");
+#endif
+
+#ifdef CONFIG_SILENT_CONSOLE
+       /* Suppress all output if "silent" mode requested               */
+       if (gd->flags & GD_FLG_SILENT)
+               outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev");
 #endif
 
        /* Scan devices looking for input and output devices */
@@ -500,6 +532,8 @@ int console_init_r (void)
                console_setfile (stdin, inputdev);
        }
 
+       gd->flags |= GD_FLG_DEVINIT;    /* device initialization completed */
+
 #ifndef CFG_CONSOLE_INFO_QUIET
        /* Print information */
        printf ("In:    ");