Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2015 MediaTek Inc. |
| 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> |
| 17 | #include <stddef.h> |
CC Ma | e3413cc | 2015-08-06 14:07:50 +0800 | [diff] [blame] | 18 | #include <stdlib.h> |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 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 | |
Yidi Lin | 3d7b606 | 2015-07-31 17:10:40 +0800 | [diff] [blame] | 24 | void *cbmem_top(void) |
| 25 | { |
Tristan Shieh | 4c8d487 | 2018-06-06 13:35:12 +0800 | [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 | } |