From 52a27223892936cdc8e1744516a82a2e44584763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Mon, 9 Sep 2013 01:31:22 +0300 Subject: [PATCH] CBMEM console: Support late init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: http://review.coreboot.org/3915 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi Reviewed-by: Paul Menzel Reviewed-by: Aaron Durbin --- src/lib/cbmem_console.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 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); + + 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);