[coreboot-gerrit] Patch set updated for coreboot: ce90d66 CBMEM console: Fix pre-RAM support

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Fri Dec 19 14:10:54 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/7862

-gerrit

commit ce90d669834ad940d729a4bce3904607819c2462
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Fri Dec 19 07:53:42 2014 +0200

    CBMEM console: Fix pre-RAM support
    
    If there is no pre-RAM storage, early CBMEM console is disabled
    
    TODO: ARM configurations do not define PRERAM_BUFFER_BASE values.
    
    Drop old romstage console from ARM64, generic console driver
    handles all arch and stages of boot.
    
    Change-Id: I70d82da629529dbfd7bc9491223abd703cbc0115
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/arch/arm/Kconfig                |  4 --
 src/arch/arm64/Makefile.inc         |  2 -
 src/arch/arm64/bootblock.ld         |  2 +
 src/arch/arm64/early_console.c      | 75 -------------------------------------
 src/console/Kconfig                 | 12 +++++-
 src/include/console/cbmem_console.h |  3 +-
 src/lib/Makefile.inc                |  4 ++
 7 files changed, 18 insertions(+), 84 deletions(-)

diff --git a/src/arch/arm/Kconfig b/src/arch/arm/Kconfig
index e946f59..edc4b12 100644
--- a/src/arch/arm/Kconfig
+++ b/src/arch/arm/Kconfig
@@ -20,10 +20,6 @@ config ARM_BOOTBLOCK_CUSTOM
 	bool
 	default n
 
-config CBMEM_CONSOLE_PRERAM_BASE
-	hex
-	depends on CONSOLE_CBMEM
-
 config CPU_HAS_BOOTBLOCK_INIT
 	bool
 	default n
diff --git a/src/arch/arm64/Makefile.inc b/src/arch/arm64/Makefile.inc
index b4df4aa..aa5507e 100644
--- a/src/arch/arm64/Makefile.inc
+++ b/src/arch/arm64/Makefile.inc
@@ -44,7 +44,6 @@ endif
 ifeq ($(CONFIG_ARCH_BOOTBLOCK_ARM64),y)
 
 bootblock-y += div0.c
-bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += early_console.c
 
 bootblock-y += id.S
 $(obj)/arch/arm64/id.bootblock.o: $(obj)/build.h
@@ -72,7 +71,6 @@ ifeq ($(CONFIG_ARCH_ROMSTAGE_ARM64),y)
 
 romstage-y += stages.c
 romstage-y += div0.c
-romstage-y += early_console.c
 romstage-y += eabi_compat.c
 romstage-y += cbmem.c
 romstage-y += memset.S
diff --git a/src/arch/arm64/bootblock.ld b/src/arch/arm64/bootblock.ld
index acce1f1..3040500 100644
--- a/src/arch/arm64/bootblock.ld
+++ b/src/arch/arm64/bootblock.ld
@@ -49,6 +49,8 @@ SECTIONS
 		*(.sbss.*);
 	} : to_load = 0xff
 
+	preram_cbmem_console = CONFIG_CBMEM_CONSOLE_PRERAM_BASE;
+
 	/DISCARD/ : {
 		*(.comment)
 		*(.note)
diff --git a/src/arch/arm64/early_console.c b/src/arch/arm64/early_console.c
deleted file mode 100644
index aa287a3..0000000
--- a/src/arch/arm64/early_console.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; version 2 of
- * the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include <console/console.h>
-#include <console/vtxprintf.h>
-
-/* 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_SERIAL8250MEM
-	if (oxford_oxpcie_present) {
-		uart8250_mem_tx_byte(
-			CONFIG_OXFORD_OXPCIE_BASE_ADDRESS + 0x1000, byte);
-	}
-#endif
-#if CONFIG_CONSOLE_SERIAL_UART
-	uart_tx_byte(byte);
-#endif
-#if CONFIG_USBDEBUG
-	usbdebug_tx_byte(0, byte);
-#endif
-#if CONFIG_CONSOLE_CBMEM && !defined(__BOOT_BLOCK__)
-	cbmemc_tx_byte(byte);
-#endif
-}
-
-void console_tx_flush(void)
-{
-#if CONFIG_CONSOLE_SERIAL8250MEM
-	uart8250_mem_tx_flush(CONFIG_OXFORD_OXPCIE_BASE_ADDRESS + 0x1000);
-#endif
-#if CONFIG_CONSOLE_SERIAL_UART
-	uart_tx_flush();
-#endif
-#if CONFIG_USBDEBUG
-	usbdebug_tx_flush(0);
-#endif
-}
-
-int do_printk(int msg_level, const char *fmt, ...)
-{
-	va_list args;
-	int i;
-
-	if (msg_level > console_loglevel) {
-		return 0;
-	}
-
-	va_start(args, fmt);
-	i = vtxprintf(console_tx_byte, fmt, args);
-	va_end(args);
-
-	console_tx_flush();
-
-	return i;
-}
diff --git a/src/console/Kconfig b/src/console/Kconfig
index 0d32011..adf86ad 100644
--- a/src/console/Kconfig
+++ b/src/console/Kconfig
@@ -175,8 +175,9 @@ config CONSOLE_CBMEM
 	  Enable this to save the console output in a CBMEM buffer. This would
 	  allow to see coreboot console output from Linux space.
 
+if CONSOLE_CBMEM
+
 config CONSOLE_CBMEM_BUFFER_SIZE
-	depends on CONSOLE_CBMEM
 	hex "Room allocated for console output in CBMEM"
 	default 0x20000
 	help
@@ -184,16 +185,23 @@ config CONSOLE_CBMEM_BUFFER_SIZE
 	  value (128K or 0x20000 bytes) is large enough to accommodate
 	  even the BIOS_SPEW level.
 
+config CBMEM_CONSOLE_PRERAM_BASE
+	hex
+	default 0xabadbeef if !CACHE_AS_RAM || BROKEN_CAR_MIGRATE
+	default 0x0
+
 config CONSOLE_PRERAM_BUFFER_SIZE
-	depends on CONSOLE_CBMEM
 	hex "Room allocated for console output before RAM is initialized"
 	default 0xc00
+	depends on CBMEM_CONSOLE_PRERAM_BASE != 0xabadbeef
 	help
 	  Console is used before RAM is initialized. This is the room reserved
 	  in the DCACHE based RAM, SRAM, etc. to keep console output before it
 	  can be saved in a CBMEM buffer. 3K bytes should be enough even for
 	  the BIOS_SPEW level.
 
+endif
+
 config CONSOLE_QEMU_DEBUGCON
 	bool "QEMU debug console output"
 	depends on BOARD_EMULATION_QEMU_X86
diff --git a/src/include/console/cbmem_console.h b/src/include/console/cbmem_console.h
index 22b6368..401b406 100644
--- a/src/include/console/cbmem_console.h
+++ b/src/include/console/cbmem_console.h
@@ -27,7 +27,8 @@ void cbmemc_relocate(void);
 void cbmemc_tx_byte(unsigned char data);
 
 #define __CBMEM_CONSOLE_ENABLE__	CONFIG_CONSOLE_CBMEM && \
-	((ENV_ROMSTAGE && !CONFIG_BROKEN_CAR_MIGRATE) || ENV_RAMSTAGE)
+	(ENV_RAMSTAGE || (CONFIG_CONSOLE_PRERAM_BUFFER_SIZE && \
+	((ENV_BOOTBLOCK && CONFIG_BOOTBLOCK_CONSOLE) || ENV_ROMSTAGE)))
 
 #if __CBMEM_CONSOLE_ENABLE__
 static inline void __cbmemc_init(void)	{ cbmemc_init(); }
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 2b5c203..d25fa9c 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -22,6 +22,10 @@ bootblock-y += cbfs.c cbfs_core.c
 bootblock-y += memchr.c
 bootblock-y += memcmp.c
 
+ifeq ($(CONFIG_BOOTBLOCK_CONSOLE),y)
+bootblock-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
+endif
+
 romstage-y += memchr.c
 romstage-y += memcmp.c
 $(foreach arch,$(ARCH_SUPPORTED),\



More information about the coreboot-gerrit mailing list