From cebbe6d4d148c67a3da17ed56cc8b1472cefc117 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 20 Aug 2009 15:22:24 +0200 Subject: ide: add save/restore support for isa Signed-off-by: Gerd Hoffmann Signed-off-by: Anthony Liguori --- hw/ide-isa.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'hw') diff --git a/hw/ide-isa.c b/hw/ide-isa.c index 705c24d..279474b 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); } -- cgit v1.1