From e3413cce3c8aa92db2483198470fae3f89a8e947 Mon Sep 17 00:00:00 2001 From: CC Ma Date: Thu, 6 Aug 2015 14:07:50 +0800 Subject: 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 Original-Commit-Id: 139a3163ca867ec5676c6cb81fdec724c99a4a99 Original-Change-Id: Ie190f86f49ae88671f0738e2d6ceafdad58a93cc Original-Signed-off-by: CC Ma Original-Reviewed-on: https://chromium-review.googlesource.com/292559 Original-Commit-Ready: Yidi Lin Original-Tested-by: Yidi Lin Original-Reviewed-by: Julius Werner Reviewed-on: https://review.coreboot.org/13098 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/soc/mediatek/mt8173/cbmem.c | 4 +++- src/soc/mediatek/mt8173/soc.c | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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 #include +#include #include 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 #include #include - #include 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) -- cgit v1.2.3