1 /* $NetBSD: gatea20.c,v 1.1 1997/03/14 02:40:32 perry Exp $ */ 2 3 /* extracted from freebsd:sys/i386/boot/biosboot/io.c */ 4 5 #include <sys/types.h> 6 #include <machine/pio.h> 7 8 #include <lib/libsa/stand.h> 9 10 #include "libi386.h" 11 12 #define K_RDWR 0x60 /* keyboard data & cmds (read/write) */ 13 #define K_STATUS 0x64 /* keyboard status */ 14 #define K_CMD 0x64 /* keybd ctlr command (write-only) */ 15 16 #define K_OBUF_FUL 0x01 /* output buffer full */ 17 #define K_IBUF_FUL 0x02 /* input buffer full */ 18 19 #define KC_CMD_WIN 0xd0 /* read output port */ 20 #define KC_CMD_WOUT 0xd1 /* write output port */ 21 #define KB_A20 0x9f /* enable A20, 22 enable output buffer full interrupt 23 enable data line 24 disable clock line */ 25 26 /* 27 * Gate A20 for high memory 28 */ 29 static unsigned char x_20 = KB_A20; 30 void gateA20() 31 { 32 #ifdef IBM_L40 33 outb(0x92, 0x2); 34 #else IBM_L40 35 while (inb(K_STATUS) & K_IBUF_FUL); 36 while (inb(K_STATUS) & K_OBUF_FUL) 37 (void)inb(K_RDWR); 38 39 outb(K_CMD, KC_CMD_WOUT); 40 while (inb(K_STATUS) & K_IBUF_FUL); 41 outb(K_RDWR, x_20); 42 while (inb(K_STATUS) & K_IBUF_FUL); 43 #endif IBM_L40 44 } 45