summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCC Ma <cc.ma@mediatek.com>2015-08-06 14:07:50 +0800
committerPatrick Georgi <pgeorgi@google.com>2016-01-22 22:15:38 +0100
commite3413cce3c8aa92db2483198470fae3f89a8e947 (patch)
tree3e7ea64986667ec27618c4757ea53b87851a0ea6 /src
parent767b45fe962c87339d4a990b6f1371fe75555e09 (diff)
downloadcoreboot-e3413cce3c8aa92db2483198470fae3f89a8e947.tar.xz
mediatek/mt8173: revise cbmem_top
Support memory range querying to above/below 4GiB. Enable PRERAM_CBMEM_CONSOLE. BRANCH=none BUG=none TEST=build and verified pass on oak board Change-Id: If12ab2e9b8a129e2c82dd97b0493d9abdd6985a9 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 139a3163ca867ec5676c6cb81fdec724c99a4a99 Original-Change-Id: Ie190f86f49ae88671f0738e2d6ceafdad58a93cc Original-Signed-off-by: CC Ma <cc.ma@mediatek.com> Original-Reviewed-on: https://chromium-review.googlesource.com/292559 Original-Commit-Ready: Yidi Lin <yidi.lin@mediatek.com> Original-Tested-by: Yidi Lin <yidi.lin@mediatek.com> Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/13098 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src')
-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)