]>
Commit | Line | Data |
---|---|---|
36a88530 RB |
1 | /* |
2 | * This file is subject to the terms and conditions of the GNU General Public | |
3 | * License. See the file "COPYING" in the main directory of this archive | |
4 | * for more details. | |
5 | * | |
6 | * Copyright (C) 2002, 2003, 06, 07 Ralf Baechle (ralf@linux-mips.org) | |
7 | * Copyright (C) 2007 MIPS Technologies, Inc. | |
8 | * written by Ralf Baechle (ralf@linux-mips.org) | |
9 | */ | |
d0380e6c | 10 | #include <linux/kernel.h> |
36a88530 | 11 | #include <linux/console.h> |
d0380e6c | 12 | #include <linux/printk.h> |
36a88530 RB |
13 | #include <linux/init.h> |
14 | ||
07cdb784 DV |
15 | #include <asm/setup.h> |
16 | ||
f7be4e75 | 17 | static void early_console_write(struct console *con, const char *s, unsigned n) |
36a88530 RB |
18 | { |
19 | while (n-- && *s) { | |
20 | if (*s == '\n') | |
21 | prom_putchar('\r'); | |
22 | prom_putchar(*s); | |
23 | s++; | |
24 | } | |
25 | } | |
26 | ||
d0380e6c | 27 | static struct console early_console_prom = { |
36a88530 RB |
28 | .name = "early", |
29 | .write = early_console_write, | |
30 | .flags = CON_PRINTBUFFER | CON_BOOT, | |
31 | .index = -1 | |
32 | }; | |
33 | ||
34 | void __init setup_early_printk(void) | |
35 | { | |
d0380e6c | 36 | if (early_console) |
36ea1d57 | 37 | return; |
d0380e6c | 38 | early_console = &early_console_prom; |
36ea1d57 | 39 | |
d0380e6c | 40 | register_console(&early_console_prom); |
36a88530 | 41 | } |