[coreboot-gerrit] Patch set updated for coreboot: c6342f8 console: Move newline translation outside console_tx_byte

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Wed Mar 5 22:35:07 CET 2014


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5336

-gerrit

commit c6342f811b41e8156ee760091c40183919daa184
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Tue Feb 4 19:03:57 2014 +0200

    console: Move newline translation outside console_tx_byte
    
    Change-Id: I706791ff43d80a36a7252a4da0e6f3af92520db7
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/arch/armv7/early_console.c              | 3 ---
 src/arch/x86/lib/romstage_console.c         | 3 ---
 src/console/console.c                       | 9 +--------
 src/console/printk.c                        | 8 ++++++++
 src/cpu/x86/smm/smiutil.c                   | 3 ---
 src/include/console/console.h               | 2 ++
 src/northbridge/intel/haswell/raminit.c     | 2 +-
 src/northbridge/intel/sandybridge/raminit.c | 2 +-
 src/soc/intel/baytrail/romstage/raminit.c   | 2 +-
 9 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/src/arch/armv7/early_console.c b/src/arch/armv7/early_console.c
index a85f554..599cbc7 100644
--- a/src/arch/armv7/early_console.c
+++ b/src/arch/armv7/early_console.c
@@ -24,9 +24,6 @@
 /* FIXME: need to make console driver more generic */
 void console_tx_byte(unsigned char byte)
 {
-	if (byte == '\n')
-		console_tx_byte('\r');
-
 #if CONFIG_CONSOLE_SERIAL
 	uart_tx_byte(byte);
 #endif
diff --git a/src/arch/x86/lib/romstage_console.c b/src/arch/x86/lib/romstage_console.c
index c80cf8c..4971f01 100644
--- a/src/arch/x86/lib/romstage_console.c
+++ b/src/arch/x86/lib/romstage_console.c
@@ -26,9 +26,6 @@
 
 void console_tx_byte(unsigned char byte)
 {
-	if (byte == '\n')
-		console_tx_byte('\r');
-
 #if CONFIG_CONSOLE_SERIAL
 	uart_tx_byte(byte);
 #endif
diff --git a/src/console/console.c b/src/console/console.c
index 1712877..d5aadf6 100644
--- a/src/console/console.c
+++ b/src/console/console.c
@@ -48,7 +48,7 @@ void console_tx_flush(void)
 	}
 }
 
-static void __console_tx_byte(unsigned char byte)
+void console_tx_byte(unsigned char byte)
 {
 	struct console_driver *driver;
 	for(driver = console_drivers; driver < econsole_drivers; driver++) {
@@ -56,13 +56,6 @@ static void __console_tx_byte(unsigned char byte)
 	}
 }
 
-void console_tx_byte(unsigned char byte)
-{
-	if (byte == '\n')
-		__console_tx_byte('\r');
-	__console_tx_byte(byte);
-}
-
 unsigned char console_rx_byte(void)
 {
 	struct console_driver *driver;
diff --git a/src/console/printk.c b/src/console/printk.c
index e86c930..a937094 100644
--- a/src/console/printk.c
+++ b/src/console/printk.c
@@ -16,6 +16,8 @@ DECLARE_SPIN_LOCK(console_lock)
 
 static void wrap_putchar(unsigned char byte, void *data)
 {
+	if (byte == '\n')
+		console_tx_byte('\r');
 	console_tx_byte(byte);
 }
 
@@ -53,3 +55,9 @@ void do_vtxprintf(const char *fmt, va_list args)
 	console_tx_flush();
 }
 
+void do_putchar(unsigned char byte)
+{
+	if (byte == '\n')
+		console_tx_byte('\r');
+	console_tx_byte(byte);
+}
diff --git a/src/cpu/x86/smm/smiutil.c b/src/cpu/x86/smm/smiutil.c
index 6e9822e..644cab7 100644
--- a/src/cpu/x86/smm/smiutil.c
+++ b/src/cpu/x86/smm/smiutil.c
@@ -29,9 +29,6 @@ void console_tx_flush(void)
 
 void console_tx_byte(unsigned char byte)
 {
-	if (byte == '\n')
-		console_tx_byte('\r');
-
 #if CONFIG_CONSOLE_SERIAL
 	uart_tx_byte(byte);
 #endif
diff --git a/src/include/console/console.h b/src/include/console/console.h
index 4dd14e5..6b32cb9 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -72,11 +72,13 @@ void __attribute__ ((noreturn)) die(const char *msg);
 /* Do nothing. */
 static inline void printk(int LEVEL, const char *fmt, ...) {}
 static inline void do_vtxprintf(const char *fmt, va_list args) {}
+static inline void do_putchar(unsigned char byte) {}
 
 #else
 
 int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 void do_vtxprintf(const char *fmt, va_list args);
+void do_putchar(unsigned char byte);
 
 #define printk(LEVEL, fmt, args...)				\
 	do {							\
diff --git a/src/northbridge/intel/haswell/raminit.c b/src/northbridge/intel/haswell/raminit.c
index 316f7fd..1e020f9 100644
--- a/src/northbridge/intel/haswell/raminit.c
+++ b/src/northbridge/intel/haswell/raminit.c
@@ -166,7 +166,7 @@ void sdram_initialize(struct pei_data *pei_data)
 	}
 
 	/* Pass console handler in pei_data */
-	pei_data->tx_byte = console_tx_byte;
+	pei_data->tx_byte = do_putchar;
 
 	/* Locate and call UEFI System Agent binary. */
 	entry = (unsigned long)cbfs_get_file_content(
diff --git a/src/northbridge/intel/sandybridge/raminit.c b/src/northbridge/intel/sandybridge/raminit.c
index bfb4033..61e1545 100644
--- a/src/northbridge/intel/sandybridge/raminit.c
+++ b/src/northbridge/intel/sandybridge/raminit.c
@@ -248,7 +248,7 @@ void sdram_initialize(struct pei_data *pei_data)
 	}
 
 	/* Pass console handler in pei_data */
-	pei_data->tx_byte = console_tx_byte;
+	pei_data->tx_byte = do_putchar;
 
 	/* Locate and call UEFI System Agent binary. */
 	/* TODO make MRC blob (0xab?) defined in cbfs_core.h. */
diff --git a/src/soc/intel/baytrail/romstage/raminit.c b/src/soc/intel/baytrail/romstage/raminit.c
index 7bcd54f..98d389e 100644
--- a/src/soc/intel/baytrail/romstage/raminit.c
+++ b/src/soc/intel/baytrail/romstage/raminit.c
@@ -55,7 +55,7 @@ static void enable_smbus(void)
 
 static void ABI_X86 send_to_console(unsigned char b)
 {
-	console_tx_byte(b);
+	do_putchar(b);
 }
 
 static void print_dram_info(void)



More information about the coreboot-gerrit mailing list