summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/mt8173/cbmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/mediatek/mt8173/cbmem.c')
-rw-r--r--src/soc/mediatek/mt8173/cbmem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/soc/mediatek/mt8173/cbmem.c b/src/soc/mediatek/mt8173/cbmem.c
index ae96c29d1d..c7afd6c08e 100644
--- a/src/soc/mediatek/mt8173/cbmem.c
+++ b/src/soc/mediatek/mt8173/cbmem.c
@@ -15,9 +15,11 @@
#include <cbmem.h>
#include <stddef.h>
+#include <stdlib.h>
#include <symbols.h>
void *cbmem_top(void)
{
- return (void *)((uintptr_t) _dram + (CONFIG_DRAM_SIZE_MB << 20));
+ return (void *)min((uintptr_t)_dram + ((size_t)CONFIG_DRAM_SIZE_MB * MiB),
+ (uintptr_t)4 * GiB);
}