blob: a3420f302c24a8a35a95dc0b8cee39414e689491 [file] [log] [blame]
developer14f3fe32016-04-28 14:07:42 +08001/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30#ifndef __MTK_PLAT_COMMON_H__
31#define __MTK_PLAT_COMMON_H__
32#include <stdint.h>
33/*******************************************************************************
34 * Function and variable prototypes
35 ******************************************************************************/
36#define DEVINFO_SIZE 4
37#define LINUX_KERNEL_32 0
38#define SMC32_PARAM_MASK (0xFFFFFFFF)
39
40struct atf_arg_t {
41 unsigned int atf_magic;
42 unsigned int tee_support;
43 unsigned int tee_entry;
44 unsigned int tee_boot_arg_addr;
45 unsigned int hwuid[4]; /* HW Unique id for t-base used */
46 unsigned int HRID[2]; /* HW random id for t-base used */
47 unsigned int atf_log_port;
48 unsigned int atf_log_baudrate;
49 unsigned int atf_log_buf_start;
50 unsigned int atf_log_buf_size;
51 unsigned int atf_irq_num;
52 unsigned int devinfo[DEVINFO_SIZE];
53 unsigned int atf_aee_debug_buf_start;
54 unsigned int atf_aee_debug_buf_size;
55};
56
57struct kernel_info {
58 uint64_t pc;
59 uint64_t r0;
60 uint64_t r1;
61 uint64_t r2;
62 uint64_t k32_64;
63};
64
65struct mtk_bl_param_t {
66 uint64_t bootarg_loc;
67 uint64_t bootarg_size;
68 uint64_t bl33_start_addr;
69 uint64_t tee_info_addr;
70};
71
72/* Declarations for mtk_plat_common.c */
73uint32_t plat_get_spsr_for_bl32_entry(void);
74uint32_t plat_get_spsr_for_bl33_entry(void);
75void clean_top_32b_of_param(uint32_t smc_fid, uint64_t *x1,
76 uint64_t *x2,
77 uint64_t *x3,
78 uint64_t *x4);
79void bl31_prepare_kernel_entry(uint64_t k32_64);
80void enable_ns_access_to_cpuectlr(void);
81void boot_to_kernel(uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4);
82uint64_t get_kernel_info_pc(void);
83uint64_t get_kernel_info_r0(void);
84uint64_t get_kernel_info_r1(void);
85uint64_t get_kernel_info_r2(void);
86
87extern struct atf_arg_t gteearg;
88#endif