Remove ARM NVIC initialization hack
authorPaul Brook <paul@codesourcery.com>
Thu, 4 Jun 2009 12:12:05 +0000 (13:12 +0100)
committerPaul Brook <paul@codesourcery.com>
Thu, 4 Jun 2009 12:12:05 +0000 (13:12 +0100)
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
hw/armv7m_nvic.c

index 9657ed1..c3c5b9e 100644 (file)
@@ -198,7 +198,7 @@ qemu_irq *armv7m_init(int flash_size, int sram_size,
     armv7m_bitband_init();
 
     nvic = qdev_create(NULL, "armv7m_nvic");
-    qdev_set_prop_ptr(nvic, "cpu", env);
+    env->v7m.nvic = nvic;
     qdev_init(nvic);
     cpu_pic = arm_pic_init_cpu(env);
     sysbus_connect_irq(sysbus_from_qdev(nvic), 0, cpu_pic[ARM_PIC_CPU_IRQ]);
index 2a948ac..f789c78 100644 (file)
@@ -393,15 +393,10 @@ static int nvic_load(QEMUFile *f, void *opaque, int version_id)
 static void armv7m_nvic_init(SysBusDevice *dev)
 {
     nvic_state *s= FROM_SYSBUSGIC(nvic_state, dev);
-    CPUState *env;
 
-    env = qdev_get_prop_ptr(&dev->qdev, "cpu");
     gic_init(&s->gic);
     cpu_register_physical_memory(0xe000e000, 0x1000, s->gic.iomemtype);
     s->systick.timer = qemu_new_timer(vm_clock, systick_timer_tick, s);
-    if (env->v7m.nvic)
-        hw_error("CPU can only have one NVIC\n");
-    env->v7m.nvic = s;
     register_savevm("armv7m_nvic", -1, 1, nvic_save, nvic_load, s);
 }