When enabling A20 put upper limit on amount of time we wait for the keyboard

controller to get ready (65K x ISA access time, visually around 1 second).
If we have wait more than that amount it's likely that the hardware is a
legacy-free one and simply doesn't have keyboard controller and doesn't
require enabling A20 at all.

This makes cdboot working for MacBook Pro with Boot Camp.

MFC after:	1 day
This commit is contained in:
sobomax 2006-04-11 04:39:29 +00:00
parent 560017edd7
commit bd596bb38e

View File

@ -485,10 +485,17 @@ twiddle: push %ax # Save
ret
#
# Enable A20
# Enable A20. Put upper limit on amount of time we wait for the
# keyboard controller to get ready (65K x ISA access time). If
# we wait more than that amount it's likely that the hardware
# is legacy-free and simply doesn't have keyboard controller
# and don't need enabling A20 at all.
#
seta20: cli # Disable interrupts
seta20.1: in $0x64,%al # Get status
xor %cx,%cx # Clear
seta20.1: inc %cx # Increment, overflow?
jz seta20.3 # Yes
in $0x64,%al # Get status
test $0x2,%al # Busy?
jnz seta20.1 # Yes
mov $0xd1,%al # Command: Write
@ -498,7 +505,7 @@ seta20.2: in $0x64,%al # Get status
jnz seta20.2 # Yes
mov $0xdf,%al # Enable
out %al,$0x60 # A20
sti # Enable interrupts
seta20.3: sti # Enable interrupts
ret # To caller
#