aboutsummaryrefslogtreecommitdiff
path: root/hw/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'hw/sparc')
-rw-r--r--hw/sparc/leon3.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index c5f1b1ee72..cac987373e 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -143,9 +143,14 @@ void leon3_irq_ack(void *irq_manager, int intno)
grlib_irqmp_ack((DeviceState *)irq_manager, intno);
}
-static void leon3_set_pil_in(void *opaque, uint32_t pil_in)
+/*
+ * This device assumes that the incoming 'level' value on the
+ * qemu_irq is the interrupt number, not just a simple 0/1 level.
+ */
+static void leon3_set_pil_in(void *opaque, int n, int level)
{
- CPUSPARCState *env = (CPUSPARCState *)opaque;
+ CPUSPARCState *env = opaque;
+ uint32_t pil_in = level;
CPUState *cs;
assert(env != NULL);
@@ -225,8 +230,8 @@ static void leon3_generic_hw_init(MachineState *machine)
/* Allocate IRQ manager */
dev = qdev_create(NULL, TYPE_GRLIB_IRQMP);
- qdev_prop_set_ptr(dev, "set_pil_in", leon3_set_pil_in);
- qdev_prop_set_ptr(dev, "set_pil_in_opaque", env);
+ env->pil_irq = qemu_allocate_irq(leon3_set_pil_in, env, 0);
+ qdev_connect_gpio_out_named(dev, "grlib-irq", 0, env->pil_irq);
qdev_init_nofail(dev);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_IRQMP_OFFSET);
env->irq_manager = dev;