cleanup early console setup
This patch cleans up our early console hacks so that we use the "approved" way of doing things. I've only tested this on a J6k... looking for testers on other systems.
Especially interesting would be something that uses non-8250 consoles, such as E/K class systems that use the serial mux console. I suspect some changes are needed there. If you can test on such a system, and see some problems [*], please let me know. likely we will need to move the register_console() call from mux_probe() into a separate initcall.
[*] during startup, the console print messages should show up regularly, and only once. symptoms of problems are if your console prints pause for a long time, or if you start seeing each line printed twice.
randolph
Index: arch/parisc/Kconfig
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/Kconfig,v retrieving revision 1.25
parisc/Kconfig +3 -0
@@ -19,6 +19,9 @@ config MMU config STACK_GROWSUP def_bool y +config EARLY_PRINTK + def_bool y + config UID16 bool
Index: arch/parisc/kernel/pdc_cons.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/pdc_cons.c,v retrieving revision 1.7
parisc/kernel/pdc_cons.c +15 -22
@@ -39,11 +39,6 @@* can or will be a fully functional linux console. */ -/* Define EARLY_BOOTUP_DEBUG to debug kernel related boot problems. -* On production kernels EARLY_BOOTUP_DEBUG should be undefined. */ -#undef EARLY_BOOTUP_DEBUG - -#include <linux/config.h> #include <linux/kernel.h> #include <linux/console.h>
@@ -81,8 +76,11 @@ void pdc_printf(const char *fmt, ...) len =vscnprintf (buf,sizeof (buf), fmt, args);va_end (args); -for (i =0 ; i < len; i++) +for (i =0 ; i < len; i++) { +if (buf[i] =='\n' ) +pdc_iodc_outc ('\r' );pdc_iodc_outc (buf[i]); + } }int pdc_console_poll_key (struct console *co)
@@ -112,14 +110,11 @@ static struct console pdc_cons = { .write = pdc_console_write, .device = PDC_CONSOLE_DEVICE, .setup = pdc_console_setup, - .flags = CON_BOOT|CON_PRINTBUFFER|CON_ENABLED, + .flags = CON_PRINTBUFFER, .index = -1, };static int pdc_console_initialized; -extern unsigned long con_start;/* kernel/printk.c */ -extern unsigned long log_end;/* kernel/printk.c */ -static void pdc_console_init_force (void ) {
@@ -135,14 +130,10 @@ static void pdc_console_init_force(void)register_console (&pdc_cons); } -void __init pdc_console_init (void ) +void __init +pdc_console_init (void ) { -#if defined(EARLY_BOOTUP_DEBUG ) || defined(CONFIG_PDC_CONSOLE )pdc_console_init_force (); -#endif -#ifdef EARLY_BOOTUP_DEBUG -printk (KERN_INFO "Initialized PDC Console for debugging.\n" ); -#endif }
@@ -155,12 +146,17 @@ void pdc_console_die(void)printk (KERN_INFO "Switching from PDC console\n" ); -/* Don't repeat what we've already printed */ - con_start = log_end; -unregister_console (&pdc_cons); } +void __init +disable_early_printk (void ) +{ +#ifndef CONFIG_PDC_CONSOLE +pdc_console_die (); +#endif +} +/* * Used for emergencies. Currently only used if an HPMC occurs. If an
@@ -180,9 +176,6 @@ void pdc_console_restart(void)while ((console = console_drivers) !=NULL )unregister_console (console_drivers); -/* Don't repeat what we've already printed */ - con_start = log_end; -/* force registering the pdc console */ pdc_console_init_force (); }
Index: arch/parisc/kernel/setup.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/setup.c,v retrieving revision 1.12
parisc/kernel/setup.c +2 -1
@@ -157,7 +157,8 @@ void __init setup_arch(char **cmdline_p)#endif #if defined(CONFIG_VT ) && defined(CONFIG_DUMMY_CONSOLE ) - conswitchp = &dummy_con;/* we use take_over_console() later ! */ +if (!conswitchp) + conswitchp = &dummy_con;/* we use take_over_console() later ! */ #endif }
Index: kernel/printk.c
===================================================================
RCS file: /var/cvs/linux-2.6/kernel/printk.c,v
retrieving revision 1.26
printk.c +2 -2
@@ -92,8 +92,8 @@ static int log_buf_len = __LOG_BUF_LEN;* must be masked before subscripting */ static unsigned long log_start;/* Index into log_buf: next char to be read by syslog() */ -unsigned long con_start;/* Index into log_buf: next char to be sent to consoles */ -unsigned long log_end;/* Index into log_buf: most-recently-written-char + 1 */ +static unsigned long con_start;/* Index into log_buf: next char to be sent to consoles */ +static unsigned long log_end;/* Index into log_buf: most-recently-written-char + 1 */ static unsigned long logged_chars;/* Number of chars produced since last read+clear operation */ /*
@@ -793,11 +793,6 @@ void register_console(struct console * cif (!(console->flags &CON_ENABLED ))return ;
Quoted 9 lines · Randolph Chung
Especially interesting would be something that uses non-8250 consoles, such as E/K class systems that use the serial mux console. I suspect some changes are needed there. If you can test on such a system, and see some problems [*], please let me know. likely we will need to move the
register_console()call frommux_probe()into a separate initcall.[*] during startup, the console print messages should show up regularly, and only once. symptoms of problems are if your console prints pause for a long time, or if you start seeing each line printed twice.
My comments in >>> <<<, this is the boot log from Knapps
Linux version 2.6.11-rc3-pa5 (willy@palinux) (gcc version 3.3.5 (Debian 1:3.3.5-5)) #9 Sun Feb 13 18:53:41 MST 2005 FP[0] enabled: Rev 0 Model 14
The 32-bit Kernel has started...
Determining PDC firmware type: System Map.
model 000058f0 00000491 00000000 00000002 53ad0a91 100000f1 00000008 000000b2 000000b2
vers 00000201
CPUID vers 14 rev 5 (0x000001c5)
model 9000/889/K460
Total Memory: 1920 Mb
Built 1 zonelists
Kernel command line: HOME=/ root=/dev/sda3 console=ttyB0 TERM=vt102 palo_kernel=0/vmlinux
PID hash table entries: 4096 (order: 12, 65536 bytes)
Switching from PDC console
Quoted 1 line
Quoted 1 line
Quoted 1 line
Long pause here <<<
Linux version 2.6.11-rc3-pa5 (willy@palinux) (gcc version 3.3.5 (Debian 1:3.3.5-5)) #9 Sun Feb 13 18:53:41 MST 2005 FP[0] enabled: Rev 0 Model 14
The 32-bit Kernel has started...
Determining PDC firmware type: System Map.
model 000058f0 00000491 00000000 00000002 53ad0a91 100000f1 00000008 000000b2 000000b2
vers 00000201
CPUID vers 14 rev 5 (0x000001c5)
model 9000/889/K460
Total Memory: 1920 Mb
Built 1 zonelists
Kernel command line: HOME=/ root=/dev/sda3 console=ttyB0 TERM=vt102 palo_kernel=0/vmlinux
PID hash table entries: 4096 (order: 12, 65536 bytes)
Switching from PDC console
Console: colour dummy device 160x64
Dentry cache hash table entries: 262144 (order: 8, 1048576 bytes)
Inode-cache hash table entries: 131072 (order: 7, 524288 bytes)
Memory: 1966080k available
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
NET: Registered protocol family 16
Quoted 1 line
Quoted 1 line
Quoted 1 line
lots more here<<<
Serial mux driver (8 ports) Revision: 0.3
ttyB0 at MMIO 0xf1900800 (polled) is a Mux
Quoted 1 line
Quoted 1 line
Quoted 1 line
etc<<<
Debian GNU/Linux 3.1 knapps ttyB0
knapps login: root
Password:
Last login: Mon Feb 14 01:56:30 2005 on ttyB0
Linux knapps 2.6.11-rc3-pa5 #9 Sun Feb 13 18:53:41 MST 2005 parisc GNU/Linux
Signature · 10 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain _______________________________________________ parisc-linux mailing list [email protected] http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
Quoted 10 lines · Matthew Wilcox
Quoted 9 lines · Randolph Chung
Especially interesting would be something that uses non-8250 consoles, such as E/K class systems that use the serial mux console. I suspect some changes are needed there. If you can test on such a system, and see some problems [*], please let me know. likely we will need to move the
register_console()call frommux_probe()into a separate initcall.[*] during startup, the console print messages should show up regularly, and only once. symptoms of problems are if your console prints pause for a long time, or if you start seeing each line printed twice.
I'm not sure we can avoid the long pauses. Look at what happens:
Quoted 2 lines
Switching from PDC console
Console: colour dummy device 160x64
The console starts up and disables the early console, using the dummy driver. Then we wait while we do a buswalk ...
Quoted 2 lines
Serial mux driver (8 ports) Revision: 0.3
ttyB0 at MMIO0xf1900800(polled) is a Mux
... and eventually the mux driver gets registered and starts spewing everything out.
So there's still a long period of time during which we have no console driver registered and it's frequently the most interesting part from the point of view of drivers or devices having trouble ;-(
Based on this, CON_BOOT seems like a superior solution. That's annoying.
Signature · 10 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain _______________________________________________ parisc-linux mailing list [email protected] http://lists.parisc-linux.org/mailman/listinfo/parisc-linux