diff options
author | Alistair Francis <alistair23@gmail.com> | 2015-02-05 13:37:21 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-02-05 13:37:21 +0000 |
commit | 8b47b7da29121ecddb173dd4afb82d6fb0eece37 (patch) | |
tree | 0c86cfbff657110d7a129c2a8daccda1335c14a5 /hw/arm/armv7m.c | |
parent | fe6ac447add80978c1bf988c3ef4a7ce8aab2fa0 (diff) |
target_arm: Parameterise the irq lines for armv7m_init
This patch allows the board to specifiy the number of NVIC interrupt
lines when using armv7m_init.
Signed-off-by: Alistair Francis <alistair23@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 5a0b0fcc778df0340899f488053acc9493679e03.1422077994.git.alistair23@gmail.com
[PMM: removed stale FIXME comment]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm/armv7m.c')
-rw-r--r-- | hw/arm/armv7m.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 50281f7aa8..c6eab6de30 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -166,14 +166,13 @@ static void armv7m_reset(void *opaque) mem_size is in bytes. Returns the NVIC array. */ -qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, +qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq, const char *kernel_filename, const char *cpu_model) { ARMCPU *cpu; CPUARMState *env; DeviceState *nvic; - /* FIXME: make this local state. */ - static qemu_irq pic[64]; + qemu_irq *pic = g_new(qemu_irq, num_irq); int image_size; uint64_t entry; uint64_t lowaddr; @@ -194,11 +193,12 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, armv7m_bitband_init(); nvic = qdev_create(NULL, "armv7m_nvic"); + qdev_prop_set_uint32(nvic, "num-irq", num_irq); env->nvic = nvic; qdev_init_nofail(nvic); sysbus_connect_irq(SYS_BUS_DEVICE(nvic), 0, qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ)); - for (i = 0; i < 64; i++) { + for (i = 0; i < num_irq; i++) { pic[i] = qdev_get_gpio_in(nvic, i); } |