summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2012-11-10 12:25:27 +0000
committernyan <nyan@FreeBSD.org>2012-11-10 12:25:27 +0000
commit4e39fbd10793d55c536674da8c72f1a1c6a0ca10 (patch)
tree10921cf41af44383cafa7eff54d73a80e728778b /sys/boot
parent04f237d3bf5308b67b36c8823b2baa4fca1d9be9 (diff)
downloadFreeBSD-src-4e39fbd10793d55c536674da8c72f1a1c6a0ca10.zip
FreeBSD-src-4e39fbd10793d55c536674da8c72f1a1c6a0ca10.tar.gz
MFi386: r241301
add detection of serial console presence to btx and boot2-like blocks
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/pc98/boot2/boot2.c6
-rw-r--r--sys/boot/pc98/btx/btx/btx.S17
2 files changed, 15 insertions, 8 deletions
diff --git a/sys/boot/pc98/boot2/boot2.c b/sys/boot/pc98/boot2/boot2.c
index e3e0b86..296ca55 100644
--- a/sys/boot/pc98/boot2/boot2.c
+++ b/sys/boot/pc98/boot2/boot2.c
@@ -554,8 +554,10 @@ parse()
}
ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) :
OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD;
- if (ioctrl & IO_SERIAL)
- sio_init(115200 / comspeed);
+ if (ioctrl & IO_SERIAL) {
+ if (sio_init(115200 / comspeed) != 0)
+ ioctrl &= ~IO_SERIAL;
+ }
} else {
for (q = arg--; *q && *q != '('; q++);
if (*q) {
diff --git a/sys/boot/pc98/btx/btx/btx.S b/sys/boot/pc98/btx/btx/btx.S
index ceed5a6..1f8ff80 100644
--- a/sys/boot/pc98/btx/btx/btx.S
+++ b/sys/boot/pc98/btx/btx/btx.S
@@ -840,7 +840,7 @@ putstr: lodsb # Load char
.set SIO_DIV,(115200/SIOSPD) # 115200 / SPD
/*
- * void sio_init(void)
+ * int sio_init(void)
*/
sio_init: movw $SIO_PRT+0x3,%dx # Data format reg
movb $SIO_FMT|0x80,%al # Set format
@@ -856,14 +856,19 @@ sio_init: movw $SIO_PRT+0x3,%dx # Data format reg
movb $0x3,%al # Set RTS,
outb %al,(%dx) # DTR
incl %edx # Line status reg
+ call sio_getc.1 # Get character
/*
- * void sio_flush(void)
+ * int sio_flush(void)
*/
-sio_flush.0: call sio_getc.1 # Get character
-sio_flush: call sio_ischar # Check for character
- jnz sio_flush.0 # Till none
- ret # To caller
+sio_flush: xorl %eax,%eax # Return value
+ xorl %ecx,%ecx # Timeout
+ movb $0x80,%ch # counter
+sio_flush.1: call sio_ischar # Check for character
+ jz sio_flush.2 # Till none
+ loop sio_flush.1 # or counter is zero
+ movb $1, %al # Exhausted all tries
+sio_flush.2: ret # To caller
/*
* void sio_putc(int c)
OpenPOWER on IntegriCloud