>From ea131715b0b8f959f8f34768ef46ac029a5f84b0 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 30 May 2013 09:25:40 +0200 Subject: [PATCH] [broken] probe for debug port Signed-off-by: Gerd Hoffmann --- src/output.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/output.c b/src/output.c index 79c3ada..102f177 100644 --- a/src/output.c +++ b/src/output.c @@ -24,6 +24,7 @@ struct putcinfo { #define DEBUG_TIMEOUT 100000 u16 DebugOutputPort VARFSEG = 0x402; +u8 DebugOutputEnabled VARFSEG = 0xff; void debug_serial_preinit(void) @@ -77,9 +78,17 @@ putc_debug(struct putcinfo *action, char c) { if (! CONFIG_DEBUG_LEVEL) return; - if (CONFIG_DEBUG_IO) + if (CONFIG_DEBUG_IO) { // Send character to debug port. - outb(c, GET_GLOBAL(DebugOutputPort)); + u8 enabled = GET_GLOBAL(DebugOutputEnabled); + if (enabled == 0xff) { + enabled = (inb(GET_GLOBAL(DebugOutputPort)) == 0xe9); + SET_GLOBAL(DebugOutputEnabled, enabled); + } + if (enabled ) { + outb(c, GET_GLOBAL(DebugOutputPort)); + } + } if (c == '\n') debug_serial('\r'); debug_serial(c); -- 1.7.9.7