diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2018-12-02 14:10:13 +0100 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-12-10 22:03:30 -0500 |
commit | 75b42835134553c96f113e5014072c0caf99d092 (patch) | |
tree | a22ca8b72057f3dc489c1653eca093c42304f498 /src/hw/serialio.c | |
parent | 628b2e6b0e390e26d59b3c5db07a4226175b6f8a (diff) | |
download | seabios-75b42835134553c96f113e5014072c0caf99d092.tar.gz |
qemu: avoid debug prints if debugcon is not enabled
In order to speed up the boot phase, we can check the QEMU
debugcon device, and disable the writes if it is not recognized.
This patch allow us to save around 10 msec (time measured
between SeaBIOS entry point and "linuxboot" entry point)
when CONFIG_DEBUG_LEVEL=1 and debugcon is not enabled.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/hw/serialio.c')
-rw-r--r-- | src/hw/serialio.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/hw/serialio.c b/src/hw/serialio.c index 319a85c1..31633443 100644 --- a/src/hw/serialio.c +++ b/src/hw/serialio.c @@ -103,11 +103,23 @@ serial_debug_flush(void) u16 DebugOutputPort VARFSEG = 0x402; +void +qemu_debug_preinit(void) +{ + /* Check if the QEMU debug output port is active */ + if (CONFIG_DEBUG_IO && + inb(GET_GLOBAL(DebugOutputPort)) != QEMU_DEBUGCON_READBACK) + DebugOutputPort = 0; +} + // Write a character to the special debugging port. void qemu_debug_putc(char c) { - if (CONFIG_DEBUG_IO && runningOnQEMU()) + if (!CONFIG_DEBUG_IO || !runningOnQEMU()) + return; + u16 port = GET_GLOBAL(DebugOutputPort); + if (port) // Send character to debug port. - outb(c, GET_GLOBAL(DebugOutputPort)); + outb(c, port); } |