wdt_i6300esb: port to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Juan Quintela 2009-10-14 22:47:04 +02:00 committed by Anthony Liguori
parent b3a7d3287c
commit 95c90a0ef3

View File

@ -369,48 +369,28 @@ static void i6300esb_map(PCIDevice *dev, int region_num,
/* qemu_register_coalesced_mmio (addr, 0x10); ? */ /* qemu_register_coalesced_mmio (addr, 0x10); ? */
} }
static void i6300esb_save(QEMUFile *f, void *vp) static const VMStateDescription vmstate_i6300esb = {
{ .name = "i6300esb_wdt",
I6300State *d = (I6300State *) vp; .version_id = sizeof(I6300State),
.minimum_version_id = sizeof(I6300State),
pci_device_save(&d->dev, f); .minimum_version_id_old = sizeof(I6300State),
qemu_put_be32(f, d->reboot_enabled); .fields = (VMStateField []) {
qemu_put_be32(f, d->clock_scale); VMSTATE_PCI_DEVICE(dev, I6300State),
qemu_put_be32(f, d->int_type); VMSTATE_INT32(reboot_enabled, I6300State),
qemu_put_be32(f, d->free_run); VMSTATE_INT32(clock_scale, I6300State),
qemu_put_be32(f, d->locked); VMSTATE_INT32(int_type, I6300State),
qemu_put_be32(f, d->enabled); VMSTATE_INT32(free_run, I6300State),
qemu_put_timer(f, d->timer); VMSTATE_INT32(locked, I6300State),
qemu_put_be32(f, d->timer1_preload); VMSTATE_INT32(enabled, I6300State),
qemu_put_be32(f, d->timer2_preload); VMSTATE_TIMER(timer, I6300State),
qemu_put_be32(f, d->stage); VMSTATE_UINT32(timer1_preload, I6300State),
qemu_put_be32(f, d->unlock_state); VMSTATE_UINT32(timer2_preload, I6300State),
qemu_put_be32(f, d->previous_reboot_flag); VMSTATE_INT32(stage, I6300State),
} VMSTATE_INT32(unlock_state, I6300State),
VMSTATE_INT32(previous_reboot_flag, I6300State),
static int i6300esb_load(QEMUFile *f, void *vp, int version) VMSTATE_END_OF_LIST()
{ }
I6300State *d = (I6300State *) vp; };
if (version != sizeof (I6300State))
return -EINVAL;
pci_device_load(&d->dev, f);
d->reboot_enabled = qemu_get_be32(f);
d->clock_scale = qemu_get_be32(f);
d->int_type = qemu_get_be32(f);
d->free_run = qemu_get_be32(f);
d->locked = qemu_get_be32(f);
d->enabled = qemu_get_be32(f);
qemu_get_timer(f, d->timer);
d->timer1_preload = qemu_get_be32(f);
d->timer2_preload = qemu_get_be32(f);
d->stage = qemu_get_be32(f);
d->unlock_state = qemu_get_be32(f);
d->previous_reboot_flag = qemu_get_be32(f);
return 0;
}
static int i6300esb_init(PCIDevice *dev) static int i6300esb_init(PCIDevice *dev)
{ {
@ -439,8 +419,7 @@ static int i6300esb_init(PCIDevice *dev)
pci_register_bar(&d->dev, 0, 0x10, pci_register_bar(&d->dev, 0, 0x10,
PCI_ADDRESS_SPACE_MEM, i6300esb_map); PCI_ADDRESS_SPACE_MEM, i6300esb_map);
register_savevm("i6300esb_wdt", -1, sizeof(I6300State), vmstate_register(-1, &vmstate_i6300esb, d);
i6300esb_save, i6300esb_load, d);
return 0; return 0;
} }