aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-08-20 15:22:25 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:43:34 -0500
commit2bcbf7e4dd73fb7811ee0899f7a578412d045e81 (patch)
treef11ac060561570f590dee9d09bbcbb7957a903e8
parentcebbe6d4d148c67a3da17ed56cc8b1472cefc117 (diff)
ide: add save/restore support for mmio
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/ide-mmio.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/hw/ide-mmio.c b/hw/ide-mmio.c
index 07b1ccf06f..ba4363049e 100644
--- a/hw/ide-mmio.c
+++ b/hw/ide-mmio.c
@@ -102,6 +102,25 @@ 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;
+}
+
void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2,
qemu_irq irq, int shift,
BlockDriverState *hd0, BlockDriverState *hd1)
@@ -119,5 +138,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);
}