developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | 42eef85 | 2018-09-24 17:15:54 +0100 | [diff] [blame] | 2 | * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 5 | */ |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 6 | #ifndef MTK_PLAT_COMMON_H |
| 7 | #define MTK_PLAT_COMMON_H |
Antonio Nino Diaz | 42eef85 | 2018-09-24 17:15:54 +0100 | [diff] [blame] | 8 | |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 9 | #include <stdint.h> |
Antonio Nino Diaz | 42eef85 | 2018-09-24 17:15:54 +0100 | [diff] [blame] | 10 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 11 | #include <common/bl_common.h> |
| 12 | #include <common/param_header.h> |
| 13 | |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 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 | |
Hsin-Yi Wang | e0bf305 | 2020-08-27 13:48:48 +0800 | [diff] [blame] | 21 | #define JEDEC_MTK_BKID U(4) |
| 22 | #define JEDEC_MTK_MFID U(0x26) |
| 23 | |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 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 | |
Antonio Nino Diaz | 42eef85 | 2018-09-24 17:15:54 +0100 | [diff] [blame] | 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 | |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 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); |
Masahiro Yamada | 5ac9d96 | 2018-04-19 01:18:48 +0900 | [diff] [blame] | 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); |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 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; |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 81 | #endif /* MTK_PLAT_COMMON_H */ |