plat-mediatek: set CFG_DRAM_SIZE according to CFG_CORE_ARM64_PA_BITS
OP-TEE Core uses CFG_DRAM_SIZE to map whole DRAM regsion so it can
resolve the physical addresses to the shared memory regions allocated by
Linux kernel.
Since the shared meomery is allocate and managed by Linux kernel, it is
unlikely to allocat a memory region outside the physical memory address.
It should be safe to configure CFG_DRAM_SIZE to a larger size than the
physical DRAM size. Even non-secure world could send an invalid physical
address, the CPU should raise an exception and fail when OP-TEE Core
accesses to that address.
Set CFG_DRAM_SIZE according to CFG_CORE_ARM64_PA_BITS regardless of the
physical DRAM size on different SKU.
Change-Id: I0b5b06cf498e9828b910cc0d934e1e839caa850e
diff --git a/core/arch/arm/plat-mediatek/main.c b/core/arch/arm/plat-mediatek/main.c
index 805a779..69747bb 100644
--- a/core/arch/arm/plat-mediatek/main.c
+++ b/core/arch/arm/plat-mediatek/main.c
@@ -19,7 +19,7 @@
static struct serial8250_uart_data console_data;
-register_ddr(CFG_DRAM_BASE, CFG_DRAM_SIZE);
+register_ddr(CFG_DRAM_BASE, BIT64(CFG_CORE_ARM64_PA_BITS) - CFG_DRAM_BASE);
#ifdef CFG_GIC
static struct gic_data gic_data;