xref: /rk3399_ARM-atf/plat/arm/common/aarch32/arm_bl2_mem_params_desc.c (revision 51faada71a219a8b94cd8d8e423f0f22e9da4d8f)
1 /*
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  ******************************************************************************/
45 static 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 	/* Fill BL32 related information */
64     {
65 	    .image_id = BL32_IMAGE_ID,
66 
67 	    SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
68 		    VERSION_2, entry_point_info_t,
69 		    SECURE | EXECUTABLE | EP_FIRST_EXE),
70 	    .ep_info.pc = BL32_BASE,
71 	    .ep_info.spsr = SPSR_MODE32(MODE32_mon, SPSR_T_ARM,
72 		    SPSR_E_LITTLE, DISABLE_ALL_EXCEPTIONS),
73 
74 	    SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
75 		    VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP),
76 	    .image_info.image_base = BL32_BASE,
77 	    .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
78 
79 	    .next_handoff_image_id = BL33_IMAGE_ID,
80     },
81 
82 	/* Fill BL33 related information */
83     {
84 	    .image_id = BL33_IMAGE_ID,
85 
86 	    SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
87 		    VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE),
88 #ifdef PRELOADED_BL33_BASE
89 	    .ep_info.pc = PRELOADED_BL33_BASE,
90 
91 	    SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
92 		    VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
93 #else
94 	    .ep_info.pc = PLAT_ARM_NS_IMAGE_OFFSET,
95 
96 	    SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
97 		    VERSION_2, image_info_t, 0),
98 	    .image_info.image_base = PLAT_ARM_NS_IMAGE_OFFSET,
99 	    .image_info.image_max_size = ARM_DRAM1_SIZE,
100 #endif /* PRELOADED_BL33_BASE */
101 
102 	    .next_handoff_image_id = INVALID_IMAGE_ID,
103     }
104 };
105 
106 REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)
107