xref: /rk3399_ARM-atf/plat/hisilicon/poplar/bl2_plat_mem_params_desc.c (revision 3a0b28cb355148bcd0702b31e23003e5d1c5ea41)
10d8052a4SVictor Chong /*
20d8052a4SVictor Chong  * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
30d8052a4SVictor Chong  *
40d8052a4SVictor Chong  * SPDX-License-Identifier: BSD-3-Clause
50d8052a4SVictor Chong  */
60d8052a4SVictor Chong 
70d8052a4SVictor Chong #include <platform_def.h>
80d8052a4SVictor Chong 
909d40e0eSAntonio Nino Diaz #include <common/bl_common.h>
1009d40e0eSAntonio Nino Diaz #include <common/desc_image_load.h>
1109d40e0eSAntonio Nino Diaz #include <plat/common/platform.h>
120d8052a4SVictor Chong 
130d8052a4SVictor Chong /*******************************************************************************
140d8052a4SVictor Chong  * Following descriptor provides BL image/ep information that gets used
150d8052a4SVictor Chong  * by BL2 to load the images and also subset of this information is
160d8052a4SVictor Chong  * passed to next BL image. The image loading sequence is managed by
170d8052a4SVictor Chong  * populating the images in required loading order. The image execution
180d8052a4SVictor Chong  * sequence is managed by populating the `next_handoff_image_id` with
190d8052a4SVictor Chong  * the next executable image id.
200d8052a4SVictor Chong  ******************************************************************************/
210d8052a4SVictor Chong static bl_mem_params_node_t bl2_mem_params_descs[] = {
220d8052a4SVictor Chong #ifdef SCP_BL2_BASE
230d8052a4SVictor Chong 	/* Fill SCP_BL2 related information if it exists */
240d8052a4SVictor Chong 	{
250d8052a4SVictor Chong 		.image_id = SCP_BL2_IMAGE_ID,
260d8052a4SVictor Chong 
270d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
280d8052a4SVictor Chong 			VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
290d8052a4SVictor Chong 
300d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
310d8052a4SVictor Chong 			VERSION_2, image_info_t, 0),
320d8052a4SVictor Chong 		.image_info.image_base = SCP_BL2_BASE,
330d8052a4SVictor Chong 		.image_info.image_max_size = SCP_BL2_SIZE,
340d8052a4SVictor Chong 
350d8052a4SVictor Chong 		.next_handoff_image_id = INVALID_IMAGE_ID,
360d8052a4SVictor Chong 	},
370d8052a4SVictor Chong #endif /* SCP_BL2_BASE */
380d8052a4SVictor Chong 
390d8052a4SVictor Chong #ifdef EL3_PAYLOAD_BASE
400d8052a4SVictor Chong 	/* Fill EL3 payload related information (BL31 is EL3 payload)*/
410d8052a4SVictor Chong 	{
420d8052a4SVictor Chong 		.image_id = BL31_IMAGE_ID,
430d8052a4SVictor Chong 
440d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
450d8052a4SVictor Chong 			VERSION_2, entry_point_info_t,
460d8052a4SVictor Chong 			SECURE | EXECUTABLE | EP_FIRST_EXE),
470d8052a4SVictor Chong 		.ep_info.pc = EL3_PAYLOAD_BASE,
480d8052a4SVictor Chong 		.ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
490d8052a4SVictor Chong 			DISABLE_ALL_EXCEPTIONS),
500d8052a4SVictor Chong 
510d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
520d8052a4SVictor Chong 			VERSION_2, image_info_t,
530d8052a4SVictor Chong 			IMAGE_ATTRIB_PLAT_SETUP | IMAGE_ATTRIB_SKIP_LOADING),
540d8052a4SVictor Chong 
550d8052a4SVictor Chong 		.next_handoff_image_id = INVALID_IMAGE_ID,
560d8052a4SVictor Chong 	},
570d8052a4SVictor Chong 
580d8052a4SVictor Chong #else /* EL3_PAYLOAD_BASE */
590d8052a4SVictor Chong 
600d8052a4SVictor Chong 	/* Fill BL31 related information */
610d8052a4SVictor Chong 	{
620d8052a4SVictor Chong 		.image_id = BL31_IMAGE_ID,
630d8052a4SVictor Chong 
640d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
650d8052a4SVictor Chong 			VERSION_2, entry_point_info_t,
660d8052a4SVictor Chong 			SECURE | EXECUTABLE | EP_FIRST_EXE),
670d8052a4SVictor Chong 		.ep_info.pc = BL31_BASE,
680d8052a4SVictor Chong 		.ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
690d8052a4SVictor Chong 			DISABLE_ALL_EXCEPTIONS),
700d8052a4SVictor Chong #if DEBUG
710d8052a4SVictor Chong 		.ep_info.args.arg1 = POPLAR_BL31_PLAT_PARAM_VAL,
720d8052a4SVictor Chong #endif
730d8052a4SVictor Chong 
740d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
750d8052a4SVictor Chong 			VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP),
760d8052a4SVictor Chong 		.image_info.image_base = BL31_BASE,
770d8052a4SVictor Chong 		.image_info.image_max_size = BL31_LIMIT - BL31_BASE,
780d8052a4SVictor Chong 
790d8052a4SVictor Chong # ifdef BL32_BASE
800d8052a4SVictor Chong 		.next_handoff_image_id = BL32_IMAGE_ID,
810d8052a4SVictor Chong # else
820d8052a4SVictor Chong 		.next_handoff_image_id = BL33_IMAGE_ID,
830d8052a4SVictor Chong # endif
840d8052a4SVictor Chong 	},
850d8052a4SVictor Chong 
860d8052a4SVictor Chong # ifdef BL32_BASE
870d8052a4SVictor Chong 	/* Fill BL32 related information */
880d8052a4SVictor Chong 	{
890d8052a4SVictor Chong 		.image_id = BL32_IMAGE_ID,
900d8052a4SVictor Chong 
910d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
920d8052a4SVictor Chong 			VERSION_2, entry_point_info_t, SECURE | EXECUTABLE),
930d8052a4SVictor Chong 		.ep_info.pc = BL32_BASE,
940d8052a4SVictor Chong 
950d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
960d8052a4SVictor Chong 			VERSION_2, image_info_t, 0),
970d8052a4SVictor Chong 		.image_info.image_base = BL32_BASE,
980d8052a4SVictor Chong 		.image_info.image_max_size = BL32_LIMIT - BL32_BASE,
990d8052a4SVictor Chong 
1000d8052a4SVictor Chong 		.next_handoff_image_id = BL33_IMAGE_ID,
1010d8052a4SVictor Chong 	},
102f3d522beSVictor Chong 
103f3d522beSVictor Chong 	/*
104f3d522beSVictor Chong 	 * Fill BL32 external 1 related information.
105*e2fe267dSJorge Troncoso 	 * A typical use for extra1 image is with OP-TEE where it is the pager
106*e2fe267dSJorge Troncoso 	 * image.
107f3d522beSVictor Chong 	 */
108f3d522beSVictor Chong 	{
109f3d522beSVictor Chong 		.image_id = BL32_EXTRA1_IMAGE_ID,
110f3d522beSVictor Chong 
111f3d522beSVictor Chong 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
112f3d522beSVictor Chong 			VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
113f3d522beSVictor Chong 
114f3d522beSVictor Chong 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
115f3d522beSVictor Chong 			VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
116f3d522beSVictor Chong 		.image_info.image_base = BL32_BASE,
117f3d522beSVictor Chong 		.image_info.image_max_size = BL32_LIMIT - BL32_BASE,
118f3d522beSVictor Chong 
119f3d522beSVictor Chong 		.next_handoff_image_id = INVALID_IMAGE_ID,
120f3d522beSVictor Chong 	},
121f3d522beSVictor Chong 
122f3d522beSVictor Chong 	/*
123f3d522beSVictor Chong 	 * Fill BL32 external 2 related information.
124*e2fe267dSJorge Troncoso 	 * A typical use for extra2 image is with OP-TEE where it is the paged
125*e2fe267dSJorge Troncoso 	 * image.
126f3d522beSVictor Chong 	 */
127f3d522beSVictor Chong 	{
128f3d522beSVictor Chong 		.image_id = BL32_EXTRA2_IMAGE_ID,
129f3d522beSVictor Chong 
130f3d522beSVictor Chong 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
131f3d522beSVictor Chong 			VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
132f3d522beSVictor Chong 
133f3d522beSVictor Chong 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
134f3d522beSVictor Chong 			VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
135f3d522beSVictor Chong #ifdef SPD_opteed
136f3d522beSVictor Chong 		.image_info.image_base = POPLAR_OPTEE_PAGEABLE_LOAD_BASE,
137f3d522beSVictor Chong 		.image_info.image_max_size = POPLAR_OPTEE_PAGEABLE_LOAD_SIZE,
138f3d522beSVictor Chong #endif
139f3d522beSVictor Chong 		.next_handoff_image_id = INVALID_IMAGE_ID,
140f3d522beSVictor Chong 	},
1410d8052a4SVictor Chong # endif /* BL32_BASE */
1420d8052a4SVictor Chong 
1430d8052a4SVictor Chong 	/* Fill BL33 related information */
1440d8052a4SVictor Chong 	{
1450d8052a4SVictor Chong 		.image_id = BL33_IMAGE_ID,
1460d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
1470d8052a4SVictor Chong 			VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE),
1480d8052a4SVictor Chong # ifdef PRELOADED_BL33_BASE
1490d8052a4SVictor Chong 		.ep_info.pc = PRELOADED_BL33_BASE,
1500d8052a4SVictor Chong 
1510d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
1520d8052a4SVictor Chong 			VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
1530d8052a4SVictor Chong # else
1540d8052a4SVictor Chong 		.ep_info.pc = PLAT_POPLAR_NS_IMAGE_OFFSET,
1550d8052a4SVictor Chong 
1560d8052a4SVictor Chong 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
1570d8052a4SVictor Chong 			VERSION_2, image_info_t, 0),
1580d8052a4SVictor Chong 		.image_info.image_base = PLAT_POPLAR_NS_IMAGE_OFFSET,
1590d8052a4SVictor Chong 		.image_info.image_max_size = DDR_BASE + DDR_SIZE -
1600d8052a4SVictor Chong 					PLAT_POPLAR_NS_IMAGE_OFFSET,
1610d8052a4SVictor Chong # endif /* PRELOADED_BL33_BASE */
1620d8052a4SVictor Chong 
1630d8052a4SVictor Chong 		.next_handoff_image_id = INVALID_IMAGE_ID,
1640d8052a4SVictor Chong 	}
1650d8052a4SVictor Chong #endif /* EL3_PAYLOAD_BASE */
1660d8052a4SVictor Chong };
1670d8052a4SVictor Chong 
1680d8052a4SVictor Chong REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)
169