blob: a56f150b26079b89a67d6222fc90ce89f01f3266 [file] [log] [blame]
Angel Ponsa2ee7612020-04-04 18:51:15 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Patrick Georgi40a3e322015-06-22 19:41:29 +02002
3#include <cbmem.h>
4#include <soc/addressmap.h>
5
Elyes Haouas799c3212022-11-09 14:00:44 +01006uintptr_t cbmem_top_chipset(void)
Patrick Georgi40a3e322015-06-22 19:41:29 +02007{
8 static uintptr_t addr;
9
10 if (addr == 0) {
11 uintptr_t begin_mib;
12 uintptr_t end_mib;
13
14 memory_in_range_below_4gb(&begin_mib, &end_mib);
15 /* Make sure we consume everything up to 4GIB. */
16 if (end_mib == 4096)
17 addr = ~(uint32_t)0;
18 else
19 addr = end_mib << 20;
20 }
21
Elyes Haouas799c3212022-11-09 14:00:44 +010022 return addr;
Patrick Georgi40a3e322015-06-22 19:41:29 +020023}