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 <kraxel@redhat.com>
Reviewed-on: http://review.coreboot.org/3338
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Gerd Hoffmann 2013-05-30 10:33:38 +02:00 committed by Ronald G. Minnich
parent d7c6e444ac
commit 22f01e611b
1 changed files with 6 additions and 1 deletions

View File

@ -21,13 +21,18 @@
#include <console/console.h>
#include <arch/io.h>
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)