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>

authored by Yinghai Lu and committed by H. Peter Anvin 74b3c444 83d9f65b

+13 -1
+13 -1
arch/x86/boot/early_serial_console.c
··· 58 58 if (arg[pos] == ',') 59 59 pos++; 60 60 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)) { 62 74 static const int bases[] = { 0x3f8, 0x2f8 }; 63 75 int idx = 0; 64 76