3 #define DEFAULT_SERIAL_PORT 0x3f8
21 #define DEFAULT_BAUD 9600
23 static void early_serial_init(
int port,
int baud)
33 divisor = 115200 /
baud;
36 outb(divisor & 0xff, port +
DLL);
37 outb((divisor >> 8) & 0xff, port +
DLH);
43 static void parse_earlyprintk(
void)
50 if (cmdline_find_option(
"earlyprintk", arg,
sizeof arg) > 0) {
53 if (!
strncmp(arg,
"serial", 6)) {
67 if (pos == 7 && !
strncmp(arg + pos,
"0x", 2)) {
69 if (port == 0 || arg + pos == e)
73 }
else if (!
strncmp(arg + pos,
"ttyS", 4)) {
74 static const int bases[] = { 0x3f8, 0x2f8 };
77 if (!
strncmp(arg + pos,
"ttyS", 4))
80 if (arg[pos++] ==
'1')
90 if (baud == 0 || arg + pos == e)
95 early_serial_init(port, baud);
98 #define BASE_BAUD (1843200/16)
99 static unsigned int probe_baud(
int port)
101 unsigned char lcr,
dll, dlh;
109 quot = (dlh << 8) | dll;
114 static void parse_console_uart8250(
void)
124 if (cmdline_find_option(
"console", optstr,
sizeof optstr) <= 0)
129 if (!
strncmp(options,
"uart8250,io,", 12))
131 else if (!
strncmp(options,
"uart,io,", 8))
136 if (options && (options[0] ==
','))
139 baud = probe_baud(port);
142 early_serial_init(port, baud);
150 parse_console_uart8250();