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