[coreboot-gerrit] New patch to review for coreboot: ab9081c CBMEM console: Fix buffer without EARLY_CBMEM_INIT

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Tue May 26 06:03:57 CEST 2015


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10301

-gerrit

commit ab9081c5a8f488b9e60bce3c5fc371e9a7bb64cd
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Tue May 26 06:46:41 2015 +0300

    CBMEM console: Fix buffer without EARLY_CBMEM_INIT
    
    On S3 resume, CBMEM_ID_CONSOLE from previous boot is found in ramstage,
    even when romstage did not create it. So buffer did not get cleared
    on S3 resume path.
    
    Also do not allocate for preram_cbmem_console in CAR when there
    are no means to back it up to ram.
    
    Change-Id: I175cebbb938adf2a7414703fefffb8da796e9fa9
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/arch/x86/init/romstage.ld | 2 +-
 src/lib/cbmem_console.c       | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/arch/x86/init/romstage.ld b/src/arch/x86/init/romstage.ld
index 27e8de1..ae7049b 100644
--- a/src/arch/x86/init/romstage.ld
+++ b/src/arch/x86/init/romstage.ld
@@ -65,7 +65,7 @@ SECTIONS
 		 * statically checked because the cache-as-ram region usage is
 		 * cpu/chipset dependent. */
 		_preram_cbmem_console = .;
-		_epreram_cbmem_console = . + 0xc00;
+		_epreram_cbmem_console = . + (CONFIG_LATE_CBMEM_INIT ? 0 : 0xc00);
 	}
 
 	/* Global variables are not allowed in romstage
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index 30bf439..e9607f3 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -225,11 +225,8 @@ void cbmemc_reinit(void)
 
 	/* 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 (ENV_RAMSTAGE && IS_ENABLED(CONFIG_LATE_CBMEM_INIT))
+		flags |= CBMEMC_RESET;
 
 	/* If CBMEM entry already existed, old contents is not altered. */
 	cbm_cons_p = cbmem_add(CBMEM_ID_CONSOLE, size);



More information about the coreboot-gerrit mailing list