blob: 923cf6932c372f02fd8b728e5fc884b53ce63359 [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 */
6#ifndef __MTK_PLAT_COMMON_H__
7#define __MTK_PLAT_COMMON_H__
Antonio Nino Diaz42eef852018-09-24 17:15:54 +01008
9#include <bl_common.h>
10#include <param_header.h>
developer14f3fe32016-04-28 14:07:42 +080011#include <stdint.h>
Antonio Nino Diaz42eef852018-09-24 17:15:54 +010012
developer14f3fe32016-04-28 14:07:42 +080013/*******************************************************************************
14 * Function and variable prototypes
15 ******************************************************************************/
16#define DEVINFO_SIZE 4
17#define LINUX_KERNEL_32 0
18#define SMC32_PARAM_MASK (0xFFFFFFFF)
19
20struct 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
37struct 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
45struct 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
Antonio Nino Diaz42eef852018-09-24 17:15:54 +010052struct 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
developer14f3fe32016-04-28 14:07:42 +080061/* Declarations for mtk_plat_common.c */
62uint32_t plat_get_spsr_for_bl32_entry(void);
63uint32_t plat_get_spsr_for_bl33_entry(void);
Masahiro Yamada5ac9d962018-04-19 01:18:48 +090064void 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);
developer14f3fe32016-04-28 14:07:42 +080068void bl31_prepare_kernel_entry(uint64_t k32_64);
69void enable_ns_access_to_cpuectlr(void);
70void boot_to_kernel(uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4);
71uint64_t get_kernel_info_pc(void);
72uint64_t get_kernel_info_r0(void);
73uint64_t get_kernel_info_r1(void);
74uint64_t get_kernel_info_r2(void);
75
76extern struct atf_arg_t gteearg;
77#endif