feat(tc): port BL31-BL33 interface to firmware handoff framework

Adding support for this framework at the handoff boundary between
firmware stage BL31 and BL33 on TC.

Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
Change-Id: Ia6cd29c8b6cdda0a127a3bac02f6fa1dcfc07151
diff --git a/plat/arm/board/tc/include/platform_def.h b/plat/arm/board/tc/include/platform_def.h
index 6ad263d..0216000 100644
--- a/plat/arm/board/tc/include/platform_def.h
+++ b/plat/arm/board/tc/include/platform_def.h
@@ -42,12 +42,18 @@
 #define PLAT_ARM_FW_HANDOFF_SIZE	U(0x9000)
 #define PLAT_ARM_EL3_FW_HANDOFF_BASE	ARM_BL_RAM_BASE
 #define PLAT_ARM_EL3_FW_HANDOFF_LIMIT	PLAT_ARM_EL3_FW_HANDOFF_BASE + PLAT_ARM_FW_HANDOFF_SIZE
+#define FW_NS_HANDOFF_BASE		(PLAT_ARM_NS_IMAGE_BASE - PLAT_ARM_FW_HANDOFF_SIZE)
 
 /* Mappings for Secure and Non-secure Transfer_list */
 #define TC_MAP_EL3_FW_HANDOFF		MAP_REGION_FLAT(		\
 					PLAT_ARM_EL3_FW_HANDOFF_BASE,	\
 					PLAT_ARM_FW_HANDOFF_SIZE,	\
 					MT_MEMORY | MT_RW | EL3_PAS)
+
+#define TC_MAP_FW_NS_HANDOFF		MAP_REGION_FLAT(		\
+					FW_NS_HANDOFF_BASE,		\
+					PLAT_ARM_FW_HANDOFF_SIZE,	\
+					MT_MEMORY | MT_RW | MT_NS)
 #endif /* TRANSFER_LIST */
 
 /*
diff --git a/plat/arm/board/tc/tc_bl31_setup.c b/plat/arm/board/tc/tc_bl31_setup.c
index 66d921d..a358390 100644
--- a/plat/arm/board/tc/tc_bl31_setup.c
+++ b/plat/arm/board/tc/tc_bl31_setup.c
@@ -159,8 +159,10 @@
 
 	arm_bl31_early_platform_setup(arg0, arg1, arg2, arg3);
 
+#if !TRANSFER_LIST
 	/* Fill the properties struct with the info from the config dtb */
 	fconf_populate("FW_CONFIG", arg1);
+#endif
 }
 
 #ifdef PLATFORM_TESTS
@@ -205,6 +207,13 @@
 {
 	arm_bl31_plat_arch_setup();
 
+	/*
+	 * When TRANSFER_LIST is enabled, HW_CONFIG is included in Transfer List
+	 * as an entry with the tag TL_TAG_FDT. In this case, the configuration
+	 * is already available, so the fconf_populate mechanism is not needed.
+	 * The code block below is only required when TRANSFER_LIST is not used.
+	 */
+#if !TRANSFER_LIST
 	/* HW_CONFIG was also loaded by BL2 */
 	const struct dyn_cfg_dtb_info_t *hw_config_info;
 
@@ -212,6 +221,7 @@
 	assert(hw_config_info != NULL);
 
 	fconf_populate("HW_CONFIG", hw_config_info->config_addr);
+#endif
 }
 
 #if defined(SPD_spmd) && (SPMC_AT_EL3 == 0)
diff --git a/plat/arm/board/tc/tc_plat.c b/plat/arm/board/tc/tc_plat.c
index b5d1008..fcee784 100644
--- a/plat/arm/board/tc/tc_plat.c
+++ b/plat/arm/board/tc/tc_plat.c
@@ -78,6 +78,10 @@
 #if SPM_MM
 	ARM_SPM_BUF_EL3_MMAP,
 #endif
+#if TRANSFER_LIST
+	TC_MAP_FW_NS_HANDOFF,
+	TC_MAP_EL3_FW_HANDOFF,
+#endif
 	{0}
 };