Author: nyan
Date: Fri Nov 23 13:09:20 2012
New Revision: 243445
URL: http://svnweb.freebsd.org/changeset/base/243445

Log:
  MFC: r242863
  
    add detection of serial console presence to btx and boot2-like blocks.

Modified:
  stable/9/sys/boot/pc98/boot2/boot2.c
  stable/9/sys/boot/pc98/btx/btx/btx.S
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/boot/   (props changed)

Modified: stable/9/sys/boot/pc98/boot2/boot2.c
==============================================================================
--- stable/9/sys/boot/pc98/boot2/boot2.c        Fri Nov 23 13:04:38 2012        
(r243444)
+++ stable/9/sys/boot/pc98/boot2/boot2.c        Fri Nov 23 13:09:20 2012        
(r243445)
@@ -555,8 +555,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: stable/9/sys/boot/pc98/btx/btx/btx.S
==============================================================================
--- stable/9/sys/boot/pc98/btx/btx/btx.S        Fri Nov 23 13:04:38 2012        
(r243444)
+++ stable/9/sys/boot/pc98/btx/btx/btx.S        Fri Nov 23 13:09:20 2012        
(r243445)
@@ -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)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to