From patchwork Thu Aug 20 13:22:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 31731 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 824D9B7099 for ; Thu, 20 Aug 2009 23:36:24 +1000 (EST) Received: from localhost ([127.0.0.1]:50085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Me7oR-0001rI-Bw for incoming@patchwork.ozlabs.org; Thu, 20 Aug 2009 09:36:19 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Me7bZ-0006oH-39 for qemu-devel@nongnu.org; Thu, 20 Aug 2009 09:23:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Me7bU-0006md-Nv for qemu-devel@nongnu.org; Thu, 20 Aug 2009 09:23:00 -0400 Received: from [199.232.76.173] (port=34895 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Me7bU-0006mM-F0 for qemu-devel@nongnu.org; Thu, 20 Aug 2009 09:22:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19342) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Me7bT-0001B2-RI for qemu-devel@nongnu.org; Thu, 20 Aug 2009 09:22:56 -0400 Received: from int-mx07.intmail.prod.int.phx2.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7KDMsCt013672 for ; Thu, 20 Aug 2009 09:22:54 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx07.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7KDMrT5030339; Thu, 20 Aug 2009 09:22:53 -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 n7KDMgPf008282; Thu, 20 Aug 2009 09:22:47 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id CF7D1700DF; Thu, 20 Aug 2009 15:22:27 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 20 Aug 2009 15:22:24 +0200 Message-Id: <1250774546-18951-9-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.20 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 08/10] ide: add save/restore support for isa 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-isa.c | 33 +++++++++++++++++++++++++++++---- 1 files changed, 29 insertions(+), 4 deletions(-) diff --git a/hw/ide-isa.c b/hw/ide-isa.c index 705c24d..279474b 100644 --- a/hw/ide-isa.c +++ b/hw/ide-isa.c @@ -33,13 +33,38 @@ /***********************************************************/ /* ISA IDE definitions */ +typedef struct ISAIDEState { + IDEBus *bus; +} ISAIDEState; + +static void isa_ide_save(QEMUFile* f, void *opaque) +{ + ISAIDEState *s = opaque; + + idebus_save(f, s->bus); + ide_save(f, &s->bus->ifs[0]); + ide_save(f, &s->bus->ifs[1]); +} + +static int isa_ide_load(QEMUFile* f, void *opaque, int version_id) +{ + ISAIDEState *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 isa_ide_init(int iobase, int iobase2, qemu_irq irq, BlockDriverState *hd0, BlockDriverState *hd1) { - IDEBus *bus; + ISAIDEState *s; - bus = qemu_mallocz(sizeof(*bus)); + s = qemu_mallocz(sizeof(*s)); + s->bus = qemu_mallocz(sizeof(IDEBus)); - ide_init2(bus, hd0, hd1, irq); - ide_init_ioport(bus, iobase, iobase2); + ide_init2(s->bus, hd0, hd1, irq); + ide_init_ioport(s->bus, iobase, iobase2); + register_savevm("isa-ide", 0, 3, isa_ide_save, isa_ide_load, s); }