qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <jes@sgi.com>
To: kevin@koconnor.net
Cc: Anthony Liguori <aliguori@us.ibm.com>, Beth Kon <eak@us.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	avi@redhat.com
Subject: [Qemu-devel] [PATCH 2/5] Reorder call for qemu-cfg probing.
Date: Mon, 03 Aug 2009 15:32:38 +0200	[thread overview]
Message-ID: <20090803133316.580115770@sgi.com> (raw)
In-Reply-To: 20090803133236.207919528@sgi.com

[-- Attachment #1: 0003-reorder-cfg-probe.patch --]
[-- Type: text/plain, Size: 2351 bytes --]

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 <jes@sgi.com>

---
 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

  parent reply	other threads:[~2009-08-04  7:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 13:32 [Qemu-devel] [PATCH 0/5] Seabios qemu detect Jes Sorensen
2009-08-03 13:32 ` [Qemu-devel] [PATCH 1/5] Move QEMU_CFG related code out of smbios.c Jes Sorensen
2009-08-03 13:32 ` Jes Sorensen [this message]
2009-08-03 13:32 ` [Qemu-devel] [PATCH 3/5] Set emu_ver based on information provided by qemu_cfg Jes Sorensen
2009-08-03 13:32 ` [Qemu-devel] [PATCH 4/5] Set irq0override based on emu_ver Jes Sorensen
2009-08-03 13:32 ` [Qemu-devel] [PATCH 5/5] Remove CONFIG_KVM and use emu_ver to runtime detect QEMU & KVM Jes Sorensen
2009-08-05  1:20 ` [Qemu-devel] Re: [PATCH 0/5] Seabios qemu detect Kevin O'Connor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090803133316.580115770@sgi.com \
    --to=jes@sgi.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=eak@us.ibm.com \
    --cc=kevin@koconnor.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).