1 /* 2 * Copyright (c) 2016, 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 #include <stdint.h> 9 /******************************************************************************* 10 * Function and variable prototypes 11 ******************************************************************************/ 12 #define DEVINFO_SIZE 4 13 #define LINUX_KERNEL_32 0 14 #define SMC32_PARAM_MASK (0xFFFFFFFF) 15 16 struct atf_arg_t { 17 unsigned int atf_magic; 18 unsigned int tee_support; 19 unsigned int tee_entry; 20 unsigned int tee_boot_arg_addr; 21 unsigned int hwuid[4]; /* HW Unique id for t-base used */ 22 unsigned int HRID[2]; /* HW random id for t-base used */ 23 unsigned int atf_log_port; 24 unsigned int atf_log_baudrate; 25 unsigned int atf_log_buf_start; 26 unsigned int atf_log_buf_size; 27 unsigned int atf_irq_num; 28 unsigned int devinfo[DEVINFO_SIZE]; 29 unsigned int atf_aee_debug_buf_start; 30 unsigned int atf_aee_debug_buf_size; 31 }; 32 33 struct kernel_info { 34 uint64_t pc; 35 uint64_t r0; 36 uint64_t r1; 37 uint64_t r2; 38 uint64_t k32_64; 39 }; 40 41 struct mtk_bl_param_t { 42 uint64_t bootarg_loc; 43 uint64_t bootarg_size; 44 uint64_t bl33_start_addr; 45 uint64_t tee_info_addr; 46 }; 47 48 /* Declarations for mtk_plat_common.c */ 49 uint32_t plat_get_spsr_for_bl32_entry(void); 50 uint32_t plat_get_spsr_for_bl33_entry(void); 51 void clean_top_32b_of_param(uint32_t smc_fid, uint64_t *x1, 52 uint64_t *x2, 53 uint64_t *x3, 54 uint64_t *x4); 55 void bl31_prepare_kernel_entry(uint64_t k32_64); 56 void enable_ns_access_to_cpuectlr(void); 57 void boot_to_kernel(uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4); 58 uint64_t get_kernel_info_pc(void); 59 uint64_t get_kernel_info_r0(void); 60 uint64_t get_kernel_info_r1(void); 61 uint64_t get_kernel_info_r2(void); 62 63 extern struct atf_arg_t gteearg; 64 #endif 65