summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cbmem_console.c6
-rw-r--r--src/lib/program.ld1
2 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index 641824f942..a7d67a3981 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -145,7 +145,11 @@ static void cbmemc_reinit(int is_recovery)
init_console_ptr(cbmem_cons_p, size);
copy_console_buffer(previous_cons_p);
}
-ROMSTAGE_CBMEM_INIT_HOOK(cbmemc_reinit)
+
+/* Run the romstage hook early so that the console region is one of the earliest created, and
+ therefore more likely to stay in the same place even across different boot modes where some
+ other regions may sometimes not get created (e.g. RW_MCACHE in vboot recovery mode). */
+ROMSTAGE_CBMEM_INIT_HOOK_EARLY(cbmemc_reinit)
RAMSTAGE_CBMEM_INIT_HOOK(cbmemc_reinit)
POSTCAR_CBMEM_INIT_HOOK(cbmemc_reinit)
diff --git a/src/lib/program.ld b/src/lib/program.ld
index 8180d9f1dc..1c5cda40e1 100644
--- a/src/lib/program.ld
+++ b/src/lib/program.ld
@@ -27,6 +27,7 @@
#if ENV_RAMSTAGE || ENV_ROMSTAGE || ENV_POSTCAR
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_cbmem_init_hooks = .;
+ KEEP(*(.rodata.cbmem_init_hooks_early));
KEEP(*(.rodata.cbmem_init_hooks));
_ecbmem_init_hooks = .;
RECORD_SIZE(cbmem_init_hooks)