diff options
author | Juan Quintela <quintela@redhat.com> | 2009-08-24 18:42:56 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-08-27 20:47:00 -0500 |
commit | 4f335febba2fb237194007ce4906fc78aa998c82 (patch) | |
tree | 71a907de37941ecd6aaf9e1beaa9165a04a3a87a /hw/cirrus_vga.c | |
parent | f3566bf92d4719c8fb05288c5b4bdfd079cfc604 (diff) |
Add pci_cirrus_vga_{save/load} functions, then remove vga.pci_dev use
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/cirrus_vga.c')
-rw-r--r-- | hw/cirrus_vga.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index cefa7d2409..991d1dac43 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -3021,9 +3021,6 @@ static void cirrus_vga_save(QEMUFile *f, void *opaque) { CirrusVGAState *s = opaque; - if (s->vga.pci_dev) - pci_device_save(s->vga.pci_dev, f); - qemu_put_be32s(f, &s->vga.latch); qemu_put_8s(f, &s->vga.sr_index); qemu_put_buffer(f, s->vga.sr, 256); @@ -3062,17 +3059,10 @@ static void cirrus_vga_save(QEMUFile *f, void *opaque) static int cirrus_vga_load(QEMUFile *f, void *opaque, int version_id) { CirrusVGAState *s = opaque; - int ret; if (version_id > 2) return -EINVAL; - if (s->vga.pci_dev && version_id >= 2) { - ret = pci_device_load(s->vga.pci_dev, f); - if (ret < 0) - return ret; - } - qemu_get_be32s(f, &s->vga.latch); qemu_get_8s(f, &s->vga.sr_index); qemu_get_buffer(f, s->vga.sr, 256); @@ -3115,6 +3105,31 @@ static int cirrus_vga_load(QEMUFile *f, void *opaque, int version_id) return 0; } +static void pci_cirrus_vga_save(QEMUFile *f, void *opaque) +{ + PCICirrusVGAState *s = opaque; + + pci_device_save(&s->dev, f); + cirrus_vga_save(f, &s->cirrus_vga); +} + +static int pci_cirrus_vga_load(QEMUFile *f, void *opaque, int version_id) +{ + PCICirrusVGAState *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; + } + + return cirrus_vga_load(f, &s->cirrus_vga, version_id); +} + /*************************************** * * initialize @@ -3231,7 +3246,6 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) qemu_register_reset(cirrus_reset, s); cirrus_reset(s); - register_savevm("cirrus_vga", 0, 2, cirrus_vga_save, cirrus_vga_load, s); } /*************************************** @@ -3251,6 +3265,7 @@ void isa_cirrus_vga_init(void) s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, &s->vga); + register_savevm("cirrus_vga", 0, 2, cirrus_vga_save, cirrus_vga_load, s); /* XXX ISA-LFB support */ } @@ -3312,7 +3327,6 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev) /* setup VGA */ vga_common_init(&s->vga, VGA_RAM_SIZE); cirrus_init_common(s, device_id, 1); - s->vga.pci_dev = dev; s->vga.ds = graphic_console_init(s->vga.update, s->vga.invalidate, s->vga.screen_dump, s->vga.text_update, &s->vga); @@ -3334,6 +3348,7 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev) pci_register_bar((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE, PCI_ADDRESS_SPACE_MEM, cirrus_pci_mmio_map); } + register_savevm("cirrus_vga", 0, 2, pci_cirrus_vga_save, pci_cirrus_vga_load, d); /* XXX: ROM BIOS */ return 0; } |