blob: e3acfe9f610e754fcf2e4ec2cf6b7dce7dcf4926 [file] [log] [blame]
Antonio Nino Diazae6779e2017-11-06 14:49:04 +00001/*
2 * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <bl_common.h>
8#include <desc_image_load.h>
9#include <platform.h>
10#include <platform_def.h>
11
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 ******************************************************************************/
20static bl_mem_params_node_t bl2_mem_params_descs[] = {
21
22 /* Fill BL31 related information */
23 {
24 .image_id = BL31_IMAGE_ID,
25
26 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
27 VERSION_2, entry_point_info_t,
28 SECURE | EXECUTABLE | EP_FIRST_EXE),
29 .ep_info.pc = BL31_BASE,
30 .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
31 DISABLE_ALL_EXCEPTIONS),
32#if DEBUG
33 .ep_info.args.arg1 = RPI3_BL31_PLAT_PARAM_VAL,
34#endif
35 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
36 VERSION_2, image_info_t,
37 IMAGE_ATTRIB_PLAT_SETUP),
38 .image_info.image_base = BL31_BASE,
39 .image_info.image_max_size = BL31_LIMIT - BL31_BASE,
40
41# ifdef BL32_BASE
42 .next_handoff_image_id = BL32_IMAGE_ID,
43# else
44 .next_handoff_image_id = BL33_IMAGE_ID,
45# endif
46 },
47
48# ifdef BL32_BASE
49 /* Fill BL32 related information */
50 {
51 .image_id = BL32_IMAGE_ID,
52
53 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
54 VERSION_2, entry_point_info_t,
55 SECURE | EXECUTABLE),
56 .ep_info.pc = BL32_BASE,
57
58 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
59 VERSION_2, image_info_t, 0),
60 .image_info.image_base = BL32_BASE,
61 .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
62
63 .next_handoff_image_id = BL33_IMAGE_ID,
64 },
65
66 /*
67 * Fill BL32 external 1 related information.
68 * A typical use for extra1 image is with OP-TEE where it is the pager
69 * image.
70 */
71 {
72 .image_id = BL32_EXTRA1_IMAGE_ID,
73
74 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
75 VERSION_2, entry_point_info_t,
76 SECURE | NON_EXECUTABLE),
77
78 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
79 VERSION_2, image_info_t,
80 IMAGE_ATTRIB_SKIP_LOADING),
81 .image_info.image_base = BL32_BASE,
82 .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
83
84 .next_handoff_image_id = INVALID_IMAGE_ID,
85 },
86
87 /*
88 * Fill BL32 external 2 related information.
89 * A typical use for extra2 image is with OP-TEE where it is the paged
90 * image.
91 */
92 {
93 .image_id = BL32_EXTRA2_IMAGE_ID,
94
95 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
96 VERSION_2, entry_point_info_t,
97 SECURE | NON_EXECUTABLE),
98
99 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
100 VERSION_2, image_info_t,
101 IMAGE_ATTRIB_SKIP_LOADING),
102 .next_handoff_image_id = INVALID_IMAGE_ID,
103 },
104# endif /* BL32_BASE */
105
106 /* Fill BL33 related information */
107 {
108 .image_id = BL33_IMAGE_ID,
109 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
110 VERSION_2, entry_point_info_t,
111 NON_SECURE | EXECUTABLE),
112# ifdef PRELOADED_BL33_BASE
113 .ep_info.pc = PRELOADED_BL33_BASE,
114
115 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
116 VERSION_2, image_info_t,
117 IMAGE_ATTRIB_SKIP_LOADING),
118# else
119 .ep_info.pc = PLAT_RPI3_NS_IMAGE_OFFSET,
120
121 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
122 VERSION_2, image_info_t, 0),
123 .image_info.image_base = PLAT_RPI3_NS_IMAGE_OFFSET,
124 .image_info.image_max_size = PLAT_RPI3_NS_IMAGE_MAX_SIZE,
125# endif /* PRELOADED_BL33_BASE */
126
127 .next_handoff_image_id = INVALID_IMAGE_ID,
128 }
129};
130
131REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)