aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-10-07 18:58:25 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-27 12:28:46 -0500
commit24daf35cc922b685d4718f76ce9f98f1b0679c63 (patch)
treeccfab2a870d186c2ea1de494bc1c0acb2dfb2849
parent0ce51e92bc2a92e43820f413adf7adc98768bfa3 (diff)
downloadqemu-24daf35cc922b685d4718f76ce9f98f1b0679c63.zip
qemu-24daf35cc922b685d4718f76ce9f98f1b0679c63.tar.gz
qemu-24daf35cc922b685d4718f76ce9f98f1b0679c63.tar.bz2
ide: port ide mmio to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/ide/mmio.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c
index 8c1ee04..84a20e5 100644
--- a/hw/ide/mmio.c
+++ b/hw/ide/mmio.c
@@ -99,24 +99,17 @@ static CPUWriteMemoryFunc * const mmio_ide_cmd[] = {
mmio_ide_cmd_write,
};
-static void mmio_ide_save(QEMUFile* f, void *opaque)
-{
- MMIOState *s = opaque;
-
- idebus_save(f, &s->bus);
- ide_save(f, &s->bus.ifs[0]);
- ide_save(f, &s->bus.ifs[1]);
-}
-
-static int mmio_ide_load(QEMUFile* f, void *opaque, int version_id)
-{
- MMIOState *s = opaque;
-
- idebus_load(f, &s->bus, version_id);
- ide_load(f, &s->bus.ifs[0], version_id);
- ide_load(f, &s->bus.ifs[1], version_id);
- return 0;
-}
+static const VMStateDescription vmstate_ide_mmio = {
+ .name = "mmio-ide",
+ .version_id = 3,
+ .minimum_version_id = 0,
+ .minimum_version_id_old = 0,
+ .fields = (VMStateField []) {
+ VMSTATE_IDE_BUS(bus, MMIOState),
+ VMSTATE_IDE_DRIVES(bus.ifs, MMIOState),
+ VMSTATE_END_OF_LIST()
+ }
+};
void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2,
qemu_irq irq, int shift,
@@ -133,6 +126,6 @@ void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2,
mem2 = cpu_register_io_memory(mmio_ide_status, mmio_ide_cmd, s);
cpu_register_physical_memory(membase, 16 << shift, mem1);
cpu_register_physical_memory(membase2, 2 << shift, mem2);
- register_savevm("mmio-ide", 0, 3, mmio_ide_save, mmio_ide_load, s);
+ vmstate_register(0, &vmstate_ide_mmio, s);
}