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