summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-12-12 12:58:12 +0100
committerAlexander Graf <agraf@suse.de>2012-12-14 13:12:57 +0100
commit05f57d9de8e99bf5f7ca762c6dc2f1e054c2074c (patch)
tree6231ca27ae041de05f3455610660e568c65e1316 /hw
parenteafb325fb11af21ed9df3f5a310fd26e70954318 (diff)
downloadqemu-05f57d9de8e99bf5f7ca762c6dc2f1e054c2074c.tar.gz
PPC: E500: PCI: Make IRQ calculation more generic
The IRQ line calculation is more or less hardcoded today. Instead, let's write it as an algorithmic function that theoretically allows an arbitrary number of PCI slots. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw')
-rw-r--r--hw/ppce500_pci.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c
index 4cd4edc85b..561a77661d 100644
--- a/hw/ppce500_pci.c
+++ b/hw/ppce500_pci.c
@@ -253,17 +253,10 @@ static const MemoryRegionOps e500_pci_reg_ops = {
static int mpc85xx_pci_map_irq(PCIDevice *pci_dev, int irq_num)
{
- int devno = pci_dev->devfn >> 3, ret = 0;
+ int devno = pci_dev->devfn >> 3;
+ int ret;
- switch (devno) {
- /* Two PCI slot */
- case 0x11:
- case 0x12:
- ret = (irq_num + devno - 0x10) % 4;
- break;
- default:
- printf("Error:%s:unknown dev number\n", __func__);
- }
+ ret = (irq_num + devno) % 4;
pci_debug("%s: devfn %x irq %d -> %d devno:%x\n", __func__,
pci_dev->devfn, irq_num, ret, devno);