From patchwork Fri Feb 22 04:15:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liguang X-Patchwork-Id: 222461 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 179FD2C0299 for ; Fri, 22 Feb 2013 15:16:00 +1100 (EST) Received: from localhost ([::1]:38392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8k3C-0006gs-47 for incoming@patchwork.ozlabs.org; Thu, 21 Feb 2013 23:15:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8k2n-0006WG-IY for qemu-devel@nongnu.org; Thu, 21 Feb 2013 23:15:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8k2l-0005Uj-FL for qemu-devel@nongnu.org; Thu, 21 Feb 2013 23:15:33 -0500 Received: from [222.73.24.84] (port=18986 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8k2l-0005Tf-1p for qemu-devel@nongnu.org; Thu, 21 Feb 2013 23:15:31 -0500 X-IronPort-AV: E=Sophos;i="4.84,713,1355068800"; d="scan'208";a="6747013" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 22 Feb 2013 12:12:57 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r1M4FG55017354 for ; Fri, 22 Feb 2013 12:15:16 +0800 Received: from liguang.fnst.cn.fujitsu.com ([10.167.225.128]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013022212143313-334888 ; Fri, 22 Feb 2013 12:14:33 +0800 From: liguang To: qemu-devel@nongnu.org Date: Fri, 22 Feb 2013 12:15:28 +0800 Message-Id: <1361506533-28463-2-git-send-email-lig.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1361506533-28463-1-git-send-email-lig.fnst@cn.fujitsu.com> References: <1361506533-28463-1-git-send-email-lig.fnst@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/02/22 12:14:33, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/02/22 12:14:33, Serialize complete at 2013/02/22 12:14:33 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Cc: liguang Subject: [Qemu-devel] [PATCH v2 1/6] pc/bios: move common BIOS_CFG_IOPORT into fw_cfg.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org BIOS_CFG_IOPORT are commonly used, so move it to fw_cfg.h bochs_bios_init seems misleading, bios may be seabios, seabios is not only for bochs, and also we are in qemu. Signed-off-by: liguang --- hw/fw_cfg.h | 4 ++++ hw/pc.c | 9 ++++----- hw/sun4u.c | 3 +-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h index 05c8df1..6b3147d 100644 --- a/hw/fw_cfg.h +++ b/hw/fw_cfg.h @@ -38,6 +38,10 @@ #define FW_CFG_INVALID 0xffff +#define FW_CFG_CTL_IOPORT 0x510 +#define FW_CFG_DATA_IOPORT 0x511 + + #ifndef NO_QEMU_PROTOS typedef struct FWCfgFile { uint32_t size; /* file size */ diff --git a/hw/pc.c b/hw/pc.c index 34b6dff..d010c75 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -64,7 +64,6 @@ /* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables. */ #define ACPI_DATA_SIZE 0x10000 -#define BIOS_CFG_IOPORT 0x510 #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1) #define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2) @@ -556,14 +555,14 @@ int e820_add_entry(uint64_t address, uint64_t length, uint32_t type) * This function returns the limit for the APIC ID value, so that all * CPU APIC IDs are < pc_apic_id_limit(). * - * This is used for FW_CFG_MAX_CPUS. See comments on bochs_bios_init(). + * This is used for FW_CFG_MAX_CPUS. See comments on bios_init(). */ static unsigned int pc_apic_id_limit(unsigned int max_cpus) { return x86_cpu_apic_id_from_index(max_cpus - 1) + 1; } -static void *bochs_bios_init(void) +static void *bios_init(void) { void *fw_cfg; uint8_t *smbios_table; @@ -572,7 +571,7 @@ static void *bochs_bios_init(void) int i, j; unsigned int apic_id_limit = pc_apic_id_limit(max_cpus); - fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); + fw_cfg = fw_cfg_init(FW_CFG_CTL_IOPORT, FW_CFG_DATA_IOPORT, 0, 0); /* FW_CFG_MAX_CPUS is a bit confusing/problematic on x86: * * SeaBIOS needs FW_CFG_MAX_CPUS for CPU hotplug, but the CPU hotplug @@ -954,7 +953,7 @@ void *pc_memory_init(MemoryRegion *system_memory, option_rom_mr, 1); - fw_cfg = bochs_bios_init(); + fw_cfg = bios_init(); rom_set_fw(fw_cfg); if (linux_boot) { diff --git a/hw/sun4u.c b/hw/sun4u.c index 9fbda29..1bdc443 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -76,7 +76,6 @@ #define PROM_FILENAME "openbios-sparc64" #define NVRAM_SIZE 0x2000 #define MAX_IDE_BUS 2 -#define BIOS_CFG_IOPORT 0x510 #define FW_CFG_SPARC64_WIDTH (FW_CFG_ARCH_LOCAL + 0x00) #define FW_CFG_SPARC64_HEIGHT (FW_CFG_ARCH_LOCAL + 0x01) #define FW_CFG_SPARC64_DEPTH (FW_CFG_ARCH_LOCAL + 0x02) @@ -877,7 +876,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, graphic_width, graphic_height, graphic_depth, (uint8_t *)&nd_table[0].macaddr); - fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); + fw_cfg = fw_cfg_init(FW_CFG_CTL_IOPORT, FW_CFG_DATA_IOPORT, 0, 0); fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);