blob: 8c2bfcd1ae4b32c08013dd3bb5d4a783a88f374f [file] [log] [blame]
Patrick Georgi40a3e322015-06-22 19:41:29 +02001/*
2 * This file is part of the coreboot project.
3 *
Patrick Georgi40a3e322015-06-22 19:41:29 +02004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Patrick Georgi40a3e322015-06-22 19:41:29 +020013 */
14
15#include <cbmem.h>
16#include <soc/addressmap.h>
17
Arthur Heymans340e4b82019-10-23 17:25:58 +020018void *cbmem_top_chipset(void)
Patrick Georgi40a3e322015-06-22 19:41:29 +020019{
20 static uintptr_t addr;
21
22 if (addr == 0) {
23 uintptr_t begin_mib;
24 uintptr_t end_mib;
25
26 memory_in_range_below_4gb(&begin_mib, &end_mib);
27 /* Make sure we consume everything up to 4GIB. */
28 if (end_mib == 4096)
29 addr = ~(uint32_t)0;
30 else
31 addr = end_mib << 20;
32 }
33
34 return (void *)addr;
35}