diff options
author | Juan Quintela <quintela@redhat.com> | 2009-08-28 15:28:26 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-09-04 09:37:25 -0500 |
commit | 0c7d19e538bd641ae7ff676ac4fb7859a7e673fa (patch) | |
tree | 93b8212ce4ebdf606d116a6ac2ded3cebbdcd975 /hw/piix_pci.c | |
parent | fa3aad24d94a6cf894db52d83f72a399324a17bb (diff) |
i440fx: use new vmstate infrastructure
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/piix_pci.c')
-rw-r--r-- | hw/piix_pci.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/hw/piix_pci.c b/hw/piix_pci.c index a044883c3a..5c337413e6 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -154,21 +154,11 @@ static void i440fx_write_config(PCIDevice *dev, i440fx_update_memory_mappings(d); } -static void i440fx_save(QEMUFile* f, void *opaque) -{ - PCII440FXState *d = opaque; - - pci_device_save(&d->dev, f); - qemu_put_8s(f, &d->smm_enabled); -} - -static int i440fx_load(QEMUFile* f, void *opaque, int version_id) +static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id) { PCII440FXState *d = opaque; int ret, i; - if (version_id > 3) - return -EINVAL; ret = pci_device_load(&d->dev, f); if (ret < 0) return ret; @@ -182,6 +172,28 @@ static int i440fx_load(QEMUFile* f, void *opaque, int version_id) return 0; } +static int i440fx_after_load(void *opaque) +{ + PCII440FXState *d = opaque; + + i440fx_update_memory_mappings(d); + return 0; +} + +static const VMStateDescription vmstate_i440fx = { + .name = "I440FX", + .version_id = 3, + .minimum_version_id = 3, + .minimum_version_id_old = 1, + .load_state_old = i440fx_load_old, + .run_after_load = i440fx_after_load, + .fields = (VMStateField []) { + VMSTATE_PCI_DEVICE(dev, PCII440FXState), + VMSTATE_UINT8(smm_enabled, PCII440FXState), + VMSTATE_END_OF_LIST() + } +}; + static int i440fx_pcihost_initfn(SysBusDevice *dev) { I440FXState *s = FROM_SYSBUS(I440FXState, dev); @@ -210,7 +222,7 @@ static int i440fx_initfn(PCIDevice *dev) d->dev.config[0x72] = 0x02; /* SMRAM */ - register_savevm("I440FX", 0, 3, i440fx_save, i440fx_load, d); + vmstate_register(0, &vmstate_i440fx, d); return 0; } |