diff --git a/arch/x86/boot/a20.c b/arch/x86/boot/a20.c index 38a1cad8a553..ff51b0ce4dfd 100644 --- a/arch/x86/boot/a20.c +++ b/arch/x86/boot/a20.c @@ -48,8 +48,9 @@ static int empty_8042(void) used as a test is the int $0x80 vector, which should be safe. */ #define A20_TEST_ADDR (4*0x80) -#define A20_TEST_SHORT 32 -#define A20_TEST_LONG 2097152 /* 2^21 */ + +#define A20_TEST_GS (*(volatile __seg_gs u32 *)A20_TEST_ADDR) +#define A20_TEST_FS (*(volatile __seg_fs u32 *)(A20_TEST_ADDR+0x10)) static int a20_test(int loops) { @@ -57,20 +58,22 @@ static int a20_test(int loops) set_fs(0xffff); - saved = ctr = rdgs32(A20_TEST_ADDR); + saved = ctr = A20_TEST_GS; do { - wrgs32(++ctr, A20_TEST_ADDR); - io_delay(); /* Serialize and make delay constant */ - barrier(); /* Compiler won't know about fs/gs overlap */ - if (rdfs32(A20_TEST_ADDR+0x10) != ctr) + A20_TEST_GS = ++ctr; + io_delay(); /* Make constant delay */ + if (A20_TEST_FS != ctr) break; } while (--loops); - wrgs32(saved, A20_TEST_ADDR); + A20_TEST_GS = saved; return loops; } +#define A20_TEST_SHORT 32 +#define A20_TEST_LONG 2097152 /* 2^21 */ + /* Quick test to see if A20 is already enabled */ static int a20_test_short(void) {