summaryrefslogtreecommitdiff
path: root/src/soc/qualcomm/ipq40xx/cbmem.c
blob: 972c6258c9a566258ad96082402f84d3210a12e6 (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
28
29
30
31
32
33
34
35
36
37
38
/*
 * This file is part of the coreboot project.
 *
 * Copyright 2014 Google Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#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 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;
}