Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5330
-gerrit
commit 821b74bad5e2ce8b5ada9fcea0b7a793851c5bf2 Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Tue Jan 28 11:34:38 2014 +0200
console: Refactor uart8250/NE2K
Do this for symmetry with romstage_console.c.
Change-Id: If17acfc3da07b1dbefa87162c3c7168deb7b354a Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/arch/x86/lib/romcc_console.c | 35 ++++++++++++++++------------------- src/arch/x86/lib/romstage_console.c | 2 +- src/include/console/ne2k.h | 4 ++++ 3 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/src/arch/x86/lib/romcc_console.c b/src/arch/x86/lib/romcc_console.c index 4bd3ad4..15f34d4 100644 --- a/src/arch/x86/lib/romcc_console.c +++ b/src/arch/x86/lib/romcc_console.c @@ -48,6 +48,16 @@ static void __console_tx_byte(unsigned char byte) #endif }
+static void __console_tx_flush(void) +{ +#if CONFIG_CONSOLE_SERIAL + uart_tx_flush(); +#endif +#if CONFIG_CONSOLE_NE2K + ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); +#endif +} + static void __console_tx_nibble(unsigned nibble) { unsigned char digit; @@ -61,13 +71,8 @@ static void __console_tx_nibble(unsigned nibble) static void __console_tx_char(int loglevel, unsigned char byte) { if (console_loglevel >= loglevel) { -#if CONFIG_CONSOLE_SERIAL - uart_tx_byte(byte); -#endif -#if CONFIG_CONSOLE_NE2K - ne2k_append_data_byte(byte, CONFIG_CONSOLE_NE2K_IO_PORT); - ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); -#endif + __console_tx_byte(byte); + __console_tx_flush(); } }
@@ -76,10 +81,8 @@ static void __console_tx_hex8(int loglevel, unsigned char value) if (console_loglevel >= loglevel) { __console_tx_nibble((value >> 4U) & 0x0fU); __console_tx_nibble(value & 0x0fU); + __console_tx_flush(); } -#if CONFIG_CONSOLE_NE2K - ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); -#endif }
static void __console_tx_hex16(int loglevel, unsigned short value) @@ -89,10 +92,8 @@ static void __console_tx_hex16(int loglevel, unsigned short value) __console_tx_nibble((value >> 8U) & 0x0fU); __console_tx_nibble((value >> 4U) & 0x0fU); __console_tx_nibble(value & 0x0fU); + __console_tx_flush(); } -#if CONFIG_CONSOLE_NE2K - ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); -#endif }
static void __console_tx_hex32(int loglevel, unsigned int value) @@ -106,10 +107,8 @@ static void __console_tx_hex32(int loglevel, unsigned int value) __console_tx_nibble((value >> 8U) & 0x0fU); __console_tx_nibble((value >> 4U) & 0x0fU); __console_tx_nibble(value & 0x0fU); + __console_tx_flush(); } -#if CONFIG_CONSOLE_NE2K - ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); -#endif }
static void __console_tx_string(int loglevel, const char *str) @@ -121,9 +120,7 @@ static void __console_tx_string(int loglevel, const char *str) __console_tx_byte('\r'); __console_tx_byte(ch); } -#if CONFIG_CONSOLE_NE2K - ne2k_transmit(CONFIG_CONSOLE_NE2K_IO_PORT); -#endif + __console_tx_flush(); } }
diff --git a/src/arch/x86/lib/romstage_console.c b/src/arch/x86/lib/romstage_console.c index 0337245..8393d95 100644 --- a/src/arch/x86/lib/romstage_console.c +++ b/src/arch/x86/lib/romstage_console.c @@ -38,7 +38,7 @@ void console_tx_byte(unsigned char byte) usb_tx_byte(0, byte); #endif #if CONFIG_CONSOLE_NE2K - ne2k_append_data(&byte, 1, CONFIG_CONSOLE_NE2K_IO_PORT); + ne2k_append_data_byte(byte, CONFIG_CONSOLE_NE2K_IO_PORT); #endif #if CONFIG_CONSOLE_CBMEM && (CONFIG_EARLY_CBMEM_INIT || !defined(__PRE_RAM__)) cbmemc_tx_byte(byte); diff --git a/src/include/console/ne2k.h b/src/include/console/ne2k.h index 62424f1..cb3c1ec 100644 --- a/src/include/console/ne2k.h +++ b/src/include/console/ne2k.h @@ -22,4 +22,8 @@ void ne2k_append_data(unsigned char *d, int len, unsigned int base); int ne2k_init(unsigned int eth_nic_base); void ne2k_transmit(unsigned int eth_nic_base); + +#ifndef __ROMCC__ +#define ne2k_append_data_byte(d, base) ne2k_append_data(&d, 1, base) +#endif #endif /* _NE2K_H */