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 3/5] Set emu_ver based on information provided by qemu_cfg.
Date: Mon, 03 Aug 2009 15:32:39 +0200	[thread overview]
Message-ID: <20090803133316.747565341@sgi.com> (raw)
In-Reply-To: 20090803133236.207919528@sgi.com

[-- Attachment #1: 0004-emulator-detect.patch --]
[-- Type: text/plain, Size: 2079 bytes --]

This patch retrieves the value of QEMU_CFG_EMULATOR and sets emu_ver,
allowing the BIOS to runtime verify which emulator it is running on.

Signed-off-by: Jes Sorensen <jes@sgi.com>

---
 src/post.c     |    4 ++++
 src/qemu-cfg.c |    8 ++++++++
 src/qemu-cfg.h |    2 ++
 src/util.h     |    7 +++++++
 4 files changed, 21 insertions(+)

Index: seabios/src/post.c
===================================================================
--- seabios.orig/src/post.c
+++ seabios/src/post.c
@@ -20,6 +20,8 @@
 #include "boot.h" // IPL
 #include "qemu-cfg.h"
 
+u16 emu_ver;
+
 void
 __set_irq(int vector, void *loc)
 {
@@ -167,6 +169,8 @@ post()
      * if someone knows how to do so reliably.
      */
     qemu_cfg_port_probe();
+    if (qemu_cfg_port)
+        emu_ver = qemu_cfg_get_emulator_rev();
 
     pic_setup();
     timer_setup();
Index: seabios/src/qemu-cfg.c
===================================================================
--- seabios.orig/src/qemu-cfg.c
+++ seabios/src/qemu-cfg.c
@@ -31,3 +31,11 @@ qemu_cfg_port_probe()
     return qemu_cfg_port;
 }
 
+u16 qemu_cfg_get_emulator_rev(void)
+{
+    u16 rev;
+
+    qemu_cfg_read((u8*)&rev, QEMU_CFG_EMULATOR, sizeof(rev));
+
+    return rev;
+}
Index: seabios/src/qemu-cfg.h
===================================================================
--- seabios.orig/src/qemu-cfg.h
+++ seabios/src/qemu-cfg.h
@@ -12,8 +12,10 @@
 #define QEMU_CFG_SIGNATURE  0x00
 #define QEMU_CFG_ID         0x01
 #define QEMU_CFG_UUID       0x02
+#define QEMU_CFG_EMULATOR   0x10
 
 void qemu_cfg_read(u8 *buf, u16 f, int len);
 int qemu_cfg_port_probe();
+u16 qemu_cfg_get_emulator_rev(void);
 
 #endif
Index: seabios/src/util.h
===================================================================
--- seabios.orig/src/util.h
+++ seabios/src/util.h
@@ -267,4 +267,11 @@ extern const char VERSION[];
 // qemu-cfg.c
 extern int qemu_cfg_port;
 
+// port.c
+extern u16 emu_ver;
+#define EMU_NONE            0x0000
+#define EMU_QEMU            0x0100
+#define EMU_QEMU_KVM        0x0101
+#define EMU_QEMU_KQEMU      0x0102
+
 #endif // util.h

  parent reply	other threads:[~2009-08-04  7:56 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 ` [Qemu-devel] [PATCH 2/5] Reorder call for qemu-cfg probing Jes Sorensen
2009-08-03 13:32 ` Jes Sorensen [this message]
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.747565341@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).