1 /* 2 * Copyright (c) 2021-2023, Stephan Gerhold <stephan@gerhold.net> 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <assert.h> 8 9 #include <arch.h> 10 #include <common/debug.h> 11 #include <plat/common/platform.h> 12 13 #include "msm8916_config.h" 14 #include "msm8916_setup.h" 15 16 static struct { 17 entry_point_info_t bl32; 18 entry_point_info_t bl33; 19 } image_ep_info = { 20 /* BL32 entry point */ 21 SET_STATIC_PARAM_HEAD(bl32, PARAM_EP, VERSION_1, 22 entry_point_info_t, SECURE), 23 .bl32.pc = BL32_BASE, 24 25 /* BL33 entry point */ 26 SET_STATIC_PARAM_HEAD(bl33, PARAM_EP, VERSION_1, 27 entry_point_info_t, NON_SECURE), 28 .bl33.pc = PRELOADED_BL33_BASE, 29 .bl33.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS), 30 }; 31 32 void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, 33 u_register_t arg2, u_register_t arg3) 34 { 35 msm8916_early_platform_setup(); 36 msm8916_configure_early(); 37 } 38 39 void bl31_plat_arch_setup(void) 40 { 41 msm8916_plat_arch_setup(BL31_BASE, BL31_END - BL31_BASE); 42 enable_mmu_el3(0); 43 } 44 45 void bl31_platform_setup(void) 46 { 47 INFO("BL31: Platform setup start\n"); 48 msm8916_platform_setup(); 49 msm8916_configure(); 50 INFO("BL31: Platform setup done\n"); 51 } 52 53 entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type) 54 { 55 switch (type) { 56 case SECURE: 57 return &image_ep_info.bl32; 58 case NON_SECURE: 59 return &image_ep_info.bl33; 60 default: 61 assert(sec_state_is_valid(type)); 62 return NULL; 63 } 64 } 65