PS/2 mouse fixes :

- Don't process pending mouse data when mouse was disabled
- Commands a7/a8 (disable/enable mouse port) now update keyboard controller command
- Implicitly enable mouse when writing data to mouse
Fixes PS/2 mouse with Red Hat 5.0.
This commit is contained in:
SarahW 2020-03-28 17:23:57 +00:00
commit d60084fb04

View file

@ -104,15 +104,23 @@ void keyboard_at_poll()
keyboard_at.wantirq = 0; keyboard_at.wantirq = 0;
if (keyboard_at.out_new & 0x100) if (keyboard_at.out_new & 0x100)
{ {
if (keyboard_at.mem[0] & 0x02) if (mouse_scan)
picint(0x1000); {
keyboard_at.out = keyboard_at.out_new & 0xff; // pclog("keyboard_at : take IRQ12\n");
keyboard_at.out_new = -1; if (keyboard_at.mem[0] & 0x02)
keyboard_at.status |= STAT_OFULL; picint(0x1000);
keyboard_at.status &= ~STAT_IFULL; keyboard_at.out = keyboard_at.out_new & 0xff;
keyboard_at.status |= STAT_MFULL; keyboard_at.out_new = -1;
// pclog("keyboard_at : take IRQ12\n"); keyboard_at.status |= STAT_OFULL;
keyboard_at.last_irq = 0x1000; keyboard_at.status &= ~STAT_IFULL;
keyboard_at.status |= STAT_MFULL;
keyboard_at.last_irq = 0x1000;
}
else
{
// pclog("keyboard_at: suppressing IRQ12\n");
keyboard_at.out_new = -1;
}
} }
else else
{ {
@ -151,7 +159,7 @@ void keyboard_at_poll()
{ {
keyboard_at.out_new = mouse_queue[mouse_queue_start] | 0x100; keyboard_at.out_new = mouse_queue[mouse_queue_start] | 0x100;
mouse_queue_start = (mouse_queue_start + 1) & 0xf; mouse_queue_start = (mouse_queue_start + 1) & 0xf;
} }
else if (!(keyboard_at.status & STAT_OFULL) && keyboard_at.out_new == -1 && else if (!(keyboard_at.status & STAT_OFULL) && keyboard_at.out_new == -1 &&
!(keyboard_at.mem[0] & 0x10) && key_queue_start != key_queue_end) !(keyboard_at.mem[0] & 0x10) && key_queue_start != key_queue_end)
{ {
@ -308,7 +316,12 @@ void keyboard_at_write(uint16_t port, uint8_t val, void *priv)
case 0xd4: /*Write to mouse*/ case 0xd4: /*Write to mouse*/
if (keyboard_at.mouse_write) if (keyboard_at.mouse_write)
{
keyboard_at.mouse_write(val, keyboard_at.mouse_p); keyboard_at.mouse_write(val, keyboard_at.mouse_p);
/*Implicitly enable mouse*/
mouse_scan = 1;
keyboard_at.mem[0] &= ~0x20;
}
break; break;
default: default:
@ -490,10 +503,12 @@ void keyboard_at_write(uint16_t port, uint8_t val, void *priv)
case 0xa7: /*Disable mouse port*/ case 0xa7: /*Disable mouse port*/
mouse_scan = 0; mouse_scan = 0;
keyboard_at.mem[0] |= 0x20;
break; break;
case 0xa8: /*Enable mouse port*/ case 0xa8: /*Enable mouse port*/
mouse_scan = 1; mouse_scan = 1;
keyboard_at.mem[0] &= ~0x20;
break; break;
case 0xa9: /*Test mouse port*/ case 0xa9: /*Test mouse port*/