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 <kevin@koconnor.net>
Reviewed-on: http://review.coreboot.org/90
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins)
Reviewed-by: Rudolf Marek <r.marek@assembler.cz>
Reviewed-by: Sven Schnelle <svens@stackframe.org>
This commit is contained in:
Kevin O'Connor
2011-07-09 20:22:21 -04:00
committed by Patrick Georgi
parent 537cacfa04
commit a68555f48d
6 changed files with 38 additions and 5 deletions

View File

@@ -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;
}