Commit c9530948 authored by Jason Wessel's avatar Jason Wessel Committed by Greg Kroah-Hartman

early_printk: Allow more than one early console

It is desirable to be able to use one early boot device to debug
another or to have multiple places you can see the early boot
diagnostics, such as the vga screen or serial device.

This patch changes the early_printk console device registration to
allow more than one early printk device to get registered via
register_console().
Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 56faf0f9
...@@ -176,10 +176,19 @@ asmlinkage void early_printk(const char *fmt, ...) ...@@ -176,10 +176,19 @@ asmlinkage void early_printk(const char *fmt, ...)
va_end(ap); va_end(ap);
} }
static inline void early_console_register(struct console *con, int keep_early)
{
early_console = con;
if (keep_early)
early_console->flags &= ~CON_BOOT;
else
early_console->flags |= CON_BOOT;
register_console(early_console);
}
static int __init setup_early_printk(char *buf) static int __init setup_early_printk(char *buf)
{ {
int keep_early; int keep;
if (!buf) if (!buf)
return 0; return 0;
...@@ -188,42 +197,34 @@ static int __init setup_early_printk(char *buf) ...@@ -188,42 +197,34 @@ static int __init setup_early_printk(char *buf)
return 0; return 0;
early_console_initialized = 1; early_console_initialized = 1;
keep_early = (strstr(buf, "keep") != NULL); keep = (strstr(buf, "keep") != NULL);
while (*buf != '\0') {
if (!strncmp(buf, "serial", 6)) { if (!strncmp(buf, "serial", 6)) {
early_serial_init(buf + 6); early_serial_init(buf + 6);
early_console = &early_serial_console; early_console_register(&early_serial_console, keep);
} else if (!strncmp(buf, "ttyS", 4)) { }
early_serial_init(buf); if (!strncmp(buf, "ttyS", 4)) {
early_console = &early_serial_console; early_serial_init(buf + 4);
} else if (!strncmp(buf, "vga", 3) early_console_register(&early_serial_console, keep);
&& boot_params.screen_info.orig_video_isVGA == 1) { }
if (!strncmp(buf, "vga", 3) &&
boot_params.screen_info.orig_video_isVGA == 1) {
max_xpos = boot_params.screen_info.orig_video_cols; max_xpos = boot_params.screen_info.orig_video_cols;
max_ypos = boot_params.screen_info.orig_video_lines; max_ypos = boot_params.screen_info.orig_video_lines;
current_ypos = boot_params.screen_info.orig_y; current_ypos = boot_params.screen_info.orig_y;
early_console = &early_vga_console; early_console_register(&early_vga_console, keep);
}
#ifdef CONFIG_EARLY_PRINTK_DBGP #ifdef CONFIG_EARLY_PRINTK_DBGP
} else if (!strncmp(buf, "dbgp", 4)) { if (!strncmp(buf, "dbgp", 4) && !early_dbgp_init(buf + 4))
if (early_dbgp_init(buf+4) < 0) early_console_register(&early_dbgp_console, keep);
return 0;
early_console = &early_dbgp_console;
/*
* usb subsys will reset ehci controller, so don't keep
* that early console
*/
keep_early = 0;
#endif #endif
#ifdef CONFIG_HVC_XEN #ifdef CONFIG_HVC_XEN
} else if (!strncmp(buf, "xen", 3)) { if (!strncmp(buf, "xen", 3))
early_console = &xenboot_console; early_console_register(&xenboot_console, keep);
#endif #endif
buf++;
} }
if (keep_early)
early_console->flags &= ~CON_BOOT;
else
early_console->flags |= CON_BOOT;
register_console(early_console);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment