From a68555f48d06b4c8d55f7e4ca208805bec3d5512 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 9 Jul 2011 20:22:21 -0400 Subject: Do full flush on uart8250 only at end of printk. The previous code does a full flush of the uart after every character. Unfortunately, this can cause transmission delays on some serial ports. This patch changes the code so that it does a flush at the end of every printk instead of at the end of every character. This reduces the time it takes to transmit serial messages (up to 9% on my Asrock e350m1 board). It also makes the transmission time more consistent which is important when performing timing tests via serial transmissions. Change-Id: I6b28488b905da68c6d68d7c517cc743cde567d70 Signed-off-by: Kevin O'Connor Reviewed-on: http://review.coreboot.org/90 Reviewed-by: Stefan Reinauer Tested-by: build bot (Jenkins) Reviewed-by: Rudolf Marek Reviewed-by: Sven Schnelle --- src/arch/x86/lib/romstage_console.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/arch/x86/lib') diff --git a/src/arch/x86/lib/romstage_console.c b/src/arch/x86/lib/romstage_console.c index a5f2e2b074..8adb3ba93d 100644 --- a/src/arch/x86/lib/romstage_console.c +++ b/src/arch/x86/lib/romstage_console.c @@ -48,6 +48,19 @@ static void console_tx_byte(unsigned char byte) #endif } +static void console_tx_flush(void) +{ +#if CONFIG_CONSOLE_SERIAL8250MEM + uart8250_mem_tx_flush(CONFIG_OXFORD_OXPCIE_BASE_ADDRESS + 0x1000); +#endif +#if CONFIG_CONSOLE_SERIAL8250 + uart8250_tx_flush(CONFIG_TTYS0_BASE); +#endif +#if CONFIG_CONSOLE_NE2K + ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); +#endif +} + int do_printk(int msg_level, const char *fmt, ...) { va_list args; @@ -60,8 +73,8 @@ int do_printk(int msg_level, const char *fmt, ...) va_start(args, fmt); i = vtxprintf(console_tx_byte, fmt, args); va_end(args); -#if CONFIG_CONSOLE_NE2K - ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); -#endif + + console_tx_flush(); + return i; } -- cgit v1.2.3