@@ -880,18 +880,9 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
/***********************************************************/
/* generic PCI irq support */
-/* 0 <= irq_num <= 3. level must be 0 or 1 */
-static void pci_set_irq(void *opaque, int irq_num, int level)
+static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change)
{
- PCIDevice *pci_dev = opaque;
PCIBus *bus;
- int change;
-
- change = level - pci_dev->irq_state[irq_num];
- if (!change)
- return;
-
- pci_dev->irq_state[irq_num] = level;
for (;;) {
bus = pci_dev->bus;
irq_num = bus->map_irq(pci_dev, irq_num);
@@ -903,6 +894,21 @@ 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 <= irq_num <= 3. level must be 0 or 1 */
+static void pci_set_irq(void *opaque, int irq_num, int level)
+{
+ PCIDevice *pci_dev = opaque;
+ int change;
+
+ change = level - pci_dev->irq_state[irq_num];
+ if (!change)
+ return;
+
+ pci_dev->irq_state[irq_num] = level;
+ pci_change_irq_level(pci_dev, irq_num, change);
+}
+
/***********************************************************/
/* monitor info on PCI */
Rearranges code slightly in preparation for interrupt status and interrupt disable support: split actual irq change from irq_state management. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- hw/pci.c | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-)