devuart: allow serial console on late detected uarts
pci uarts are detected late and usually do not contain the console= parameter logic. for these, we can just enable them when devuart is reset, and replay the boot messages once enabled. this is usefull as it allows us to use these uarts for kernel debugging in interrupt context.
This commit is contained in:
parent
27fe8ee356
commit
00542efd15
1 changed files with 21 additions and 0 deletions
|
@ -240,9 +240,30 @@ uartreset(void)
|
||||||
|
|
||||||
uart[i] = p;
|
uart[i] = p;
|
||||||
p->dev = i;
|
p->dev = i;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* enable serial console for uarts detected
|
||||||
|
* late during boot (like pci card).
|
||||||
|
*/
|
||||||
|
if(consuart == nil){
|
||||||
|
char *s, *options;
|
||||||
|
|
||||||
|
if((s = getconf("console")) != nil
|
||||||
|
&& strtoul(s, &options, 0) == i
|
||||||
|
&& options > s){
|
||||||
|
p->console = 1;
|
||||||
|
if(*options != '\0')
|
||||||
|
uartctl(p, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(p->console || p->special){
|
if(p->console || p->special){
|
||||||
if(uartenable(p) != nil){
|
if(uartenable(p) != nil){
|
||||||
if(p->console){
|
if(p->console){
|
||||||
|
if(consuart == nil){
|
||||||
|
consuart = p;
|
||||||
|
uartputs(kmesg.buf, kmesg.n);
|
||||||
|
}
|
||||||
serialoq = p->oq;
|
serialoq = p->oq;
|
||||||
}
|
}
|
||||||
p->opens++;
|
p->opens++;
|
||||||
|
|
Loading…
Reference in a new issue