Fix CBMEM console use with CAR_MIGRATION
With EARLY_CBMEM_INIT and CAR_MIGRATION selected, cbmemc_reinit()
was called twice during romstage. This effectively deleted output
of romstage in CBMEM console.
Change-Id: I21072a319c0e4a5f695b0573bc017bf7921fc663
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/3609
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index de452d7..1b58402 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -193,7 +193,7 @@
new_cons_p->buffer_cursor = cursor;
}
-void cbmemc_reinit(void)
+static void cbmemc_reinit_(void)
{
struct cbmem_console *cbm_cons_p;
@@ -221,5 +221,12 @@
current_console_set(cbm_cons_p);
}
-/* Call cbmemc_reinit() at CAR migration time. */
-CAR_MIGRATE(cbmemc_reinit)
+void cbmemc_reinit(void)
+{
+#if !CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__)
+ cbmemc_reinit_();
+#endif
+}
+
+/* Call cbmemc_reinit_() at CAR migration time. */
+CAR_MIGRATE(cbmemc_reinit_)