Re: [PATCH] x86, setup: fix earlyprintk=serial,0x3f8,115200

From: Yinghai Lu
Date: Thu Sep 09 2010 - 03:55:18 EST


On 09/08/2010 02:28 PM, H. Peter Anvin wrote:
> On 08/29/2010 06:13 PM, Yinghai Lu wrote:
>>
>> earlyprintk could take io port.
>>
>> So we need to handle this case in setup code too, otherwise 0x3f8
>> will be treated as baud rate.
>>
>
> What about a non-hexadecimal port? It seems more logical to me to move
> the strncmp() up and test that before using simple_strtoull().

non-hex is not supported...

in arch/x86/kernel/early_printk.c
static __init void early_serial_init(char *s)
{
unsigned char c;
unsigned divisor;
unsigned baud = DEFAULT_BAUD;
char *e;

if (*s == ',')
++s;

if (*s) {
unsigned port;
if (!strncmp(s, "0x", 2)) {
early_serial_base = simple_strtoul(s, &e, 16);
} else {
static const int __initconst bases[] = { 0x3f8, 0x2f8 };

if (!strncmp(s, "ttyS", 4))
s += 4;
port = simple_strtoul(s, &e, 10);
if (port > 1 || s == e)
port = 0;
early_serial_base = bases[port];
}
s += strcspn(s, ",");
if (*s == ',')
s++;
}

so it check 0x too.


Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/