diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1998-09-06 23:00:04 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1998-09-06 23:00:04 +0000 |
commit | 0adb528a6f1b3625b4ac27b6575de0dbcef5f6f3 (patch) | |
tree | d3d6bc7b19f1e2659ff946ae249bb96cd5165aea /sys/arch | |
parent | 4215a296701c19482a05b676f9b821a745d1fbbb (diff) |
Better keyboard timing code mostly from FreeBSD
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_hdr.h | 9 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_kbd.c | 23 |
2 files changed, 18 insertions, 14 deletions
diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h index 3fabcc4428a..c59a577030b 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h +++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_hdr.h,v 1.20 1998/06/30 20:51:11 millert Exp $ */ +/* $OpenBSD: pcvt_hdr.h,v 1.21 1998/09/06 23:00:03 niklas Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -1189,18 +1189,13 @@ static __inline void vt_selattr(struct video_state *svsp) { volatile u_char x = inb(0x84); (void) &x;} \ { volatile u_char x = inb(0x84); (void) &x;} \ { volatile u_char x = inb(0x84); (void) &x;} \ - { volatile u_char x = inb(0x84); (void) &x;} \ - { volatile u_char x = inb(0x84); (void) &x;} \ - { volatile u_char x = inb(0x84); (void) &x;} \ - { volatile u_char x = inb(0x84); (void) &x;} \ - { volatile u_char x = inb(0x84); (void) &x;} \ { volatile u_char x = inb(0x84); (void) &x;} #else /* PCVT_PORTIO_DELAY */ /* use system supplied delay function for */ /* producing delays for accesssing the */ /* keyboard controller */ -#define PCVT_KBD_DELAY() delay(11) +#define PCVT_KBD_DELAY() delay(7) #endif /* PCVT_PORTIO_DELAY */ /*---------------------------------- E O F ----------------------------------*/ diff --git a/sys/arch/i386/isa/pcvt/pcvt_kbd.c b/sys/arch/i386/isa/pcvt/pcvt_kbd.c index 2ce7f6353f5..c56446626e4 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_kbd.c +++ b/sys/arch/i386/isa/pcvt/pcvt_kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_kbd.c,v 1.18 1998/08/09 06:13:30 millert Exp $ */ +/* $OpenBSD: pcvt_kbd.c,v 1.19 1998/09/06 23:00:03 niklas Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -336,12 +336,13 @@ kbd_wait_output() { u_int i; - for (i = 100000; i; i--) { - PCVT_KBD_DELAY(); + /* > 100 msec */ + for (i = 100; i; i--) { if ((inb(CONTROLLER_CTRL) & STATUS_INPBF) == 0) { PCVT_KBD_DELAY(); return 1; } + DELAY(1000); } return 0; } @@ -351,12 +352,13 @@ kbd_wait_input() { u_int i; - for (i = 100000; i; i--) { - PCVT_KBD_DELAY(); + /* > 500 msec */ + for (i = 500; i; i--) { if ((inb(CONTROLLER_CTRL) & STATUS_OUTPBF) != 0) { PCVT_KBD_DELAY(); return 1; } + DELAY(1000); } return 0; } @@ -485,8 +487,15 @@ void doreset(void) * Discard any stale keyboard activity. The 0.1 boot code isn't * very careful and sometimes leaves a KEYB_R_RESEND. */ - while(inb(CONTROLLER_CTRL) & STATUS_OUTPBF) - kbd_response(); + while (1) { + if (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) + kbd_response(); + else { + DELAY(10000); + if (!(inb(CONTROLLER_CTRL) & STATUS_OUTPBF)) + break; + } + } /* Start keyboard reset */ |