From 22f01e611be6fbd3ee5a70b27b96478ff1f4e93a Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 30 May 2013 10:33:38 +0200 Subject: [PATCH] console: add qemu debugcon detection The qemu debugcon port returns 0xe9 on reads in case the device is present. Use that for detection and write console output to the port only in case the device is actually present. Change-Id: I41aabcf11845d24004e4f795dfd799822fd14646 Signed-off-by: Gerd Hoffmann Reviewed-on: http://review.coreboot.org/3338 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Ronald G. Minnich --- src/console/qemu_debugcon_console.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/console/qemu_debugcon_console.c b/src/console/qemu_debugcon_console.c index 3037e3651c..e2591baa15 100644 --- a/src/console/qemu_debugcon_console.c +++ b/src/console/qemu_debugcon_console.c @@ -21,13 +21,18 @@ #include #include +static unsigned char readback; + static void debugcon_init(void) { + readback = inb(CONFIG_CONSOLE_QEMU_DEBUGCON_PORT); } static void debugcon_tx_byte(unsigned char data) { - outb(data, CONFIG_CONSOLE_QEMU_DEBUGCON_PORT); + if (readback == 0xe9) { + outb(data, CONFIG_CONSOLE_QEMU_DEBUGCON_PORT); + } } static void debugcon_tx_flush(void)