aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/early_printk.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 519a5e10be53..2acfd3fdc0cc 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -176,10 +176,19 @@ asmlinkage void early_printk(const char *fmt, ...)
176 va_end(ap); 176 va_end(ap);
177} 177}
178 178
179static inline void early_console_register(struct console *con, int keep_early)
180{
181 early_console = con;
182 if (keep_early)
183 early_console->flags &= ~CON_BOOT;
184 else
185 early_console->flags |= CON_BOOT;
186 register_console(early_console);
187}
179 188
180static int __init setup_early_printk(char *buf) 189static int __init setup_early_printk(char *buf)
181{ 190{
182 int keep_early; 191 int keep;
183 192
184 if (!buf) 193 if (!buf)
185 return 0; 194 return 0;
@@ -188,42 +197,34 @@ static int __init setup_early_printk(char *buf)
188 return 0; 197 return 0;
189 early_console_initialized = 1; 198 early_console_initialized = 1;
190 199
191 keep_early = (strstr(buf, "keep") != NULL); 200 keep = (strstr(buf, "keep") != NULL);
192 201
193 if (!strncmp(buf, "serial", 6)) { 202 while (*buf != '\0') {
194 early_serial_init(buf + 6); 203 if (!strncmp(buf, "serial", 6)) {
195 early_console = &early_serial_console; 204 early_serial_init(buf + 6);
196 } else if (!strncmp(buf, "ttyS", 4)) { 205 early_console_register(&early_serial_console, keep);
197 early_serial_init(buf); 206 }
198 early_console = &early_serial_console; 207 if (!strncmp(buf, "ttyS", 4)) {
199 } else if (!strncmp(buf, "vga", 3) 208 early_serial_init(buf + 4);
200 && boot_params.screen_info.orig_video_isVGA == 1) { 209 early_console_register(&early_serial_console, keep);
201 max_xpos = boot_params.screen_info.orig_video_cols; 210 }
202 max_ypos = boot_params.screen_info.orig_video_lines; 211 if (!strncmp(buf, "vga", 3) &&
203 current_ypos = boot_params.screen_info.orig_y; 212 boot_params.screen_info.orig_video_isVGA == 1) {
204 early_console = &early_vga_console; 213 max_xpos = boot_params.screen_info.orig_video_cols;
214 max_ypos = boot_params.screen_info.orig_video_lines;
215 current_ypos = boot_params.screen_info.orig_y;
216 early_console_register(&early_vga_console, keep);
217 }
205#ifdef CONFIG_EARLY_PRINTK_DBGP 218#ifdef CONFIG_EARLY_PRINTK_DBGP
206 } else if (!strncmp(buf, "dbgp", 4)) { 219 if (!strncmp(buf, "dbgp", 4) && !early_dbgp_init(buf + 4))
207 if (early_dbgp_init(buf+4) < 0) 220 early_console_register(&early_dbgp_console, keep);
208 return 0;
209 early_console = &early_dbgp_console;
210 /*
211 * usb subsys will reset ehci controller, so don't keep
212 * that early console
213 */
214 keep_early = 0;
215#endif 221#endif
216#ifdef CONFIG_HVC_XEN 222#ifdef CONFIG_HVC_XEN
217 } else if (!strncmp(buf, "xen", 3)) { 223 if (!strncmp(buf, "xen", 3))
218 early_console = &xenboot_console; 224 early_console_register(&xenboot_console, keep);
219#endif 225#endif
226 buf++;
220 } 227 }
221
222 if (keep_early)
223 early_console->flags &= ~CON_BOOT;
224 else
225 early_console->flags |= CON_BOOT;
226 register_console(early_console);
227 return 0; 228 return 0;
228} 229}
229 230