summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/mediatek/mt8173/cbmem.c4
-rw-r--r--src/soc/mediatek/mt8173/soc.c3
2 files changed, 4 insertions, 3 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);
}
diff --git a/src/soc/mediatek/mt8173/soc.c b/src/soc/mediatek/mt8173/soc.c
index 9183be126d..7f0b1b7855 100644
--- a/src/soc/mediatek/mt8173/soc.c
+++ b/src/soc/mediatek/mt8173/soc.c
@@ -16,13 +16,12 @@
#include <cpu/cpu.h>
#include <console/console.h>
#include <device/device.h>
-
#include <symbols.h>
static void soc_read_resources(device_t dev)
{
ram_resource(dev, 0, (uintptr_t)_dram / KiB,
- CONFIG_DRAM_SIZE_MB * KiB);
+ CONFIG_DRAM_SIZE_MB * (MiB / KiB));
}
static void soc_init(device_t dev)