0001
0002
0003
0004
0005
0006
0007
0008
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 }