1 /* 2 * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 #ifndef __MTK_PLAT_COMMON_H__ 7 #define __MTK_PLAT_COMMON_H__ 8 9 #include <bl_common.h> 10 #include <param_header.h> 11 #include <stdint.h> 12 13 /******************************************************************************* 14 * Function and variable prototypes 15 ******************************************************************************/ 16 #define DEVINFO_SIZE 4 17 #define LINUX_KERNEL_32 0 18 #define SMC32_PARAM_MASK (0xFFFFFFFF) 19 20 struct atf_arg_t { 21 unsigned int atf_magic; 22 unsigned int tee_support; 23 unsigned int tee_entry; 24 unsigned int tee_boot_arg_addr; 25 unsigned int hwuid[4]; /* HW Unique id for t-base used */ 26 unsigned int HRID[2]; /* HW random id for t-base used */ 27 unsigned int atf_log_port; 28 unsigned int atf_log_baudrate; 29 unsigned int atf_log_buf_start; 30 unsigned int atf_log_buf_size; 31 unsigned int atf_irq_num; 32 unsigned int devinfo[DEVINFO_SIZE]; 33 unsigned int atf_aee_debug_buf_start; 34 unsigned int atf_aee_debug_buf_size; 35 }; 36 37 struct kernel_info { 38 uint64_t pc; 39 uint64_t r0; 40 uint64_t r1; 41 uint64_t r2; 42 uint64_t k32_64; 43 }; 44 45 struct mtk_bl_param_t { 46 uint64_t bootarg_loc; 47 uint64_t bootarg_size; 48 uint64_t bl33_start_addr; 49 uint64_t tee_info_addr; 50 }; 51 52 struct mtk_bl31_params { 53 param_header_t h; 54 image_info_t *bl31_image_info; 55 entry_point_info_t *bl32_ep_info; 56 image_info_t *bl32_image_info; 57 entry_point_info_t *bl33_ep_info; 58 image_info_t *bl33_image_info; 59 }; 60 61 /* Declarations for mtk_plat_common.c */ 62 uint32_t plat_get_spsr_for_bl32_entry(void); 63 uint32_t plat_get_spsr_for_bl33_entry(void); 64 void clean_top_32b_of_param(uint32_t smc_fid, u_register_t *x1, 65 u_register_t *x2, 66 u_register_t *x3, 67 u_register_t *x4); 68 void bl31_prepare_kernel_entry(uint64_t k32_64); 69 void enable_ns_access_to_cpuectlr(void); 70 void boot_to_kernel(uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4); 71 uint64_t get_kernel_info_pc(void); 72 uint64_t get_kernel_info_r0(void); 73 uint64_t get_kernel_info_r1(void); 74 uint64_t get_kernel_info_r2(void); 75 76 extern struct atf_arg_t gteearg; 77 #endif 78