blob: ba6a4db2dddb3b30e044c8fe148fb89b2b82469b [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
Fu Weic2f78442017-05-27 21:21:42 +08007#include <platform_def.h>
8
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <common/desc_image_load.h>
10#include <plat/common/platform.h>
11
Fu Weic2f78442017-05-27 21:21:42 +080012/*******************************************************************************
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 ******************************************************************************/
20static 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,
24
25 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
26 entry_point_info_t,
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),
31
32 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2, image_info_t,
33 IMAGE_ATTRIB_PLAT_SETUP | IMAGE_ATTRIB_SKIP_LOADING),
34
35 .next_handoff_image_id = INVALID_IMAGE_ID,
36 },
37#else /* EL3_PAYLOAD_BASE */
Etienne Carriere911de8c2018-02-02 13:23:22 +010038#ifdef AARCH64
Fu Weic2f78442017-05-27 21:21:42 +080039 /* Fill BL31 related information */
40 { .image_id = BL31_IMAGE_ID,
41
42 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
43 entry_point_info_t,
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),
48# if DEBUG
49 .ep_info.args.arg1 = QEMU_BL31_PLAT_PARAM_VAL,
50# endif
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,
55
56# ifdef QEMU_LOAD_BL32
57 .next_handoff_image_id = BL32_IMAGE_ID,
58# else
59 .next_handoff_image_id = BL33_IMAGE_ID,
60# endif
61 },
Etienne Carriere911de8c2018-02-02 13:23:22 +010062#endif /* AARCH64 */
Fu Weic2f78442017-05-27 21:21:42 +080063# ifdef QEMU_LOAD_BL32
Etienne Carriere911de8c2018-02-02 13:23:22 +010064
65#ifdef AARCH64
66#define BL32_EP_ATTRIBS (SECURE | EXECUTABLE)
67#define BL32_IMG_ATTRIBS 0
68#else
69#define BL32_EP_ATTRIBS (SECURE | EXECUTABLE | EP_FIRST_EXE)
70#define BL32_IMG_ATTRIBS IMAGE_ATTRIB_PLAT_SETUP
71#endif
72
Fu Weic2f78442017-05-27 21:21:42 +080073 /* Fill BL32 related information */
74 { .image_id = BL32_IMAGE_ID,
75
76 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
Etienne Carriere911de8c2018-02-02 13:23:22 +010077 entry_point_info_t, BL32_EP_ATTRIBS),
Fu Weic2f78442017-05-27 21:21:42 +080078 .ep_info.pc = BL32_BASE,
79
Etienne Carriere911de8c2018-02-02 13:23:22 +010080 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2,
81 image_info_t, BL32_IMG_ATTRIBS),
82
Fu Weic2f78442017-05-27 21:21:42 +080083 .image_info.image_base = BL32_BASE,
84 .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
85
86 .next_handoff_image_id = BL33_IMAGE_ID,
87 },
Jens Wiklander0acbaaa2017-08-24 13:16:26 +020088
89 /*
90 * Fill BL32 external 1 related information.
91 * A typical use for extra1 image is with OP-TEE where it is the
92 * pager image.
93 */
94 { .image_id = BL32_EXTRA1_IMAGE_ID,
95
96 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
97 entry_point_info_t, SECURE | NON_EXECUTABLE),
98
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,
103
104 .next_handoff_image_id = INVALID_IMAGE_ID,
105 },
106
107 /*
108 * Fill BL32 external 2 related information.
109 * A typical use for extra2 image is with OP-TEE where it is the
110 * paged image.
111 */
112 { .image_id = BL32_EXTRA2_IMAGE_ID,
113
114 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
115 entry_point_info_t, SECURE | NON_EXECUTABLE),
116
117 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2,
118 image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
Etienne Carriere911de8c2018-02-02 13:23:22 +0100119#if defined(SPD_opteed) || defined(AARCH32_SP_OPTEE)
Jens Wiklander0acbaaa2017-08-24 13:16:26 +0200120 .image_info.image_base = QEMU_OPTEE_PAGEABLE_LOAD_BASE,
121 .image_info.image_max_size = QEMU_OPTEE_PAGEABLE_LOAD_SIZE,
122#endif
123 .next_handoff_image_id = INVALID_IMAGE_ID,
124 },
Fu Weic2f78442017-05-27 21:21:42 +0800125# endif /* QEMU_LOAD_BL32 */
126
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,
133
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,
138
139 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2, image_info_t,
140 0),
141 .image_info.image_base = NS_IMAGE_OFFSET,
142 .image_info.image_max_size = NS_DRAM0_BASE + NS_DRAM0_SIZE -
143 NS_IMAGE_OFFSET,
144# endif /* !PRELOADED_BL33_BASE */
145
146 .next_handoff_image_id = INVALID_IMAGE_ID,
147 }
148#endif /* !EL3_PAYLOAD_BASE */
149};
150
151REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)