6 #define K_RDWR 0x60 /* keyboard data & cmds (read/write) */
7 #define K_STATUS 0x64 /* keyboard status */
8 #define K_CMD 0x64 /* keybd ctlr command (write-only) */
10 #define K_OBUF_FUL 0x01 /* output buffer full */
11 #define K_IBUF_FUL 0x02 /* input buffer full */
13 #define KC_CMD_WIN 0xd0 /* read output port */
14 #define KC_CMD_WOUT 0xd1 /* write output port */
15 #define KB_SET_A20 0xdf /* enable A20,
16 enable output buffer full interrupt
19 #define KB_UNSET_A20 0xdd /* enable A20,
20 enable output buffer full interrupt
24 enum { Disable_A20 = 0x2400, Enable_A20 = 0x2401, Query_A20_Status = 0x2402,
25 Query_A20_Support = 0x2403 };
30 static void empty_8042 ( void )
35 time = currticks() + TICKS_PER_SEC; /* max wait of 1 second */
36 while ((((st = inb(K_CMD)) & K_OBUF_FUL) ||
44 * Gate A20 for high memory
46 * Note that this function gets called as part of the return path from
47 * librm's real_call, which is used to make the int15 call if librm is
48 * being used. To avoid an infinite recursion, we make gateA20_set
49 * return immediately if it is already part of the call stack.
51 void gateA20_set ( void ) {
52 static char reentry_guard = 0;
53 unsigned int discard_a;
60 __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
66 : "=r" ( flags ), "=a" ( discard_a )
67 : "a" ( Enable_A20 ) );
70 /* INT 15 method failed, try alternatives */
75 outb(KC_CMD_WOUT, K_CMD);
77 outb(KB_SET_A20, K_RDWR);
85 void gateA20_unset ( void ) {
86 /* Not currently implemented */