2 * $FreeBSD: src/sys/boot/i386/libi386/gatea20.c,v 1.2.2.1 2000/12/28 13:12:40 ps Exp $
3 * From: $NetBSD: gatea20.c,v 1.2 1997/10/29 00:32:49 fvdl Exp $
6 /* extracted from freebsd:sys/i386/boot/biosboot/io.c */
9 #include <machine/cpufunc.h>
11 #include <bootstrap.h>
15 #define K_RDWR 0x60 /* keyboard data & cmds (read/write) */
16 #define K_STATUS 0x64 /* keyboard status */
17 #define K_CMD 0x64 /* keybd ctlr command (write-only) */
19 #define K_OBUF_FUL 0x01 /* output buffer full */
20 #define K_IBUF_FUL 0x02 /* input buffer full */
22 #define KC_CMD_WIN 0xd0 /* read output port */
23 #define KC_CMD_WOUT 0xd1 /* write output port */
24 #define KB_A20 0x9f /* enable A20,
26 enable output buffer full interrupt
31 * Gate A20 for high memory
33 static unsigned char x_20 = KB_A20;
36 __asm("pushfl ; cli");
40 while (inb(K_STATUS) & K_IBUF_FUL);
41 while (inb(K_STATUS) & K_OBUF_FUL)
44 outb(K_CMD, KC_CMD_WOUT);
46 while (inb(K_STATUS) & K_IBUF_FUL);
49 while (inb(K_STATUS) & K_IBUF_FUL);