summaryrefslogtreecommitdiff
path: root/src/mainboard/emulation/qemu-aarch64/cbmem.c
blob: 3aac9bf71569b76df442a06b56ae7a6d306a2cc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* SPDX-License-Identifier: GPL-2.0-or-later */

#include <cbmem.h>
#include <ramdetect.h>
#include <symbols.h>
#include <commonlib/device_tree.h>

DECLARE_REGION(fdt)
uintptr_t cbmem_top_chipset(void)
{
	uint64_t top;

	top = fdt_get_memory_top((void *)_fdt);
	if (top)
		return MIN(top, (uint64_t)4 * GiB - 1);

	return (uintptr_t)_dram + (probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB) * MiB);
}