Make sure command/data port (0x60) and status port (0x64) are in correct

order.  Some brain-damaged ACPI BIOS has reversed resources.
This commit is contained in:
Jung-uk Kim 2006-07-03 23:40:58 +00:00
parent 473c2d129b
commit 100656ed4e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=160091

View File

@ -112,15 +112,21 @@ atkbdc_isa_probe(device_t dev)
* The AT keyboard controller uses two ports (a command/data port * The AT keyboard controller uses two ports (a command/data port
* 0x60 and a status port 0x64), which may be given to us in * 0x60 and a status port 0x64), which may be given to us in
* one resource (0x60 through 0x64) or as two separate resources * one resource (0x60 through 0x64) or as two separate resources
* (0x60 and 0x64). Furthermore, /boot/device.hints may contain * (0x60 and 0x64). Some brain-damaged ACPI BIOS has reversed
* just one port, 0x60. We shall adjust resource settings * command/data port and status port. Furthermore, /boot/device.hints
* so that these two ports are available as two separate resources. * may contain just one port, 0x60. We shall adjust resource settings
* so that these two ports are available as two separate resources
* in correct order.
*/ */
device_quiet(dev); device_quiet(dev);
rid = 0; rid = 0;
if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &start, &count) != 0) if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &start, &count) != 0)
return ENXIO; return ENXIO;
if (count > 1) /* adjust the count */ if (start == IO_KBD + KBD_STATUS_PORT) {
start = IO_KBD;
count++;
}
if (count > 1) /* adjust the count and/or start port */
bus_set_resource(dev, SYS_RES_IOPORT, rid, start, 1); bus_set_resource(dev, SYS_RES_IOPORT, rid, start, 1);
port0 = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); port0 = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
if (port0 == NULL) if (port0 == NULL)