From 22ec3283efba9ba0792790da786d6776d83f2a92 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 18 Sep 2011 15:58:26 +0300 Subject: irq: introduce qemu_irq_proxy() In some cases we have a circular dependency involving irqs - the irq controller depends on a bus, which in turn depends on the irq controller. Add qemu_irq_proxy() which acts as a passthrough, except that the target irq may be set later on. Reviewed-by: Richard Henderson Signed-off-by: Avi Kivity Signed-off-by: Anthony Liguori --- hw/irq.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'hw/irq.c') diff --git a/hw/irq.c b/hw/irq.c index 60eabe8901..62f766eb6f 100644 --- a/hw/irq.c +++ b/hw/irq.c @@ -90,3 +90,17 @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2) s[1] = irq2; return qemu_allocate_irqs(qemu_splitirq, s, 1)[0]; } + +static void proxy_irq_handler(void *opaque, int n, int level) +{ + qemu_irq **target = opaque; + + if (*target) { + qemu_set_irq((*target)[n], level); + } +} + +qemu_irq *qemu_irq_proxy(qemu_irq **target, int n) +{ + return qemu_allocate_irqs(proxy_irq_handler, target, n); +} -- cgit v1.2.3