diff --git a/src/include/86box/pci.h b/src/include/86box/pci.h index 8483eb417..d2348ba02 100644 --- a/src/include/86box/pci.h +++ b/src/include/86box/pci.h @@ -115,6 +115,11 @@ /* PCI MIRQ lines (currently 8, this many are needed by the ALi M1543(C). */ #define PCI_MIRQS_NUM 8 #define PCI_MIRQ_MAX (PCI_MIRQS_NUM - 1) +/* The base for internal IRQ lines accepted by pci_irq(). */ +#define PCI_IIRQ_BASE 0x80 +/* PCI direct IRQ lines - always at 4 per the PCI specification. */ +#define PCI_IIRQS_NUM 4 +#define PCI_IIRQ_MAX (PCI_IIRQS_NUM - 1) /* The base for direct IRQ lines accepted by pci_irq(). */ #define PCI_DIRQ_BASE 0xf0 /* PCI direct IRQ lines (currently 16 because we only emulate the legacy PIC). */ @@ -148,12 +153,16 @@ #define pci_set_mirq(mirq, level, irq_state) \ pci_irq(PCI_MIRQ_BASE | (mirq), 0, level, 1, irq_state) +#define pci_set_iirq(pci_int, irq_state) \ + pci_irq(PCI_IIRQ_BASE | 0, pci_int, 0, 1, irq_state) #define pci_set_dirq(irq, irq_state) \ pci_irq(PCI_DIRQ_BASE | (irq), 0, 1, 1, irq_state) #define pci_set_irq(slot, pci_int, irq_state) \ pci_irq(slot, pci_int, 0, 1, irq_state) #define pci_clear_mirq(mirq, level, irq_state) \ pci_irq(PCI_MIRQ_BASE | (mirq), 0, level, 0, irq_state) +#define pci_clear_iirq(pci_int, irq_state) \ + pci_irq(PCI_IIRQ_BASE | 0, pci_int, 0, 0, irq_state) #define pci_clear_dirq(dirq, irq_state) \ pci_irq(PCI_DIRQ_BASE | (irq), 0, 1, 0, irq_state) #define pci_clear_irq(slot, pci_int, irq_state) \ diff --git a/src/pci.c b/src/pci.c index 13b780050..266be4396 100644 --- a/src/pci.c +++ b/src/pci.c @@ -204,6 +204,19 @@ pci_irq(uint8_t slot, uint8_t pci_int, int level, int set, uint8_t *irq_state) } } break; + case (PCI_IIRQ_BASE | 0x00) ... (PCI_IIRQ_BASE | PCI_IIRQ_MAX): + /* PCI internal routing. */ + if (!last_pci_card || (pci_flags & FLAG_NO_IRQ_STEERING)) + return; + + irq_routing = (pci_int_index - PCI_INTA) & PCI_IRQ_MAX; + + irq_line = pci_irqs[irq_routing]; + + /* Ignore what was provided to us as a parameter and override it with whatever + the chipset is set to. */ + level = !!pci_irq_level[irq_routing]; + break; case (PCI_MIRQ_BASE | 0x00) ... (PCI_MIRQ_BASE | PCI_MIRQ_MAX): /* MIRQ */ slot &= PCI_MIRQ_MAX;