[coreboot-gerrit] New patch to review for coreboot: cbmem console: make verstage first class citizen

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Thu Oct 8 17:12:45 CET 2015


Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11820

-gerrit

commit 1cb87717f6a0f29adbc6fadcabf1e3970552a45d
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Wed Oct 7 15:41:45 2015 -0500

    cbmem console: make verstage first class citizen
    
    The conditions in cbmem console for supporting verstage
    were implicitly utilizing CONFIG_BOOTBLOCK_CONSOLE to handle
    the cbmem console enablement. Fix it so verstage is a first
    class citizen for deciding actions pertaining to cbmem console.
    
    BUG=chrome-os-partner:44827
    BRANCH=None
    TEST=Built and booted glados using verstage. cbmem console
         shows verstage output.
    
    Change-Id: Iba79efd1c1d4056f1a105a5e10ffc95f3e69b597
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 src/include/console/cbmem_console.h |  6 ++++--
 src/lib/cbmem_console.c             | 26 +++++++++++++++++++++-----
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/src/include/console/cbmem_console.h b/src/include/console/cbmem_console.h
index 06013f2..35eae21 100644
--- a/src/include/console/cbmem_console.h
+++ b/src/include/console/cbmem_console.h
@@ -26,8 +26,10 @@ void cbmemc_init(void);
 void cbmemc_tx_byte(unsigned char data);
 
 #define __CBMEM_CONSOLE_ENABLE__	CONFIG_CONSOLE_CBMEM && \
-	(ENV_RAMSTAGE || (IS_ENABLED(CONFIG_EARLY_CBMEM_INIT) && \
-	(ENV_ROMSTAGE || (ENV_BOOTBLOCK && CONFIG_BOOTBLOCK_CONSOLE))))
+	(ENV_RAMSTAGE || ENV_VERSTAGE || \
+		(IS_ENABLED(CONFIG_EARLY_CBMEM_INIT) && \
+		 (ENV_ROMSTAGE || (ENV_BOOTBLOCK && CONFIG_BOOTBLOCK_CONSOLE)))\
+	)
 
 #if __CBMEM_CONSOLE_ENABLE__
 static inline void __cbmemc_init(void)	{ cbmemc_init(); }
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index 464294c..d8fc7a9 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -105,12 +105,28 @@ static inline void init_console_ptr(void *storage, u32 total_space, int flags)
 void cbmemc_init(void)
 {
 #ifdef __PRE_RAM__
-	int flags = CBMEMC_RESET;
+	int flags = 0;
 
-	/* Do not clear output from bootblock. */
-	if (ENV_ROMSTAGE && !IS_ENABLED(CONFIG_CACHE_AS_RAM))
-		if (IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE))
-			flags = 0;
+	/* If in bootblock always initialize the console first. */
+	if (ENV_BOOTBLOCK)
+		flags = CBMEMC_RESET;
+	else if (ENV_ROMSTAGE) {
+		/* Initialize console for the first time in romstage when
+		 * there's no prior stage that initialized it first. */
+		if (!IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK) &&
+		    !IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE))
+			flags = CBMEMC_RESET;
+	} else if (ENV_VERSTAGE) {
+		/*
+		 * Initialize console for the first time in verstage when
+		 * there is no console in bootblock. Otherwise honor the
+		 * bootblock console when verstage comes right after
+		 * bootblock.
+		 */
+		if (IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK) &&
+		    !IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE))
+			flags = CBMEMC_RESET;
+	}
 
 	init_console_ptr(_preram_cbmem_console,
 			_preram_cbmem_console_size, flags);



More information about the coreboot-gerrit mailing list