Received: from eggs.gnu.org ([208.118.235.92]:35338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tin0o-00045Z-Fk for qemu-devel@nongnu.org; Wed, 12 Dec 2012 09:10:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tin0d-0001Br-TK for qemu-devel@nongnu.org; Wed, 12 Dec 2012 09:10:14 -0500 From: Alexander Graf Date: Wed, 12 Dec 2012 15:09:55 +0100 Message-Id: <1355321398-23393-3-git-send-email-agraf@suse.de> In-Reply-To: <1355321398-23393-1-git-send-email-agraf@suse.de> References: <1355321398-23393-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 2/5] PPC: E500: PCI: Make IRQ calculation more generic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-ppc@nongnu.org List" Cc: qemu-devel qemu-devel 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 --- hw/ppce500_pci.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-) diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c index 4cd4edc..561a776 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); -- 1.6.0.2