Masahiro Yamada | 574388c | 2016-09-03 11:37:40 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <assert.h> |
| 9 | #include <desc_image_load.h> |
| 10 | #include <platform_def.h> |
| 11 | |
| 12 | #include "uniphier.h" |
| 13 | |
| 14 | static struct bl_mem_params_node uniphier_image_descs[] = { |
| 15 | { |
| 16 | .image_id = SCP_BL2_IMAGE_ID, |
| 17 | |
| 18 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 19 | VERSION_2, image_info_t, 0), |
| 20 | .image_info.image_base = UNIPHIER_SCP_BASE, |
| 21 | .image_info.image_max_size = UNIPHIER_SCP_MAX_SIZE, |
| 22 | |
| 23 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 24 | VERSION_2, entry_point_info_t, |
| 25 | NON_SECURE | NON_EXECUTABLE), |
| 26 | |
| 27 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 28 | }, |
| 29 | { |
| 30 | .image_id = BL31_IMAGE_ID, |
| 31 | |
| 32 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 33 | VERSION_2, image_info_t, 0), |
| 34 | .image_info.image_base = BL31_BASE, |
| 35 | .image_info.image_max_size = BL31_LIMIT - BL31_BASE, |
| 36 | |
| 37 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 38 | VERSION_2, entry_point_info_t, |
| 39 | SECURE | EXECUTABLE | EP_FIRST_EXE), |
| 40 | .ep_info.pc = BL31_BASE, |
| 41 | .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX, |
| 42 | DISABLE_ALL_EXCEPTIONS), |
| 43 | |
| 44 | #ifdef UNIPHIER_LOAD_BL32 |
| 45 | .next_handoff_image_id = BL32_IMAGE_ID, |
| 46 | #else |
| 47 | .next_handoff_image_id = BL33_IMAGE_ID, |
| 48 | #endif |
| 49 | }, |
| 50 | #ifdef UNIPHIER_LOAD_BL32 |
| 51 | { |
| 52 | .image_id = BL32_IMAGE_ID, |
| 53 | |
| 54 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 55 | VERSION_2, image_info_t, 0), |
| 56 | .image_info.image_base = BL32_BASE, |
| 57 | .image_info.image_max_size = BL32_LIMIT - BL32_BASE, |
| 58 | |
| 59 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 60 | VERSION_2, entry_point_info_t, |
| 61 | SECURE | EXECUTABLE), |
| 62 | .ep_info.pc = BL32_BASE, |
| 63 | .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX, |
| 64 | DISABLE_ALL_EXCEPTIONS), |
| 65 | |
| 66 | .next_handoff_image_id = BL33_IMAGE_ID, |
| 67 | }, |
| 68 | #endif |
| 69 | { |
| 70 | .image_id = BL33_IMAGE_ID, |
| 71 | |
| 72 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 73 | VERSION_2, image_info_t, 0), |
| 74 | .image_info.image_base = UNIPHIER_BL33_BASE, |
| 75 | .image_info.image_max_size = UNIPHIER_BL33_MAX_SIZE, |
| 76 | |
| 77 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 78 | VERSION_2, entry_point_info_t, |
| 79 | NON_SECURE | EXECUTABLE), |
| 80 | .ep_info.pc = UNIPHIER_BL33_BASE, |
| 81 | .ep_info.spsr = SPSR_64(MODE_EL1, MODE_SP_ELX, |
| 82 | DISABLE_ALL_EXCEPTIONS), |
| 83 | |
| 84 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 85 | }, |
| 86 | }; |
| 87 | REGISTER_BL_IMAGE_DESCS(uniphier_image_descs) |
| 88 | |
| 89 | /* SCP is optional. Allow run-time fixup of the descriptor array. */ |
| 90 | void uniphier_image_descs_fixup(void) |
| 91 | { |
| 92 | struct bl_mem_params_node *desc; |
| 93 | |
| 94 | desc = get_bl_mem_params_node(SCP_BL2_IMAGE_ID); |
| 95 | assert(desc != NULL); |
| 96 | desc->image_info.h.attr |= IMAGE_ATTRIB_SKIP_LOADING; |
| 97 | } |