
Ladislav Michl wrote:
On Wed, Jun 29, 2005 at 06:24:40PM -0400, Dave Ellis wrote:
The current implementation of CONFIG_SILENT_CONSOLE needs CFG_DEVICE_NULLDEV. I suppose a check could be added to flag the error at build time if CFG_DEVICE_NULLDEV is not defined.
GD_FLG_SILENT flag is checked on every output to console, nulldev
device
seems redundant to me.
Once devices are set up GD_FLG_SILENT would only block output that implies stdout, not output that specifies it. I think (I haven't tried it) printf("abc") would be blocked by GD_FLG_SILENT but fprintf(stdout, "abc") would not. The fprintf() would be blocked because stdout is nulldev. So I guess it is mostly redundant, but not for the fprintf() case.
In abortboot the "silent" operation is suspended by setting the console back to serial so you can use the console to
[snip]
Indeed, console is set back to serial, but it doesn't help you to see any output. I would assume you should see at least something like "Enter password - autoboot in n seconds"
[snip]
Again, why there is nulldev device when GD_FLG_SILENT is checked on
every
console output? Is CONFIG_AUTOBOOT_PROMPT supposed to be displayed
even
with "silent" console? Would it break any user setup if I remove
nulldev?
I think I see the problem. CONFIG_AUTOBOOT_PROMPT should be displayed, but it isn't because printf() is checking GD_FLG_SILENT. The cleanest solution I see is to check GD_FLG_SILENT only when sending directly to the handler, not when sending to the device. That keeps printf(...) and fprintf(stdout, ...) consistent. Below is a patch to try:
Dave Ellis
--- u-boot.cvs/common/console.c Thu Mar 31 13:42:16 2005 +++ u-boot.patched/common/console.c Thu Jun 30 16:21:07 2005 @@ -189,16 +189,17 @@ void putc (const char c) { DECLARE_GLOBAL_DATA_PTR;
-#ifdef CONFIG_SILENT_CONSOLE - if (gd->flags & GD_FLG_SILENT) - return; -#endif - if (gd->flags & GD_FLG_DEVINIT) { /* Send to the standard output */ fputc (stdout, c); } else { /* Send directly to the handler */ + +#ifdef CONFIG_SILENT_CONSOLE + if (gd->flags & GD_FLG_SILENT) + return; +#endif + serial_putc (c); } } @@ -207,16 +208,16 @@ void puts (const char *s) { DECLARE_GLOBAL_DATA_PTR;
-#ifdef CONFIG_SILENT_CONSOLE - if (gd->flags & GD_FLG_SILENT) - return; -#endif - if (gd->flags & GD_FLG_DEVINIT) { /* Send to the standard output */ fputs (stdout, s); } else { /* Send directly to the handler */ + +#ifdef CONFIG_SILENT_CONSOLE + if (gd->flags & GD_FLG_SILENT) + return; +#endif serial_puts (s); } }