lkml.org 
[lkml]   [2010]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86, setup: fix earlyprintk=serial,0x3f8,115200
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


\
 
 \ /
  Last update: 2010-09-09 09:57    [W:0.832 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site