diff options
author | Juan Quintela <quintela@redhat.com> | 2009-09-10 03:04:41 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-09-11 11:10:08 -0500 |
commit | 3c619b5975d68bb07b2e7274b2f8068b11acd772 (patch) | |
tree | 2bc4b8b40a8f81579929aa151a8ccd045e3763f4 /hw/pckbd.c | |
parent | bcb58d9ac97b2bbb73711e071c75772b43d23def (diff) | |
download | qemu-3c619b5975d68bb07b2e7274b2f8068b11acd772.zip qemu-3c619b5975d68bb07b2e7274b2f8068b11acd772.tar.gz qemu-3c619b5975d68bb07b2e7274b2f8068b11acd772.tar.bz2 |
vmstate: port pckbd device
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/pckbd.c')
-rw-r--r-- | hw/pckbd.c | 39 |
1 files changed, 15 insertions, 24 deletions
@@ -339,28 +339,19 @@ static void kbd_reset(void *opaque) s->status = KBD_STAT_CMD | KBD_STAT_UNLOCKED; } -static void kbd_save(QEMUFile* f, void* opaque) -{ - KBDState *s = (KBDState*)opaque; - - qemu_put_8s(f, &s->write_cmd); - qemu_put_8s(f, &s->status); - qemu_put_8s(f, &s->mode); - qemu_put_8s(f, &s->pending); -} - -static int kbd_load(QEMUFile* f, void* opaque, int version_id) -{ - KBDState *s = (KBDState*)opaque; - - if (version_id != 3) - return -EINVAL; - qemu_get_8s(f, &s->write_cmd); - qemu_get_8s(f, &s->status); - qemu_get_8s(f, &s->mode); - qemu_get_8s(f, &s->pending); - return 0; -} +static const VMStateDescription vmstate_kbd = { + .name = "pckbd", + .version_id = 3, + .minimum_version_id = 3, + .minimum_version_id_old = 3, + .fields = (VMStateField []) { + VMSTATE_UINT8(write_cmd, KBDState), + VMSTATE_UINT8(status, KBDState), + VMSTATE_UINT8(mode, KBDState), + VMSTATE_UINT8(pending, KBDState), + VMSTATE_END_OF_LIST() + } +}; /* Memory mapped interface */ static uint32_t kbd_mm_readb (void *opaque, target_phys_addr_t addr) @@ -407,7 +398,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, s->mask = mask; kbd_reset(s); - register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s); + vmstate_register(0, &vmstate_kbd, s); s_io_memory = cpu_register_io_memory(kbd_mm_read, kbd_mm_write, s); cpu_register_physical_memory(base, size, s_io_memory); @@ -432,7 +423,7 @@ static int i8042_initfn(ISADevice *dev) isa_init_irq(dev, &s->irq_mouse, 12); kbd_reset(s); - register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s); + vmstate_register(0, &vmstate_kbd, s); register_ioport_read(0x60, 1, 1, kbd_read_data, s); register_ioport_write(0x60, 1, 1, kbd_write_data, s); register_ioport_read(0x64, 1, 1, kbd_read_status, s); |