summaryrefslogtreecommitdiff
path: root/sys/src/9/port
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-03-19 15:53:40 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-03-19 15:53:40 +0000
commit00542efd15c5ee37fa927fbe9ba85a2bb377d406 (patch)
treebefdad724a66b4695d04a5bcaeeb09c6eec9a49a /sys/src/9/port
parent27fe8ee3569ff13ff0fa6cb8d3af6ce48fe1a876 (diff)
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.
Diffstat (limited to 'sys/src/9/port')
-rw-r--r--sys/src/9/port/devuart.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/src/9/port/devuart.c b/sys/src/9/port/devuart.c
index 928bfc9c5..b3291719f 100644
--- a/sys/src/9/port/devuart.c
+++ b/sys/src/9/port/devuart.c
@@ -240,9 +240,30 @@ uartreset(void)
uart[i] = p;
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(uartenable(p) != nil){
if(p->console){
+ if(consuart == nil){
+ consuart = p;
+ uartputs(kmesg.buf, kmesg.n);
+ }
serialoq = p->oq;
}
p->opens++;