developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 1 | /* |
Joel Hutton | 5cc3bc8 | 2018-03-21 11:40:57 +0000 | [diff] [blame] | 2 | * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 5 | */ |
Isla Mitchell | e363146 | 2017-07-14 10:46:32 +0100 | [diff] [blame] | 6 | #include <arch_helpers.h> |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 7 | #include <arm_gic.h> |
| 8 | #include <assert.h> |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 9 | #include <bl_common.h> |
| 10 | #include <cci.h> |
Masahiro Yamada | 0fac5af | 2016-12-28 16:11:41 +0900 | [diff] [blame] | 11 | #include <common_def.h> |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 12 | #include <console.h> |
| 13 | #include <context_mgmt.h> |
| 14 | #include <debug.h> |
| 15 | #include <generic_delay_timer.h> |
| 16 | #include <mcucfg.h> |
| 17 | #include <mmio.h> |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 18 | #include <mt_cpuxgpt.h> |
Isla Mitchell | e363146 | 2017-07-14 10:46:32 +0100 | [diff] [blame] | 19 | #include <mtk_plat_common.h> |
| 20 | #include <mtk_sip_svc.h> |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 21 | #include <plat_private.h> |
Isla Mitchell | e363146 | 2017-07-14 10:46:32 +0100 | [diff] [blame] | 22 | #include <platform.h> |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 23 | #include <string.h> |
Joel Hutton | 5cc3bc8 | 2018-03-21 11:40:57 +0000 | [diff] [blame] | 24 | #include <utils_def.h> |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 25 | #include <xlat_tables.h> |
Joel Hutton | 5cc3bc8 | 2018-03-21 11:40:57 +0000 | [diff] [blame] | 26 | |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 27 | /******************************************************************************* |
| 28 | * Declarations of linker defined symbols which will help us find the layout |
| 29 | * of trusted SRAM |
| 30 | ******************************************************************************/ |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 31 | /* |
| 32 | * The next 2 constants identify the extents of the code & RO data region. |
| 33 | * These addresses are used by the MMU setup code and therefore they must be |
| 34 | * page-aligned. It is the responsibility of the linker script to ensure that |
| 35 | * __RO_START__ and __RO_END__ linker symbols refer to page-aligned addresses. |
| 36 | */ |
Joel Hutton | 5cc3bc8 | 2018-03-21 11:40:57 +0000 | [diff] [blame] | 37 | IMPORT_SYM(unsigned long, __RO_START__, BL31_RO_BASE); |
| 38 | IMPORT_SYM(unsigned long, __RO_END__, BL31_RO_LIMIT); |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 39 | |
| 40 | /* |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 41 | * Placeholder variables for copying the arguments that have been passed to |
| 42 | * BL3-1 from BL2. |
| 43 | */ |
| 44 | static entry_point_info_t bl32_image_ep_info; |
| 45 | static entry_point_info_t bl33_image_ep_info; |
| 46 | |
| 47 | static const int cci_map[] = { |
| 48 | PLAT_MT_CCI_CLUSTER0_SL_IFACE_IX, |
| 49 | PLAT_MT_CCI_CLUSTER1_SL_IFACE_IX |
| 50 | }; |
| 51 | |
| 52 | static uint32_t cci_map_length = ARRAY_SIZE(cci_map); |
| 53 | |
| 54 | /* Table of regions to map using the MMU. */ |
| 55 | static const mmap_region_t plat_mmap[] = { |
| 56 | /* for TF text, RO, RW */ |
| 57 | MAP_REGION_FLAT(MTK_DEV_RNG0_BASE, MTK_DEV_RNG0_SIZE, |
| 58 | MT_DEVICE | MT_RW | MT_SECURE), |
| 59 | MAP_REGION_FLAT(MTK_DEV_RNG1_BASE, MTK_DEV_RNG1_SIZE, |
| 60 | MT_DEVICE | MT_RW | MT_SECURE), |
| 61 | MAP_REGION_FLAT(RAM_CONSOLE_BASE & ~(PAGE_SIZE_MASK), RAM_CONSOLE_SIZE, |
| 62 | MT_DEVICE | MT_RW | MT_NS), |
| 63 | { 0 } |
| 64 | |
| 65 | }; |
| 66 | |
| 67 | /******************************************************************************* |
| 68 | * Macro generating the code for the function setting up the pagetables as per |
| 69 | * the platform memory map & initialize the mmu, for the given exception level |
| 70 | ******************************************************************************/ |
| 71 | #define DEFINE_CONFIGURE_MMU_EL(_el) \ |
| 72 | void plat_configure_mmu_el ## _el(unsigned long total_base, \ |
| 73 | unsigned long total_size, \ |
| 74 | unsigned long ro_start, \ |
| 75 | unsigned long ro_limit, \ |
| 76 | unsigned long coh_start, \ |
| 77 | unsigned long coh_limit) \ |
| 78 | { \ |
| 79 | mmap_add_region(total_base, total_base, \ |
| 80 | total_size, \ |
| 81 | MT_MEMORY | MT_RW | MT_SECURE); \ |
| 82 | mmap_add_region(ro_start, ro_start, \ |
| 83 | ro_limit - ro_start, \ |
| 84 | MT_MEMORY | MT_RO | MT_SECURE); \ |
| 85 | mmap_add_region(coh_start, coh_start, \ |
| 86 | coh_limit - coh_start, \ |
| 87 | MT_DEVICE | MT_RW | MT_SECURE); \ |
| 88 | mmap_add(plat_mmap); \ |
| 89 | init_xlat_tables(); \ |
| 90 | \ |
| 91 | enable_mmu_el ## _el(0); \ |
| 92 | } |
| 93 | |
| 94 | /* Define EL3 variants of the function initialising the MMU */ |
| 95 | DEFINE_CONFIGURE_MMU_EL(3) |
| 96 | |
| 97 | unsigned int plat_get_syscnt_freq2(void) |
| 98 | { |
| 99 | return SYS_COUNTER_FREQ_IN_TICKS; |
| 100 | } |
| 101 | |
| 102 | void plat_cci_init(void) |
| 103 | { |
| 104 | /* Initialize CCI driver */ |
| 105 | cci_init(PLAT_MT_CCI_BASE, cci_map, cci_map_length); |
| 106 | } |
| 107 | |
| 108 | void plat_cci_enable(void) |
| 109 | { |
| 110 | /* |
| 111 | * Enable CCI coherency for this cluster. |
| 112 | * No need for locks as no other cpu is active at the moment. |
| 113 | */ |
| 114 | cci_enable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr())); |
| 115 | } |
| 116 | |
| 117 | void plat_cci_disable(void) |
| 118 | { |
| 119 | cci_disable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr())); |
| 120 | } |
| 121 | |
| 122 | |
| 123 | static void platform_setup_cpu(void) |
| 124 | { |
| 125 | /* setup big cores */ |
| 126 | mmio_write_32((uintptr_t)&mt6795_mcucfg->mp1_config_res, |
| 127 | MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK | |
| 128 | MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK | |
| 129 | MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK | |
| 130 | MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK | |
| 131 | MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK); |
| 132 | mmio_setbits_32((uintptr_t)&mt6795_mcucfg->mp1_miscdbg, MP1_AINACTS); |
| 133 | mmio_setbits_32((uintptr_t)&mt6795_mcucfg->mp1_clkenm_div, |
| 134 | MP1_SW_CG_GEN); |
| 135 | mmio_clrbits_32((uintptr_t)&mt6795_mcucfg->mp1_rst_ctl, |
| 136 | MP1_L2RSTDISABLE); |
| 137 | |
| 138 | /* set big cores arm64 boot mode */ |
| 139 | mmio_setbits_32((uintptr_t)&mt6795_mcucfg->mp1_cpucfg, |
| 140 | MP1_CPUCFG_64BIT); |
| 141 | |
| 142 | /* set LITTLE cores arm64 boot mode */ |
| 143 | mmio_setbits_32((uintptr_t)&mt6795_mcucfg->mp0_rv_addr[0].rv_addr_hw, |
| 144 | MP0_CPUCFG_64BIT); |
| 145 | } |
| 146 | |
| 147 | /******************************************************************************* |
| 148 | * Return a pointer to the 'entry_point_info' structure of the next image for |
| 149 | * the security state specified. BL33 corresponds to the non-secure image type |
| 150 | * while BL32 corresponds to the secure image type. A NULL pointer is returned |
| 151 | * if the image does not exist. |
| 152 | ******************************************************************************/ |
| 153 | entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type) |
| 154 | { |
| 155 | entry_point_info_t *next_image_info; |
| 156 | |
| 157 | next_image_info = (type == NON_SECURE) ? |
| 158 | &bl33_image_ep_info : &bl32_image_ep_info; |
| 159 | |
| 160 | /* None of the images on this platform can have 0x0 as the entrypoint */ |
| 161 | if (next_image_info->pc) |
| 162 | return next_image_info; |
| 163 | else |
| 164 | return NULL; |
| 165 | } |
| 166 | |
| 167 | /******************************************************************************* |
| 168 | * Perform any BL3-1 early platform setup. Here is an opportunity to copy |
| 169 | * parameters passed by the calling EL (S-EL1 in BL2 & S-EL3 in BL1) before they |
| 170 | * are lost (potentially). This needs to be done before the MMU is initialized |
| 171 | * so that the memory layout can be used while creating page tables. |
| 172 | * BL2 has flushed this information to memory, so we are guaranteed to pick up |
| 173 | * good data. |
| 174 | ******************************************************************************/ |
| 175 | void bl31_early_platform_setup(bl31_params_t *from_bl2, |
| 176 | void *plat_params_from_bl2) |
| 177 | { |
| 178 | struct mtk_bl_param_t *pmtk_bl_param = |
| 179 | (struct mtk_bl_param_t *)from_bl2; |
| 180 | struct atf_arg_t *teearg; |
| 181 | unsigned long long normal_base; |
| 182 | unsigned long long atf_base; |
| 183 | |
| 184 | assert(from_bl2 != NULL); |
| 185 | /* |
| 186 | * Mediatek preloader(i.e, BL2) is in 32 bit state, high 32bits |
| 187 | * of 64 bit GP registers are UNKNOWN if CPU warm reset from 32 bit |
| 188 | * to 64 bit state. So we need to clear high 32bit, |
| 189 | * which may be random value. |
| 190 | */ |
| 191 | pmtk_bl_param = |
| 192 | (struct mtk_bl_param_t *)((uint64_t)pmtk_bl_param & 0x00000000ffffffff); |
| 193 | plat_params_from_bl2 = |
| 194 | (void *)((uint64_t)plat_params_from_bl2 & 0x00000000ffffffff); |
| 195 | |
| 196 | teearg = (struct atf_arg_t *)pmtk_bl_param->tee_info_addr; |
| 197 | |
| 198 | console_init(teearg->atf_log_port, UART_CLOCK, UART_BAUDRATE); |
| 199 | memcpy((void *)>eearg, (void *)teearg, sizeof(struct atf_arg_t)); |
| 200 | |
| 201 | normal_base = 0; |
| 202 | /* in ATF boot time, timer for cntpct_el0 is not initialized |
| 203 | * so it will not count now. |
| 204 | */ |
| 205 | atf_base = read_cntpct_el0(); |
| 206 | sched_clock_init(normal_base, atf_base); |
| 207 | |
| 208 | VERBOSE("bl31_setup\n"); |
| 209 | |
| 210 | /* Populate entry point information for BL3-2 and BL3-3 */ |
| 211 | SET_PARAM_HEAD(&bl32_image_ep_info, |
| 212 | PARAM_EP, |
| 213 | VERSION_1, |
| 214 | 0); |
| 215 | SET_SECURITY_STATE(bl32_image_ep_info.h.attr, SECURE); |
| 216 | bl32_image_ep_info.pc = BL32_BASE; |
| 217 | |
| 218 | SET_PARAM_HEAD(&bl33_image_ep_info, |
| 219 | PARAM_EP, |
| 220 | VERSION_1, |
| 221 | 0); |
| 222 | /* |
| 223 | * Tell BL3-1 where the non-trusted software image |
| 224 | * is located and the entry state information |
| 225 | */ |
| 226 | /* BL33_START_ADDRESS */ |
| 227 | bl33_image_ep_info.pc = pmtk_bl_param->bl33_start_addr; |
| 228 | bl33_image_ep_info.spsr = plat_get_spsr_for_bl33_entry(); |
| 229 | bl33_image_ep_info.args.arg4 = pmtk_bl_param->bootarg_loc; |
| 230 | bl33_image_ep_info.args.arg5 = pmtk_bl_param->bootarg_size; |
| 231 | SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE); |
| 232 | } |
| 233 | /******************************************************************************* |
| 234 | * Perform any BL3-1 platform setup code |
| 235 | ******************************************************************************/ |
| 236 | |
| 237 | void bl31_platform_setup(void) |
| 238 | { |
| 239 | platform_setup_cpu(); |
| 240 | |
| 241 | generic_delay_timer_init(); |
| 242 | |
| 243 | plat_mt_gic_driver_init(); |
| 244 | /* Initialize the gic cpu and distributor interfaces */ |
| 245 | plat_mt_gic_init(); |
| 246 | |
| 247 | /* Topologies are best known to the platform. */ |
| 248 | mt_setup_topology(); |
| 249 | } |
| 250 | /******************************************************************************* |
| 251 | * Perform the very early platform specific architectural setup here. At the |
| 252 | * moment this is only intializes the mmu in a quick and dirty way. |
| 253 | * Init MTK propiartary log buffer control field. |
| 254 | ******************************************************************************/ |
| 255 | void bl31_plat_arch_setup(void) |
| 256 | { |
| 257 | /* Enable non-secure access to CCI-400 registers */ |
| 258 | mmio_write_32(CCI400_BASE + CCI_SEC_ACCESS_OFFSET, 0x1); |
| 259 | |
| 260 | plat_cci_init(); |
| 261 | plat_cci_enable(); |
| 262 | |
| 263 | if (gteearg.atf_log_buf_size != 0) { |
| 264 | INFO("mmap atf buffer : 0x%x, 0x%x\n\r", |
| 265 | gteearg.atf_log_buf_start, |
| 266 | gteearg.atf_log_buf_size); |
| 267 | |
| 268 | mmap_add_region( |
| 269 | gteearg.atf_log_buf_start & |
| 270 | ~(PAGE_SIZE_2MB_MASK), |
| 271 | gteearg.atf_log_buf_start & |
| 272 | ~(PAGE_SIZE_2MB_MASK), |
| 273 | PAGE_SIZE_2MB, |
| 274 | MT_DEVICE | MT_RW | MT_NS); |
| 275 | |
| 276 | INFO("mmap atf buffer (force 2MB aligned):0x%x, 0x%x\n", |
| 277 | (gteearg.atf_log_buf_start & ~(PAGE_SIZE_2MB_MASK)), |
| 278 | PAGE_SIZE_2MB); |
| 279 | } |
| 280 | /* |
| 281 | * add TZRAM_BASE to memory map |
| 282 | * then set RO and COHERENT to different attribute |
| 283 | */ |
| 284 | plat_configure_mmu_el3( |
| 285 | (TZRAM_BASE & ~(PAGE_SIZE_MASK)), |
| 286 | (TZRAM_SIZE & ~(PAGE_SIZE_MASK)), |
| 287 | (BL31_RO_BASE & ~(PAGE_SIZE_MASK)), |
| 288 | BL31_RO_LIMIT, |
Masahiro Yamada | 0fac5af | 2016-12-28 16:11:41 +0900 | [diff] [blame] | 289 | BL_COHERENT_RAM_BASE, |
| 290 | BL_COHERENT_RAM_END); |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 291 | /* Initialize for ATF log buffer */ |
| 292 | if (gteearg.atf_log_buf_size != 0) { |
| 293 | gteearg.atf_aee_debug_buf_size = ATF_AEE_BUFFER_SIZE; |
| 294 | gteearg.atf_aee_debug_buf_start = |
| 295 | gteearg.atf_log_buf_start + |
| 296 | gteearg.atf_log_buf_size - ATF_AEE_BUFFER_SIZE; |
| 297 | INFO("ATF log service is registered (0x%x, aee:0x%x)\n", |
| 298 | gteearg.atf_log_buf_start, |
| 299 | gteearg.atf_aee_debug_buf_start); |
| 300 | } else{ |
| 301 | gteearg.atf_aee_debug_buf_size = 0; |
| 302 | gteearg.atf_aee_debug_buf_start = 0; |
| 303 | } |
| 304 | |
| 305 | /* Platform code before bl31_main */ |
| 306 | /* compatible to the earlier chipset */ |
| 307 | |
| 308 | /* Show to ATF log buffer & UART */ |
| 309 | INFO("BL3-1: %s\n", version_string); |
| 310 | INFO("BL3-1: %s\n", build_message); |
| 311 | |
| 312 | } |
| 313 | #if 0 |
| 314 | /* MTK Define */ |
| 315 | #define ACTLR_CPUECTLR_BIT (1 << 1) |
| 316 | |
| 317 | void enable_ns_access_to_cpuectlr(void) |
| 318 | { |
| 319 | unsigned int next_actlr; |
| 320 | |
| 321 | |
| 322 | /* ACTLR_EL1 do not implement CUPECTLR */ |
| 323 | next_actlr = read_actlr_el2(); |
| 324 | next_actlr |= ACTLR_CPUECTLR_BIT; |
| 325 | write_actlr_el2(next_actlr); |
| 326 | |
| 327 | next_actlr = read_actlr_el3(); |
| 328 | next_actlr |= ACTLR_CPUECTLR_BIT; |
| 329 | write_actlr_el3(next_actlr); |
| 330 | } |
| 331 | #endif |
| 332 | /******************************************************************************* |
| 333 | * This function prepare boot argument for 64 bit kernel entry |
| 334 | ******************************************************************************/ |
| 335 | static entry_point_info_t *bl31_plat_get_next_kernel64_ep_info(void) |
| 336 | { |
| 337 | entry_point_info_t *next_image_info; |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 338 | unsigned int mode; |
| 339 | |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 340 | mode = 0; |
| 341 | |
| 342 | /* Kernel image is always non-secured */ |
| 343 | next_image_info = &bl33_image_ep_info; |
| 344 | |
| 345 | /* Figure out what mode we enter the non-secure world in */ |
Jeenu Viswambharan | 2a9b882 | 2017-02-21 14:40:44 +0000 | [diff] [blame] | 346 | if (EL_IMPLEMENTED(2)) { |
developer | 550bf5e | 2016-07-11 16:05:23 +0800 | [diff] [blame] | 347 | INFO("Kernel_EL2\n"); |
| 348 | mode = MODE_EL2; |
| 349 | } else{ |
| 350 | INFO("Kernel_EL1\n"); |
| 351 | mode = MODE_EL1; |
| 352 | } |
| 353 | |
| 354 | INFO("Kernel is 64Bit\n"); |
| 355 | next_image_info->spsr = |
| 356 | SPSR_64(mode, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS); |
| 357 | next_image_info->pc = get_kernel_info_pc(); |
| 358 | next_image_info->args.arg0 = get_kernel_info_r0(); |
| 359 | next_image_info->args.arg1 = get_kernel_info_r1(); |
| 360 | |
| 361 | INFO("pc=0x%lx, r0=0x%lx, r1=0x%lx\n", |
| 362 | next_image_info->pc, |
| 363 | next_image_info->args.arg0, |
| 364 | next_image_info->args.arg1); |
| 365 | |
| 366 | |
| 367 | SET_SECURITY_STATE(next_image_info->h.attr, NON_SECURE); |
| 368 | |
| 369 | /* None of the images on this platform can have 0x0 as the entrypoint */ |
| 370 | if (next_image_info->pc) |
| 371 | return next_image_info; |
| 372 | else |
| 373 | return NULL; |
| 374 | } |
| 375 | |
| 376 | /******************************************************************************* |
| 377 | * This function prepare boot argument for 32 bit kernel entry |
| 378 | ******************************************************************************/ |
| 379 | static entry_point_info_t *bl31_plat_get_next_kernel32_ep_info(void) |
| 380 | { |
| 381 | entry_point_info_t *next_image_info; |
| 382 | unsigned int mode; |
| 383 | |
| 384 | mode = 0; |
| 385 | |
| 386 | /* Kernel image is always non-secured */ |
| 387 | next_image_info = &bl33_image_ep_info; |
| 388 | |
| 389 | /* Figure out what mode we enter the non-secure world in */ |
| 390 | mode = MODE32_hyp; |
| 391 | /* |
| 392 | * TODO: Consider the possibility of specifying the SPSR in |
| 393 | * the FIP ToC and allowing the platform to have a say as |
| 394 | * well. |
| 395 | */ |
| 396 | |
| 397 | INFO("Kernel is 32Bit\n"); |
| 398 | next_image_info->spsr = |
| 399 | SPSR_MODE32(mode, SPSR_T_ARM, SPSR_E_LITTLE, |
| 400 | (DAIF_FIQ_BIT | DAIF_IRQ_BIT | DAIF_ABT_BIT)); |
| 401 | next_image_info->pc = get_kernel_info_pc(); |
| 402 | next_image_info->args.arg0 = get_kernel_info_r0(); |
| 403 | next_image_info->args.arg1 = get_kernel_info_r1(); |
| 404 | next_image_info->args.arg2 = get_kernel_info_r2(); |
| 405 | |
| 406 | INFO("pc=0x%lx, r0=0x%lx, r1=0x%lx, r2=0x%lx\n", |
| 407 | next_image_info->pc, |
| 408 | next_image_info->args.arg0, |
| 409 | next_image_info->args.arg1, |
| 410 | next_image_info->args.arg2); |
| 411 | |
| 412 | |
| 413 | SET_SECURITY_STATE(next_image_info->h.attr, NON_SECURE); |
| 414 | |
| 415 | /* None of the images on this platform can have 0x0 as the entrypoint */ |
| 416 | if (next_image_info->pc) |
| 417 | return next_image_info; |
| 418 | else |
| 419 | return NULL; |
| 420 | } |
| 421 | |
| 422 | /******************************************************************************* |
| 423 | * This function prepare boot argument for kernel entrypoint |
| 424 | ******************************************************************************/ |
| 425 | void bl31_prepare_kernel_entry(uint64_t k32_64) |
| 426 | { |
| 427 | entry_point_info_t *next_image_info; |
| 428 | uint32_t image_type; |
| 429 | |
| 430 | /* Determine which image to execute next */ |
| 431 | /* image_type = bl31_get_next_image_type(); */ |
| 432 | image_type = NON_SECURE; |
| 433 | |
| 434 | /* Program EL3 registers to enable entry into the next EL */ |
| 435 | if (k32_64 == 0) |
| 436 | next_image_info = bl31_plat_get_next_kernel32_ep_info(); |
| 437 | else |
| 438 | next_image_info = bl31_plat_get_next_kernel64_ep_info(); |
| 439 | |
| 440 | assert(next_image_info); |
| 441 | assert(image_type == GET_SECURITY_STATE(next_image_info->h.attr)); |
| 442 | |
| 443 | INFO("BL3-1: Preparing for EL3 exit to %s world, Kernel\n", |
| 444 | (image_type == SECURE) ? "secure" : "normal"); |
| 445 | INFO("BL3-1: Next image address = 0x%llx\n", |
| 446 | (unsigned long long) next_image_info->pc); |
| 447 | INFO("BL3-1: Next image spsr = 0x%x\n", next_image_info->spsr); |
| 448 | cm_init_context(read_mpidr_el1(), next_image_info); |
| 449 | cm_prepare_el3_exit(image_type); |
| 450 | } |