blob: 919c173580c8c2e53aab50ecf7e768c56e46f6e0 [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
Hsin-Yi Wange0bf3052020-08-27 13:48:48 +080021#define JEDEC_MTK_BKID U(4)
22#define JEDEC_MTK_MFID U(0x26)
23
developer14f3fe32016-04-28 14:07:42 +080024struct 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
41struct 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
49struct 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 Diaz42eef852018-09-24 17:15:54 +010056struct 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
developer14f3fe32016-04-28 14:07:42 +080065/* Declarations for mtk_plat_common.c */
66uint32_t plat_get_spsr_for_bl32_entry(void);
67uint32_t plat_get_spsr_for_bl33_entry(void);
Masahiro Yamada5ac9d962018-04-19 01:18:48 +090068void 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);
developer14f3fe32016-04-28 14:07:42 +080072void bl31_prepare_kernel_entry(uint64_t k32_64);
73void enable_ns_access_to_cpuectlr(void);
74void boot_to_kernel(uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4);
75uint64_t get_kernel_info_pc(void);
76uint64_t get_kernel_info_r0(void);
77uint64_t get_kernel_info_r1(void);
78uint64_t get_kernel_info_r2(void);
79
80extern struct atf_arg_t gteearg;
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000081#endif /* MTK_PLAT_COMMON_H */