aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/cbmem_console.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-04-20 15:24:19 -0500
committerPatrick Georgi <pgeorgi@google.com>2015-04-23 16:35:51 +0200
commitd70bf7cc219f8478e8336f60542a50c078bf531b (patch)
treec2b63025bdf691e3724b7225d58bebd13aa07aca /src/lib/cbmem_console.c
parent58decc540dd40c180542d214f74773c7c17b4f28 (diff)
downloadcoreboot-d70bf7cc219f8478e8336f60542a50c078bf531b.tar.gz
coreboot-d70bf7cc219f8478e8336f60542a50c078bf531b.tar.xz
coreboot-d70bf7cc219f8478e8336f60542a50c078bf531b.zip
cbmem_console: fix it for x86
The Kconfig options pertaining cbmem console in the preram environment no longer make sense with the linker script changes. Remove them and their usage within cbmem_console. Change-Id: Ibf61645ca2331e4851e748e4e7aa5059e1192ed7 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9851 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/lib/cbmem_console.c')
-rw-r--r--src/lib/cbmem_console.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index 770c1d2c9..628d3b9c1 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -83,7 +83,7 @@ static inline void init_console_ptr(void *storage, u32 total_space, int flags)
{
struct cbmem_console *cbm_cons_p = storage;
- if (!cbm_cons_p) {
+ if (!cbm_cons_p || total_space == 0) {
current_console_set(NULL);
return;
}
@@ -209,22 +209,32 @@ static void copy_console_buffer(struct cbmem_console *old_cons_p,
void cbmemc_reinit(void)
{
- struct cbmem_console *cbm_cons_p = NULL;
+ struct cbmem_console *cbm_cons_p;
+ const size_t size = CONFIG_CONSOLE_CBMEM_BUFFER_SIZE;
int flags = CBMEMC_APPEND;
- if (ENV_ROMSTAGE && (CONFIG_CONSOLE_PRERAM_BUFFER_SIZE == 0))
- return;
-
- /* If CBMEM entry already existed, old contents is not altered. */
- cbm_cons_p = cbmem_add(CBMEM_ID_CONSOLE,
- CONFIG_CONSOLE_CBMEM_BUFFER_SIZE);
+ /* No appending when no preram console available and adding for
+ * the first time. */
+ if (!ENV_RAMSTAGE && _preram_cbmem_console_size == 0)
+ flags = CBMEMC_RESET;
- /* Clear old contents of CBMEM buffer. */
- if (ENV_ROMSTAGE || (CONFIG_CONSOLE_PRERAM_BUFFER_SIZE == 0))
+ /* Need to reset the newly added cbmem console in romstage. */
+ if (ENV_ROMSTAGE)
flags |= CBMEMC_RESET;
- init_console_ptr(cbm_cons_p,
- CONFIG_CONSOLE_CBMEM_BUFFER_SIZE, flags);
+ /* Need to reset the newly added cbmem console in ramstage
+ * when there was no console in preram environment. */
+ if (ENV_RAMSTAGE) {
+ cbm_cons_p = cbmem_find(CBMEM_ID_CONSOLE);
+ if (cbm_cons_p == NULL)
+ flags |= CBMEMC_RESET;
+ }
+
+ /* If CBMEM entry already existed, old contents is not altered. */
+ cbm_cons_p = cbmem_add(CBMEM_ID_CONSOLE, size);
+
+ init_console_ptr(cbm_cons_p, size, flags);
}
+
/* Call cbmemc_reinit() at CAR migration time. */
CAR_MIGRATE(cbmemc_reinit)