summaryrefslogtreecommitdiff
path: root/src/soc/sifive/fu540/cbmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/sifive/fu540/cbmem.c')
-rw-r--r--src/soc/sifive/fu540/cbmem.c8
1 files changed, 6 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);
}