summaryrefslogtreecommitdiff
path: root/src/soc/qualcomm/ipq806x/cbmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/qualcomm/ipq806x/cbmem.c')
-rw-r--r--src/soc/qualcomm/ipq806x/cbmem.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/soc/qualcomm/ipq806x/cbmem.c b/src/soc/qualcomm/ipq806x/cbmem.c
index 7aff231be7..9674db65da 100644
--- a/src/soc/qualcomm/ipq806x/cbmem.c
+++ b/src/soc/qualcomm/ipq806x/cbmem.c
@@ -16,7 +16,24 @@
#include <cbmem.h>
#include <soc/soc_services.h>
+static int cbmem_backing_store_ready;
+
+void ipq_cbmem_backing_store_ready(void)
+{
+ cbmem_backing_store_ready = 1;
+}
+
void *cbmem_top(void)
{
+ /*
+ * In romstage, make sure that cbmem backing store is ready before
+ * returning the pointer to cbmem top. Otherwise, it could lead to
+ * issues with components that utilize cbmem in romstage
+ * (e.g. vboot_locator for loading ipq blobs before DRAM is
+ * initialized).
+ */
+ if (ENV_ROMSTAGE && (cbmem_backing_store_ready == 0))
+ return NULL;
+
return _memlayout_cbmem_top;
}