qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 22/26] Add pci_cirrus_vga_{save/load} functions, then remove vga.pci_dev use
Date: Mon, 24 Aug 2009 18:42:56 +0200	[thread overview]
Message-ID: <6af7aacfdace3c84449d2d5ec413205b4778e898.1251131364.git.quintela@redhat.com> (raw)
In-Reply-To: <cover.1251131364.git.quintela@redhat.com>
In-Reply-To: <cover.1251131364.git.quintela@redhat.com>


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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 9bcaa96..16cc054 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 void 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 void 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 */
 }

-- 
1.6.2.5

  parent reply	other threads:[~2009-08-24 16:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24 16:42 [Qemu-devel] [PATCH 00/26] Indirection Cleanup Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 01/26] eepro100: convert casts to DO_UPCAST() Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 02/26] eepro100: cast a void * makes no sense Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 03/26] eepro100: Remove unused indirection of PCIDevice Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 04/26] pci: remove casts from void * Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 05/26] rtl8139: Remove unneeded double indirection of PCIRTL8139State Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 06/26] rtl8139: remove pointless cast from void * Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 07/26] lsi53c895a: " Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 08/26] lsi53c895a: use DO_UPCAST to cast from PCIDevice Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 09/26] lsi53c895a: rename PCIDevice field from pci_dev to dev (consistence) Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 10/26] lsi53c895a: LSIState is a DeviceHost Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 11/26] Introduce vga_common_reset() to be able to typcheck vga_reset() Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 12/26] vga: Rename vga_state -> vga Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 13/26] Everything outside of vga.c should use VGACommonState Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 14/26] usb-ohci: Change casts to DO_UPCAST() for OHCIPCIState Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 15/26] ne2000: remove casts from void * Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 16/26] ne2000: pci_dev has this very value with the right type Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 17/26] ne2000: Change casts to DO_UPCAST() for PCINE2000State Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 18/26] We need PCINE2000State for save/load functions Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 19/26] Add pci_ne2000_{save/load} functions, then remove pci_dev NE2000State field Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 20/26] cirrus_vga: remove pointless cast from void * Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 21/26] cirrus_vga: Change casts to DO_UPCAST() for PCICirrusVGAState Juan Quintela
2009-08-24 16:42 ` Juan Quintela [this message]
2009-08-24 16:42 ` [Qemu-devel] [PATCH 23/26] pcnet: Change casts to DO_UPCAST() for PCIPCNetState Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 24/26] pcnet: remove useless casts This are casts to the very type of the function Juan Quintela
2009-08-24 16:42 ` [Qemu-devel] [PATCH 25/26] pcnet: Add pci_pcnet_{save/load} functions, then remove PCNetState pci_dev field Juan Quintela
2009-08-24 16:43 ` [Qemu-devel] [PATCH 26/26] e1000 cleanup Juan Quintela
2009-08-25  8:22 ` [Qemu-devel] [PATCH 00/26] Indirection Cleanup Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6af7aacfdace3c84449d2d5ec413205b4778e898.1251131364.git.quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).