Project

General

Profile

Bug #573 » a20.patch

qhwt+dfly, 03/06/2007 01:50 PM

View differences:

boot/i386/cdboot/cdboot.S 27 Feb 2007 23:57:54 -0000
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
......
jnz seta20.2 # Yes
mov $0xdf,%al # Enable
out %al,$0x60 # A20
sti # Enable interrupts
seta20.3: sti # Enable interrupts
ret # To caller
/*
boot/i386/pxeldr/pxeldr.S 28 Feb 2007 14:26:15 -0000
jmp putstr # keep looping
/*
* 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: 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
......
jnz seta20.2 # Yes
movb $0xdf,%al # Enable
outb %al,$0x60 # A20
sti # Enable interrupts
seta20.3: sti # Enable interrupts
retw # To caller
/*
dev/misc/atkbdc_layer/atkbdc_isa.c 28 Feb 2007 12:30:00 -0000
struct resource *port1;
int error;
int rid;
#if defined(__i386__)
bus_space_tag_t tag;
bus_space_handle_t ioh1;
volatile int i;
register_t flags;
#endif
/* check PnP IDs */
if (ISA_PNP_PROBE(device_get_parent(dev), dev, atkbdc_ids) == ENXIO)
......
return ENXIO;
}
#if defined(__i386__)
/*
* Check if we really have AT keyboard controller. Poll status
* register until we get "all clear" indication. If no such
* indication comes, it probably means that there is no AT
* keyboard controller present. Give up in such case. Check relies
* on the fact that reading from non-existing in/out port returns
* 0xff on i386. May or may not be true on other platforms.
*/
tag = rman_get_bustag(port0);
ioh1 = rman_get_bushandle(port1);
flags = intr_disable();
for (i = 0; i != 65535; i++) {
if ((bus_space_read_1(tag, ioh1, 0) & 0x2) == 0)
break;
}
intr_restore(flags);
if (i == 65535) {
bus_release_resource(dev, SYS_RES_IOPORT, 0, port0);
bus_release_resource(dev, SYS_RES_IOPORT, 1, port1);
return ENXIO;
}
#endif
error = atkbdc_probe_unit(device_get_unit(dev), port0, port1);
bus_release_resource(dev, SYS_RES_IOPORT, 0, port0);
cpu/i386/include/cpufunc.h 28 Feb 2007 12:27:12 -0000
__asm __volatile("movl %0,%%dr7" : : "r" (sel));
}
static __inline register_t
intr_disable(void)
{
register_t eflags;
eflags = read_eflags();
cpu_disable_intr();
return (eflags);
}
static __inline void
intr_restore(register_t eflags)
{
write_eflags(eflags);
}
#else /* !__GNUC__ */
int breakpoint (void);
(1-1/2)