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>
This commit is contained in:
Kyösti Mälkki 2013-09-09 01:31:22 +03:00
parent f56ff9069e
commit 52a2722389
1 changed files with 17 additions and 17 deletions

View File

@ -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);
if (!cbm_cons_p) {
current_console_set(NULL);
return;
}
cbm_cons_p->buffer_size = CONFIG_CONSOLE_CBMEM_BUFFER_SIZE -
sizeof(struct cbmem_console);
cbm_cons_p->buffer_cursor = 0;
}
cbm_cons_p->buffer_size = CONFIG_CONSOLE_CBMEM_BUFFER_SIZE -
sizeof(struct cbmem_console);
cbm_cons_p->buffer_cursor = 0;
#else
cbm_cons_p = cbmem_find(CBMEM_ID_CONSOLE);
if (!cbm_cons_p)
return;
#endif
copy_console_buffer(cbm_cons_p);
current_console_set(cbm_cons_p);