From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-Id: <20090803133316.580115770@sgi.com> Date: Mon, 03 Aug 2009 15:32:38 +0200 From: Jes Sorensen References: <20090803133236.207919528@sgi.com> Content-Disposition: inline; filename=0003-reorder-cfg-probe.patch Subject: [Qemu-devel] [PATCH 2/5] Reorder call for qemu-cfg probing. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kevin@koconnor.net Cc: Anthony Liguori , Beth Kon , qemu-devel , avi@redhat.com 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