qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 34/61] pci: introduce pci_swizzle_map_irq_fn() for i


From: Isaku Yamahata
Subject: [Qemu-devel] [PATCH 34/61] pci: introduce pci_swizzle_map_irq_fn() for interrupt pin swizzle.
Date: Wed, 30 Sep 2009 19:18:10 +0900

introduce pci_swizzle_map_irq_fn() for interrupt pin swizzle.
PCI bridge swizzle is common logic, by introducing this function
duplicated swizzle logic will be avoided later.

Signed-off-by: Isaku Yamahata <address@hidden>
---
 hw/pci.c |    6 ++++++
 hw/pci.h |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 954fc57..b358d80 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -898,6 +898,12 @@ static void pci_set_irq(void *opaque, int irq_num, int 
level)
     bus->set_irq(bus->irq_opaque, irq_num, bus->irq_count[irq_num] != 0);
 }
 
+/* 0 <= pin <= 3 0 = INTA, 1 = INTB, 2 = INTC, 3 = INTD */
+int pci_swizzle_map_irq_fn(PCIDevice *pci_dev, int pin)
+{
+    return (pin + PCI_SLOT(pci_dev->devfn) - 1) % PCI_NUM_PINS;
+}
+
 /***********************************************************/
 /* monitor info on PCI */
 
diff --git a/hw/pci.h b/hw/pci.h
index ce72020..5cd882c 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -268,6 +268,8 @@ int pci_device_load(PCIDevice *s, QEMUFile *f);
 
 typedef void (*pci_set_irq_fn)(void *opaque, int irq_num, int level);
 typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num);
+/* 0 <= pin <= 3 0 = INTA, 1 = INTB, 2 = INTC, 3 = INTD */
+int pci_swizzle_map_irq_fn(PCIDevice *pci_dev, int pin);
 PCIBus *pci_register_bus(DeviceState *parent, const char *name,
                          pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
                          void *irq_opaque, int devfn_min, int nirq);
-- 
1.6.0.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]