[SeaBIOS] [PATCH] Use dedicated HVM debug io port for Xen

Julian Pidancet julian.pidancet at gmail.com
Sat Nov 5 03:43:04 CET 2011


When running on Xen, use Xen debug io port as debug output instead
of Bochs one.

Signed-off-by: Julian Pidancet <julian.pidancet at gmail.com>
---
 src/output.c |    9 +++++++--
 src/xen.h    |    2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/output.c b/src/output.c
index 462ffb7..78541a4 100644
--- a/src/output.c
+++ b/src/output.c
@@ -11,6 +11,7 @@
 #include "bregs.h" // struct bregs
 #include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_GLOBAL
+#include "xen.h" // PORT_XEN_DEBUG
 
 struct putcinfo {
     void (*func)(struct putcinfo *info, char c);
@@ -75,9 +76,13 @@ putc_debug(struct putcinfo *action, char c)
 {
     if (! CONFIG_DEBUG_LEVEL)
         return;
-    if (! CONFIG_COREBOOT)
+    if (! CONFIG_COREBOOT) {
         // Send character to debug port.
-        outb(c, PORT_BIOS_DEBUG);
+        if (CONFIG_XEN)
+            outb(c, PORT_XEN_DEBUG);
+        else
+            outb(c, PORT_BIOS_DEBUG);
+    }
     if (c == '\n')
         debug_serial('\r');
     debug_serial(c);
diff --git a/src/xen.h b/src/xen.h
index 0ed1e9f..802fee0 100644
--- a/src/xen.h
+++ b/src/xen.h
@@ -3,6 +3,8 @@
 
 #include "util.h"
 
+#define PORT_XEN_DEBUG         0xe9
+
 extern u32 xen_cpuid_base;
 
 void xen_probe(void);
-- 
Julian Pidancet




More information about the SeaBIOS mailing list