From: Ian Campbell <ian.campbell@citrix.com>
To: seabios@seabios.org
Cc: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Subject: [PATCH 2/3] Xen: Autodetect debug I/O port at runtime instead of via Kconfig
Date: Thu, 28 Jun 2012 11:08:32 +0100 [thread overview]
Message-ID: <1340878114-12815-2-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1340878070.10942.29.camel@zakaz.uk.xensource.com>
This allows a common image which supports Xen to still print debug
Signed-off-by: Ian Campbell <ian.campbell@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
next prev parent reply other threads:[~2012-06-28 10:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-28 10:08 [PATCH 0/3] Fixes for running under Xen Ian Campbell
2012-06-28 10:08 ` [PATCH 1/3] enable Xen support by default Ian Campbell
2012-06-28 10:08 ` Ian Campbell [this message]
2012-06-28 10:08 ` [PATCH 3/3] SMM: Disable use of SMM when running under Xen Ian Campbell
2012-06-28 10:16 ` [PATCH 0/3] Fixes for " Ian Campbell
2012-07-02 15:18 ` [SeaBIOS] " Kevin O'Connor
[not found] ` <20120702151832.GA27558@morn.localdomain>
2012-07-02 16:01 ` Ian Campbell
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=1340878114-12815-2-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=seabios@seabios.org \
--cc=xen-devel@lists.xen.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).