aboutsummaryrefslogtreecommitdiff
path: root/hw/ide
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-10-07 19:01:50 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-27 12:28:46 -0500
commit200ab5e26a2ecfd69b6d52ebd2cc2e3e205a66cb (patch)
tree337d318c86f05e7fc47f2f12497c95277b8ac09f /hw/ide
parent24daf35cc922b685d4718f76ce9f98f1b0679c63 (diff)
ide: port isa ide to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/ide')
-rw-r--r--hw/ide/isa.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 9f0fdd6498..fe67bcdf7c 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -44,24 +44,17 @@ typedef struct ISAIDEState {
qemu_irq irq;
} ISAIDEState;
-static void isa_ide_save(QEMUFile* f, void *opaque)
-{
- ISAIDEState *s = opaque;
-
- idebus_save(f, &s->bus);
- ide_save(f, &s->bus.ifs[0]);
- ide_save(f, &s->bus.ifs[1]);
-}
-
-static int isa_ide_load(QEMUFile* f, void *opaque, int version_id)
-{
- ISAIDEState *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_isa = {
+ .name = "isa-ide",
+ .version_id = 3,
+ .minimum_version_id = 0,
+ .minimum_version_id_old = 0,
+ .fields = (VMStateField []) {
+ VMSTATE_IDE_BUS(bus, ISAIDEState),
+ VMSTATE_IDE_DRIVES(bus.ifs, ISAIDEState),
+ VMSTATE_END_OF_LIST()
+ }
+};
static int isa_ide_initfn(ISADevice *dev)
{
@@ -71,7 +64,7 @@ static int isa_ide_initfn(ISADevice *dev)
ide_init_ioport(&s->bus, s->iobase, s->iobase2);
isa_init_irq(dev, &s->irq, s->isairq);
ide_init2(&s->bus, NULL, NULL, s->irq);
- register_savevm("isa-ide", 0, 3, isa_ide_save, isa_ide_load, s);
+ vmstate_register(0, &vmstate_ide_isa, s);
return 0;
};