[SeaBIOS] [PATCH 2/3] Xen: Autodetect debug I/O port at runtime instead of via Kconfig
Ian Campbell
ian.campbell at citrix.com
Thu Jun 28 12:08:32 CEST 2012
This allows a common image which supports Xen to still print debug
Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
---
src/Kconfig | 7 -------
src/output.c | 4 +++-
src/util.h | 1 +
src/xen.c | 6 ++++++
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/Kconfig b/src/Kconfig
index 8120ff7..8932c9e 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -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
diff --git a/src/output.c b/src/output.c
index 37c4942..83de7f4 100644
--- a/src/output.c
+++ b/src/output.c
@@ -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);
diff --git a/src/util.h b/src/util.h
index dbee0e5..ef8ec7c 100644
--- a/src/util.h
+++ b/src/util.h
@@ -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;
diff --git a/src/xen.c b/src/xen.c
index b18cca2..41aab98 100644
--- 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)
--
1.7.2.5
More information about the SeaBIOS
mailing list