]> xenbits.xensource.com Git - seabios.git/commitdiff
Xen: Autodetect debug I/O port at runtime instead of via Kconfig
authorIan Campbell <ian.campbell@citrix.com>
Thu, 28 Jun 2012 10:08:32 +0000 (11:08 +0100)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 2 Jul 2012 15:14:51 +0000 (11:14 -0400)
This allows a common image which supports Xen to still print debug

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
src/Kconfig
src/output.c
src/util.h
src/xen.c

index 8120ff7b326e7c4ec522a8c46efefde5408815ee..8932c9e8f07d5e2c2e8c1d4bbf4ce7ac77c137b3 100644 (file)
@@ -361,11 +361,4 @@ menu "Debugging"
             information by outputing strings in a special port present in the
             IO space.
 
-    config DEBUG_IO_PORT
-        depends on DEBUG_IO
-        hex "Debug IO port address"
-        default 0x0402
-        help
-            Bochs uses the 0x0402 address by default, whereas Xen
-            makes the 0xe9 IO address available for guests use.
 endmenu
index 37c4942eddd482828694865d021ff61547359d3f..83de7f464d76394719ef3b47a46b8203a09e08f3 100644 (file)
@@ -23,6 +23,8 @@ struct putcinfo {
 
 #define DEBUG_TIMEOUT 100000
 
+u16 DebugOutputPort VAR16VISIBLE = 0x402;
+
 void
 debug_serial_setup(void)
 {
@@ -77,7 +79,7 @@ putc_debug(struct putcinfo *action, char c)
         return;
     if (CONFIG_DEBUG_IO)
         // Send character to debug port.
-        outb(c, CONFIG_DEBUG_IO_PORT);
+        outb(c, GET_GLOBAL(DebugOutputPort));
     if (c == '\n')
         debug_serial('\r');
     debug_serial(c);
index dbee0e5f07510572c0f140cf35145346fd362b47..ef8ec7cbeac42b1db91bda68be02dcadaaa3a217 100644 (file)
@@ -231,6 +231,7 @@ int wait_preempt(void);
 void check_preempt(void);
 
 // output.c
+extern u16 DebugOutputPort;
 void debug_serial_setup(void);
 void panic(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2))) __noreturn;
index b18cca20488c9df90c69373caca15fc7c4df0e5d..41aab98d15e77d00aeffff99e0c315be048aac6f 100644 (file)
--- a/src/xen.c
+++ b/src/xen.c
@@ -65,6 +65,10 @@ void xen_probe(void)
         dprintf(1, "Found hypervisor signature \"%s\" at %x\n",
                 signature, base);
         if (strcmp(signature, "XenVMMXenVMM") == 0) {
+            /* Set debug_io_port first, so the following messages work. */
+            DebugOutputPort = 0xe9;
+            dprintf(1, "SeaBIOS (version %s)\n\n", VERSION);
+            dprintf(1, "Found Xen hypervisor signature at %x\n", base);
             if ((eax - base) < 2)
                 panic("Insufficient Xen cpuid leaves. eax=%x at base %x\n",
                       eax, base);
@@ -72,6 +76,8 @@ void xen_probe(void)
             break;
         }
     }
+    if (!xen_cpuid_base)
+        dprintf(1, "No Xen hypervisor found.\n");
 }
 
 static int hypercall_xen_version( int cmd, void *arg)