diff mbox

[RFC,3/3] sysbus: Allow passthrough of single IRQ

Message ID 1307532813-27175-4-git-send-email-peter.maydell@linaro.org
State RFC
Headers show

Commit Message

Peter Maydell June 8, 2011, 11:33 a.m. UTC
Add a sysbus_pass_one_irq() function to allow one sysbus device
to pass a single IRQ through to another. (It is already possible
to delegate all your IRQs to another device with sysbus_pass_irq().)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/sysbus.c |    9 +++++++++
 hw/sysbus.h |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/hw/sysbus.c b/hw/sysbus.c
index 793b0c1..8211e8f 100644
--- a/hw/sysbus.c
+++ b/hw/sysbus.c
@@ -134,6 +134,15 @@  void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target)
     }
 }
 
+void sysbus_pass_one_irq(SysBusDevice *dev, SysBusDevice *target, int tn)
+{
+    int n;
+
+    assert(dev->num_irq < QDEV_MAX_IRQ);
+    n = dev->num_irq++;
+    dev->irqp[n] = target->irqp[tn];
+}
+
 void sysbus_init_mmio(SysBusDevice *dev, target_phys_addr_t size,
                       ram_addr_t iofunc)
 {
diff --git a/hw/sysbus.h b/hw/sysbus.h
index 789e4c5..a6a873c 100644
--- a/hw/sysbus.h
+++ b/hw/sysbus.h
@@ -51,6 +51,7 @@  void sysbus_init_mmio_cb(SysBusDevice *dev, target_phys_addr_t size,
 void sysbus_pass_mmio(SysBusDevice *dev, SysBusDevice *target, int target_mmio);
 void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
 void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
+void sysbus_pass_one_irq(SysBusDevice *dev, SysBusDevice *target, int tn);
 void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t ioport, pio_addr_t size);