Skip to content

Commit 74b3c44

Browse files
Yinghai LuH. Peter Anvin
authored andcommitted
x86, setup: Fix earlyprintk=serial,0x3f8,115200
earlyprintk can take and I/O port, so we need to handle this case in the setup code too, otherwise 0x3f8 will be treated as a baud rate. Signed-off-by: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <4C7B05A6.4010801@kernel.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
1 parent 83d9f65 commit 74b3c44

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

arch/x86/boot/early_serial_console.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,19 @@ static void parse_earlyprintk(void)
5858
if (arg[pos] == ',')
5959
pos++;
6060

61-
if (!strncmp(arg + pos, "ttyS", 4)) {
61+
/*
62+
* make sure we have
63+
* "serial,0x3f8,115200"
64+
* "serial,ttyS0,115200"
65+
* "ttyS0,115200"
66+
*/
67+
if (pos == 7 && !strncmp(arg + pos, "0x", 2)) {
68+
port = simple_strtoull(arg + pos, &e, 16);
69+
if (port == 0 || arg + pos == e)
70+
port = DEFAULT_SERIAL_PORT;
71+
else
72+
pos = e - arg;
73+
} else if (!strncmp(arg + pos, "ttyS", 4)) {
6274
static const int bases[] = { 0x3f8, 0x2f8 };
6375
int idx = 0;
6476

0 commit comments

Comments
 (0)