Date: Sat, 26 Apr 1997 03:10:05 +1000 From: Bruce Evans <bde@zeta.org.au> To: hackers@freebsd.org, j@uriah.heep.sax.de Subject: Re: alternative probe_keyboard.c (was: Re: i386/3124: BOOT_PROBE_KEYBOARD hangs system in bootblocks) Message-ID: <199704251710.DAA05121@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>The only chance to get it tested is: > >. commit it, >. make keyboard probing the default, >. so Jordan's next 3.0-SNAP will use it by default. There is little need for it in -current. It could be controlled by an option in /boot.config: -S: force a serial console. Don't bother probing the keyboard. To use a keyboard after all, either start booting with a serial console and toggle -S, or if you don't have access to a serial console after all, boot from another disk without -S. Simplest. -K: enable the keyboard probe. Same as now except there is no danger from buggy keyboard probes except for people who enable the probe. If you use this in a SNAP, don't expect adequate test coverage of the probe :-). -D: enable dual normal/serial console. Do all i/o to both the normal and the serial console without much probing. -D -S: as above, except -S just gives preference to the serial console. You can toggle it easily by typing on either console. I implemented a non-optional ugly version -D. It's simple except for the timeout stuff. The timeout stuff could be skipped if there were a -D flag (users should only use -D if serial hardware exists). Output at 9600 bps is a bit slow to use all the time (twiddle() takes longer than disk i/o :-). Bruce diff -c2 boot.c~ boot.c *** boot.c~ Sat Mar 15 07:40:29 1997 --- boot.c Sat Mar 29 16:58:19 1997 *************** *** 85,91 **** --- 85,96 ---- int ret; + #if 1 + init_serial(); + #endif #ifdef PROBE_KEYBOARD if (probe_keyboard()) { + #if 0 init_serial(); + #endif loadflags |= RB_SERIAL; printf("\nNo keyboard found."); *************** *** 95,99 **** --- 100,106 ---- #ifdef PROBE_KEYBOARD_LOCK if (!(inb(0x64) & 0x10)) { + #if 0 init_serial(); + #endif loadflags |= RB_SERIAL; printf("\nKeyboard locked."); *************** *** 102,106 **** --- 109,115 ---- #ifdef FORCE_COMCONSOLE + #if 0 init_serial(); + #endif loadflags |= RB_SERIAL; printf("\nSerial console forced."); diff -c2 io.c~ io.c *** io.c~ Mon Feb 24 00:49:46 1997 --- io.c Sat Mar 29 17:46:09 1997 *************** *** 123,135 **** --- 123,145 ---- { if (c == '\n') { + #if 0 if (loadflags & RB_SERIAL) serial_putc('\r'); else putc('\r'); + #else + putc('\r'); + serial_putc('\r'); + #endif } + #if 0 if (loadflags & RB_SERIAL) serial_putc(c); else putc(c); + #else + putc(c); + serial_putc(c); + #endif } *************** *** 140,144 **** --- 150,164 ---- loop: + #if 0 if ((c = ((loadflags & RB_SERIAL) ? serial_getc() : getc())) == '\r') + #else + if (ischar()) + c = getc(); + else if (serial_ischar()) + c = serial_getc(); + else + goto loop; + if (c == '\r') + #endif c = '\n'; if (c == '\b') { *************** *** 186,193 **** isc = ischar(); if (!(loadflags & RB_SERIAL)) return (isc); return (serial_ischar()); - } --- 206,216 ---- isc = ischar(); + #if 0 if (!(loadflags & RB_SERIAL)) + #else + if (isc != 0) + #endif return (isc); return (serial_ischar()); } diff -c2 serial.S~ serial.S *** serial.S~ Mon Feb 24 00:49:46 1997 --- serial.S Sat Mar 29 17:56:01 1997 *************** *** 96,101 **** push %edx mov $COMCONSOLE + 5, %edx # line status reg ! 1: inb %dx, %al test $0x20, %al jz 1b # TX buffer not empty --- 96,105 ---- push %edx + movl $10000, %ecx # timeout mov $COMCONSOLE + 5, %edx # line status reg ! 1: ! decl %ecx ! je 2f ! inb %dx, %al test $0x20, %al jz 1b # TX buffer not empty *************** *** 106,109 **** --- 110,114 ---- outb %al, %dx # send this one + 2: pop %edx pop %ebp *************** *** 177,181 **** outb %al, %dx ! add $2, %edx # line control reg movb $0x13, %al outb %al, %dx # 8 bit, no parity, 1 stop bit --- 182,190 ---- outb %al, %dx ! incl %edx # fifo control register (if any) ! xorl %eax,%eax ! outb %al, %dx # disable fifo to reduce worst-case busy-wait ! ! incl %edx # line control reg movb $0x13, %al outb %al, %dx # 8 bit, no parity, 1 stop bit
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704251710.DAA05121>