Ralf Baechle | 36a8853 | 2007-03-01 11:56:43 +0000 | [diff] [blame] | 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 | |
Franck Bui-Huu | ca4437d | 2007-05-03 12:58:54 +0200 | [diff] [blame^] | 15 | static void __init |
| 16 | early_console_write(struct console *con, const char *s, unsigned n) |
Ralf Baechle | 36a8853 | 2007-03-01 11:56:43 +0000 | [diff] [blame] | 17 | { |
| 18 | while (n-- && *s) { |
| 19 | if (*s == '\n') |
| 20 | prom_putchar('\r'); |
| 21 | prom_putchar(*s); |
| 22 | s++; |
| 23 | } |
| 24 | } |
| 25 | |
Franck Bui-Huu | ca4437d | 2007-05-03 12:58:54 +0200 | [diff] [blame^] | 26 | static struct console early_console __initdata = { |
Ralf Baechle | 36a8853 | 2007-03-01 11:56:43 +0000 | [diff] [blame] | 27 | .name = "early", |
| 28 | .write = early_console_write, |
| 29 | .flags = CON_PRINTBUFFER | CON_BOOT, |
| 30 | .index = -1 |
| 31 | }; |
| 32 | |
| 33 | void __init setup_early_printk(void) |
| 34 | { |
| 35 | register_console(&early_console); |
| 36 | } |