aboutsummaryrefslogtreecommitdiff
path: root/hw/cirrus_vga.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-08-17 10:44:00 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-08-17 10:44:00 +0000
commitd2269f6f64e1b707fc8ea5d43102589c03dd090e (patch)
tree3fffa8215aabd3edba3d2ba82446fdeee93aa4e3 /hw/cirrus_vga.c
parentdfd92d3a46c31b17fcdbd735c6f88de54bc6bd3f (diff)
downloadqemu-d2269f6f64e1b707fc8ea5d43102589c03dd090e.zip
qemu-d2269f6f64e1b707fc8ea5d43102589c03dd090e.tar.gz
qemu-d2269f6f64e1b707fc8ea5d43102589c03dd090e.tar.bz2
save VGA PCI state
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2113 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/cirrus_vga.c')
-rw-r--r--hw/cirrus_vga.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index d186d79..94163e5 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -2905,6 +2905,9 @@ static void cirrus_vga_save(QEMUFile *f, void *opaque)
{
CirrusVGAState *s = opaque;
+ if (s->pci_dev)
+ pci_device_save(s->pci_dev, f);
+
qemu_put_be32s(f, &s->latch);
qemu_put_8s(f, &s->sr_index);
qemu_put_buffer(f, s->sr, 256);
@@ -2943,10 +2946,17 @@ 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 != 1)
+ if (version_id > 2)
return -EINVAL;
+ if (s->pci_dev && version_id >= 2) {
+ ret = pci_device_load(s->pci_dev, f);
+ if (ret < 0)
+ return ret;
+ }
+
qemu_get_be32s(f, &s->latch);
qemu_get_8s(f, &s->sr_index);
qemu_get_buffer(f, s->sr, 256);
@@ -3100,7 +3110,7 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci)
s->cursor_invalidate = cirrus_cursor_invalidate;
s->cursor_draw_line = cirrus_cursor_draw_line;
- register_savevm("cirrus_vga", 0, 1, cirrus_vga_save, cirrus_vga_load, s);
+ register_savevm("cirrus_vga", 0, 2, cirrus_vga_save, cirrus_vga_load, s);
}
/***************************************
@@ -3178,6 +3188,7 @@ void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
vga_common_init((VGAState *)s,
ds, vga_ram_base, vga_ram_offset, vga_ram_size);
cirrus_init_common(s, device_id, 1);
+ s->pci_dev = (PCIDevice *)d;
/* setup memory space */
/* memory #0 LFB */