From 19eb7509d380fd5d9e6d083ad0d2633820c8db4b Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Sat, 26 Mar 2016 11:50:05 +0800 Subject: rockchip: make sure sdram top does not spill into MMIO space The base address of MMIO space is different for different Rockchip SOCs. Define them in the appropriate address map files and use the definition in common code. BRANCH=none BUG=chrome-os-partner:51537 TEST=emerge-kevin coreboot Change-Id: I615f3cadd6d5d994b7dd1defbd10d02ad5c994da Signed-off-by: Patrick Georgi Original-Commit-Id: 24f941e960e4a2cfb9fc26415f56e240de3d00d9 Original-Change-Id: Ia48d75e7de546b17636cde7829ee09837b9d7ac9 Original-Signed-off-by: Lin Huang Original-Reviewed-on: https://chromium-review.googlesource.com/337190 Original-Commit-Ready: Vadim Bendebury Original-Tested-by: Vadim Bendebury Original-Reviewed-by: Vadim Bendebury Reviewed-on: https://review.coreboot.org/14717 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/soc/rockchip/rk3399/include/soc/addressmap.h | 2 ++ src/soc/rockchip/rk3399/romstage.c | 4 +++- src/soc/rockchip/rk3399/soc.c | 7 ++++--- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/soc/rockchip/rk3399') diff --git a/src/soc/rockchip/rk3399/include/soc/addressmap.h b/src/soc/rockchip/rk3399/include/soc/addressmap.h index 8c1dacc08c..28cbd7a56e 100644 --- a/src/soc/rockchip/rk3399/include/soc/addressmap.h +++ b/src/soc/rockchip/rk3399/include/soc/addressmap.h @@ -16,6 +16,8 @@ #ifndef __SOC_ROCKCHIP_RK3399_ADDRESSMAP_H__ #define __SOC_ROCKCHIP_RK3399_ADDRESSMAP_H__ +#define MAX_DRAM_ADDRESS 0xF8000000 + #define PMUGRF_BASE 0xff320000 #define PMUSGRF_BASE 0xff330000 #define PMUCRU_BASE 0xff750000 diff --git a/src/soc/rockchip/rk3399/romstage.c b/src/soc/rockchip/rk3399/romstage.c index c7183b671e..05c853eb84 100644 --- a/src/soc/rockchip/rk3399/romstage.c +++ b/src/soc/rockchip/rk3399/romstage.c @@ -25,10 +25,12 @@ #include #include #include +#include #include #include -static const uint64_t dram_size = (uint64_t)CONFIG_DRAM_SIZE_MB * MiB; +static const uint64_t dram_size = + (uint64_t)min((uint64_t)CONFIG_DRAM_SIZE_MB * MiB, MAX_DRAM_ADDRESS); void main(void) { diff --git a/src/soc/rockchip/rk3399/soc.c b/src/soc/rockchip/rk3399/soc.c index aa21038e64..453dc0f595 100644 --- a/src/soc/rockchip/rk3399/soc.c +++ b/src/soc/rockchip/rk3399/soc.c @@ -13,18 +13,19 @@ * GNU General Public License for more details. */ -#include #include +#include #include -#include +#include #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); + min(CONFIG_DRAM_SIZE_MB * KiB, MAX_DRAM_ADDRESS / KiB)); } static void soc_init(device_t dev) -- cgit v1.2.3