mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
leon3: use qemu_irq framework instead of callback as property
"set_pin_in" property is used to define a callback mechanism where the device says "call the callback function, passing it an opaque cookie and a 32-bit value". We already have a generic mechanism for doing that, which is the qemu_irq. So we should just use that. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: KONRAD Frederic <frederic.konrad@adacore.com>
This commit is contained in:
parent
3110ce8192
commit
ab4c072d2f
3 changed files with 14 additions and 35 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue