summaryrefslogtreecommitdiffstats
path: root/hw/ide-isa.c
diff options
context:
space:
mode:
authorGerd Hoffmann2009-08-20 15:22:24 +0200
committerAnthony Liguori2009-08-28 03:43:34 +0200
commitcebbe6d4d148c67a3da17ed56cc8b1472cefc117 (patch)
treea9642c162bf126e1aa16e5938f3abd0d40b0706e /hw/ide-isa.c
parentide: split away ide-microdrive.c (diff)
downloadqemu-cebbe6d4d148c67a3da17ed56cc8b1472cefc117.tar.gz
qemu-cebbe6d4d148c67a3da17ed56cc8b1472cefc117.tar.xz
qemu-cebbe6d4d148c67a3da17ed56cc8b1472cefc117.zip
ide: add save/restore support for isa
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/ide-isa.c')
-rw-r--r--hw/ide-isa.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/hw/ide-isa.c b/hw/ide-isa.c
index 705c24d670..279474b30e 100644
--- a/hw/ide-isa.c
+++ b/hw/ide-isa.c
@@ -33,13 +33,38 @@
/***********************************************************/
/* ISA IDE definitions */
+typedef struct ISAIDEState {
+ IDEBus *bus;
+} 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;
+}
+
void isa_ide_init(int iobase, int iobase2, qemu_irq irq,
BlockDriverState *hd0, BlockDriverState *hd1)
{
- IDEBus *bus;
+ ISAIDEState *s;
- bus = qemu_mallocz(sizeof(*bus));
+ s = qemu_mallocz(sizeof(*s));
+ s->bus = qemu_mallocz(sizeof(IDEBus));
- ide_init2(bus, hd0, hd1, irq);
- ide_init_ioport(bus, iobase, iobase2);
+ ide_init2(s->bus, hd0, hd1, irq);
+ ide_init_ioport(s->bus, iobase, iobase2);
+ register_savevm("isa-ide", 0, 3, isa_ide_save, isa_ide_load, s);
}