diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2019-01-26 04:12:30 -0800 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2019-01-28 11:54:54 -0800 |
commit | 66f03d7e13d2abe56c6b1841faf0edf5b4ec4b66 (patch) | |
tree | 9fc893febbb7f975bc4f21a6c858465db3c2cd81 /hw/xtensa/pic_cpu.c | |
parent | 3f75038a3369078b656826eb454ead5f5dc8802e (diff) |
target/xtensa: rearrange access to external interrupts
Replace xtensa_get_extint that returns single external IRQ descriptor
with xtensa_get_extints that returns a vector of all external IRQs.
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'hw/xtensa/pic_cpu.c')
-rw-r--r-- | hw/xtensa/pic_cpu.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/hw/xtensa/pic_cpu.c b/hw/xtensa/pic_cpu.c index f706849026..077f4ad53d 100644 --- a/hw/xtensa/pic_cpu.c +++ b/hw/xtensa/pic_cpu.c @@ -88,11 +88,11 @@ static void xtensa_ccompare_cb(void *opaque) void xtensa_irq_init(CPUXtensaState *env) { - env->irq_inputs = (void **)qemu_allocate_irqs( - xtensa_set_irq, env, env->config->ninterrupt); - if (xtensa_option_enabled(env->config, XTENSA_OPTION_TIMER_INTERRUPT)) { - unsigned i; + unsigned i; + env->irq_inputs = qemu_allocate_irqs(xtensa_set_irq, env, + env->config->ninterrupt); + if (xtensa_option_enabled(env->config, XTENSA_OPTION_TIMER_INTERRUPT)) { env->time_base = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); env->ccount_base = env->sregs[CCOUNT]; for (i = 0; i < env->config->nccompare; ++i) { @@ -101,16 +101,14 @@ void xtensa_irq_init(CPUXtensaState *env) xtensa_ccompare_cb, env->ccompare + i); } } + for (i = 0; i < env->config->nextint; ++i) { + unsigned irq = env->config->extint[i]; + + env->ext_irq_inputs[i] = env->irq_inputs[irq]; + } } -void *xtensa_get_extint(CPUXtensaState *env, unsigned extint) +qemu_irq *xtensa_get_extints(CPUXtensaState *env) { - if (extint < env->config->nextint) { - unsigned irq = env->config->extint[extint]; - return env->irq_inputs[irq]; - } else { - qemu_log("%s: trying to acquire invalid external interrupt %d\n", - __func__, extint); - return NULL; - } + return env->ext_irq_inputs; } |