summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2013-09-09 01:31:22 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2013-09-21 06:21:53 +0200
commit52a27223892936cdc8e1744516a82a2e44584763 (patch)
tree11c2bc4172005515f0a0c9b29b9ab0b4f061dc84 /src/lib
parentf56ff9069eb49df30d7e99e4e67aad851a54bc7d (diff)
downloadcoreboot-52a27223892936cdc8e1744516a82a2e44584763.tar.xz
CBMEM console: Support late init
It is not compulsory to have CBMEM console initialised in romstage, so try add the CBMEM table entry again in ramstage, if not found. Change-Id: I96ab502df7f05d6bf1d6e6fa84d395ef6306b525 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/3915 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Aaron Durbin <adurbin@google.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cbmem_console.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index 1b584028b4..819c27f42d 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -195,27 +195,27 @@ static void copy_console_buffer(struct cbmem_console *new_cons_p)
static void cbmemc_reinit_(void)
{
- struct cbmem_console *cbm_cons_p;
+ struct cbmem_console *cbm_cons_p = NULL;
+
+#ifndef __PRE_RAM__
+ cbm_cons_p = cbmem_find(CBMEM_ID_CONSOLE);
+#endif
-#ifdef __PRE_RAM__
- cbm_cons_p = cbmem_add(CBMEM_ID_CONSOLE,
- CONFIG_CONSOLE_CBMEM_BUFFER_SIZE);
if (!cbm_cons_p) {
- current_console_set(NULL);
- return;
- }
+ cbm_cons_p = cbmem_add(CBMEM_ID_CONSOLE,
+ CONFIG_CONSOLE_CBMEM_BUFFER_SIZE);
- cbm_cons_p->buffer_size = CONFIG_CONSOLE_CBMEM_BUFFER_SIZE -
- sizeof(struct cbmem_console);
+ if (!cbm_cons_p) {
+ current_console_set(NULL);
+ return;
+ }
- cbm_cons_p->buffer_cursor = 0;
-#else
- cbm_cons_p = cbmem_find(CBMEM_ID_CONSOLE);
+ cbm_cons_p->buffer_size = CONFIG_CONSOLE_CBMEM_BUFFER_SIZE -
+ sizeof(struct cbmem_console);
- if (!cbm_cons_p)
- return;
+ cbm_cons_p->buffer_cursor = 0;
+ }
-#endif
copy_console_buffer(cbm_cons_p);
current_console_set(cbm_cons_p);