The following diff changes the OpenBSD/loongson console device selection
from an `either serial or glass console, depending on the value of
environment variables in pmon' to `glass console if there is a graphics
card, otherwise serial if there are serial ports, and prefer serial if
environment variables say so'.
This should not change anything, except for not-so-hypothetical systems
with no graphics capabilities - they ought to fallback to serial
console, but currently will only do so if the `nokbd' and `novga'
environment variables are set.
I would like this diff to be tested on a Fuloong system, in both glass
and serial console configurations, to confirm it does not break anything
on this particular model. Other supported system models have been
tested.
Miod
Index: loongson/generic2e_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/loongson/loongson/generic2e_machdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 generic2e_machdep.c
--- loongson/generic2e_machdep.c 15 Apr 2011 20:40:06 -0000 1.2
+++ loongson/generic2e_machdep.c 19 May 2011 17:35:25 -0000
@@ -54,7 +54,6 @@
#include <mips64/archtype.h>
#include <machine/autoconf.h>
-#include <machine/pmon.h>
#include <dev/ic/i8259reg.h>
@@ -336,20 +336,13 @@ generic2e_reset()
void
generic2e_setup(void)
{
+ /*
+ * All 2E systems are expected to have a serial port.
+ */
#if NCOM > 0
- const char *envvar;
- int serial;
-
- envvar = pmon_getenv("nokbd");
- serial = envvar != NULL;
- envvar = pmon_getenv("novga");
- serial = serial && envvar != NULL;
-
- if (serial) {
- comconsiot = &bonito_pci_io_space_tag;
- comconsaddr = 0x3f8;
- comconsrate = 115200; /* default PMON console speed */
- }
+ comconsiot = &bonito_pci_io_space_tag;
+ comconsaddr = 0x3f8;
+ comconsrate = 115200; /* default PMON console speed */
#endif
}
Index: loongson/wscons_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/loongson/loongson/wscons_machdep.c,v
retrieving revision 1.9
diff -u -p -r1.9 wscons_machdep.c
--- loongson/wscons_machdep.c 23 Nov 2010 04:07:55 -0000 1.9
+++ loongson/wscons_machdep.c 19 May 2011 17:35:26 -0000
@@ -52,6 +52,7 @@
#include <machine/autoconf.h>
#include <machine/bus.h>
+#include <machine/pmon.h>
#include <dev/cons.h>
@@ -96,12 +97,19 @@ wscnprobe(struct consdev *cp)
cp->cn_pri = CN_DEAD;
+ /*
+ * Don't try to look for a glass console if the machine may have a
+ * serial port and is configured to use it.
+ */
+ if (sys_platform->legacy_io_ranges != NULL &&
+ pmon_getenv("nokbd") != NULL && pmon_getenv("novga") != NULL)
+ return;
+
/* Locate the major number. */
for (maj = 0; maj < nchrdev; maj++) {
if (cdevsw[maj].d_open == wsdisplayopen)
break;
}
-
if (maj == nchrdev) {
/* We are not in cdevsw[], give up. */
return;
@@ -124,7 +132,7 @@ wscnprobe(struct consdev *cp)
continue;
cp->cn_dev = makedev(maj, 0);
- cp->cn_pri = CN_MIDPRI;
+ cp->cn_pri = CN_MIDPRI; /* enough to win over serial */
break;
}
}
Index: loongson/yeeloong_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/loongson/loongson/yeeloong_machdep.c,v
retrieving revision 1.16
diff -u -p -r1.16 yeeloong_machdep.c
--- loongson/yeeloong_machdep.c 15 Apr 2011 20:40:06 -0000 1.16
+++ loongson/yeeloong_machdep.c 19 May 2011 17:35:26 -0000
@@ -27,7 +27,6 @@
#include <mips64/archtype.h>
#include <machine/autoconf.h>
-#include <machine/pmon.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
@@ -455,19 +483,9 @@ void
fuloong_setup(void)
{
#if NCOM > 0
- const char *envvar;
- int serial;
-
- envvar = pmon_getenv("nokbd");
- serial = envvar != NULL;
- envvar = pmon_getenv("novga");
- serial = serial && envvar != NULL;
-
- if (serial) {
- comconsiot = &bonito_pci_io_space_tag;
- comconsaddr = 0x2f8;
- comconsrate = 115200; /* default PMON console speed */
- }
+ comconsiot = &bonito_pci_io_space_tag;
+ comconsaddr = 0x2f8;
+ comconsrate = 115200; /* default PMON console speed */
#endif
}