From d2b5931756fdb9f839180e33898cd1e3e4fbdc90 Mon Sep 17 00:00:00 2001 From: pbrook Date: Sun, 24 Sep 2006 00:16:34 +0000 Subject: PCI shared IRQ fix (original patch by andrzej zaborowski). git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2165 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/unin_pci.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'hw/unin_pci.c') diff --git a/hw/unin_pci.c b/hw/unin_pci.c index a7e3600047..d132d6ec2e 100644 --- a/hw/unin_pci.c +++ b/hw/unin_pci.c @@ -140,9 +140,15 @@ static CPUReadMemoryFunc *pci_unin_read[] = { }; #endif -static void pci_unin_set_irq(PCIDevice *d, void *pic, int irq_num, int level) +/* Don't know if this matches real hardware, but it agrees with OHW. */ +static int pci_unin_map_irq(PCIDevice *pci_dev, int irq_num) { - openpic_set_irq(pic, d->config[PCI_INTERRUPT_LINE], level); + return (irq_num + (pci_dev->devfn >> 3)) & 3; +} + +static void pci_unin_set_irq(void *pic, int irq_num, int level) +{ + openpic_set_irq(pic, irq_num + 8, level); } PCIBus *pci_pmac_init(void *pic) @@ -154,7 +160,8 @@ PCIBus *pci_pmac_init(void *pic) /* Use values found on a real PowerMac */ /* Uninorth main bus */ s = qemu_mallocz(sizeof(UNINState)); - s->bus = pci_register_bus(pci_unin_set_irq, NULL, 11 << 3); + s->bus = pci_register_bus(pci_unin_set_irq, pci_unin_map_irq, + pic, 11 << 3); pci_mem_config = cpu_register_io_memory(0, pci_unin_main_config_read, pci_unin_main_config_write, s); -- cgit v1.2.1