ide: add save/restore support for isa

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Gerd Hoffmann 2009-08-20 15:22:24 +02:00 committed by Anthony Liguori
parent 3f221c8d02
commit cebbe6d4d1

View File

@ -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);
}