summaryrefslogtreecommitdiff
path: root/src/arch/x86/lib
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2014-01-28 11:34:38 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2014-04-09 13:28:33 +0200
commitdbc7bd9dce2d188dd48de7acd5754507ff0c87e5 (patch)
treed5539c092fa6c3cfe7650703e1c38b4858d2db45 /src/arch/x86/lib
parent77f43e9b43894f6cdeaab29b2960796b1e3a219e (diff)
downloadcoreboot-dbc7bd9dce2d188dd48de7acd5754507ff0c87e5.tar.xz
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> Reviewed-on: http://review.coreboot.org/5330 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'src/arch/x86/lib')
-rw-r--r--src/arch/x86/lib/romcc_console.c35
-rw-r--r--src/arch/x86/lib/romstage_console.c2
2 files changed, 17 insertions, 20 deletions
diff --git a/src/arch/x86/lib/romcc_console.c b/src/arch/x86/lib/romcc_console.c
index a6e8ecc1f9..0557a52e5c 100644
--- a/src/arch/x86/lib/romcc_console.c
+++ b/src/arch/x86/lib/romcc_console.c
@@ -41,6 +41,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;
@@ -54,13 +64,8 @@ static void __console_tx_nibble(unsigned nibble)
static void __console_tx_char(int loglevel, unsigned char byte)
{
if (console_log_level(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();
}
}
@@ -69,10 +74,8 @@ static void __console_tx_hex8(int loglevel, unsigned char value)
if (console_log_level(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)
@@ -82,10 +85,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)
@@ -99,10 +100,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)
@@ -114,9 +113,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 4971f018c0..58742a2454 100644
--- a/src/arch/x86/lib/romstage_console.c
+++ b/src/arch/x86/lib/romstage_console.c
@@ -33,7 +33,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);