Jarried Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/85249?usp=email )
Change subject: soc/mediatek/mt8196: Reserve memory for OP-TEE ......................................................................
soc/mediatek/mt8196: Reserve memory for OP-TEE
This patch reserves 70MB memory space for running the OP-TEE image.
BUG=b:317009620 TEST=build pass
Change-Id: I6f75870bdd76e89866508d351b04a0921f30fe4d Signed-off-by: Jarried Lin jarried.lin@mediatek.corp-partner.google.com --- M src/soc/mediatek/common/include/soc/symbols.h M src/soc/mediatek/mt8196/include/soc/memlayout.ld M src/soc/mediatek/mt8196/soc.c 3 files changed, 13 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/85249/1
diff --git a/src/soc/mediatek/common/include/soc/symbols.h b/src/soc/mediatek/common/include/soc/symbols.h index 5e1c705..065c300 100644 --- a/src/soc/mediatek/common/include/soc/symbols.h +++ b/src/soc/mediatek/common/include/soc/symbols.h @@ -6,5 +6,6 @@ #include <symbols.h>
DECLARE_REGION(dram_dma) +DECLARE_REGION(resv_mem_optee)
#endif /* _SOC_MEDIATEK_COMMON_SYMBOLS_H_ */ diff --git a/src/soc/mediatek/mt8196/include/soc/memlayout.ld b/src/soc/mediatek/mt8196/include/soc/memlayout.ld index f5710f4..f038e23 100644 --- a/src/soc/mediatek/mt8196/include/soc/memlayout.ld +++ b/src/soc/mediatek/mt8196/include/soc/memlayout.ld @@ -2,6 +2,9 @@
#include <soc/memlayout.h>
+#define OPTEE_BUF(addr, size) \ + REGION(resv_mem_optee, addr, size, 4K) + SECTIONS { /* MT8196 has 256KB SRAM. */ @@ -54,6 +57,7 @@ DRAM_DMA(0x80000000, 1M) POSTRAM_CBFS_CACHE(0x80100000, 2M) RAMSTAGE(0x80300000, 2M) + OPTEE_BUF(0x80500000, 70M)
BL31(0x94600000, 0x200000) } diff --git a/src/soc/mediatek/mt8196/soc.c b/src/soc/mediatek/mt8196/soc.c index eb72fca..fee9192 100644 --- a/src/soc/mediatek/mt8196/soc.c +++ b/src/soc/mediatek/mt8196/soc.c @@ -5,8 +5,16 @@ #include <soc/emi.h> #include <soc/mmu_operations.h> #include <soc/pcie.h> +#include <soc/symbols.h> #include <symbols.h>
+void bootmem_platform_add_ranges(void) +{ + if (CONFIG(ARM64_BL31_OPTEE_WITH_SMC)) + bootmem_add_range((uint64_t)_resv_mem_optee, + (uint64_t)REGION_SIZE(resv_mem_optee), BM_MEM_RESERVED); +} + static void soc_read_resources(struct device *dev) { ram_range(dev, 0, (uintptr_t)_dram, sdram_size());