2020-04-04 18:51:19 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2014-05-01 23:45:56 +02:00
|
|
|
|
|
|
|
#include <cbmem.h>
|
2014-12-12 02:31:20 +01:00
|
|
|
#include <soc/soc_services.h>
|
2014-05-01 23:45:56 +02:00
|
|
|
|
2016-03-28 22:29:33 +02:00
|
|
|
static int cbmem_backing_store_ready;
|
|
|
|
|
|
|
|
void ipq_cbmem_backing_store_ready(void)
|
|
|
|
{
|
|
|
|
cbmem_backing_store_ready = 1;
|
|
|
|
}
|
|
|
|
|
2019-10-23 17:25:58 +02:00
|
|
|
void *cbmem_top_chipset(void)
|
2014-05-01 23:45:56 +02:00
|
|
|
{
|
2016-03-28 22:29:33 +02:00
|
|
|
/*
|
|
|
|
* 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).
|
|
|
|
*/
|
2019-10-27 07:13:55 +01:00
|
|
|
if (cbmem_backing_store_ready == 0)
|
2016-03-28 22:29:33 +02:00
|
|
|
return NULL;
|
|
|
|
|
2014-12-12 02:31:20 +01:00
|
|
|
return _memlayout_cbmem_top;
|
2014-05-01 23:45:56 +02:00
|
|
|
}
|