From patchwork Fri May 14 07:29:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 52572 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 87E4AB7DE0 for ; Fri, 14 May 2010 17:41:52 +1000 (EST) Received: from localhost ([127.0.0.1]:41828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCpWn-0001uZ-3E for incoming@patchwork.ozlabs.org; Fri, 14 May 2010 03:41:49 -0400 Received: from [140.186.70.92] (port=33019 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCpOM-0006w3-A8 for qemu-devel@nongnu.org; Fri, 14 May 2010 03:33:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCpNz-0002eA-IM for qemu-devel@nongnu.org; Fri, 14 May 2010 03:33:05 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:37505) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCpNy-0002cH-Li for qemu-devel@nongnu.org; Fri, 14 May 2010 03:32:43 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id B6EAE1070FF; Fri, 14 May 2010 16:32:35 +0900 (JST) Received: (nullmailer pid 27986 invoked by uid 1000); Fri, 14 May 2010 07:29:24 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org Date: Fri, 14 May 2010 16:29:07 +0900 Message-Id: X-Mailer: git-send-email 1.6.6.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: blauwirbel@gmail.com, yamahata@valinux.co.jp, Paolo Bonzini , kraxel@redhat.com Subject: [Qemu-devel] [PATCH 09/26] pc: remove global variable rtc_state by using qemu_irq. 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 Remove the reference to the global variable, rtc_state, by passing function argument to cmos_init_hd(), cmos_init(). Signed-off-by: Isaku Yamahata Cc: Paolo Bonzini Acked-by: Gerd Hoffmann Cc: Blue Swirl --- Changes v12 -> v13 Blue already converted the CMOS S3 to use qemu_irq by the change set of 53b67b3052f39b049bc7c79ae1ce132c90098c6c. So the patch is simplified. --- hw/pc.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 3b6da4a..c88158c 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -65,8 +65,6 @@ #define MAX_IDE_BUS 2 -static RTCState *rtc_state; - #define E820_NR_ENTRIES 16 struct e820_entry { @@ -207,9 +205,9 @@ static int cmos_get_fd_drive_type(int fd0) return val; } -static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd) +static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd, + RTCState *s) { - RTCState *s = rtc_state; int cylinders, heads, sectors; bdrv_get_geometry_hint(hd, &cylinders, &heads, §ors); rtc_set_memory(s, type_ofs, 47); @@ -273,9 +271,8 @@ static int pc_boot_set(void *opaque, const char *boot_device) /* hd_table must contain 4 block drivers */ static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, const char *boot_device, DriveInfo **hd_table, - FDCtrl *floppy_controller) + FDCtrl *floppy_controller, RTCState *s) { - RTCState *s = rtc_state; int val; int fd0, fd1, nb; int i; @@ -350,9 +347,9 @@ static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, rtc_set_memory(s, 0x12, (hd_table[0] ? 0xf0 : 0) | (hd_table[1] ? 0x0f : 0)); if (hd_table[0]) - cmos_init_hd(0x19, 0x1b, hd_table[0]->bdrv); + cmos_init_hd(0x19, 0x1b, hd_table[0]->bdrv, s); if (hd_table[1]) - cmos_init_hd(0x1a, 0x24, hd_table[1]->bdrv); + cmos_init_hd(0x1a, 0x24, hd_table[1]->bdrv, s); val = 0; for (i = 0; i < 4; i++) { @@ -835,6 +832,7 @@ static void pc_init1(ram_addr_t ram_size, DriveInfo *fd[MAX_FD]; void *fw_cfg; FDCtrl *floppy_controller; + RTCState *rtc_state; PITState *pit; if (ram_size >= 0xe0000000 ) { @@ -1037,7 +1035,7 @@ static void pc_init1(ram_addr_t ram_size, floppy_controller = fdctrl_init_isa(fd); cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd, - floppy_controller); + floppy_controller, rtc_state); if (pci_enabled && usb_enabled) { usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);