diff options
author | Juan Quintela <quintela@redhat.com> | 2009-08-28 15:28:27 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-09-04 09:37:26 -0500 |
commit | d1f171bd3a53ef2c6710b9905e270ad958e36932 (patch) | |
tree | f69e1b2d2f207f90479c164d7bf38a0576cf193e /hw/piix_pci.c | |
parent | 0c7d19e538bd641ae7ff676ac4fb7859a7e673fa (diff) |
piix3: 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 | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/hw/piix_pci.c b/hw/piix_pci.c index 5c337413e6..ef3463b789 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -317,33 +317,17 @@ static void piix3_reset(void *opaque) memset(d->pci_irq_levels, 0, sizeof(d->pci_irq_levels)); } -static void piix3_save(QEMUFile* f, void *opaque) -{ - PIIX3State *d = opaque; - int i; - - pci_device_save(&d->dev, f); - - for (i = 0; i < 4; i++) - qemu_put_be32(f, d->pci_irq_levels[i]); -} - -static int piix3_load(QEMUFile* f, void *opaque, int version_id) -{ - PIIX3State *d = opaque; - int i, ret; - - if (version_id > 3 || version_id < 2) - return -EINVAL; - ret = pci_device_load(&d->dev, f); - if (ret < 0) - return ret; - if (version_id >= 3) { - for (i = 0; i < 4; i++) - d->pci_irq_levels[i] = qemu_get_be32(f); +static const VMStateDescription vmstate_piix3 = { + .name = "PIIX3", + .version_id = 3, + .minimum_version_id = 2, + .minimum_version_id_old = 2, + .fields = (VMStateField []) { + VMSTATE_PCI_DEVICE(dev, PIIX3State), + VMSTATE_INT32_ARRAY_V(pci_irq_levels, PIIX3State, 4, 3), + VMSTATE_END_OF_LIST() } - return 0; -} +}; static int piix3_initfn(PCIDevice *dev) { @@ -351,7 +335,7 @@ static int piix3_initfn(PCIDevice *dev) uint8_t *pci_conf; isa_bus_new(&d->dev.qdev); - register_savevm("PIIX3", 0, 3, piix3_save, piix3_load, d); + vmstate_register(0, &vmstate_piix3, d); pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL); |