]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(imx8mn): add hab and map required memory blocks
authorAndrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Mon, 26 Sep 2022 20:47:12 +0000 (22:47 +0200)
committerAndrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Wed, 19 Oct 2022 13:53:01 +0000 (15:53 +0200)
In order for HAB to perform operations, memory regions has to be mapped
in TF-A, which HAB ROM code would use internally.

Include those memory blocks for i.MX8MN SoC. Of a special note, the DRAM
block is mapped with complete size available on the platform and uses
MT_RW attributes, this is required to minimize the size of translation
tables and provide a possibility to exchange the execution results
between EL3 and EL1&2, see details in [1].

Link: [1]: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/16880
Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Change-Id: If7a2b718658db452871e1ae56b71a4983e8ef2fe

plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c
plat/imx/imx8m/imx8mn/include/platform_def.h

index 464c87dde892497f2ced10dcd8575b199772d1a6..de30967d9a13ff6046b3aa5449dd69a0e2091681 100644 (file)
@@ -32,7 +32,9 @@
 #define TRUSTY_PARAMS_LEN_BYTES      (4096*2)
 
 static const mmap_region_t imx_mmap[] = {
-       GIC_MAP, AIPS_MAP, OCRAM_S_MAP, DDRC_MAP, {0},
+       GIC_MAP, AIPS_MAP, OCRAM_S_MAP, DDRC_MAP,
+       CAAM_RAM_MAP, NS_OCRAM_MAP, ROM_MAP, DRAM_MAP,
+       {0},
 };
 
 static const struct aipstz_cfg aipstz[] = {
index dbb44165c62e5adbdf222d0fa7e669d73902e1fe..d4b171734f345cfa79d7fba12d5f184ab39efe87 100644 (file)
 #define IMX_DDR_IPS_BASE               U(0x3d000000)
 #define IMX_DDR_IPS_SIZE               U(0x1800000)
 #define IMX_ROM_BASE                   U(0x0)
+#define IMX_ROM_SIZE                   U(0x40000)
+#define IMX_NS_OCRAM_BASE              U(0x900000)
+#define IMX_NS_OCRAM_SIZE              U(0x60000)
+#define IMX_CAAM_RAM_BASE              U(0x100000)
+#define IMX_CAAM_RAM_SIZE              U(0x10000)
+#define IMX_DRAM_BASE                  U(0x40000000)
+#define IMX_DRAM_SIZE                  U(0xc0000000)
 
 #define IMX_GIC_BASE                   PLAT_GICD_BASE
 #define IMX_GIC_SIZE                   U(0x200000)
 #define AIPS_MAP       MAP_REGION_FLAT(IMX_AIPS_BASE, IMX_AIPS_SIZE, MT_DEVICE | MT_RW) /* AIPS map */
 #define OCRAM_S_MAP    MAP_REGION_FLAT(OCRAM_S_BASE, OCRAM_S_SIZE, MT_DEVICE | MT_RW) /* OCRAM_S */
 #define DDRC_MAP       MAP_REGION_FLAT(IMX_DDRPHY_BASE, IMX_DDR_IPS_SIZE, MT_DEVICE | MT_RW) /* DDRMIX */
+#define CAAM_RAM_MAP   MAP_REGION_FLAT(IMX_CAAM_RAM_BASE, IMX_CAAM_RAM_SIZE, MT_MEMORY | MT_RW) /* CAMM RAM */
+#define NS_OCRAM_MAP   MAP_REGION_FLAT(IMX_NS_OCRAM_BASE, IMX_NS_OCRAM_SIZE, MT_MEMORY | MT_RW) /* NS OCRAM */
+#define ROM_MAP                MAP_REGION_FLAT(IMX_ROM_BASE, IMX_ROM_SIZE, MT_MEMORY | MT_RO) /* ROM code */
+
+/*
+ * Note: DRAM region is mapped with entire size available and uses MT_RW
+ * attributes.
+ * See details in docs/plat/imx8m.rst "High Assurance Boot (HABv4)" section
+ * for explanation of this mapping scheme.
+ */
+#define DRAM_MAP       MAP_REGION_FLAT(IMX_DRAM_BASE, IMX_DRAM_SIZE, MT_MEMORY | MT_RW | MT_NS) /* DRAM */
 
 #endif /* platform_def.h */