From patchwork Thu Aug 20 13:22:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 31735 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 93A5EB70CF for ; Thu, 20 Aug 2009 23:44:49 +1000 (EST) Received: from localhost ([127.0.0.1]:43670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Me7wZ-000464-Rz for incoming@patchwork.ozlabs.org; Thu, 20 Aug 2009 09:44:43 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Me7bh-0006s7-VS for qemu-devel@nongnu.org; Thu, 20 Aug 2009 09:23:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Me7bc-0006q3-6Q for qemu-devel@nongnu.org; Thu, 20 Aug 2009 09:23:08 -0400 Received: from [199.232.76.173] (port=34899 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Me7bc-0006pz-1w for qemu-devel@nongnu.org; Thu, 20 Aug 2009 09:23:04 -0400 Received: from mx20.gnu.org ([199.232.41.8]:42822) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Me7bb-0001Dc-Fm for qemu-devel@nongnu.org; Thu, 20 Aug 2009 09:23:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Me7ba-0003Bi-BE for qemu-devel@nongnu.org; Thu, 20 Aug 2009 09:23:02 -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 n7KDN19N010067 for ; Thu, 20 Aug 2009 09:23:01 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7KDN0gi006392; Thu, 20 Aug 2009 09:23:00 -0400 Received: from zweiblum.home.kraxel.org (vpn2-8-125.ams2.redhat.com [10.36.8.125]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with SMTP id n7KDMlsS008288; Thu, 20 Aug 2009 09:22:49 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id D678D700E0; Thu, 20 Aug 2009 15:22:27 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 20 Aug 2009 15:22:25 +0200 Message-Id: <1250774546-18951-10-git-send-email-kraxel@redhat.com> In-Reply-To: <1250774546-18951-1-git-send-email-kraxel@redhat.com> References: <1250774546-18951-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-Detected-Operating-System: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 09/10] ide: add save/restore support for mmio 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: Gerd Hoffmann --- hw/ide-mmio.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/hw/ide-mmio.c b/hw/ide-mmio.c index e76c5ec..6df0da0 100644 --- a/hw/ide-mmio.c +++ b/hw/ide-mmio.c @@ -102,6 +102,25 @@ static CPUWriteMemoryFunc *mmio_ide_cmd[] = { mmio_ide_cmd_write, }; +static void mmio_ide_save(QEMUFile* f, void *opaque) +{ + MMIOState *s = opaque; + + idebus_save(f, s->bus); + ide_save(f, &s->bus->ifs[0]); + ide_save(f, &s->bus->ifs[1]); +} + +static int mmio_ide_load(QEMUFile* f, void *opaque, int version_id) +{ + MMIOState *s = opaque; + + idebus_load(f, s->bus, version_id); + ide_load(f, &s->bus->ifs[0], version_id); + ide_load(f, &s->bus->ifs[1], version_id); + return 0; +} + void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2, qemu_irq irq, int shift, BlockDriverState *hd0, BlockDriverState *hd1) @@ -119,5 +138,6 @@ void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2, mem2 = cpu_register_io_memory(mmio_ide_status, mmio_ide_cmd, s); cpu_register_physical_memory(membase, 16 << shift, mem1); cpu_register_physical_memory(membase2, 2 << shift, mem2); + register_savevm("mmio-ide", 0, 3, mmio_ide_save, mmio_ide_load, s); }