summaryrefslogtreecommitdiff
path: root/plat/hisilicon/hikey960/hikey960_bl31_setup.c
diff options
context:
space:
mode:
authorVictor Chong <victor.chong@linaro.org>2017-08-17 15:21:10 +0900
committerVictor Chong <victor.chong@linaro.org>2017-09-01 22:47:50 +0900
commit2de0c5cc4fac47dcc5df295bd1eaf3a6da528424 (patch)
tree04ee8116f1cbc513999f0044653d0752ecf2f3e6 /plat/hisilicon/hikey960/hikey960_bl31_setup.c
parenta87a1fb3ede3fa2361ae4efd08d6daa30dc8c00b (diff)
downloadarm-trusted-firmware-2de0c5cc4fac47dcc5df295bd1eaf3a6da528424.tar.gz
hikey*: Add LOAD_IMAGE_V2 support
Signed-off-by: Victor Chong <victor.chong@linaro.org> Signed-off-by: Leo Yan <leo.yan@linaro.org>
Diffstat (limited to 'plat/hisilicon/hikey960/hikey960_bl31_setup.c')
-rw-r--r--plat/hisilicon/hikey960/hikey960_bl31_setup.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/plat/hisilicon/hikey960/hikey960_bl31_setup.c b/plat/hisilicon/hikey960/hikey960_bl31_setup.c
index 41c591b15..28aa8c287 100644
--- a/plat/hisilicon/hikey960/hikey960_bl31_setup.c
+++ b/plat/hisilicon/hikey960/hikey960_bl31_setup.c
@@ -76,8 +76,13 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(unsigned int type)
return NULL;
}
+#if LOAD_IMAGE_V2
+void bl31_early_platform_setup(void *from_bl2,
+ void *plat_params_from_bl2)
+#else
void bl31_early_platform_setup(bl31_params_t *from_bl2,
void *plat_params_from_bl2)
+#endif
{
unsigned int id, uart_base;
@@ -95,12 +100,50 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2,
cci_init(CCI400_REG_BASE, cci_map, ARRAY_SIZE(cci_map));
cci_enable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
+#if LOAD_IMAGE_V2
+ /*
+ * Check params passed from BL2 should not be NULL,
+ */
+ bl_params_t *params_from_bl2 = (bl_params_t *)from_bl2;
+ assert(params_from_bl2 != NULL);
+ assert(params_from_bl2->h.type == PARAM_BL_PARAMS);
+ assert(params_from_bl2->h.version >= VERSION_2);
+
+ bl_params_node_t *bl_params = params_from_bl2->head;
+
+ /*
+ * Copy BL33 and BL32 (if present), entry point information.
+ * They are stored in Secure RAM, in BL2's address space.
+ */
+ while (bl_params) {
+ if (bl_params->image_id == BL32_IMAGE_ID)
+ bl32_ep_info = *bl_params->ep_info;
+
+ if (bl_params->image_id == BL33_IMAGE_ID)
+ bl33_ep_info = *bl_params->ep_info;
+
+ bl_params = bl_params->next_params_info;
+ }
+
+ if (bl33_ep_info.pc == 0)
+ panic();
+
+#else /* LOAD_IMAGE_V2 */
+
+ /*
+ * Check params passed from BL2 should not be NULL,
+ */
+ assert(from_bl2 != NULL);
+ assert(from_bl2->h.type == PARAM_BL31);
+ assert(from_bl2->h.version >= VERSION_1);
+
/*
* Copy BL3-2 and BL3-3 entry point information.
* They are stored in Secure RAM, in BL2's address space.
*/
bl32_ep_info = *from_bl2->bl32_ep_info;
bl33_ep_info = *from_bl2->bl33_ep_info;
+#endif /* LOAD_IMAGE_V2 */
}
void bl31_plat_arch_setup(void)