From 61d6b06696b7efc6e6bc1df6573ba58e743d6ae3 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 21 Jun 2008 12:15:10 -0400 Subject: Init serial port before using it for debug - also reinit after option rom. Apparently, some VGA option roms will enable serial irqs - this could cause problems with spurious irqs from debug messages. Also, improve debugging of option roms that fail the checksum check. --- src/output.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/output.c') diff --git a/src/output.c b/src/output.c index 054082f..dd647a2 100644 --- a/src/output.c +++ b/src/output.c @@ -13,6 +13,25 @@ #define DEBUG_PORT 0x03f8 #define DEBUG_TIMEOUT 100000 +void +debug_serial_setup() +{ + if (!CONFIG_DEBUG_SERIAL) + return; + // setup for serial logging: 8N1 + u8 oldparam, newparam = 0x03; + oldparam = inb(DEBUG_PORT+3); + outb(newparam, DEBUG_PORT+3); + // Disable irqs + u8 oldier, newier = 0; + oldier = inb(DEBUG_PORT+1); + outb(newier, DEBUG_PORT+1); + + if (oldparam != newparam || oldier != newier) + dprintf(1, "Changing serial settings was %x/%x now %x/%x\n" + , oldparam, oldier, newparam, newier); +} + static void debug_serial(char c) { -- cgit v1.1