Antonio Nino Diaz | ae6779e | 2017-11-06 14:49:04 +0000 | [diff] [blame] | 1 | /* |
| 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 | ******************************************************************************/ |
| 20 | static 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), |
Ying-Chun Liu (PaulLiu) | d9f76e6 | 2018-06-10 02:00:27 +0800 | [diff] [blame] | 102 | #ifdef SPD_opteed |
| 103 | .image_info.image_base = RPI3_OPTEE_PAGEABLE_LOAD_BASE, |
| 104 | .image_info.image_max_size = RPI3_OPTEE_PAGEABLE_LOAD_SIZE, |
| 105 | #endif |
Antonio Nino Diaz | ae6779e | 2017-11-06 14:49:04 +0000 | [diff] [blame] | 106 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 107 | }, |
| 108 | # endif /* BL32_BASE */ |
| 109 | |
| 110 | /* Fill BL33 related information */ |
| 111 | { |
| 112 | .image_id = BL33_IMAGE_ID, |
| 113 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 114 | VERSION_2, entry_point_info_t, |
| 115 | NON_SECURE | EXECUTABLE), |
| 116 | # ifdef PRELOADED_BL33_BASE |
| 117 | .ep_info.pc = PRELOADED_BL33_BASE, |
| 118 | |
| 119 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 120 | VERSION_2, image_info_t, |
| 121 | IMAGE_ATTRIB_SKIP_LOADING), |
| 122 | # else |
| 123 | .ep_info.pc = PLAT_RPI3_NS_IMAGE_OFFSET, |
| 124 | |
| 125 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 126 | VERSION_2, image_info_t, 0), |
| 127 | .image_info.image_base = PLAT_RPI3_NS_IMAGE_OFFSET, |
| 128 | .image_info.image_max_size = PLAT_RPI3_NS_IMAGE_MAX_SIZE, |
| 129 | # endif /* PRELOADED_BL33_BASE */ |
| 130 | |
| 131 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 132 | } |
| 133 | }; |
| 134 | |
| 135 | REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs) |