summaryrefslogtreecommitdiff
path: root/src/soc/qualcomm/ipq806x/cbmem.c
blob: f89cfabdf4d743cd84373185527e84cd4c787649 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* SPDX-License-Identifier: GPL-2.0-only */
/* This file is part of the coreboot project. */

#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_chipset(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 (cbmem_backing_store_ready == 0)
		return NULL;

	return _memlayout_cbmem_top;
}