summaryrefslogtreecommitdiff
path: root/sys/arch/i386/stand/libsa/bioskbd.S
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-03-31 23:06:34 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-03-31 23:06:34 +0000
commitd56519762d6c1899f2baa3dbbc461af05cd168a6 (patch)
tree3d68308130e343610f48c1c66982d81dd56a226e /sys/arch/i386/stand/libsa/bioskbd.S
parent10a04de1b4af9903e9146ad801619b45a42583c6 (diff)
commit all my mods to the last imported libsa stuff....
including: - disklabel support; - better boot cmd line - smaller size (using some compilation switches ;) - no more relocations in /boot, it's loaded in the place; - better disk performance (maybe were already in there) - installboot -n does not require write perms for device - more debugs - missing parts in libsa (such as cd9660 and so) - i don't like 2 files for exec_i386 (sorry, toby, let's discuss maybe?) tricks and tails: - joined .text and .data (saves you a page) - prot mode switching still in biosboot (it's freezed for awhile) - biosdisk internals changed - biosdev is not passed propery to the kernel (i'll fix it soon) - sure i missed smth here to note (use the source, Luke!)
Diffstat (limited to 'sys/arch/i386/stand/libsa/bioskbd.S')
-rw-r--r--sys/arch/i386/stand/libsa/bioskbd.S99
1 files changed, 80 insertions, 19 deletions
diff --git a/sys/arch/i386/stand/libsa/bioskbd.S b/sys/arch/i386/stand/libsa/bioskbd.S
index ff414bf30f2..83b5d283573 100644
--- a/sys/arch/i386/stand/libsa/bioskbd.S
+++ b/sys/arch/i386/stand/libsa/bioskbd.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: bioskbd.S,v 1.2 1997/03/31 03:12:11 weingart Exp $ */
+/* $OpenBSD: bioskbd.S,v 1.3 1997/03/31 23:06:28 mickey Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
@@ -61,7 +61,75 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
ENTRY(kbd_probe)
-
+#if 0
+#include <machine/console.h>
+#include <machine/cpufunc.h>
+#include "boot.h"
+
+int
+probe_keyboard(void)
+{
+ int i, retries = 5;
+ unsigned char val;
+
+ /* flush any noise in the buffer */
+ while (inb(KB_STAT) & KB_BUF_FULL) {
+ delay1ms();
+ (void) inb(KB_DATA);
+ }
+
+ /* Try to reset keyboard hardware */
+ again:
+ while (--retries) {
+#ifdef DEBUG
+ printf("%d ", retries);
+#endif
+ while ((inb(KB_STAT) & KB_READY) == KB_READY) delay1ms();
+ outb(KB_DATA, KB_RESET);
+ for (i=0; i<1000; i++) {
+ delay1ms();
+ val = inb(KB_DATA);
+ if (val == KB_ACK || val == KB_ECHO)
+ goto gotack;
+ if (val == KB_RESEND)
+ break;
+ }
+ }
+gotres:
+#ifdef DEBUG
+ printf("gotres\n");
+#endif
+ if (!retries) {
+#ifdef DEBUG
+ printf("gave up\n");
+#endif
+ return(1);
+ }
+gotack:
+ delay1ms();
+ while ((inb(KB_STAT) & KB_BUF_FULL) == 0) delay1ms();
+ delay1ms();
+#ifdef DEBUG
+ printf("ACK ");
+#endif
+ val = inb(KB_DATA);
+ if (val == KB_ACK)
+ goto gotack;
+ if (val == KB_RESEND)
+ goto again;
+ if (val != KB_RESET_DONE) {
+#ifdef DEBUG
+ printf("stray val %d\n", val);
+#endif
+ return(0);
+ }
+#ifdef DEBUG
+ printf("ok\n");
+#endif
+ return(0);
+}
+
+#endif
movl 1, %eax /* present (: */
ret
@@ -75,9 +143,7 @@ ENTRY(kbd_probe)
ENTRY(kbd_putc)
pushl %ebp
movl %esp, %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
+ pushal
movb 8(%ebp), %cl
@@ -86,16 +152,14 @@ ENTRY(kbd_putc)
movb %cl, %al
movb $0x0e, %ah
- xorl %ebx, %ebx
- incl %ebx
+ xorl %bx, %bx
+ incl %bx
int $0x10 # display a byte
data32
call _C_LABEL(real_to_prot)
- popl %edi
- popl %esi
- popl %ebx
+ popal
popl %ebp
ret
@@ -144,11 +208,7 @@ ENTRY(kbd_getc)
# ZF = set
*/
ENTRY(kbd_ischar)
- pushl %ebp
- movl %esp, %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
+ pushal
call _C_LABEL(prot_to_real)
@@ -162,9 +222,10 @@ ENTRY(kbd_ischar)
call _C_LABEL(real_to_prot)
movzbl %bl, %eax
+ movl %eax, 1f
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
+ popal
+ movl 1f, %eax
ret
+1: .long 0
+