From patchwork Wed Oct 14 17:34:58 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 36007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 69BDCB7E39 for ; Thu, 15 Oct 2009 04:49:22 +1100 (EST) Received: from localhost ([127.0.0.1]:60779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1My7yP-0004um-5D for incoming@patchwork.ozlabs.org; Wed, 14 Oct 2009 13:49:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1My7lP-0002Na-OB for qemu-devel@nongnu.org; Wed, 14 Oct 2009 13:35:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1My7lJ-0002JN-9H for qemu-devel@nongnu.org; Wed, 14 Oct 2009 13:35:49 -0400 Received: from [199.232.76.173] (port=55248 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1My7lJ-0002JC-0M for qemu-devel@nongnu.org; Wed, 14 Oct 2009 13:35:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22030) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1My7lI-0008NJ-Fn for qemu-devel@nongnu.org; Wed, 14 Oct 2009 13:35:44 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9EHZhT7011490 for ; Wed, 14 Oct 2009 13:35:43 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9EHZXFs001016; Wed, 14 Oct 2009 13:35:42 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Oct 2009 19:34:58 +0200 Message-Id: <2606ee19eaea580f790b316255f3e2c1da1b4baf.1255541443.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 07/16] vga: port vga-pci to vmstate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- hw/vga-pci.c | 34 +++++++++++----------------------- 1 files changed, 11 insertions(+), 23 deletions(-) diff --git a/hw/vga-pci.c b/hw/vga-pci.c index 5e75938..1edfdee 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);