1 /*
2  * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <arch.h>
8 #include <common/desc_image_load.h>
9 #include <plat/common/platform.h>
10 #include <platform_def.h>
11 
12 static bl_mem_params_node_t bl2_mem_params_descs[] = {
13 	{
14 		.image_id = BL31_IMAGE_ID,
15 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
16 				      entry_point_info_t,
17 				      SECURE | EXECUTABLE | EP_FIRST_EXE),
18 		.ep_info.pc = BL31_BASE,
19 		.ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
20 					DISABLE_ALL_EXCEPTIONS),
21 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2, image_info_t,
22 				      IMAGE_ATTRIB_PLAT_SETUP),
23 		.image_info.image_base = BL31_BASE,
24 		.image_info.image_max_size = BL31_LIMIT - BL31_BASE,
25 		.next_handoff_image_id = INVALID_IMAGE_ID,
26 	},
27 	{
28 		.image_id = BL32_IMAGE_ID,
29 
30 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
31 				      entry_point_info_t,
32 				      SECURE | EXECUTABLE),
33 		.ep_info.pc = BL32_BASE,
34 
35 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2,
36 				      image_info_t, 0),
37 
38 		.image_info.image_base = BL32_BASE,
39 		.image_info.image_max_size = BL32_SIZE,
40 
41 		.next_handoff_image_id = BL33_IMAGE_ID,
42 	},
43 	{
44 		.image_id = BL32_EXTRA1_IMAGE_ID,
45 
46 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
47 				      entry_point_info_t,
48 				      SECURE | NON_EXECUTABLE),
49 
50 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2,
51 				      image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
52 		.image_info.image_base = BL32_BASE,
53 		.image_info.image_max_size =  BL32_SIZE,
54 
55 		.next_handoff_image_id = INVALID_IMAGE_ID,
56 	},
57 	{
58 		/* This is a zero sized image so we don't set base or size */
59 		.image_id = BL32_EXTRA2_IMAGE_ID,
60 
61 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
62 				      VERSION_2, entry_point_info_t,
63 				      SECURE | NON_EXECUTABLE),
64 
65 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
66 				      VERSION_2, image_info_t,
67 				      IMAGE_ATTRIB_SKIP_LOADING),
68 		.next_handoff_image_id = INVALID_IMAGE_ID,
69 	},
70 	{
71 		.image_id = BL33_IMAGE_ID,
72 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, VERSION_2,
73 				      entry_point_info_t,
74 				      NON_SECURE | EXECUTABLE),
75 		# ifdef PRELOADED_BL33_BASE
76 			.ep_info.pc = PLAT_NS_IMAGE_OFFSET,
77 
78 			SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
79 					      VERSION_2, image_info_t,
80 					      IMAGE_ATTRIB_SKIP_LOADING),
81 		# else
82 			.ep_info.pc = PLAT_NS_IMAGE_OFFSET,
83 
84 			SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
85 					      VERSION_2, image_info_t, 0),
86 			.image_info.image_base = PLAT_NS_IMAGE_OFFSET,
87 			.image_info.image_max_size = PLAT_NS_IMAGE_SIZE,
88 		# endif /* PRELOADED_BL33_BASE */
89 
90 		.next_handoff_image_id = INVALID_IMAGE_ID,
91 	}
92 };
93 
94 REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs);
95