blob: acc5b95280cb0229f87b862c53f47f8319bbfbb0 [file] [log] [blame]
Soby Mathew991d42c2015-06-29 16:30:12 +01001/*
Soby Mathew3a9e8bf2015-05-05 16:33:16 +01002 * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
Soby Mathew991d42c2015-06-29 16:30:12 +01003 *
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
31#ifndef __PLATFORM_H__
32#define __PLATFORM_H__
33
34#include <stdint.h>
35
36
37/*******************************************************************************
38 * Forward declarations
39 ******************************************************************************/
40struct plat_pm_ops;
41struct meminfo;
42struct image_info;
43struct entry_point_info;
44struct bl31_params;
45
46/*******************************************************************************
47 * plat_get_rotpk_info() flags
48 ******************************************************************************/
49#define ROTPK_IS_HASH (1 << 0)
50
51/*******************************************************************************
52 * Function declarations
53 ******************************************************************************/
54/*******************************************************************************
55 * Mandatory common functions
56 ******************************************************************************/
57uint64_t plat_get_syscnt_freq(void);
58int plat_get_image_source(unsigned int image_id,
59 uintptr_t *dev_handle,
60 uintptr_t *image_spec);
61unsigned long plat_get_ns_image_entrypoint(void);
Soby Mathewb0082d22015-04-09 13:40:55 +010062unsigned int plat_my_core_pos(void);
63int plat_core_pos_by_mpidr(unsigned long mpidr);
Soby Mathew991d42c2015-06-29 16:30:12 +010064
65/*******************************************************************************
66 * Mandatory interrupt management functions
67 ******************************************************************************/
68uint32_t plat_ic_get_pending_interrupt_id(void);
69uint32_t plat_ic_get_pending_interrupt_type(void);
70uint32_t plat_ic_acknowledge_interrupt(void);
71uint32_t plat_ic_get_interrupt_type(uint32_t id);
72void plat_ic_end_of_interrupt(uint32_t id);
73uint32_t plat_interrupt_type_to_line(uint32_t type,
74 uint32_t security_state);
75
76/*******************************************************************************
77 * Optional common functions (may be overridden)
78 ******************************************************************************/
Soby Mathewb0082d22015-04-09 13:40:55 +010079unsigned long plat_get_my_stack(void);
Soby Mathew991d42c2015-06-29 16:30:12 +010080void plat_report_exception(unsigned long);
81int plat_crash_console_init(void);
82int plat_crash_console_putc(int c);
83
84/*******************************************************************************
85 * Mandatory BL1 functions
86 ******************************************************************************/
87void bl1_early_platform_setup(void);
88void bl1_plat_arch_setup(void);
89void bl1_platform_setup(void);
90struct meminfo *bl1_plat_sec_mem_layout(void);
91
92/*
93 * This function allows the platform to change the entrypoint information for
94 * BL2, after BL1 has loaded BL2 into memory but before BL2 is executed.
95 */
96void bl1_plat_set_bl2_ep_info(struct image_info *image,
97 struct entry_point_info *ep);
98
99/*******************************************************************************
100 * Optional BL1 functions (may be overridden)
101 ******************************************************************************/
102void bl1_init_bl2_mem_layout(const struct meminfo *bl1_mem_layout,
103 struct meminfo *bl2_mem_layout);
104
105/*******************************************************************************
106 * Mandatory BL2 functions
107 ******************************************************************************/
108void bl2_early_platform_setup(struct meminfo *mem_layout);
109void bl2_plat_arch_setup(void);
110void bl2_platform_setup(void);
111struct meminfo *bl2_plat_sec_mem_layout(void);
112
113/*
114 * This function returns a pointer to the shared memory that the platform has
115 * kept aside to pass trusted firmware related information that BL3-1
116 * could need
117 */
118struct bl31_params *bl2_plat_get_bl31_params(void);
119
120/*
121 * This function returns a pointer to the shared memory that the platform
122 * has kept to point to entry point information of BL31 to BL2
123 */
124struct entry_point_info *bl2_plat_get_bl31_ep_info(void);
125
126/*
127 * This function flushes to main memory all the params that are
128 * passed to BL3-1
129 */
130void bl2_plat_flush_bl31_params(void);
131
132/*
133 * The next 2 functions allow the platform to change the entrypoint information
134 * for the mandatory 3rd level BL images, BL3-1 and BL3-3. This is done after
135 * BL2 has loaded those images into memory but before BL3-1 is executed.
136 */
137void bl2_plat_set_bl31_ep_info(struct image_info *image,
138 struct entry_point_info *ep);
139
140void bl2_plat_set_bl33_ep_info(struct image_info *image,
141 struct entry_point_info *ep);
142
143/* Gets the memory layout for BL3-3 */
144void bl2_plat_get_bl33_meminfo(struct meminfo *mem_info);
145
146/*******************************************************************************
147 * Conditionally mandatory BL2 functions: must be implemented if BL3-0 image
148 * is supported
149 ******************************************************************************/
150/* Gets the memory layout for BL3-0 */
151void bl2_plat_get_bl30_meminfo(struct meminfo *mem_info);
152
153/*
154 * This function is called after loading BL3-0 image and it is used to perform
155 * any platform-specific actions required to handle the SCP firmware.
156 */
157int bl2_plat_handle_bl30(struct image_info *bl30_image_info);
158
159/*******************************************************************************
160 * Conditionally mandatory BL2 functions: must be implemented if BL3-2 image
161 * is supported
162 ******************************************************************************/
163void bl2_plat_set_bl32_ep_info(struct image_info *image,
164 struct entry_point_info *ep);
165
166/* Gets the memory layout for BL3-2 */
167void bl2_plat_get_bl32_meminfo(struct meminfo *mem_info);
168
169/*******************************************************************************
170 * Optional BL2 functions (may be overridden)
171 ******************************************************************************/
172
173/*******************************************************************************
174 * Mandatory BL3-1 functions
175 ******************************************************************************/
176void bl31_early_platform_setup(struct bl31_params *from_bl2,
177 void *plat_params_from_bl2);
178void bl31_plat_arch_setup(void);
179void bl31_platform_setup(void);
180struct entry_point_info *bl31_plat_get_next_image_ep_info(uint32_t type);
181
182/*******************************************************************************
183 * Mandatory PSCI functions (BL3-1)
184 ******************************************************************************/
185int platform_setup_pm(const struct plat_pm_ops **);
Soby Mathew9d754f62015-04-08 17:42:06 +0100186const unsigned char *plat_get_power_domain_tree_desc(void);
Soby Mathew991d42c2015-06-29 16:30:12 +0100187
188/*******************************************************************************
189 * Optional BL3-1 functions (may be overridden)
190 ******************************************************************************/
191void bl31_plat_enable_mmu(uint32_t flags);
192
193/*******************************************************************************
194 * Optional BL3-2 functions (may be overridden)
195 ******************************************************************************/
196void bl32_plat_enable_mmu(uint32_t flags);
197
198/*******************************************************************************
199 * Trusted Board Boot functions
200 ******************************************************************************/
201int plat_get_rotpk_info(void *cookie, void **key_ptr, unsigned int *key_len,
202 unsigned int *flags);
203
204#endif /* __PLATFORM_H__ */