[Midnightbsd-cvs] src [8333] trunk/sys/boot/common: handle console that fail to probe
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Sep 17 18:54:50 EDT 2016
Revision: 8333
http://svnweb.midnightbsd.org/src/?rev=8333
Author: laffer1
Date: 2016-09-17 18:54:49 -0400 (Sat, 17 Sep 2016)
Log Message:
-----------
handle console that fail to probe
Modified Paths:
--------------
trunk/sys/boot/common/bootstrap.h
trunk/sys/boot/common/console.c
Modified: trunk/sys/boot/common/bootstrap.h
===================================================================
--- trunk/sys/boot/common/bootstrap.h 2016-09-17 22:54:33 UTC (rev 8332)
+++ trunk/sys/boot/common/bootstrap.h 2016-09-17 22:54:49 UTC (rev 8333)
@@ -109,10 +109,10 @@
const char *c_name;
const char *c_desc;
int c_flags;
-#define C_PRESENTIN (1<<0)
-#define C_PRESENTOUT (1<<1)
-#define C_ACTIVEIN (1<<2)
-#define C_ACTIVEOUT (1<<3)
+#define C_PRESENTIN (1<<0) /* console can provide input */
+#define C_PRESENTOUT (1<<1) /* console can provide output */
+#define C_ACTIVEIN (1<<2) /* user wants input from console */
+#define C_ACTIVEOUT (1<<3) /* user wants output to console */
void (* c_probe)(struct console *cp); /* set c_flags to match hardware */
int (* c_init)(int arg); /* reinit XXX may need more args */
void (* c_out)(int c); /* emit c */
Modified: trunk/sys/boot/common/console.c
===================================================================
--- trunk/sys/boot/common/console.c 2016-09-17 22:54:33 UTC (rev 8332)
+++ trunk/sys/boot/common/console.c 2016-09-17 22:54:49 UTC (rev 8333)
@@ -100,11 +100,12 @@
{
int cons;
int rv;
-
+
/* Loop forever polling all active consoles */
for(;;)
for (cons = 0; consoles[cons] != NULL; cons++)
- if ((consoles[cons]->c_flags & C_ACTIVEIN) &&
+ if ((consoles[cons]->c_flags & (C_PRESENTIN | C_ACTIVEIN)) ==
+ (C_PRESENTIN | C_ACTIVEIN) &&
((rv = consoles[cons]->c_in()) != -1))
return(rv);
}
@@ -115,7 +116,8 @@
int cons;
for (cons = 0; consoles[cons] != NULL; cons++)
- if ((consoles[cons]->c_flags & C_ACTIVEIN) &&
+ if ((consoles[cons]->c_flags & (C_PRESENTIN | C_ACTIVEIN)) ==
+ (C_PRESENTIN | C_ACTIVEIN) &&
(consoles[cons]->c_ready() != 0))
return(1);
return(0);
@@ -125,13 +127,14 @@
putchar(int c)
{
int cons;
-
+
/* Expand newlines */
if (c == '\n')
putchar('\r');
-
+
for (cons = 0; consoles[cons] != NULL; cons++)
- if (consoles[cons]->c_flags & C_ACTIVEOUT)
+ if ((consoles[cons]->c_flags & (C_PRESENTOUT | C_ACTIVEOUT)) ==
+ (C_PRESENTOUT | C_ACTIVEOUT))
consoles[cons]->c_out(c);
}
@@ -220,6 +223,10 @@
if (cons >= 0) {
consoles[cons]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT;
consoles[cons]->c_init(0);
+ if ((consoles[cons]->c_flags & (C_PRESENTIN | C_PRESENTOUT)) !=
+ (C_PRESENTIN | C_PRESENTOUT))
+ printf("console %s failed to initialize\n",
+ consoles[cons]->c_name);
}
}
More information about the Midnightbsd-cvs
mailing list