summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2006-04-11 04:39:29 +0000
committersobomax <sobomax@FreeBSD.org>2006-04-11 04:39:29 +0000
commitbd596bb38eb3e410833a1f56dcf3d9702c6740b7 (patch)
treecb45dc0f2fefb3bef808ba1daab14501d807674a
parent560017edd75e506598787853758d2966a5336f64 (diff)
downloadFreeBSD-src-bd596bb38eb3e410833a1f56dcf3d9702c6740b7.zip
FreeBSD-src-bd596bb38eb3e410833a1f56dcf3d9702c6740b7.tar.gz
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
-rw-r--r--sys/boot/i386/cdboot/cdboot.s13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/boot/i386/cdboot/cdboot.s b/sys/boot/i386/cdboot/cdboot.s
index ab959f4..69ac8d4 100644
--- a/sys/boot/i386/cdboot/cdboot.s
+++ b/sys/boot/i386/cdboot/cdboot.s
@@ -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
#
OpenPOWER on IntegriCloud