ach/x86/postcar.c: Avoid double CBMEM initialization
On FSP1.1 platform cbmem_initiailze() is called in
chipset_teardown_car_main(). This causes double
call op cbmem_initialize().
Add call to cbmem_online() to avoid double CBMEM init.
BUG = N/A
TEST = Build and boot on Facebook FBG1701
Change-Id: I449ddfc94f1099d7c0e9005e6a5cf509e1433bb1
Signed-off-by: Frans Hendriks <fhendriks@eltan.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49646
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Wim Vervoorn <wvervoorn@eltan.com>
diff --git a/src/arch/x86/postcar.c b/src/arch/x86/postcar.c
index dcacc70..1df8c44 100644
--- a/src/arch/x86/postcar.c
+++ b/src/arch/x86/postcar.c
@@ -23,8 +23,12 @@
/*
* CBMEM needs to be recovered because timestamps rely on
* the cbmem infrastructure being around. Explicitly recover it.
+ *
+ * On some platforms CBMEM needs to be initialized earlier.
+ * Use cbmem_online() to avoid init CBMEM twice.
*/
- cbmem_initialize();
+ if (!cbmem_online())
+ cbmem_initialize();
timestamp_add_now(TS_START_POSTCAR);