Fixed FDC37C665 UART 2 handler and some ALi M1487/89 bugs.

This commit is contained in:
OBattler
2021-08-12 11:09:24 +02:00
parent 79ad6568f8
commit da9546c82a
2 changed files with 27 additions and 16 deletions

View File

@@ -74,6 +74,9 @@ typedef struct
} ali1489_t;
static void ali1489_ide_handler(ali1489_t *dev);
static void
ali1489_shadow_recalc(ali1489_t *dev)
{
@@ -105,7 +108,7 @@ ali1489_shadow_recalc(ali1489_t *dev)
}
}
flushmmucache();
flushmmucache_nopc();
}
@@ -121,8 +124,7 @@ ali1489_smram_recalc(ali1489_t *dev)
smram_enable(dev->smram, 0xa0000, 0xa0000, 0x20000, (dev->regs[0x19] & 0x08), 1);
break;
case 0x20:
if ((dev->regs[0x14] & 0x03) == 0x00)
smram_enable(dev->smram, 0xe0000, 0xe0000, 0x10000, (dev->regs[0x19] & 0x08), 1);
smram_enable(dev->smram, 0xe0000, 0xe0000, 0x10000, (dev->regs[0x19] & 0x08), 1);
break;
case 0x30:
if ((dev->regs[0x35] & 0xc0) == 0x80)
@@ -199,10 +201,12 @@ ali1489_defaults(ali1489_t *dev)
smi_line = 0;
in_smm = 0;
pci_set_irq(PCI_INTA, PCI_IRQ_DISABLED);
pci_set_irq(PCI_INTB, PCI_IRQ_DISABLED);
pci_set_irq(PCI_INTC, PCI_IRQ_DISABLED);
pci_set_irq(PCI_INTD, PCI_IRQ_DISABLED);
pci_set_irq_routing(PCI_INTA, PCI_IRQ_DISABLED);
pci_set_irq_routing(PCI_INTB, PCI_IRQ_DISABLED);
pci_set_irq_routing(PCI_INTC, PCI_IRQ_DISABLED);
pci_set_irq_routing(PCI_INTD, PCI_IRQ_DISABLED);
ali1489_ide_handler(dev);
}
@@ -459,7 +463,7 @@ ali1489_ide_handler(ali1489_t *dev)
{
ide_pri_disable();
ide_sec_disable();
if (dev->regs[0x01] & 0x01) {
if (dev->ide_regs[0x01] & 0x01) {
ide_pri_enable();
if (!(dev->ide_regs[0x35] & 0x40))
ide_sec_enable();
@@ -570,10 +574,10 @@ ali1489_reset(void *priv)
{
ali1489_t *dev = (ali1489_t *)priv;
pci_set_irq(PCI_INTA, PCI_IRQ_DISABLED);
pci_set_irq(PCI_INTB, PCI_IRQ_DISABLED);
pci_set_irq(PCI_INTC, PCI_IRQ_DISABLED);
pci_set_irq(PCI_INTD, PCI_IRQ_DISABLED);
pci_set_irq_routing(PCI_INTA, PCI_IRQ_DISABLED);
pci_set_irq_routing(PCI_INTB, PCI_IRQ_DISABLED);
pci_set_irq_routing(PCI_INTC, PCI_IRQ_DISABLED);
pci_set_irq_routing(PCI_INTD, PCI_IRQ_DISABLED);
ali1489_defaults(dev);
}

View File

@@ -73,7 +73,7 @@ set_com34_addr(fdc37c66x_t *dev)
static void
set_serial_addr(fdc37c66x_t *dev, int port)
{
uint8_t shift = (port << 4);
uint8_t shift = (port << 2);
double clock_src = 24000000.0 / 13.0;
if (dev->regs[4] & (1 << (4 + port)))
@@ -81,7 +81,7 @@ set_serial_addr(fdc37c66x_t *dev, int port)
serial_remove(dev->uart[port]);
if (dev->regs[2] & (4 << shift)) {
switch (dev->regs[2] & (3 << shift)) {
switch ((dev->regs[2] >> shift) & 3) {
case 0:
serial_setup(dev->uart[port], SERIAL1_ADDR, SERIAL1_IRQ);
break;
@@ -112,11 +112,11 @@ lpt1_handler(fdc37c66x_t *dev)
break;
case 2:
lpt1_init(0x378);
lpt1_irq(5);
lpt1_irq(7 /*5*/);
break;
case 3:
lpt1_init(0x278);
lpt1_irq(5);
lpt1_irq(7 /*5*/);
break;
}
}
@@ -264,6 +264,13 @@ fdc37c66x_reset(fdc37c66x_t *dev)
dev->regs[0xd] = dev->chip_id;
dev->regs[0xe] = 0x01;
set_serial_addr(dev, 0);
set_serial_addr(dev, 1);
lpt1_handler(dev);
fdc_handler(dev);
if (dev->has_ide)
ide_handler(dev);
}