[coreboot-gerrit] New patch to review for coreboot: rockchip: make sure sdram top does not spill into MMIO space
Patrick Georgi (pgeorgi@google.com)
gerrit at coreboot.org
Sat May 7 08:30:31 CEST 2016
Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14717
-gerrit
commit 5dbb2a09ec6c803a46af088b97b507ccc4235026
Author: Lin Huang <hl at rock-chips.com>
Date: Sat Mar 26 11:50:05 2016 +0800
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 <pgeorgi at chromium.org>
Original-Commit-Id: 24f941e960e4a2cfb9fc26415f56e240de3d00d9
Original-Change-Id: Ia48d75e7de546b17636cde7829ee09837b9d7ac9
Original-Signed-off-by: Lin Huang <hl at rock-chips.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/337190
Original-Commit-Ready: Vadim Bendebury <vbendeb at chromium.org>
Original-Tested-by: Vadim Bendebury <vbendeb at chromium.org>
Original-Reviewed-by: Vadim Bendebury <vbendeb at chromium.org>
---
src/soc/rockchip/common/cbmem.c | 8 +++++---
src/soc/rockchip/rk3288/include/soc/addressmap.h | 2 ++
src/soc/rockchip/rk3399/include/soc/addressmap.h | 2 ++
src/soc/rockchip/rk3399/romstage.c | 4 +++-
src/soc/rockchip/rk3399/soc.c | 7 ++++---
5 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/soc/rockchip/common/cbmem.c b/src/soc/rockchip/common/cbmem.c
index d06b292..401f8b2 100644
--- a/src/soc/rockchip/common/cbmem.c
+++ b/src/soc/rockchip/common/cbmem.c
@@ -14,11 +14,13 @@
*/
#include <cbmem.h>
-#include <stddef.h>
-#include <symbols.h>
+#include <soc/addressmap.h>
#include <soc/sdram.h>
+#include <stdlib.h>
+#include <symbols.h>
void *cbmem_top(void)
{
- return _dram + sdram_size_mb()*MiB;
+ return (void *)min((uintptr_t)_dram + sdram_size_mb() * MiB,
+ MAX_DRAM_ADDRESS);
}
diff --git a/src/soc/rockchip/rk3288/include/soc/addressmap.h b/src/soc/rockchip/rk3288/include/soc/addressmap.h
index ba59404..4842ee6 100644
--- a/src/soc/rockchip/rk3288/include/soc/addressmap.h
+++ b/src/soc/rockchip/rk3288/include/soc/addressmap.h
@@ -16,6 +16,8 @@
#ifndef __SOC_ROCKCHIP_RK3288_ADDRESSMAP_H__
#define __SOC_ROCKCHIP_RK3288_ADDRESSMAP_H__
+#define MAX_DRAM_ADDRESS 0xFE000000
+
#define SDMMC1_BASE 0xFF0C0000
#define SDMMC0_BASE 0xFF0D0000
#define EMMC_BASE 0xFF0F0000
diff --git a/src/soc/rockchip/rk3399/include/soc/addressmap.h b/src/soc/rockchip/rk3399/include/soc/addressmap.h
index 8c1dacc..28cbd7a 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 c7183b6..05c853e 100644
--- a/src/soc/rockchip/rk3399/romstage.c
+++ b/src/soc/rockchip/rk3399/romstage.c
@@ -25,10 +25,12 @@
#include <program_loading.h>
#include <romstage_handoff.h>
#include <symbols.h>
+#include <soc/addressmap.h>
#include <soc/mmu_operations.h>
#include <soc/sdram.h>
-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 aa21038..453dc0f 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 <cpu/cpu.h>
#include <console/console.h>
+#include <cpu/cpu.h>
#include <device/device.h>
-#include <stdlib.h>
+#include <soc/addressmap.h>
#include <stddef.h>
+#include <stdlib.h>
#include <string.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);
+ min(CONFIG_DRAM_SIZE_MB * KiB, MAX_DRAM_ADDRESS / KiB));
}
static void soc_init(device_t dev)
More information about the coreboot-gerrit
mailing list