[3/5] Set emu_ver based on information provided by qemu_cfg.
diff mbox

Message ID 20090803133316.747565341@sgi.com
State Superseded
Headers show

Commit Message

Jes Sorensen Aug. 3, 2009, 1:32 p.m. UTC
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(+)

Patch
diff mbox

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