• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <platform_def.h>
8 
9 #include <common/bl_common.h>
10 #include <common/desc_image_load.h>
11 #include <plat/common/platform.h>
12 
13 /*******************************************************************************
14  * Following descriptor provides BL image/ep information that gets used
15  * by BL2 to load the images and also subset of this information is
16  * passed to next BL image. The image loading sequence is managed by
17  * populating the images in required loading order. The image execution
18  * sequence is managed by populating the `next_handoff_image_id` with
19  * the next executable image id.
20  ******************************************************************************/
21 static bl_mem_params_node_t bl2_mem_params_descs[] = {
22 
23 	/* Fill BL31 related information */
24 	{
25 		.image_id = BL31_IMAGE_ID,
26 
27 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
28 				      VERSION_2, entry_point_info_t,
29 				      SECURE | EXECUTABLE | EP_FIRST_EXE),
30 		.ep_info.pc = BL31_BASE,
31 		.ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
32 					DISABLE_ALL_EXCEPTIONS),
33 #if DEBUG
34 		.ep_info.args.arg1 = RPI3_BL31_PLAT_PARAM_VAL,
35 #endif
36 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
37 				      VERSION_2, image_info_t,
38 				      IMAGE_ATTRIB_PLAT_SETUP),
39 		.image_info.image_base = BL31_BASE,
40 		.image_info.image_max_size = BL31_LIMIT - BL31_BASE,
41 
42 # ifdef BL32_BASE
43 		.next_handoff_image_id = BL32_IMAGE_ID,
44 # else
45 		.next_handoff_image_id = BL33_IMAGE_ID,
46 # endif
47 	},
48 
49 # ifdef BL32_BASE
50 	/* Fill BL32 related information */
51 	{
52 		.image_id = BL32_IMAGE_ID,
53 
54 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
55 				      VERSION_2, entry_point_info_t,
56 				      SECURE | EXECUTABLE),
57 		.ep_info.pc = BL32_BASE,
58 
59 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
60 				      VERSION_2, image_info_t, 0),
61 		.image_info.image_base = BL32_BASE,
62 		.image_info.image_max_size = BL32_LIMIT - BL32_BASE,
63 
64 		.next_handoff_image_id = BL33_IMAGE_ID,
65 	},
66 
67 	/*
68 	 * Fill BL32 external 1 related information.
69 	 * A typical use for extra1 image is with OP-TEE where it is the pager
70 	 * image.
71 	 */
72 	{
73 		.image_id = BL32_EXTRA1_IMAGE_ID,
74 
75 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
76 				      VERSION_2, entry_point_info_t,
77 				      SECURE | NON_EXECUTABLE),
78 
79 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
80 				      VERSION_2, image_info_t,
81 				      IMAGE_ATTRIB_SKIP_LOADING),
82 		.image_info.image_base = BL32_BASE,
83 		.image_info.image_max_size = BL32_LIMIT - BL32_BASE,
84 
85 		.next_handoff_image_id = INVALID_IMAGE_ID,
86 	},
87 
88 	/*
89 	 * Fill BL32 external 2 related information.
90 	 * A typical use for extra2 image is with OP-TEE where it is the paged
91 	 * image.
92 	 */
93 	{
94 		.image_id = BL32_EXTRA2_IMAGE_ID,
95 
96 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
97 				      VERSION_2, entry_point_info_t,
98 				      SECURE | NON_EXECUTABLE),
99 
100 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
101 				      VERSION_2, image_info_t,
102 				      IMAGE_ATTRIB_SKIP_LOADING),
103 #ifdef SPD_opteed
104 		.image_info.image_base = RPI3_OPTEE_PAGEABLE_LOAD_BASE,
105 		.image_info.image_max_size = RPI3_OPTEE_PAGEABLE_LOAD_SIZE,
106 #endif
107 		.next_handoff_image_id = INVALID_IMAGE_ID,
108 	},
109 # endif /* BL32_BASE */
110 
111 	/* Fill BL33 related information */
112 	{
113 		.image_id = BL33_IMAGE_ID,
114 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
115 				      VERSION_2, entry_point_info_t,
116 				      NON_SECURE | EXECUTABLE),
117 # ifdef PRELOADED_BL33_BASE
118 		.ep_info.pc = PRELOADED_BL33_BASE,
119 
120 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
121 				      VERSION_2, image_info_t,
122 				      IMAGE_ATTRIB_SKIP_LOADING),
123 # else
124 		.ep_info.pc = PLAT_RPI3_NS_IMAGE_OFFSET,
125 
126 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
127 				      VERSION_2, image_info_t, 0),
128 		.image_info.image_base = PLAT_RPI3_NS_IMAGE_OFFSET,
129 		.image_info.image_max_size = PLAT_RPI3_NS_IMAGE_MAX_SIZE,
130 # endif /* PRELOADED_BL33_BASE */
131 
132 		.next_handoff_image_id = INVALID_IMAGE_ID,
133 	}
134 };
135 
136 REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)
137