2 #include <linux/kernel.h>
4 #include <linux/string.h>
5 #include <linux/screen_info.h>
6 #include <linux/usb/ch9.h>
9 #include <linux/errno.h>
11 #include <asm/processor.h>
12 #include <asm/fcntl.h>
13 #include <asm/setup.h>
16 #include <asm/fixmap.h>
18 #include <asm/pgtable.h>
22 #define VGABASE (__ISA_IO_base + 0xb8000)
24 static int max_ypos = 25, max_xpos = 80;
25 static int current_ypos = 25, current_xpos;
27 static void early_vga_write(
struct console *
con,
const char *
str,
unsigned n)
32 while ((c = *str++) !=
'\0' && n-- > 0) {
33 if (current_ypos >= max_ypos) {
35 for (k = 1, j = 0; k < max_ypos; k++, j++) {
36 for (i = 0; i < max_xpos; i++) {
41 for (i = 0; i < max_xpos; i++)
43 current_ypos = max_ypos-1;
45 #ifdef CONFIG_KGDB_KDB
49 }
else if (c ==
'\r') {
56 }
else if (c !=
'\r') {
57 writew(((0x7 << 8) | (
unsigned short) c),
58 VGABASE + 2*(max_xpos*current_ypos +
60 if (current_xpos >= max_xpos) {
68 static struct console early_vga_console = {
70 .write = early_vga_write,
95 static int early_serial_putc(
unsigned char ch)
102 return timeout ? 0 : -1;
105 static void early_serial_write(
struct console *
con,
const char *
s,
unsigned n)
107 while (*s && n-- > 0) {
109 early_serial_putc(
'\r');
110 early_serial_putc(*s);
115 #define DEFAULT_BAUD 9600
117 static __init void early_serial_init(
char *s)
132 static const int __initconst bases[] = { 0x3f8, 0x2f8 };
137 if (port > 1 || s == e)
153 if (baud == 0 || s == e)
157 divisor = 115200 /
baud;
165 static struct console early_serial_console = {
167 .write = early_serial_write,
173 static struct console *early_console = &early_vga_console;
174 static int __initdata early_console_initialized;
184 early_console->
write(early_console, buf, n);
188 static inline void early_console_register(
struct console *con,
int keep_early)
190 if (early_console->
index != -1) {
210 if (early_console_initialized)
212 early_console_initialized = 1;
216 while (*buf !=
'\0') {
217 if (!
strncmp(buf,
"serial", 6)) {
219 early_serial_init(buf);
220 early_console_register(&early_serial_console, keep);
224 if (!
strncmp(buf,
"ttyS", 4)) {
225 early_serial_init(buf + 4);
226 early_console_register(&early_serial_console, keep);
233 early_console_register(&early_vga_console, keep);
235 #ifdef CONFIG_EARLY_PRINTK_DBGP
239 #ifdef CONFIG_HVC_XEN
241 early_console_register(&xenboot_console, keep);
243 #ifdef CONFIG_EARLY_PRINTK_INTEL_MID
244 if (!
strncmp(buf,
"mrst", 4)) {