aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-10-14 15:42:44 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-27 12:28:55 -0500
commita4f9631ceed50ada61cb70248ce34917e3b34c56 (patch)
tree4e71b6ace4ff42b539e3f081b00246ad52b280fe /hw
parentf74599c49931700fefc865b076876101ce7745e1 (diff)
vga: port vga-pci to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/vga-pci.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 5e75938f94..1edfdeefed 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -34,29 +34,17 @@ typedef struct PCIVGAState {
VGACommonState vga;
} PCIVGAState;
-static void pci_vga_save(QEMUFile *f, void *opaque)
-{
- PCIVGAState *s = opaque;
-
- pci_device_save(&s->dev, f);
- vga_common_save(f, &s->vga);
-}
-
-static int pci_vga_load(QEMUFile *f, void *opaque, int version_id)
-{
- PCIVGAState *s = opaque;
- int ret;
-
- if (version_id > 2)
- return -EINVAL;
-
- if (version_id >= 2) {
- ret = pci_device_load(&s->dev, f);
- if (ret < 0)
- return ret;
+static const VMStateDescription vmstate_vga_pci = {
+ .name = "vga",
+ .version_id = 2,
+ .minimum_version_id = 2,
+ .minimum_version_id_old = 2,
+ .fields = (VMStateField []) {
+ VMSTATE_PCI_DEVICE(dev, PCIVGAState),
+ VMSTATE_STRUCT(vga, PCIVGAState, 0, vmstate_vga_common, VGACommonState),
+ VMSTATE_END_OF_LIST()
}
- return vga_common_load(f, &s->vga, version_id);
-}
+};
static void vga_map(PCIDevice *pci_dev, int region_num,
uint32_t addr, uint32_t size, int type)
@@ -93,7 +81,7 @@ static int pci_vga_initfn(PCIDevice *dev)
// vga + console init
vga_common_init(s, VGA_RAM_SIZE);
vga_init(s);
- register_savevm("vga", 0, 2, pci_vga_save, pci_vga_load, d);
+ vmstate_register(0, &vmstate_vga_pci, d);
s->ds = graphic_console_init(s->update, s->invalidate,
s->screen_dump, s->text_update, s);