From 913293e6360d5e73afcde065a3748b735fe248dd Mon Sep 17 00:00:00 2001 From: sobomax Date: Tue, 11 Apr 2006 20:53:49 +0000 Subject: Merge in timeout into A20-enable routine from cdboot/boot1. MFC after: 1 day --- sys/boot/i386/pxeldr/pxeldr.S | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sys/boot') diff --git a/sys/boot/i386/pxeldr/pxeldr.S b/sys/boot/i386/pxeldr/pxeldr.S index 25ab5c0..12b008b 100644 --- a/sys/boot/i386/pxeldr/pxeldr.S +++ b/sys/boot/i386/pxeldr/pxeldr.S @@ -227,10 +227,17 @@ putc: movw $0x7,%bx # attribute for output jmp putstr # keep looping /* - * Enable A20 + * Enable A20. Put an upper limit on the amount of time we wait for the + * keyboard controller to get ready (65K x ISA access time). If + * we wait more than that amount, the hardware is probably + * legacy-free and simply doesn't have a keyboard controller. + * Thus, the A20 line is already enabled. */ seta20: cli # Disable interrupts -seta20.1: inb $0x64,%al # Get status + xor %cx,%cx # Clear +seta20.1: inc %cx # Increment, overflow? + jz seta20.3 # Yes + inb $0x64,%al # Get status testb $0x2,%al # Busy? jnz seta20.1 # Yes movb $0xd1,%al # Command: Write @@ -240,7 +247,7 @@ seta20.2: inb $0x64,%al # Get status jnz seta20.2 # Yes movb $0xdf,%al # Enable outb %al,$0x60 # A20 - sti # Enable interrupts +seta20.3: sti # Enable interrupts retw # To caller /* -- cgit v1.1