Reverted the old AMIkeyboard controller fix and implemented proper fixes to some AMI keyboard controller commands to make the Vi15G work with a 'F' keyboard controller.

This commit is contained in:
OBattler
2022-08-03 00:19:13 +02:00
parent c02916c2c4
commit ef4cb33259

View File

@@ -1398,7 +1398,7 @@ write64_ami(void *priv, uint8_t val)
else
add_data(dev, 'H');
} else
add_data(dev, 'H');
add_data(dev, 'F');
return 0;
case 0xa2: /* clear keyboard controller lines P22/P23 */
@@ -1438,7 +1438,7 @@ write64_ami(void *priv, uint8_t val)
case 0xa6: /* read clock */
if ((dev->flags & KBC_TYPE_MASK) < KBC_TYPE_PS2_NOREF) {
kbd_log("ATkbc: AMI - read clock\n");
add_data(dev, !!(dev->ami_stat & 1));
add_to_kbc_queue_front(dev, (dev->ami_stat & 1) ? 0xff : 0x00, 0, 0x00);
return 0;
}
break;
@@ -1462,7 +1462,7 @@ write64_ami(void *priv, uint8_t val)
case 0xa9: /* read cache */
if ((dev->flags & KBC_TYPE_MASK) < KBC_TYPE_PS2_NOREF) {
kbd_log("ATkbc: AMI - read cache\n");
add_data(dev, !!(dev->ami_stat & 2));
add_to_kbc_queue_front(dev, (dev->ami_stat & 2) ? 0xff : 0x00, 0, 0x00);
return 0;
}
break;
@@ -1535,7 +1535,7 @@ write64_ami(void *priv, uint8_t val)
* (allow command D1 to change bits 2/3 of the output port)
*/
kbd_log("ATkbc: AMI - unblock KBC lines P22 and P23\n");
dev->output_locked = 1;
dev->ami_flags &= 0xfb;
return 0;
case 0xc9:
@@ -1544,7 +1544,7 @@ write64_ami(void *priv, uint8_t val)
* (disallow command D1 from changing bits 2/3 of the port)
*/
kbd_log("ATkbc: AMI - block KBC lines P22 and P23\n");
dev->output_locked = 1;
dev->ami_flags |= 0x04;
return 0;
case 0xcc:
@@ -1796,7 +1796,9 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
case 0xd1: /* write output port */
kbd_log("ATkbc: write output port\n");
if (dev->output_locked) {
/* Bit 2 of AMI flags is P22-P23 blocked (1 = yes, 0 = no),
discovered by reverse-engineering the AOpeN Vi15G BIOS. */
if (dev->ami_flags & 0x04) {
/*If keyboard controller lines P22-P23 are blocked,
we force them to remain unchanged.*/
val &= ~0x0c;
@@ -2259,6 +2261,7 @@ kbd_reset(void *priv)
set_scancode_map(dev);
dev->ami_flags = ((dev->flags & KBC_TYPE_MASK) >= KBC_TYPE_PS2_NOREF) ? 0x01 : 0x00;
dev->ami_stat |= 0x02;
}