From patchwork Fri Oct 16 14:04:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 36234 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 C2092B7BB8 for ; Sat, 17 Oct 2009 01:55:13 +1100 (EST) Received: from localhost ([127.0.0.1]:58602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MyoD0-0007vt-2n for incoming@patchwork.ozlabs.org; Fri, 16 Oct 2009 10:55:10 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MynPr-0006Lm-PV for qemu-devel@nongnu.org; Fri, 16 Oct 2009 10:04:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MynPm-0006EH-7Y for qemu-devel@nongnu.org; Fri, 16 Oct 2009 10:04:22 -0400 Received: from [199.232.76.173] (port=42696 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MynPm-0006Dl-0O for qemu-devel@nongnu.org; Fri, 16 Oct 2009 10:04:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46442) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MynPl-0002e8-AK for qemu-devel@nongnu.org; Fri, 16 Oct 2009 10:04:17 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9GE4GD7024645 for ; Fri, 16 Oct 2009 10:04:16 -0400 Received: from zweiblum.home.kraxel.org (vpn2-9-112.ams2.redhat.com [10.36.9.112]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n9GE4Dme001492; Fri, 16 Oct 2009 10:04:14 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 70F9C700E5; Fri, 16 Oct 2009 16:04:12 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Oct 2009 16:04:09 +0200 Message-Id: <1255701851-11147-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1255701851-11147-1-git-send-email-kraxel@redhat.com> References: <1255701851-11147-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 2/4] rom loader: make vga+rom loading target specific 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 This patch adds a loader-target.c file for target-specific rom loading functions. The rom_add_vga() and rom_add_option() macros are transformed into functions and sticked in there. They load the bios on TARGET_I386 and no nothing on other targets. With this in place we can move the rom loading calls from pc.c to the individual drivers. Signed-off-by: Gerd Hoffmann --- Makefile.hw | 7 +++++++ hw/loader-dummy.c | 18 ++++++++++++++++++ hw/loader-i386.c | 16 ++++++++++++++++ hw/loader.h | 6 ++---- 4 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 hw/loader-dummy.c create mode 100644 hw/loader-i386.c diff --git a/Makefile.hw b/Makefile.hw index f4b4469..7da6775 100644 --- a/Makefile.hw +++ b/Makefile.hw @@ -12,7 +12,14 @@ VPATH=$(SRC_PATH):$(SRC_PATH)/hw QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu obj-y = + obj-y += loader.o +ifdef TARGET_I386 +obj-y += loader-i386.o +else +obj-y += loader-dummy.o +endif + obj-y += virtio.o obj-y += fw_cfg.o obj-y += watchdog.o diff --git a/hw/loader-dummy.c b/hw/loader-dummy.c new file mode 100644 index 0000000..31e12ce --- /dev/null +++ b/hw/loader-dummy.c @@ -0,0 +1,18 @@ +/* + * target specific rom code -- dummy + */ + +#include "hw.h" +#include "loader.h" + +int rom_add_vga(const char *file) +{ + /* nothing */ + return 0; +} + +int rom_add_option(const char *file) +{ + /* nothing */ + return 0; +} diff --git a/hw/loader-i386.c b/hw/loader-i386.c new file mode 100644 index 0000000..06eaf4d --- /dev/null +++ b/hw/loader-i386.c @@ -0,0 +1,16 @@ +/* + * target specific rom code -- i386 + */ + +#include "hw.h" +#include "loader.h" + +int rom_add_vga(const char *file) +{ + return rom_add_file(file, PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN); +} + +int rom_add_option(const char *file) +{ + return rom_add_file(file, PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN); +} diff --git a/hw/loader.h b/hw/loader.h index 945c662..d013253 100644 --- a/hw/loader.h +++ b/hw/loader.h @@ -38,9 +38,7 @@ 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) +int rom_add_vga(const char *file); +int rom_add_option(const char *file); #endif