Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Tristan Shieh | 362a734 | 2018-06-06 14:03:22 +0800 | [diff] [blame] | 4 | * Copyright 2018 MediaTek Inc. |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <cbmem.h> |
Elyes HAOUAS | ba9b504 | 2019-12-19 07:47:52 +0100 | [diff] [blame^] | 17 | #include <commonlib/helpers.h> |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 18 | #include <stddef.h> |
| 19 | #include <symbols.h> |
Yidi Lin | c6d7dcc | 2016-02-04 17:26:48 +0800 | [diff] [blame] | 20 | #include <soc/emi.h> |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 21 | |
Tristan Shieh | 4c8d487 | 2018-06-06 13:35:12 +0800 | [diff] [blame] | 22 | #define MAX_DRAM_ADDRESS ((uintptr_t)4 * GiB) |
| 23 | |
Arthur Heymans | 340e4b8 | 2019-10-23 17:25:58 +0200 | [diff] [blame] | 24 | void *cbmem_top_chipset(void) |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 25 | { |
Elyes HAOUAS | ba9b504 | 2019-12-19 07:47:52 +0100 | [diff] [blame^] | 26 | return (void *)MIN((uintptr_t)_dram + sdram_size(), MAX_DRAM_ADDRESS); |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 27 | } |