From patchwork Mon Aug 3 13:32:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jes Sorensen X-Patchwork-Id: 30703 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 bilbo.ozlabs.org (Postfix) with ESMTPS id DFE45B6F20 for ; Tue, 4 Aug 2009 17:53:54 +1000 (EST) Received: from localhost ([127.0.0.1]:40442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MYEqA-0005ua-K4 for incoming@patchwork.ozlabs.org; Tue, 04 Aug 2009 03:53:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MYEli-0003xU-TL for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:49:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MYEld-0003t2-HB for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:49:09 -0400 Received: from [199.232.76.173] (port=46543 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MYEld-0003sm-8Z for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:49:05 -0400 Received: from mx20.gnu.org ([199.232.41.8]:39869) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MYElc-0007zD-Lm for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:49:04 -0400 Received: from relay3.sgi.com ([192.48.156.57] helo=relay.sgi.com) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MYElb-0005iu-Qn for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:49:04 -0400 Received: from eye3.emea.sgi.com (eye3.emea.sgi.com [144.253.156.24]) by relay3.corp.sgi.com (Postfix) with ESMTP id 25DD6AC009; Tue, 4 Aug 2009 00:48:56 -0700 (PDT) Received: from eye3.emea.sgi.com (localhost.localdomain [127.0.0.1]) by eye3.emea.sgi.com (8.14.3/8.14.3) with ESMTP id n747mt9J004239; Tue, 4 Aug 2009 09:48:55 +0200 Received: (from jes@localhost) by eye3.emea.sgi.com (8.14.3/8.14.3/Submit) id n747mth0004238; Tue, 4 Aug 2009 09:48:55 +0200 X-Authentication-Warning: eye3.emea.sgi.com: jes set sender to jes@sgi.com using -f Message-Id: <20090803133316.580115770@sgi.com> User-Agent: quilt/0.47-1 Date: Mon, 03 Aug 2009 15:32:38 +0200 From: Jes Sorensen To: kevin@koconnor.net References: <20090803133236.207919528@sgi.com> Content-Disposition: inline; filename=0003-reorder-cfg-probe.patch X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Anthony Liguori , Beth Kon , qemu-devel , avi@redhat.com Subject: [Qemu-devel] [PATCH 2/5] Reorder call for qemu-cfg probing. 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 moves the call to probe for qemu-cfg to an earlier point in the BIOS init. Required in order to use the output for mptable setup etc. Signed-off-by: Jes Sorensen --- src/post.c | 10 ++++++++++ src/qemu-cfg.c | 6 +++++- src/smbios.c | 2 +- src/util.h | 3 +++ 4 files changed, 19 insertions(+), 2 deletions(-) Index: seabios/src/post.c =================================================================== --- seabios.orig/src/post.c +++ seabios/src/post.c @@ -18,6 +18,7 @@ #include "bregs.h" // struct bregs #include "mptable.h" // mptable_init #include "boot.h" // IPL +#include "qemu-cfg.h" void __set_irq(int vector, void *loc) @@ -158,6 +159,15 @@ post() init_ivt(); init_bda(); + /* + * Test for emulator earlier, to be able to runtime check whether + * we are on QEMU/KVM/Coreboot etc. + * + * Would be ideal to be able to runtime test for coreboot in here, + * if someone knows how to do so reliably. + */ + qemu_cfg_port_probe(); + pic_setup(); timer_setup(); mathcp_setup(); Index: seabios/src/qemu-cfg.c =================================================================== --- seabios.orig/src/qemu-cfg.c +++ seabios/src/qemu-cfg.c @@ -10,6 +10,8 @@ #include "ioport.h" #include "qemu-cfg.h" +int qemu_cfg_port = 0; + void qemu_cfg_read(u8 *buf, u16 f, int len) { @@ -24,6 +26,8 @@ qemu_cfg_port_probe() u8 sig[4] = "QEMU"; u8 buf[4]; qemu_cfg_read(buf, QEMU_CFG_SIGNATURE, 4); - return *(u32*)buf == *(u32*)sig; + if (*(u32*)buf == *(u32*)sig) + qemu_cfg_port = 1; + return qemu_cfg_port; } Index: seabios/src/smbios.c =================================================================== --- seabios.orig/src/smbios.c +++ seabios/src/smbios.c @@ -24,7 +24,7 @@ uuid_probe(u8 *bios_uuid) return; if (CONFIG_COREBOOT) return; - if (! qemu_cfg_port_probe()) + if (!qemu_cfg_port) // Feature not available return; Index: seabios/src/util.h =================================================================== --- seabios.orig/src/util.h +++ seabios/src/util.h @@ -264,4 +264,7 @@ extern int irq0override; // version (auto generated file out/version.c) extern const char VERSION[]; +// qemu-cfg.c +extern int qemu_cfg_port; + #endif // util.h