vmstate: port armv7m nvic
Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
02b6875795
commit
0797226c56
|
@ -365,30 +365,19 @@ static void nvic_writel(void *opaque, uint32_t offset, uint32_t value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvic_save(QEMUFile *f, void *opaque)
|
static const VMStateDescription vmstate_nvic = {
|
||||||
{
|
.name = "armv7m_nvic",
|
||||||
nvic_state *s = (nvic_state *)opaque;
|
.version_id = 1,
|
||||||
|
.minimum_version_id = 1,
|
||||||
qemu_put_be32(f, s->systick.control);
|
.minimum_version_id_old = 1,
|
||||||
qemu_put_be32(f, s->systick.reload);
|
.fields = (VMStateField[]) {
|
||||||
qemu_put_be64(f, s->systick.tick);
|
VMSTATE_UINT32(systick.control, nvic_state),
|
||||||
qemu_put_timer(f, s->systick.timer);
|
VMSTATE_UINT32(systick.reload, nvic_state),
|
||||||
}
|
VMSTATE_INT64(systick.tick, nvic_state),
|
||||||
|
VMSTATE_TIMER(systick.timer, nvic_state),
|
||||||
static int nvic_load(QEMUFile *f, void *opaque, int version_id)
|
VMSTATE_END_OF_LIST()
|
||||||
{
|
}
|
||||||
nvic_state *s = (nvic_state *)opaque;
|
};
|
||||||
|
|
||||||
if (version_id != 1)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
s->systick.control = qemu_get_be32(f);
|
|
||||||
s->systick.reload = qemu_get_be32(f);
|
|
||||||
s->systick.tick = qemu_get_be64(f);
|
|
||||||
qemu_get_timer(f, s->systick.timer);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int armv7m_nvic_init(SysBusDevice *dev)
|
static int armv7m_nvic_init(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
|
@ -397,7 +386,7 @@ static int armv7m_nvic_init(SysBusDevice *dev)
|
||||||
gic_init(&s->gic);
|
gic_init(&s->gic);
|
||||||
cpu_register_physical_memory(0xe000e000, 0x1000, s->gic.iomemtype);
|
cpu_register_physical_memory(0xe000e000, 0x1000, s->gic.iomemtype);
|
||||||
s->systick.timer = qemu_new_timer_ns(vm_clock, systick_timer_tick, s);
|
s->systick.timer = qemu_new_timer_ns(vm_clock, systick_timer_tick, s);
|
||||||
register_savevm(&dev->qdev, "armv7m_nvic", -1, 1, nvic_save, nvic_load, s);
|
vmstate_register(&dev->qdev, -1, &vmstate_nvic, s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue