David Hendricks | 8cbd569 | 2017-12-01 20:49:48 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2014 Rockchip Inc. |
Patrick Rudolph | ab0a774 | 2019-01-02 14:04:02 +0100 | [diff] [blame^] | 5 | * Copyright 2019 9Elements GmbH <patrick.rudolph@9elements.com> |
David Hendricks | 8cbd569 | 2017-12-01 20:49:48 -0800 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | */ |
| 16 | |
| 17 | #include <cbmem.h> |
| 18 | #include <soc/addressmap.h> |
| 19 | #include <soc/sdram.h> |
| 20 | #include <stdlib.h> |
| 21 | #include <symbols.h> |
| 22 | |
| 23 | void *cbmem_top(void) |
| 24 | { |
Patrick Rudolph | 52acef1 | 2018-08-08 12:46:18 +0200 | [diff] [blame] | 25 | /* Make sure not to overlap with reserved ATF scratchpad */ |
Patrick Rudolph | ab0a774 | 2019-01-02 14:04:02 +0100 | [diff] [blame^] | 26 | return (void *)((uintptr_t)_dram + (sdram_size_mb() - 1) * MiB); |
David Hendricks | 8cbd569 | 2017-12-01 20:49:48 -0800 | [diff] [blame] | 27 | } |