Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Copyright (C) 2002, 2003, 06, 07 Ralf Baechle (ralf@linux-mips.org)
0007  * Copyright (C) 2007 MIPS Technologies, Inc.
0008  *   written by Ralf Baechle (ralf@linux-mips.org)
0009  */
0010 #include <linux/kernel.h>
0011 #include <linux/console.h>
0012 #include <linux/printk.h>
0013 #include <linux/init.h>
0014 
0015 #include <asm/setup.h>
0016 
0017 static void early_console_write(struct console *con, const char *s, unsigned n)
0018 {
0019     while (n-- && *s) {
0020         if (*s == '\n')
0021             prom_putchar('\r');
0022         prom_putchar(*s);
0023         s++;
0024     }
0025 }
0026 
0027 static struct console early_console_prom = {
0028     .name   = "early",
0029     .write  = early_console_write,
0030     .flags  = CON_PRINTBUFFER | CON_BOOT,
0031     .index  = -1
0032 };
0033 
0034 void __init setup_early_printk(void)
0035 {
0036     if (early_console)
0037         return;
0038     early_console = &early_console_prom;
0039 
0040     register_console(&early_console_prom);
0041 }