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

@ -31,6 +31,11 @@ static void ttyS0_tx_byte(unsigned char data)
uart8250_tx_byte(CONFIG_TTYS0_BASE, data);
}
static void ttyS0_tx_flush(void)
{
uart8250_tx_flush(CONFIG_TTYS0_BASE);
}
static unsigned char ttyS0_rx_byte(void)
{
return uart8250_rx_byte(CONFIG_TTYS0_BASE);
@ -44,6 +49,7 @@ static int ttyS0_tst_byte(void)
static const struct console_driver uart8250_console __console = {
.init = ttyS0_init,
.tx_byte = ttyS0_tx_byte,
.tx_flush = ttyS0_tx_flush,
.rx_byte = ttyS0_rx_byte,
.tst_byte = ttyS0_tst_byte,
};

View File

@ -36,6 +36,11 @@ static void uartmem_tx_byte(unsigned char data)
uart8250_mem_tx_byte(uart_bar, data);
}
static void uartmem_tx_flush(void)
{
uart8250_mem_tx_flush(uart_bar);
}
static unsigned char uartmem_rx_byte(void)
{
if (!uart_bar)
@ -55,6 +60,7 @@ static int uartmem_tst_byte(void)
static const struct console_driver uart8250mem_console __console = {
.init = uartmem_init,
.tx_byte = uartmem_tx_byte,
.tx_flush = uartmem_tx_flush,
.rx_byte = uartmem_rx_byte,
.tst_byte = uartmem_tst_byte,
};