Angel Pons | e67ab18 | 2020-04-04 18:51:11 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | /* This file is part of the coreboot project. */ | ||||
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 3 | |
4 | #include <cbmem.h> | ||||
Elyes HAOUAS | ba9b504 | 2019-12-19 07:47:52 +0100 | [diff] [blame] | 5 | #include <commonlib/helpers.h> |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 6 | #include <stddef.h> |
7 | #include <symbols.h> | ||||
Yidi Lin | c6d7dcc | 2016-02-04 17:26:48 +0800 | [diff] [blame] | 8 | #include <soc/emi.h> |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 9 | |
Tristan Shieh | 4c8d487 | 2018-06-06 13:35:12 +0800 | [diff] [blame] | 10 | #define MAX_DRAM_ADDRESS ((uintptr_t)4 * GiB) |
11 | |||||
Arthur Heymans | 340e4b8 | 2019-10-23 17:25:58 +0200 | [diff] [blame] | 12 | void *cbmem_top_chipset(void) |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 13 | { |
Elyes HAOUAS | ba9b504 | 2019-12-19 07:47:52 +0100 | [diff] [blame] | 14 | return (void *)MIN((uintptr_t)_dram + sdram_size(), MAX_DRAM_ADDRESS); |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 15 | } |