diff --git a/src/chipset/via_pipc.c b/src/chipset/via_pipc.c index 248664983..c02bb4ecd 100644 --- a/src/chipset/via_pipc.c +++ b/src/chipset/via_pipc.c @@ -43,6 +43,7 @@ #include <86box/hdc.h> #include <86box/hdc_ide.h> #include <86box/hdc_ide_sff8038i.h> +#include <86box/keyboard.h> #include <86box/usb.h> #include <86box/machine.h> #include <86box/smbus.h> @@ -1774,6 +1775,38 @@ pipc_init(const device_t *info) acpi_set_irq_mode(dev->acpi, 0); } + uint32_t kbc_params = 0x00004200; + /* + NOTE: The VIA VT82C42N returns 0x46 ('F') in command 0xA1 (so it + emulates the AMI KF/AMIKey KBC firmware), and 0x42 ('B') in + command 0xAF. + + The version on the VIA VT82C686B southbridge also returns + 'F' in command 0xA1, but 0x45 ('E') in command 0xAF. + The version on the VIA VT82C586B southbridge also returns + 'F' in command 0xA1, but 0x44 ('D') in command 0xAF. + The version on the VIA VT82C586A southbridge also returns + 'F' in command 0xA1, but 0x43 ('C') in command 0xAF. + */ + switch (dev->local) { + /* 596A, 596B, 686B, and 8231 are guesses because we have no probes yet. */ + case VIA_PIPC_586A: case VIA_PIPC_596A: + kbc_params = 0x00004300; + break; + case VIA_PIPC_586B: case VIA_PIPC_596B: + kbc_params = 0x00004400; + break; + case VIA_PIPC_686A: case VIA_PIPC_686B: + case VIA_PIPC_8231: + kbc_params = 0x00004500; + break; + } + + if (machine_get_kbc_device(machine) == NULL) + device_add_params(machine_has_bus(machine, MACHINE_BUS_PS2) ? + &kbc_ps2_via_device : &kbc_at_via_device, + (void *) (uintptr_t) kbc_params); + return dev; }