• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <cbmem.h>
4 #include <soc/soc_services.h>
5 
6 static int cbmem_backing_store_ready;
7 
ipq_cbmem_backing_store_ready(void)8 void ipq_cbmem_backing_store_ready(void)
9 {
10 	cbmem_backing_store_ready = 1;
11 }
12 
cbmem_top_chipset(void)13 uintptr_t cbmem_top_chipset(void)
14 {
15 	/*
16 	 * In romstage, make sure that cbmem backing store is ready before
17 	 * returning pointer to cbmem top. Otherwise, it could lead to issues
18 	 * with components that utilize cbmem in romstage (e.g. vboot_locator
19 	 * for loading ipq blobs before DRAM is initialized).
20 	 */
21 	if (cbmem_backing_store_ready == 0)
22 		return 0;
23 
24 	return (uintptr_t)_memlayout_cbmem_top;
25 }
26