From 06a2ddb54d82ea81b21f69d0d0944d15949d6be3 Mon Sep 17 00:00:00 2001 From: sobomax Date: Thu, 29 Apr 2010 06:16:00 +0000 Subject: On certain chipsets AT keyboard controller isn't present and is emulated by BIOS using SMI interrupt. On those chipsets reading from the status port may be thousand times slower than usually. Sometimes this emilation is not working properly resulting in commands timing out and since we assume that inb() operation takes very little time to complete we need to adjust number of retries to keep waiting time within a designed limits (100ms). Measure time it takes to make read_status() call and adjust number of retries accordingly. To keep it simple, use TSC to measure inb() performance and keep it to amd64-only, since TSC may not available on older CPUs. Also enable detection of the AT controller absence on amd64. Reviewed by: jhb MFC after: 1 month --- sys/dev/atkbdc/atkbdc_ebus.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/dev/atkbdc/atkbdc_ebus.c') diff --git a/sys/dev/atkbdc/atkbdc_ebus.c b/sys/dev/atkbdc/atkbdc_ebus.c index 639203d..0dcb0a7 100644 --- a/sys/dev/atkbdc/atkbdc_ebus.c +++ b/sys/dev/atkbdc/atkbdc_ebus.c @@ -202,6 +202,7 @@ atkbdc_ebus_attach(device_t dev) "cannot determine command/data port resource\n"); return (ENXIO); } + sc->retry = 5000; sc->port0 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, start, start, 1, RF_ACTIVE); if (sc->port0 == NULL) { -- cgit v1.1