blob: bffbeedfd8ae453b9686c9ea52c899abf7a01ccd [file] [log] [blame]
Angel Ponsa2ee7612020-04-04 18:51:15 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Patrick Georgi40a3e322015-06-22 19:41:29 +02003
4#include <cbmem.h>
5#include <soc/addressmap.h>
6
Arthur Heymans340e4b82019-10-23 17:25:58 +02007void *cbmem_top_chipset(void)
Patrick Georgi40a3e322015-06-22 19:41:29 +02008{
9 static uintptr_t addr;
10
11 if (addr == 0) {
12 uintptr_t begin_mib;
13 uintptr_t end_mib;
14
15 memory_in_range_below_4gb(&begin_mib, &end_mib);
16 /* Make sure we consume everything up to 4GIB. */
17 if (end_mib == 4096)
18 addr = ~(uint32_t)0;
19 else
20 addr = end_mib << 20;
21 }
22
23 return (void *)addr;
24}