From patchwork Mon Oct 26 11:18: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: 36900 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 6D3AAB7BE2 for ; Mon, 26 Oct 2009 22:52:25 +1100 (EST) Received: from localhost ([127.0.0.1]:33740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N2O7a-0000K9-5H for incoming@patchwork.ozlabs.org; Mon, 26 Oct 2009 07:52:22 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N2O74-0000K1-Ch for qemu-devel@nongnu.org; Mon, 26 Oct 2009 07:51:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N2O6z-0000JF-T9 for qemu-devel@nongnu.org; Mon, 26 Oct 2009 07:51:49 -0400 Received: from [199.232.76.173] (port=40847 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N2O6z-0000J8-Ok for qemu-devel@nongnu.org; Mon, 26 Oct 2009 07:51:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50687) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N2O6y-0007Wt-Sp for qemu-devel@nongnu.org; Mon, 26 Oct 2009 07:51:45 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9QBpeGP006953 for ; Mon, 26 Oct 2009 07:51:40 -0400 Received: from zweiblum.home.kraxel.org (vpn1-5-193.ams2.redhat.com [10.36.5.193]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n9QBITUG032442; Mon, 26 Oct 2009 07:18:30 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id BDD2A700E5; Mon, 26 Oct 2009 12:18:27 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 26 Oct 2009 12:18:25 +0100 Message-Id: <1256555907-21505-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1256555907-21505-1-git-send-email-kraxel@redhat.com> References: <1256555907-21505-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH v4 2/4] rom loader: make vga+rom loading configurable. 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 The rom_add_vga() and rom_add_option() macros are transformed into functions. They look at the new rom_enable_driver_roms variable and only do something if it is set to non-zero, making vga+option rom loading runtime option. pc_init() sets rom_enable_driver_roms to 1. With this in place we can move the rom loading calls from pc.c to the individual drivers. Signed-off-by: Gerd Hoffmann --- hw/loader.c | 15 +++++++++++++++ hw/loader.h | 7 +++---- hw/pc.c | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/hw/loader.c b/hw/loader.c index 6baafa8..a08585b 100644 --- a/hw/loader.c +++ b/hw/loader.c @@ -534,6 +534,7 @@ struct Rom { }; static QTAILQ_HEAD(, Rom) roms = QTAILQ_HEAD_INITIALIZER(roms); +int rom_enable_driver_roms; static void rom_insert(Rom *rom) { @@ -612,6 +613,20 @@ int rom_add_blob(const char *name, const void *blob, size_t len, return 0; } +int rom_add_vga(const char *file) +{ + if (!rom_enable_driver_roms) + return 0; + return rom_add_file(file, PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN); +} + +int rom_add_option(const char *file) +{ + if (!rom_enable_driver_roms) + return 0; + return rom_add_file(file, PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN); +} + static void rom_reset(void *unused) { Rom *rom; diff --git a/hw/loader.h b/hw/loader.h index 945c662..67dae57 100644 --- a/hw/loader.h +++ b/hw/loader.h @@ -38,9 +38,8 @@ void do_info_roms(Monitor *mon); #define PC_ROM_ALIGN 0x800 #define PC_ROM_SIZE (PC_ROM_MAX - PC_ROM_MIN_VGA) -#define rom_add_vga(_f) \ - rom_add_file(_f, PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN) -#define rom_add_option(_f) \ - rom_add_file(_f, PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN) +extern int rom_enable_driver_roms; +int rom_add_vga(const char *file); +int rom_add_option(const char *file); #endif diff --git a/hw/pc.c b/hw/pc.c index 408d6d6..09d60ed 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1137,6 +1137,7 @@ static void pc_init1(ram_addr_t ram_size, + rom_enable_driver_roms = 1; option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE); cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset);