| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#include <assert.h> |
| 9 |
|
| 10 |
#include <arch.h> |
| 11 |
#include <common/bl_common.h> |
| 12 |
#include <common/debug.h> |
| 13 |
#ifdef USE_CCI |
| 14 |
#include <drivers/arm/cci.h> |
| 15 |
#endif |
| 16 |
#include <drivers/console.h> |
| 17 |
#include <plat/common/platform.h> |
| 18 |
|
| 19 |
#include <marvell_def.h> |
| 20 |
#include <marvell_plat_priv.h> |
| 21 |
#include <plat_marvell.h> |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
static entry_point_info_t bl32_image_ep_info; |
| 28 |
static entry_point_info_t bl33_image_ep_info; |
| 29 |
|
| 30 |
|
| 31 |
#pragma weak bl31_early_platform_setup2 |
| 32 |
#pragma weak bl31_platform_setup |
| 33 |
#pragma weak bl31_plat_arch_setup |
| 34 |
#pragma weak bl31_plat_get_next_image_ep_info |
| 35 |
#pragma weak plat_get_syscnt_freq2 |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type) |
| 45 |
{ |
| 46 |
entry_point_info_t *next_image_info; |
| 47 |
|
| 48 |
assert(sec_state_is_valid(type)); |
| 49 |
next_image_info = (type == NON_SECURE) |
| 50 |
? &bl33_image_ep_info : &bl32_image_ep_info; |
| 51 |
|
| 52 |
return next_image_info; |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
void marvell_bl31_early_platform_setup(void *from_bl2, |
| 65 |
uintptr_t soc_fw_config, |
| 66 |
uintptr_t hw_config, |
| 67 |
void *plat_params_from_bl2) |
| 68 |
{ |
| 69 |
|
| 70 |
marvell_console_boot_init(); |
| 71 |
|
| 72 |
#if RESET_TO_BL31 |
| 73 |
|
| 74 |
assert(from_bl2 == NULL); |
| 75 |
assert(plat_params_from_bl2 == NULL); |
| 76 |
|
| 77 |
#ifdef BL32_BASE |
| 78 |
|
| 79 |
SET_PARAM_HEAD(&bl32_image_ep_info, |
| 80 |
PARAM_EP, |
| 81 |
VERSION_1, |
| 82 |
0); |
| 83 |
SET_SECURITY_STATE(bl32_image_ep_info.h.attr, SECURE); |
| 84 |
bl32_image_ep_info.pc = BL32_BASE; |
| 85 |
bl32_image_ep_info.spsr = marvell_get_spsr_for_bl32_entry(); |
| 86 |
#endif |
| 87 |
|
| 88 |
|
| 89 |
SET_PARAM_HEAD(&bl33_image_ep_info, |
| 90 |
PARAM_EP, |
| 91 |
VERSION_1, |
| 92 |
0); |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
bl33_image_ep_info.pc = plat_get_ns_image_entrypoint(); |
| 98 |
bl33_image_ep_info.spsr = marvell_get_spsr_for_bl33_entry(); |
| 99 |
SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE); |
| 100 |
|
| 101 |
#else |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
assert(((unsigned long long)plat_params_from_bl2) == |
| 108 |
MARVELL_BL31_PLAT_PARAM_VAL); |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
bl_params_t *params_from_bl2 = (bl_params_t *)from_bl2; |
| 114 |
assert(params_from_bl2 != NULL); |
| 115 |
assert(params_from_bl2->h.type == PARAM_BL_PARAMS); |
| 116 |
assert(params_from_bl2->h.version >= VERSION_2); |
| 117 |
|
| 118 |
bl_params_node_t *bl_params = params_from_bl2->head; |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
while (bl_params != NULL) { |
| 125 |
if (bl_params->image_id == BL32_IMAGE_ID) |
| 126 |
bl32_image_ep_info = *bl_params->ep_info; |
| 127 |
|
| 128 |
if (bl_params->image_id == BL33_IMAGE_ID) |
| 129 |
bl33_image_ep_info = *bl_params->ep_info; |
| 130 |
|
| 131 |
bl_params = bl_params->next_params_info; |
| 132 |
} |
| 133 |
#endif |
| 134 |
} |
| 135 |
|
| 136 |
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, |
| 137 |
u_register_t arg2, u_register_t arg3) |
| 138 |
|
| 139 |
{ |
| 140 |
marvell_bl31_early_platform_setup((void *)arg0, arg1, arg2, |
| 141 |
(void *)arg3); |
| 142 |
|
| 143 |
#ifdef USE_CCI |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
plat_marvell_interconnect_init(); |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
plat_marvell_interconnect_enter_coherency(); |
| 156 |
#endif |
| 157 |
} |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
void marvell_bl31_platform_setup(void) |
| 164 |
{ |
| 165 |
|
| 166 |
plat_marvell_gic_driver_init(); |
| 167 |
plat_marvell_gic_init(); |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
marvell_psci_arch_init(0); |
| 175 |
} |
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
void marvell_bl31_plat_runtime_setup(void) |
| 183 |
{ |
| 184 |
|
| 185 |
marvell_console_runtime_init(); |
| 186 |
} |
| 187 |
|
| 188 |
void bl31_platform_setup(void) |
| 189 |
{ |
| 190 |
marvell_bl31_platform_setup(); |
| 191 |
} |
| 192 |
|
| 193 |
void bl31_plat_runtime_setup(void) |
| 194 |
{ |
| 195 |
marvell_bl31_plat_runtime_setup(); |
| 196 |
} |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
void marvell_bl31_plat_arch_setup(void) |
| 206 |
{ |
| 207 |
marvell_setup_page_tables(BL31_BASE, |
| 208 |
BL31_END - BL31_BASE, |
| 209 |
BL_CODE_BASE, |
| 210 |
BL_CODE_END, |
| 211 |
BL_RO_DATA_BASE, |
| 212 |
BL_RO_DATA_END |
| 213 |
#if USE_COHERENT_MEM |
| 214 |
, BL_COHERENT_RAM_BASE, |
| 215 |
BL_COHERENT_RAM_END |
| 216 |
#endif |
| 217 |
); |
| 218 |
|
| 219 |
#if BL31_CACHE_DISABLE |
| 220 |
enable_mmu_el3(DISABLE_DCACHE); |
| 221 |
INFO("Cache is disabled in BL3\n"); |
| 222 |
#else |
| 223 |
enable_mmu_el3(0); |
| 224 |
#endif |
| 225 |
} |
| 226 |
|
| 227 |
void bl31_plat_arch_setup(void) |
| 228 |
{ |
| 229 |
marvell_bl31_plat_arch_setup(); |
| 230 |
} |
| 231 |
|
| 232 |
unsigned int plat_get_syscnt_freq2(void) |
| 233 |
{ |
| 234 |
return PLAT_REF_CLK_IN_HZ; |
| 235 |
} |