Commit bdb11366b9370e97fb436444c697c01fe839dc11

Authored by Paul Brook
1 parent f3d08ee6

Remove ARM NVIC initialization hack

The ARMv7-M NVIC device pokes itself into the CPU state.  Now we have a
proper device model we can have the CPU/SoC code do this.

Signed-off-by: Paul Brook <paul@codesourcery.com>
hw/armv7m.c
@@ -198,7 +198,7 @@ qemu_irq *armv7m_init(int flash_size, int sram_size, @@ -198,7 +198,7 @@ qemu_irq *armv7m_init(int flash_size, int sram_size,
198 armv7m_bitband_init(); 198 armv7m_bitband_init();
199 199
200 nvic = qdev_create(NULL, "armv7m_nvic"); 200 nvic = qdev_create(NULL, "armv7m_nvic");
201 - qdev_set_prop_ptr(nvic, "cpu", env); 201 + env->v7m.nvic = nvic;
202 qdev_init(nvic); 202 qdev_init(nvic);
203 cpu_pic = arm_pic_init_cpu(env); 203 cpu_pic = arm_pic_init_cpu(env);
204 sysbus_connect_irq(sysbus_from_qdev(nvic), 0, cpu_pic[ARM_PIC_CPU_IRQ]); 204 sysbus_connect_irq(sysbus_from_qdev(nvic), 0, cpu_pic[ARM_PIC_CPU_IRQ]);
hw/armv7m_nvic.c
@@ -393,15 +393,10 @@ static int nvic_load(QEMUFile *f, void *opaque, int version_id) @@ -393,15 +393,10 @@ static int nvic_load(QEMUFile *f, void *opaque, int version_id)
393 static void armv7m_nvic_init(SysBusDevice *dev) 393 static void armv7m_nvic_init(SysBusDevice *dev)
394 { 394 {
395 nvic_state *s= FROM_SYSBUSGIC(nvic_state, dev); 395 nvic_state *s= FROM_SYSBUSGIC(nvic_state, dev);
396 - CPUState *env;  
397 396
398 - env = qdev_get_prop_ptr(&dev->qdev, "cpu");  
399 gic_init(&s->gic); 397 gic_init(&s->gic);
400 cpu_register_physical_memory(0xe000e000, 0x1000, s->gic.iomemtype); 398 cpu_register_physical_memory(0xe000e000, 0x1000, s->gic.iomemtype);
401 s->systick.timer = qemu_new_timer(vm_clock, systick_timer_tick, s); 399 s->systick.timer = qemu_new_timer(vm_clock, systick_timer_tick, s);
402 - if (env->v7m.nvic)  
403 - hw_error("CPU can only have one NVIC\n");  
404 - env->v7m.nvic = s;  
405 register_savevm("armv7m_nvic", -1, 1, nvic_save, nvic_load, s); 400 register_savevm("armv7m_nvic", -1, 1, nvic_save, nvic_load, s);
406 } 401 }
407 402