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 Change-Id: I05e75448be8572e2736d4d0e04997e536fb69396 Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://chromium-review.googlesource.com/193166 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Commit-Queue: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
This commit is contained in:
parent
4f38c073bf
commit
6871aa3151
2 changed files with 14 additions and 2 deletions
|
|
@ -229,6 +229,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"
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ static u8 static_console[STATIC_CONSOLE_SIZE];
|
|||
|
||||
static inline struct cbmem_console *current_console(void)
|
||||
{
|
||||
#if CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__)
|
||||
#if CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__) || \
|
||||
CONFIG_CONSOLE_FIXED_PRERAM_CBMEM_BUFFER
|
||||
return car_get_var(cbmem_console_p);
|
||||
#else
|
||||
/*
|
||||
|
|
@ -94,7 +95,8 @@ static inline struct cbmem_console *current_console(void)
|
|||
|
||||
static inline void current_console_set(struct cbmem_console *new_console_p)
|
||||
{
|
||||
#if CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__)
|
||||
#if CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__) || \
|
||||
CONFIG_CONSOLE_FIXED_PRERAM_CBMEM_BUFFER
|
||||
car_set_var(cbmem_console_p, new_console_p);
|
||||
#else
|
||||
CBMEM_CONSOLE_REDIRECT = new_console_p;
|
||||
|
|
@ -108,7 +110,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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue