2 * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
7 #include <platform_def.h>
9 #include <common/desc_image_load.h>
10 #include <plat/common/platform.h>
12 /*******************************************************************************
13 * Following descriptor provides BL image/ep information that gets used
14 * by BL2 to load the images and also subset of this information is
15 * passed to next BL image. The image loading sequence is managed by
16 * populating the images in required loading order. The image execution
17 * sequence is managed by populating the `next_handoff_image_id` with
18 * the next executable image id.
19 ******************************************************************************/
20 static bl_mem_params_node_t bl2_mem_params_descs
[] = {
21 #ifdef EL3_PAYLOAD_BASE
22 /* Fill EL3 payload related information (BL31 is EL3 payload) */
23 { .image_id
= BL31_IMAGE_ID
,
25 SET_STATIC_PARAM_HEAD(ep_info
, PARAM_EP
, VERSION_2
,
27 SECURE
| EXECUTABLE
| EP_FIRST_EXE
),
28 .ep_info
.pc
= EL3_PAYLOAD_BASE
,
29 .ep_info
.spsr
= SPSR_64(MODE_EL3
, MODE_SP_ELX
,
30 DISABLE_ALL_EXCEPTIONS
),
32 SET_STATIC_PARAM_HEAD(image_info
, PARAM_EP
, VERSION_2
, image_info_t
,
33 IMAGE_ATTRIB_PLAT_SETUP
| IMAGE_ATTRIB_SKIP_LOADING
),
35 .next_handoff_image_id
= INVALID_IMAGE_ID
,
37 #else /* EL3_PAYLOAD_BASE */
39 /* Fill BL31 related information */
40 { .image_id
= BL31_IMAGE_ID
,
42 SET_STATIC_PARAM_HEAD(ep_info
, PARAM_EP
, VERSION_2
,
44 SECURE
| EXECUTABLE
| EP_FIRST_EXE
),
45 .ep_info
.pc
= BL31_BASE
,
46 .ep_info
.spsr
= SPSR_64(MODE_EL3
, MODE_SP_ELX
,
47 DISABLE_ALL_EXCEPTIONS
),
49 .ep_info
.args
.arg1
= QEMU_BL31_PLAT_PARAM_VAL
,
51 SET_STATIC_PARAM_HEAD(image_info
, PARAM_EP
, VERSION_2
, image_info_t
,
52 IMAGE_ATTRIB_PLAT_SETUP
),
53 .image_info
.image_base
= BL31_BASE
,
54 .image_info
.image_max_size
= BL31_LIMIT
- BL31_BASE
,
56 # ifdef QEMU_LOAD_BL32
57 .next_handoff_image_id
= BL32_IMAGE_ID
,
59 .next_handoff_image_id
= BL33_IMAGE_ID
,
62 #endif /* __aarch64__ */
63 # ifdef QEMU_LOAD_BL32
66 #define BL32_EP_ATTRIBS (SECURE | EXECUTABLE)
67 #define BL32_IMG_ATTRIBS 0
69 #define BL32_EP_ATTRIBS (SECURE | EXECUTABLE | EP_FIRST_EXE)
70 #define BL32_IMG_ATTRIBS IMAGE_ATTRIB_PLAT_SETUP
73 /* Fill BL32 related information */
74 { .image_id
= BL32_IMAGE_ID
,
76 SET_STATIC_PARAM_HEAD(ep_info
, PARAM_EP
, VERSION_2
,
77 entry_point_info_t
, BL32_EP_ATTRIBS
),
78 .ep_info
.pc
= BL32_BASE
,
80 SET_STATIC_PARAM_HEAD(image_info
, PARAM_EP
, VERSION_2
,
81 image_info_t
, BL32_IMG_ATTRIBS
),
83 .image_info
.image_base
= BL32_BASE
,
84 .image_info
.image_max_size
= BL32_LIMIT
- BL32_BASE
,
86 .next_handoff_image_id
= BL33_IMAGE_ID
,
90 * Fill BL32 external 1 related information.
91 * A typical use for extra1 image is with OP-TEE where it is the
94 { .image_id
= BL32_EXTRA1_IMAGE_ID
,
96 SET_STATIC_PARAM_HEAD(ep_info
, PARAM_EP
, VERSION_2
,
97 entry_point_info_t
, SECURE
| NON_EXECUTABLE
),
99 SET_STATIC_PARAM_HEAD(image_info
, PARAM_EP
, VERSION_2
,
100 image_info_t
, IMAGE_ATTRIB_SKIP_LOADING
),
101 .image_info
.image_base
= BL32_BASE
,
102 .image_info
.image_max_size
= BL32_LIMIT
- BL32_BASE
,
104 .next_handoff_image_id
= INVALID_IMAGE_ID
,
108 * Fill BL32 external 2 related information.
109 * A typical use for extra2 image is with OP-TEE where it is the
112 { .image_id
= BL32_EXTRA2_IMAGE_ID
,
114 SET_STATIC_PARAM_HEAD(ep_info
, PARAM_EP
, VERSION_2
,
115 entry_point_info_t
, SECURE
| NON_EXECUTABLE
),
117 SET_STATIC_PARAM_HEAD(image_info
, PARAM_EP
, VERSION_2
,
118 image_info_t
, IMAGE_ATTRIB_SKIP_LOADING
),
119 #if defined(SPD_opteed) || defined(AARCH32_SP_OPTEE)
120 .image_info
.image_base
= QEMU_OPTEE_PAGEABLE_LOAD_BASE
,
121 .image_info
.image_max_size
= QEMU_OPTEE_PAGEABLE_LOAD_SIZE
,
123 .next_handoff_image_id
= INVALID_IMAGE_ID
,
125 # endif /* QEMU_LOAD_BL32 */
127 /* Fill BL33 related information */
128 { .image_id
= BL33_IMAGE_ID
,
129 SET_STATIC_PARAM_HEAD(ep_info
, PARAM_EP
, VERSION_2
,
130 entry_point_info_t
, NON_SECURE
| EXECUTABLE
),
131 # ifdef PRELOADED_BL33_BASE
132 .ep_info
.pc
= PRELOADED_BL33_BASE
,
134 SET_STATIC_PARAM_HEAD(image_info
, PARAM_EP
, VERSION_2
, image_info_t
,
135 IMAGE_ATTRIB_SKIP_LOADING
),
136 # else /* PRELOADED_BL33_BASE */
137 .ep_info
.pc
= NS_IMAGE_OFFSET
,
139 SET_STATIC_PARAM_HEAD(image_info
, PARAM_EP
, VERSION_2
, image_info_t
,
141 .image_info
.image_base
= NS_IMAGE_OFFSET
,
142 .image_info
.image_max_size
= NS_IMAGE_MAX_SIZE
,
143 # endif /* !PRELOADED_BL33_BASE */
145 .next_handoff_image_id
= INVALID_IMAGE_ID
,
147 #endif /* !EL3_PAYLOAD_BASE */
150 REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs
)