staticint empty_8042(void)
{
u8 status; int loops = MAX_8042_LOOPS; int ffs = MAX_8042_FF;
while (loops--) {
io_delay();
status = inb(0x64); if (status == 0xff) { /* FF is a plausible, but very unlikely status */ if (!--ffs) return -1; /* Assume no KBC present */
} if (status & 1) { /* Read and discard input data */
io_delay();
(void)inb(0x60);
} elseif (!(status & 2)) { /* Buffers empty, finished! */ return 0;
}
}
return -1;
}
/* Returns nonzero if the A20 line is enabled. The memory address
used as a test is the int $0x80 vector, which should be safe. */
staticint a20_test(int loops)
{ int ok = 0; int saved, ctr;
set_fs(0x0000);
set_gs(0xffff);
saved = ctr = rdfs32(A20_TEST_ADDR);
while (loops--) {
wrfs32(++ctr, A20_TEST_ADDR);
io_delay(); /* Serialize and make delay constant */
ok = rdgs32(A20_TEST_ADDR+0x10) ^ ctr; if (ok) break;
}
wrfs32(saved, A20_TEST_ADDR); return ok;
}
/* Quick test to see if A20 is already enabled */ staticint a20_test_short(void)
{ return a20_test(A20_TEST_SHORT);
}
/* Longer test that actually waits for A20 to come on line; this
is useful when dealing with the KBC or other slow external circuitry. */ staticint a20_test_long(void)
{ return a20_test(A20_TEST_LONG);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.