summaryrefslogtreecommitdiff
path: root/src/soc/sifive
diff options
context:
space:
mode:
authorPhilipp Hug <philipp@hug.cx>2018-07-07 14:21:30 +0200
committerRonald G. Minnich <rminnich@gmail.com>2018-10-30 02:07:12 +0000
commitbb7f41d85ad8b73b401906426f11e0e6832d3d1e (patch)
tree4586cea856b65ff7dbfcc6691b1eab8ebac3b9a6 /src/soc/sifive
parent3d8e53f85ad4cf6547f3e4c408aa49460fd76eec (diff)
downloadcoreboot-bb7f41d85ad8b73b401906426f11e0e6832d3d1e.tar.xz
sifive/fu540: correct cbmem support
Return correct memory location for cbmem instead of incorrectly returning memory size. Change-Id: If7f490a46edebb04c2280bf317d1adacef08f30d Signed-off-by: Philipp Hug <philipp@hug.cx> Reviewed-on: https://review.coreboot.org/29197 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Xiang Wang <wxjstz@126.com> Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Diffstat (limited to 'src/soc/sifive')
-rw-r--r--src/soc/sifive/fu540/cbmem.c8
-rw-r--r--src/soc/sifive/fu540/include/soc/addressmap.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/soc/sifive/fu540/cbmem.c b/src/soc/sifive/fu540/cbmem.c
index 8648370f20..1c68de894b 100644
--- a/src/soc/sifive/fu540/cbmem.c
+++ b/src/soc/sifive/fu540/cbmem.c
@@ -14,9 +14,13 @@
*/
#include <cbmem.h>
+#include <soc/addressmap.h>
+#include <soc/sdram.h>
+#include <stdlib.h>
+#include <symbols.h>
void *cbmem_top(void)
{
- /* dummy value */
- return (void *)(4ULL * GiB);
+ return (void *)min((uintptr_t)_dram + sdram_size_mb() * MiB,
+ FU540_MAXDRAM);
}
diff --git a/src/soc/sifive/fu540/include/soc/addressmap.h b/src/soc/sifive/fu540/include/soc/addressmap.h
index 21709b5443..cd611494bb 100644
--- a/src/soc/sifive/fu540/include/soc/addressmap.h
+++ b/src/soc/sifive/fu540/include/soc/addressmap.h
@@ -34,3 +34,4 @@
#define FU540_QSPI0FLASH 0x20000000
#define FU540_QSPI1FLASH 0x30000000
#define FU540_DRAM 0x80000000
+#define FU540_MAXDRAM 0x2000000000ULL