diff options
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/mips/kernel/early_printk.c | 40 | ||||
-rw-r--r-- | arch/mips/kernel/setup.c | 8 |
3 files changed, 49 insertions, 0 deletions
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index a3dad394acb7..49246264cc7c 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -65,5 +65,6 @@ obj-$(CONFIG_64BIT) += cpu-bugs64.o | |||
65 | obj-$(CONFIG_I8253) += i8253.o | 65 | obj-$(CONFIG_I8253) += i8253.o |
66 | 66 | ||
67 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o | 67 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o |
68 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | ||
68 | 69 | ||
69 | CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) | 70 | CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) |
diff --git a/arch/mips/kernel/early_printk.c b/arch/mips/kernel/early_printk.c new file mode 100644 index 000000000000..304efdc5682f --- /dev/null +++ b/arch/mips/kernel/early_printk.c | |||
@@ -0,0 +1,40 @@ | |||
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 | */ | ||
10 | #include <linux/console.h> | ||
11 | #include <linux/init.h> | ||
12 | |||
13 | extern void prom_putchar(char); | ||
14 | |||
15 | static void early_console_write(struct console *con, const char *s, unsigned n) | ||
16 | { | ||
17 | while (n-- && *s) { | ||
18 | if (*s == '\n') | ||
19 | prom_putchar('\r'); | ||
20 | prom_putchar(*s); | ||
21 | s++; | ||
22 | } | ||
23 | } | ||
24 | |||
25 | static struct console early_console = { | ||
26 | .name = "early", | ||
27 | .write = early_console_write, | ||
28 | .flags = CON_PRINTBUFFER | CON_BOOT, | ||
29 | .index = -1 | ||
30 | }; | ||
31 | |||
32 | void __init setup_early_printk(void) | ||
33 | { | ||
34 | register_console(&early_console); | ||
35 | } | ||
36 | |||
37 | void __init disable_early_printk(void) | ||
38 | { | ||
39 | unregister_console(&early_console); | ||
40 | } | ||
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 11ab222a2e97..4975da0bfb63 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -525,6 +525,14 @@ void __init setup_arch(char **cmdline_p) | |||
525 | { | 525 | { |
526 | cpu_probe(); | 526 | cpu_probe(); |
527 | prom_init(); | 527 | prom_init(); |
528 | |||
529 | #ifdef CONFIG_EARLY_PRINTK | ||
530 | { | ||
531 | extern void setup_early_printk(void); | ||
532 | |||
533 | setup_early_printk(); | ||
534 | } | ||
535 | #endif | ||
528 | cpu_report(); | 536 | cpu_report(); |
529 | 537 | ||
530 | #if defined(CONFIG_VT) | 538 | #if defined(CONFIG_VT) |