• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <cbmem.h>
4 #include <symbols.h>
5 #include <ramdetect.h>
6 #include <commonlib/device_tree.h>
7 #include <mcall.h>
8 
cbmem_top_chipset(void)9 uintptr_t cbmem_top_chipset(void)
10 {
11 	uint64_t top;
12 
13 	top = fdt_get_memory_top((void *)HLS()->fdt);
14 	if (top)
15 		return MIN(top, (uint64_t)4 * GiB - 1);
16 
17 	size_t dram_mb_detected = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB);
18 	return (uintptr_t)_dram + dram_mb_detected * MiB;
19 }
20