Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Nov 2012 12:25:27 +0000 (UTC)
From:      Takahashi Yoshihiro <nyan@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r242863 - in head/sys/boot/pc98: boot2 btx/btx
Message-ID:  <201211101225.qAACPRYP006845@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nyan
Date: Sat Nov 10 12:25:27 2012
New Revision: 242863
URL: http://svnweb.freebsd.org/changeset/base/242863

Log:
  MFi386: r241301
  
    add detection of serial console presence to btx and boot2-like blocks

Modified:
  head/sys/boot/pc98/boot2/boot2.c
  head/sys/boot/pc98/btx/btx/btx.S

Modified: head/sys/boot/pc98/boot2/boot2.c
==============================================================================
--- head/sys/boot/pc98/boot2/boot2.c	Sat Nov 10 12:22:26 2012	(r242862)
+++ head/sys/boot/pc98/boot2/boot2.c	Sat Nov 10 12:25:27 2012	(r242863)
@@ -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) {

Modified: head/sys/boot/pc98/btx/btx/btx.S
==============================================================================
--- head/sys/boot/pc98/btx/btx/btx.S	Sat Nov 10 12:22:26 2012	(r242862)
+++ head/sys/boot/pc98/btx/btx/btx.S	Sat Nov 10 12:25:27 2012	(r242863)
@@ -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 
 		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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211101225.qAACPRYP006845>