summaryrefslogtreecommitdiff
path: root/src/soc/rockchip/common/cbmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/rockchip/common/cbmem.c')
-rw-r--r--src/soc/rockchip/common/cbmem.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/soc/rockchip/common/cbmem.c b/src/soc/rockchip/common/cbmem.c
index d06b292424..401f8b2a65 100644
--- a/src/soc/rockchip/common/cbmem.c
+++ b/src/soc/rockchip/common/cbmem.c
@@ -14,11 +14,13 @@
*/
#include <cbmem.h>
-#include <stddef.h>
-#include <symbols.h>
+#include <soc/addressmap.h>
#include <soc/sdram.h>
+#include <stdlib.h>
+#include <symbols.h>
void *cbmem_top(void)
{
- return _dram + sdram_size_mb()*MiB;
+ return (void *)min((uintptr_t)_dram + sdram_size_mb() * MiB,
+ MAX_DRAM_ADDRESS);
}