blob: 64315f7a079ace5a6c70b3d2b36c1bdf6e09310e [file] [log] [blame]
Yatharth Kocharf9a0f162016-09-13 17:07:57 +01001/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <bl_common.h>
32#include <desc_image_load.h>
33#include <platform.h>
34#include <platform_def.h>
35
36
37/*******************************************************************************
38 * Following descriptor provides BL image/ep information that gets used
39 * by BL2 to load the images and also subset of this information is
40 * passed to next BL image. The image loading sequence is managed by
41 * populating the images in required loading order. The image execution
42 * sequence is managed by populating the `next_handoff_image_id` with
43 * the next executable image id.
44 ******************************************************************************/
45static bl_mem_params_node_t bl2_mem_params_descs[] = {
46#ifdef SCP_BL2_BASE
47 /* Fill SCP_BL2 related information if it exists */
48 {
49 .image_id = SCP_BL2_IMAGE_ID,
50
51 SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
52 VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
53
54 SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
55 VERSION_2, image_info_t, 0),
56 .image_info.image_base = SCP_BL2_BASE,
57 .image_info.image_max_size = PLAT_CSS_MAX_SCP_BL2_SIZE,
58
59 .next_handoff_image_id = INVALID_IMAGE_ID,
60 },
61#endif /* SCP_BL2_BASE */
62
63#ifdef EL3_PAYLOAD_BASE
64 /* Fill EL3 payload related information (BL31 is EL3 payload)*/
65 {
66 .image_id = BL31_IMAGE_ID,
67
68 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
69 VERSION_2, entry_point_info_t,
70 SECURE | EXECUTABLE | EP_FIRST_EXE),
71 .ep_info.pc = EL3_PAYLOAD_BASE,
72 .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
73 DISABLE_ALL_EXCEPTIONS),
74
75 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
76 VERSION_2, image_info_t,
77 IMAGE_ATTRIB_PLAT_SETUP | IMAGE_ATTRIB_SKIP_LOADING),
78
79 .next_handoff_image_id = INVALID_IMAGE_ID,
80 },
81
82#else /* EL3_PAYLOAD_BASE */
83
84 /* Fill BL31 related information */
85 {
86 .image_id = BL31_IMAGE_ID,
87
88 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
89 VERSION_2, entry_point_info_t,
90 SECURE | EXECUTABLE | EP_FIRST_EXE),
91 .ep_info.pc = BL31_BASE,
92 .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
93 DISABLE_ALL_EXCEPTIONS),
94#if DEBUG
95 .ep_info.args.arg1 = ARM_BL31_PLAT_PARAM_VAL,
96#endif
97
98 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
99 VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP),
100 .image_info.image_base = BL31_BASE,
101 .image_info.image_max_size = BL31_LIMIT - BL31_BASE,
102
103# ifdef BL32_BASE
104 .next_handoff_image_id = BL32_IMAGE_ID,
105# else
106 .next_handoff_image_id = BL33_IMAGE_ID,
107# endif
108 },
109
110# ifdef BL32_BASE
111 /* Fill BL32 related information */
112 {
113 .image_id = BL32_IMAGE_ID,
114
115 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
116 VERSION_2, entry_point_info_t, SECURE | EXECUTABLE),
117 .ep_info.pc = BL32_BASE,
118
119 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
120 VERSION_2, image_info_t, 0),
121 .image_info.image_base = BL32_BASE,
122 .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
123
124 .next_handoff_image_id = BL33_IMAGE_ID,
125 },
126# endif /* BL32_BASE */
127
128 /* Fill BL33 related information */
129 {
130 .image_id = BL33_IMAGE_ID,
131 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
132 VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE),
133# ifdef PRELOADED_BL33_BASE
134 .ep_info.pc = PRELOADED_BL33_BASE,
135
136 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
137 VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
138# else
139 .ep_info.pc = PLAT_ARM_NS_IMAGE_OFFSET,
140
141 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
142 VERSION_2, image_info_t, 0),
143 .image_info.image_base = PLAT_ARM_NS_IMAGE_OFFSET,
144 .image_info.image_max_size = ARM_DRAM1_SIZE,
145# endif /* PRELOADED_BL33_BASE */
146
147 .next_handoff_image_id = INVALID_IMAGE_ID,
148 }
149#endif /* EL3_PAYLOAD_BASE */
150};
151
152REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)