atkbd.c (197504) | atkbd.c (198251) |
---|---|
1/*- 2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/atkbdc/atkbd.c 197504 2009-09-25 20:06:31Z jkim $"); | 29__FBSDID("$FreeBSD: head/sys/dev/atkbdc/atkbd.c 198251 2009-10-19 20:58:10Z jkim $"); |
30 31#include "opt_compat.h" 32#include "opt_kbd.h" 33#include "opt_atkbd.h" 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> --- 1048 unchanged lines hidden (view full) --- 1086 1087/* local functions */ 1088 1089static int 1090get_typematic(keyboard_t *kbd) 1091{ 1092#if defined(__i386__) || defined(__amd64__) 1093 /* | 30 31#include "opt_compat.h" 32#include "opt_kbd.h" 33#include "opt_atkbd.h" 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> --- 1048 unchanged lines hidden (view full) --- 1086 1087/* local functions */ 1088 1089static int 1090get_typematic(keyboard_t *kbd) 1091{ 1092#if defined(__i386__) || defined(__amd64__) 1093 /* |
1094 * Only some systems allow us to retrieve the keyboard repeat | 1094 * Only some systems allow us to retrieve the keyboard repeat |
1095 * rate previously set via the BIOS... 1096 */ 1097 x86regs_t regs; 1098 uint8_t *p; 1099 | 1095 * rate previously set via the BIOS... 1096 */ 1097 x86regs_t regs; 1098 uint8_t *p; 1099 |
1100 if (x86bios_get_intr(0x15) == 0 || x86bios_get_intr(0x16) == 0) 1101 return (ENODEV); 1102 |
|
1100 /* Is BIOS system configuration table supported? */ | 1103 /* Is BIOS system configuration table supported? */ |
1101 bzero(®s, sizeof(regs)); | 1104 x86bios_init_regs(®s); |
1102 regs.R_AH = 0xc0; 1103 x86bios_intr(®s, 0x15); 1104 if ((regs.R_FLG & PSL_C) != 0 || regs.R_AH != 0) 1105 return (ENODEV); 1106 | 1105 regs.R_AH = 0xc0; 1106 x86bios_intr(®s, 0x15); 1107 if ((regs.R_FLG & PSL_C) != 0 || regs.R_AH != 0) 1108 return (ENODEV); 1109 |
1107 /* Is int 16, function 0x09 supported? */ | 1110 /* Is int 0x16, function 0x09 supported? */ |
1108 p = x86bios_offset((regs.R_ES << 4) + regs.R_BX); 1109 if (readw(p) < 5 || (readb(p + 6) & 0x40) == 0) 1110 return (ENODEV); 1111 | 1111 p = x86bios_offset((regs.R_ES << 4) + regs.R_BX); 1112 if (readw(p) < 5 || (readb(p + 6) & 0x40) == 0) 1113 return (ENODEV); 1114 |
1112 /* Is int 16, function 0x0306 supported? */ 1113 bzero(®s, sizeof(regs)); | 1115 /* Is int 0x16, function 0x0306 supported? */ 1116 x86bios_init_regs(®s); |
1114 regs.R_AH = 0x09; 1115 x86bios_intr(®s, 0x16); 1116 if ((regs.R_AL & 0x08) == 0) 1117 return (ENODEV); 1118 | 1117 regs.R_AH = 0x09; 1118 x86bios_intr(®s, 0x16); 1119 if ((regs.R_AL & 0x08) == 0) 1120 return (ENODEV); 1121 |
1119 bzero(®s, sizeof(regs)); | 1122 x86bios_init_regs(®s); |
1120 regs.R_AX = 0x0306; 1121 x86bios_intr(®s, 0x16); 1122 kbd->kb_delay1 = typematic_delay(regs.R_BH << 5); 1123 kbd->kb_delay2 = typematic_rate(regs.R_BL); 1124 return (0); 1125#else 1126 return (ENODEV); 1127#endif /* __i386__ || __amd64__ */ --- 384 unchanged lines hidden --- | 1123 regs.R_AX = 0x0306; 1124 x86bios_intr(®s, 0x16); 1125 kbd->kb_delay1 = typematic_delay(regs.R_BH << 5); 1126 kbd->kb_delay2 = typematic_rate(regs.R_BL); 1127 return (0); 1128#else 1129 return (ENODEV); 1130#endif /* __i386__ || __amd64__ */ --- 384 unchanged lines hidden --- |