[coreboot-gerrit] Patch set updated for coreboot: b4267d1 cbmem console: Make cbmem console usable on ARM.

Marc Jones (marc.jones@se-eng.com) gerrit at coreboot.org
Mon Dec 15 23:57:07 CET 2014


Marc Jones (marc.jones at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7747

-gerrit

commit b4267d103d16dd9727e8d9fb267433cfbd1fb6aa
Author: Gabe Black <gabeblack at google.com>
Date:   Thu Apr 3 18:50:12 2014 -0700

    cbmem console: Make cbmem console usable on ARM.
    
    The current CBMEM console implementation can work in two different ways, one
    that requires CAR migration which doesn't make sense on ARM and will break the
    build, and a second which assumes 0x600 is a valid memory address which can be
    used to keep track of the current location of the console. Neither of those
    work on ARM.
    
    To get around that problem, this change adds yet another flavor of behavior
    to the cbmem console driver where it assumes the console is in a fixed place
    before RAM is initialized (bootblock and ROM stage) and in CBMEM afterwards
    (RAM stage). More specifically, the location of the console is always fixed
    in a particular stage, attempts to set it are ignored, it's only initialized
    in the earliest stage it's enabled, and cbmem reinitialization and migration
    is ignored in RAM stage.
    
    We really need to rework all the twisted paths through this code and reduce
    it to one implementation that makes sense and works in all the situations it
    needs to without all the extra complexity.
    
    BUG=None
    TEST=Built and booted on nyan with other changes that enable the console.
    Ran cbmem -c and verified that output was preserved. Did the same on falco.
    BRANCH=None
    
    Original-Change-Id: I05e75448be8572e2736d4d0e04997e536fb69396
    Original-Signed-off-by: Gabe Black <gabeblack at google.com>
    Original-Reviewed-on: https://chromium-review.googlesource.com/193166
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
    Original-Commit-Queue: Gabe Black <gabeblack at chromium.org>
    Original-Tested-by: Gabe Black <gabeblack at chromium.org>
    (cherry picked from commit 6871aa315100c94cd3989aefbf17dd3285a08f1f)
    Signed-off-by: Marc Jones <marc.jones at se-eng.com>
    
    Change-Id: If916b97a22b1541d8b841a3dc6c4a1e34a110721
---
 src/console/Kconfig     | 5 +++++
 src/lib/cbmem_console.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/src/console/Kconfig b/src/console/Kconfig
index 0d32011..04bbf01 100644
--- a/src/console/Kconfig
+++ b/src/console/Kconfig
@@ -175,6 +175,11 @@ 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.
 
+config CONSOLE_FIXED_PRERAM_CBMEM_BUFFER
+	default n if ARCH_X86
+	default y if !ARCH_X86
+	bool "Assume the preram CBMEM console buffer is in a fixed location"
+
 config CONSOLE_CBMEM_BUFFER_SIZE
 	depends on CONSOLE_CBMEM
 	hex "Room allocated for console output in CBMEM"
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index b5b75f3..4dd0807 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -80,7 +80,12 @@ static inline void init_console_ptr(void *storage, u32 total_space)
 	/* Initialize the cache-as-ram pointer and underlying structure. */
 	car_set_var(cbmem_console_p, cbm_cons_p);
 	cbm_cons_p->buffer_size = total_space - sizeof(struct cbmem_console);
+#if !CONFIG_CONSOLE_FIXED_PRERAM_CBMEM_BUFFER || \
+    ((defined __BOOT_BLOCK__ && CONFIG_BOOTBLOCK_CONSOLE) || \
+     (defined __PRE_RAM__ && !defined __BOOTBLOCK__ && \
+      CONFIG_EARLY_CONSOLE && !CONFIG_BOOTBLOCK_CONSOLE))
 	cbm_cons_p->buffer_cursor = 0;
+#endif
 }
 
 void cbmemc_init(void)



More information about the coreboot-gerrit mailing list