From patchwork Tue Oct 13 11:06:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 35839 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 7F9ACB7B83 for ; Tue, 13 Oct 2009 22:07:01 +1100 (EST) Received: from localhost ([127.0.0.1]:45488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MxfDW-0003b3-II for incoming@patchwork.ozlabs.org; Tue, 13 Oct 2009 07:06:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MxfD3-0003a4-9x for qemu-devel@nongnu.org; Tue, 13 Oct 2009 07:06:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MxfCz-0003Yj-Ma for qemu-devel@nongnu.org; Tue, 13 Oct 2009 07:06:29 -0400 Received: from [199.232.76.173] (port=39477 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MxfCz-0003YX-EW for qemu-devel@nongnu.org; Tue, 13 Oct 2009 07:06:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53050) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MxfCy-0002fx-HI for qemu-devel@nongnu.org; Tue, 13 Oct 2009 07:06:24 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9DB6N3b017623 for ; Tue, 13 Oct 2009 07:06:23 -0400 Received: from zweiblum.home.kraxel.org (vpn1-5-43.ams2.redhat.com [10.36.5.43]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n9DB6KmJ010261; Tue, 13 Oct 2009 07:06:21 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 3AD6A700FF; Tue, 13 Oct 2009 13:06:18 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 13 Oct 2009 13:06:16 +0200 Message-Id: <1255431978-4992-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1255431978-4992-1-git-send-email-kraxel@redhat.com> References: <1255431978-4992-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 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.target | 2 +- hw/loader-target.c | 34 ++++++++++++++++++++++++++++++++++ hw/loader.h | 6 ++---- 3 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 hw/loader-target.c diff --git a/Makefile.target b/Makefile.target index 2726487..6054a68 100644 --- a/Makefile.target +++ b/Makefile.target @@ -154,7 +154,7 @@ endif #CONFIG_BSD_USER # System emulator target ifdef CONFIG_SOFTMMU -obj-y = vl.o monitor.o pci.o machine.o gdbstub.o +obj-y = vl.o monitor.o pci.o machine.o gdbstub.o loader-target.o # virtio has to be here due to weird dependency between PCI and virtio-net. # need to fix this properly obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o virtio-pci.o diff --git a/hw/loader-target.c b/hw/loader-target.c new file mode 100644 index 0000000..54a6745 --- /dev/null +++ b/hw/loader-target.c @@ -0,0 +1,34 @@ +/* + * target specific rom code + */ + +#include "hw.h" +#include "loader.h" + +#ifdef TARGET_I386 + +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); +} + +#else + +int __attribute__((weak)) rom_add_vga(const char *file) +{ + /* nothing */ + return 0; +} + +int __attribute__((weak)) rom_add_option(const char *file) +{ + /* nothing */ + return 0; +} + +#endif 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