aboutsummaryrefslogtreecommitdiff
path: root/src/output.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-05-15 22:22:12 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-05-15 22:22:12 -0400
commit3e832bb2387ebe051fbc6d242fd2adf53647519d (patch)
tree46e9d6924fa0b44d4d5f1719f1bbf816aeb33268 /src/output.c
parent05c32dcc7565fb62ba81366403d8ca83ca9a3cd3 (diff)
downloadseabios-hppa-3e832bb2387ebe051fbc6d242fd2adf53647519d.zip
seabios-hppa-3e832bb2387ebe051fbc6d242fd2adf53647519d.tar.gz
seabios-hppa-3e832bb2387ebe051fbc6d242fd2adf53647519d.tar.bz2
Flush debugging serial output after every line.
Wait for the serial port to be ready after every debug function. This fixes an issue with serial port detection.
Diffstat (limited to 'src/output.c')
-rw-r--r--src/output.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/output.c b/src/output.c
index 96f444f..9cebf95 100644
--- a/src/output.c
+++ b/src/output.c
@@ -38,6 +38,8 @@ debug_serial_setup()
static void
debug_serial(char c)
{
+ if (!CONFIG_DEBUG_SERIAL)
+ return;
int timeout = DEBUG_TIMEOUT;
while ((inb(DEBUG_PORT+SEROFF_LSR) & 0x60) != 0x60)
if (!timeout--)
@@ -46,6 +48,19 @@ debug_serial(char c)
outb(c, DEBUG_PORT+SEROFF_DATA);
}
+// Write a character to the serial port.
+static void
+debug_serial_flush()
+{
+ if (!CONFIG_DEBUG_SERIAL)
+ return;
+ int timeout = DEBUG_TIMEOUT;
+ while ((inb(DEBUG_PORT+SEROFF_LSR) & 0x40) != 0x40)
+ if (!timeout--)
+ // Ran out of time.
+ return;
+}
+
// Show a character on the screen.
static void
screenc(u8 c)
@@ -68,12 +83,10 @@ putc(u16 action, char c)
if (! CONFIG_COREBOOT)
// Send character to debug port.
outb(c, PORT_BIOS_DEBUG);
- if (CONFIG_DEBUG_SERIAL) {
- // Send character to serial port.
- if (c == '\n')
- debug_serial('\r');
- debug_serial(c);
- }
+ // Send character to serial port.
+ if (c == '\n')
+ debug_serial('\r');
+ debug_serial(c);
}
if (action) {
@@ -244,6 +257,7 @@ bvprintf(u16 action, const char *fmt, va_list args)
}
s = n;
}
+ debug_serial_flush();
}
void
@@ -298,6 +312,7 @@ hexdump(void *d, int len)
d+=4;
}
putc(0, '\n');
+ debug_serial_flush();
}
static void
@@ -320,6 +335,7 @@ __debug_isr(const char *fname)
{
puts_cs(0, fname);
putc(0, '\n');
+ debug_serial_flush();
}
// Function called on handler startup.