blob: 9965cfdb57e2ddc675aebb71081a37128257b168 [file] [log] [blame]
Fu Weic2f78442017-05-27 21:21:42 +08001/*
2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <desc_image_load.h>
8#include <platform.h>
9#include <platform_def.h>
10
11/*******************************************************************************
12 * Following descriptor provides BL image/ep information that gets used
13 * by BL2 to load the images and also subset of this information is
14 * passed to next BL image. The image loading sequence is managed by
15 * populating the images in required loading order. The image execution
16 * sequence is managed by populating the `next_handoff_image_id` with
17 * the next executable image id.
18 ******************************************************************************/
19static bl_mem_params_node_t bl2_mem_params_descs[] = {
20#ifdef EL3_PAYLOAD_BASE
21 /* Fill EL3 payload related information (BL31 is EL3 payload) */
22 { .image_id = BL31_IMAGE_ID,
23
24 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
25 entry_point_info_t,
26 SECURE | EXECUTABLE | EP_FIRST_EXE),
27 .ep_info.pc = EL3_PAYLOAD_BASE,
28 .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
29 DISABLE_ALL_EXCEPTIONS),
30
31 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2, image_info_t,
32 IMAGE_ATTRIB_PLAT_SETUP | IMAGE_ATTRIB_SKIP_LOADING),
33
34 .next_handoff_image_id = INVALID_IMAGE_ID,
35 },
36#else /* EL3_PAYLOAD_BASE */
Etienne Carriere911de8c2018-02-02 13:23:22 +010037#ifdef AARCH64
Fu Weic2f78442017-05-27 21:21:42 +080038 /* Fill BL31 related information */
39 { .image_id = BL31_IMAGE_ID,
40
41 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
42 entry_point_info_t,
43 SECURE | EXECUTABLE | EP_FIRST_EXE),
44 .ep_info.pc = BL31_BASE,
45 .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
46 DISABLE_ALL_EXCEPTIONS),
47# if DEBUG
48 .ep_info.args.arg1 = QEMU_BL31_PLAT_PARAM_VAL,
49# endif
50 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2, image_info_t,
51 IMAGE_ATTRIB_PLAT_SETUP),
52 .image_info.image_base = BL31_BASE,
53 .image_info.image_max_size = BL31_LIMIT - BL31_BASE,
54
55# ifdef QEMU_LOAD_BL32
56 .next_handoff_image_id = BL32_IMAGE_ID,
57# else
58 .next_handoff_image_id = BL33_IMAGE_ID,
59# endif
60 },
Etienne Carriere911de8c2018-02-02 13:23:22 +010061#endif /* AARCH64 */
Fu Weic2f78442017-05-27 21:21:42 +080062# ifdef QEMU_LOAD_BL32
Etienne Carriere911de8c2018-02-02 13:23:22 +010063
64#ifdef AARCH64
65#define BL32_EP_ATTRIBS (SECURE | EXECUTABLE)
66#define BL32_IMG_ATTRIBS 0
67#else
68#define BL32_EP_ATTRIBS (SECURE | EXECUTABLE | EP_FIRST_EXE)
69#define BL32_IMG_ATTRIBS IMAGE_ATTRIB_PLAT_SETUP
70#endif
71
Fu Weic2f78442017-05-27 21:21:42 +080072 /* Fill BL32 related information */
73 { .image_id = BL32_IMAGE_ID,
74
75 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
Etienne Carriere911de8c2018-02-02 13:23:22 +010076 entry_point_info_t, BL32_EP_ATTRIBS),
Fu Weic2f78442017-05-27 21:21:42 +080077 .ep_info.pc = BL32_BASE,
78
Etienne Carriere911de8c2018-02-02 13:23:22 +010079 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2,
80 image_info_t, BL32_IMG_ATTRIBS),
81
Fu Weic2f78442017-05-27 21:21:42 +080082 .image_info.image_base = BL32_BASE,
83 .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
84
85 .next_handoff_image_id = BL33_IMAGE_ID,
86 },
Jens Wiklander0acbaaa2017-08-24 13:16:26 +020087
88 /*
89 * Fill BL32 external 1 related information.
90 * A typical use for extra1 image is with OP-TEE where it is the
91 * pager image.
92 */
93 { .image_id = BL32_EXTRA1_IMAGE_ID,
94
95 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
96 entry_point_info_t, SECURE | NON_EXECUTABLE),
97
98 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2,
99 image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
100 .image_info.image_base = BL32_BASE,
101 .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
102
103 .next_handoff_image_id = INVALID_IMAGE_ID,
104 },
105
106 /*
107 * Fill BL32 external 2 related information.
108 * A typical use for extra2 image is with OP-TEE where it is the
109 * paged image.
110 */
111 { .image_id = BL32_EXTRA2_IMAGE_ID,
112
113 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
114 entry_point_info_t, SECURE | NON_EXECUTABLE),
115
116 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2,
117 image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
Etienne Carriere911de8c2018-02-02 13:23:22 +0100118#if defined(SPD_opteed) || defined(AARCH32_SP_OPTEE)
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200119 .image_info.image_base = QEMU_OPTEE_PAGEABLE_LOAD_BASE,
120 .image_info.image_max_size = QEMU_OPTEE_PAGEABLE_LOAD_SIZE,
121#endif
122 .next_handoff_image_id = INVALID_IMAGE_ID,
123 },
Fu Weic2f78442017-05-27 21:21:42 +0800124# endif /* QEMU_LOAD_BL32 */
125
126 /* Fill BL33 related information */
127 { .image_id = BL33_IMAGE_ID,
128 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
129 entry_point_info_t, NON_SECURE | EXECUTABLE),
130# ifdef PRELOADED_BL33_BASE
131 .ep_info.pc = PRELOADED_BL33_BASE,
132
133 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2, image_info_t,
134 IMAGE_ATTRIB_SKIP_LOADING),
135# else /* PRELOADED_BL33_BASE */
136 .ep_info.pc = NS_IMAGE_OFFSET,
137
138 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2, image_info_t,
139 0),
140 .image_info.image_base = NS_IMAGE_OFFSET,
141 .image_info.image_max_size = NS_DRAM0_BASE + NS_DRAM0_SIZE -
142 NS_IMAGE_OFFSET,
143# endif /* !PRELOADED_BL33_BASE */
144
145 .next_handoff_image_id = INVALID_IMAGE_ID,
146 }
147#endif /* !EL3_PAYLOAD_BASE */
148};
149
150REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)