[coreboot-gerrit] New patch to review for coreboot: dca887d hardwaremain: explicitly call cbmem_initialize() early

Aaron Durbin (adurbin@google.com) gerrit at coreboot.org
Tue Apr 7 00:51:19 CEST 2015


Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9327

-gerrit

commit dca887d12212758fa1527714639d68df968c79f6
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Mon Apr 6 16:12:58 2015 -0500

    hardwaremain: explicitly call cbmem_initialize() early
    
    Over the course of time there have been some implicit assumptions
    about cbmem being available for find() or add() operations. However,
    the cbmem area was never fully recovered until entering the state
    machine: BS_ON_ENTRY into BS_PRE_DEVICE. Correct this assumption
    by explicitly calling cbmem_initialize() in the EARLY_CBMEM_INIT
    case.
    
    This, however, doesn't fix timestamp_init() showing an error about
    not being able to allocate the timestamp table.
    
    Change-Id: Ib93fcc932e202ebd37822f07a278ea9694fe965c
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 src/lib/dynamic_cbmem.c | 13 +------------
 src/lib/hardwaremain.c  |  9 +++++++++
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/lib/dynamic_cbmem.c b/src/lib/dynamic_cbmem.c
index 3b008c7..c63cb46 100644
--- a/src/lib/dynamic_cbmem.c
+++ b/src/lib/dynamic_cbmem.c
@@ -426,18 +426,7 @@ void *cbmem_entry_start(const struct cbmem_entry *entry)
 
 #if !defined(__PRE_RAM__)
 
-#if IS_ENABLED(CONFIG_EARLY_CBMEM_INIT)
-/* selected cbmem can be initialized early in ramstage. Additionally, that
- * means cbmem console can be reinitialized early as well. The post_device
- * function is empty since cbmem was initialized early in ramstage. */
-static void init_cbmem_pre_device(void *unused)
-{
-	cbmem_initialize();
-}
-
-BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_ENTRY, init_cbmem_pre_device, NULL);
-#else
-
+#if !IS_ENABLED(CONFIG_EARLY_CBMEM_INIT)
 static void init_cbmem_post_device(void *unused)
 {
 	if (acpi_is_wakeup())
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index 83bc7be..5f06ca7 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -26,6 +26,7 @@
 #include <bootstate.h>
 #include <console/console.h>
 #include <console/post_codes.h>
+#include <cbmem.h>
 #include <version.h>
 #include <device/device.h>
 #include <device/pci.h>
@@ -433,6 +434,14 @@ static void boot_state_schedule_static_entries(void)
 
 void main(void)
 {
+	/*
+	 * CBMEM needs to be recovered in the EARLY_CBMEM_INIT case because
+	 * timestamps, APCI, etc rely on the cbmem infrastructure being
+	 * around. Explicitly recover it.
+	 */
+	if (IS_ENABLED(CONFIG_EARLY_CBMEM_INIT))
+		cbmem_initialize();
+
 	/* Record current time, try to locate timestamps in CBMEM. */
 	timestamp_init(timestamp_get());
 



More information about the coreboot-gerrit mailing list