blob: 55f4c516ebf3f60d0c0093ea44de80f65cf26c73 [file] [log] [blame]
developer14f3fe32016-04-28 14:07:42 +08001/*
Antonio Nino Diaz42eef852018-09-24 17:15:54 +01002 * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
developer14f3fe32016-04-28 14:07:42 +08003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
developer14f3fe32016-04-28 14:07:42 +08005 */
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00006#ifndef MTK_PLAT_COMMON_H
7#define MTK_PLAT_COMMON_H
Antonio Nino Diaz42eef852018-09-24 17:15:54 +01008
developer14f3fe32016-04-28 14:07:42 +08009#include <stdint.h>
Antonio Nino Diaz42eef852018-09-24 17:15:54 +010010
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000011#include <common/bl_common.h>
12#include <common/param_header.h>
13
developer14f3fe32016-04-28 14:07:42 +080014/*******************************************************************************
15 * Function and variable prototypes
16 ******************************************************************************/
17#define DEVINFO_SIZE 4
18#define LINUX_KERNEL_32 0
19#define SMC32_PARAM_MASK (0xFFFFFFFF)
20
21struct atf_arg_t {
22 unsigned int atf_magic;
23 unsigned int tee_support;
24 unsigned int tee_entry;
25 unsigned int tee_boot_arg_addr;
26 unsigned int hwuid[4]; /* HW Unique id for t-base used */
27 unsigned int HRID[2]; /* HW random id for t-base used */
28 unsigned int atf_log_port;
29 unsigned int atf_log_baudrate;
30 unsigned int atf_log_buf_start;
31 unsigned int atf_log_buf_size;
32 unsigned int atf_irq_num;
33 unsigned int devinfo[DEVINFO_SIZE];
34 unsigned int atf_aee_debug_buf_start;
35 unsigned int atf_aee_debug_buf_size;
36};
37
38struct kernel_info {
39 uint64_t pc;
40 uint64_t r0;
41 uint64_t r1;
42 uint64_t r2;
43 uint64_t k32_64;
44};
45
46struct mtk_bl_param_t {
47 uint64_t bootarg_loc;
48 uint64_t bootarg_size;
49 uint64_t bl33_start_addr;
50 uint64_t tee_info_addr;
51};
52
Antonio Nino Diaz42eef852018-09-24 17:15:54 +010053struct mtk_bl31_params {
54 param_header_t h;
55 image_info_t *bl31_image_info;
56 entry_point_info_t *bl32_ep_info;
57 image_info_t *bl32_image_info;
58 entry_point_info_t *bl33_ep_info;
59 image_info_t *bl33_image_info;
60};
61
developer14f3fe32016-04-28 14:07:42 +080062/* Declarations for mtk_plat_common.c */
63uint32_t plat_get_spsr_for_bl32_entry(void);
64uint32_t plat_get_spsr_for_bl33_entry(void);
Masahiro Yamada5ac9d962018-04-19 01:18:48 +090065void clean_top_32b_of_param(uint32_t smc_fid, u_register_t *x1,
66 u_register_t *x2,
67 u_register_t *x3,
68 u_register_t *x4);
developer14f3fe32016-04-28 14:07:42 +080069void bl31_prepare_kernel_entry(uint64_t k32_64);
70void enable_ns_access_to_cpuectlr(void);
71void boot_to_kernel(uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4);
72uint64_t get_kernel_info_pc(void);
73uint64_t get_kernel_info_r0(void);
74uint64_t get_kernel_info_r1(void);
75uint64_t get_kernel_info_r2(void);
76
77extern struct atf_arg_t gteearg;
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000078#endif /* MTK_PLAT_COMMON_H */