Implement ES1371 game port remapping

This commit is contained in:
RichardG867
2021-11-24 15:19:19 -03:00
parent 82a179a46a
commit b67468070a

View File

@@ -58,6 +58,7 @@ typedef struct {
uint32_t int_ctrl, int_status,
legacy_ctrl;
void * gameport;
int mem_page;
@@ -772,6 +773,7 @@ es1371_outb(uint16_t port, uint8_t val, void *p)
break;
case 0x03:
dev->int_ctrl = (dev->int_ctrl & 0x00ffffff) | (val << 24);
gameport_remap(dev->gameport, 0x200 | ((val & 0x03) << 3));
break;
/* UART Data Register, Address 08H
@@ -867,6 +869,7 @@ es1371_outw(uint16_t port, uint16_t val, void *p)
break;
case 0x02:
dev->int_ctrl = (dev->int_ctrl & 0x0000ffff) | (val << 16);
gameport_remap(dev->gameport, 0x200 | ((val & 0x0300) >> 5));
break;
/* Memory Page Register, Address 0CH
@@ -949,6 +952,7 @@ es1371_outl(uint16_t port, uint32_t val, void *p)
es1371_fetch(dev, 1);
}
dev->int_ctrl = val;
gameport_remap(dev->gameport, 0x200 | ((val & 0x03000000) >> 21));
break;
/* Interrupt/Chip Select Status Register, Address 04H
@@ -1409,7 +1413,7 @@ es1371_pci_read(int func, int addr, void *p)
case 0x06: return 0x10; /* Supports ACPI */
case 0x07: return 0x00;
case 0x08: return 0x08; /* Revision ID - 0x02 (datasheet, VMware) has issues with the 2001 Creative WDM driver */
case 0x08: return 0x02; /* Revision ID - 0x02 (datasheet, VMware) has issues with the 2001 Creative WDM driver */
case 0x09: return 0x00; /* Multimedia audio device */
case 0x0a: return 0x01;
case 0x0b: return 0x04;
@@ -1844,8 +1848,8 @@ es1371_init(const device_t *info)
sound_add_handler(es1371_get_buffer, dev);
sound_set_cd_audio_filter(es1371_filter_cd_audio, dev);
/* Add our own always-present game port to override the standalone ISAPnP one. */
gameport_remap(gameport_add(&gameport_pnp_device), 0x200);
dev->gameport = gameport_add(&gameport_pnp_device);
gameport_remap(dev->gameport, 0x200);
dev->card = pci_add_card(info->local ? PCI_ADD_SOUND : PCI_ADD_NORMAL, es1371_pci_read, es1371_pci_write, dev);