aboutsummaryrefslogtreecommitdiff
path: root/hw/sparc/leon3.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-11-20 17:38:51 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-07 17:24:29 +0400
commite23ae617f68420248a978c1040686658a34a7f95 (patch)
treea05120759cb17a44e6cbc07af0734f211950031b /hw/sparc/leon3.c
parentab4c072d2f2f4d2e4bfa54bb89e43e2b4cb86275 (diff)
leon3: use qdev gpio facilities for the PIL
As Peter Maydell once said: "Creating a gpio pin on some object that isn't yourself looks a bit odd, but all this leon3 code is modifying the CPU object from the outside anyway. Someday we might tidy it up, but not today." Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'hw/sparc/leon3.c')
-rw-r--r--hw/sparc/leon3.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index cac987373e..8038887ff7 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -230,8 +230,10 @@ static void leon3_generic_hw_init(MachineState *machine)
/* Allocate IRQ manager */
dev = qdev_create(NULL, TYPE_GRLIB_IRQMP);
- 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_gpio_in_named_with_opaque(DEVICE(cpu), leon3_set_pil_in,
+ env, "pil", 1);
+ qdev_connect_gpio_out_named(dev, "grlib-irq", 0,
+ qdev_get_gpio_in_named(DEVICE(cpu), "pil", 0));
qdev_init_nofail(dev);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_IRQMP_OFFSET);
env->irq_manager = dev;