xref: /rk3399_ARM-atf/include/plat/common/platform.h (revision 5f0cdb059d7d5c3a8a834074a7f236b85d014dde)
1 /*
2  * Copyright (c) 2013-2014, 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 
31 #ifndef __PLATFORM_H__
32 #define __PLATFORM_H__
33 
34 #include <stdint.h>
35 
36 
37 /*******************************************************************************
38  * Forward declarations
39  ******************************************************************************/
40 struct plat_pm_ops;
41 struct meminfo;
42 struct image_info;
43 struct entry_point_info;
44 
45 /*******************************************************************************
46  * Function and variable prototypes
47  ******************************************************************************/
48 void bl1_plat_arch_setup(void);
49 void bl2_plat_arch_setup(void);
50 void bl31_plat_arch_setup(void);
51 int platform_setup_pm(const struct plat_pm_ops **);
52 unsigned int platform_get_core_pos(unsigned long mpidr);
53 void enable_mmu_el1(void);
54 void enable_mmu_el3(void);
55 void configure_mmu_el1(unsigned long total_base,
56 		       unsigned long total_size,
57 		       unsigned long,
58 		       unsigned long,
59 		       unsigned long,
60 		       unsigned long);
61 void configure_mmu_el3(unsigned long total_base,
62 		       unsigned long total_size,
63 		       unsigned long,
64 		       unsigned long,
65 		       unsigned long,
66 		       unsigned long);
67 void plat_report_exception(unsigned long);
68 unsigned long plat_get_ns_image_entrypoint(void);
69 unsigned long platform_get_stack(unsigned long mpidr);
70 uint64_t plat_get_syscnt_freq(void);
71 uint32_t ic_get_pending_interrupt_id(void);
72 uint32_t ic_get_pending_interrupt_type(void);
73 uint32_t ic_acknowledge_interrupt(void);
74 uint32_t ic_get_interrupt_type(uint32_t id);
75 void ic_end_of_interrupt(uint32_t id);
76 uint32_t plat_interrupt_type_to_line(uint32_t type,
77 				     uint32_t security_state);
78 
79 int plat_get_max_afflvl(void);
80 unsigned int plat_get_aff_count(unsigned int, unsigned long);
81 unsigned int plat_get_aff_state(unsigned int, unsigned long);
82 int plat_get_image_source(const char *image_name,
83 			uintptr_t *dev_handle,
84 			uintptr_t *image_spec);
85 
86 /*
87  * Before calling this function BL2 is loaded in memory and its entrypoint
88  * is set by load_image. This is a placeholder for the platform to change
89  * the entrypoint of BL2 and set SPSR and security state.
90  * On FVP we are only setting the security state, entrypoint
91  */
92 void bl1_plat_set_bl2_ep_info(struct image_info *image,
93 			      struct entry_point_info *ep);
94 
95 /*
96  * Before calling this function BL31 is loaded in memory and its entrypoint
97  * is set by load_image. This is a placeholder for the platform to change
98  * the entrypoint of BL31 and set SPSR and security state.
99  * On FVP we are only setting the security state, entrypoint
100  */
101 void bl2_plat_set_bl31_ep_info(struct image_info *image,
102 			       struct entry_point_info *ep);
103 
104 /*
105  * Before calling this function BL32 is loaded in memory and its entrypoint
106  * is set by load_image. This is a placeholder for the platform to change
107  * the entrypoint of BL32 and set SPSR and security state.
108  * On FVP we are only setting the security state, entrypoint
109  */
110 void bl2_plat_set_bl32_ep_info(struct image_info *image,
111 			       struct entry_point_info *ep);
112 
113 /*
114  * Before calling this function BL33 is loaded in memory and its entrypoint
115  * is set by load_image. This is a placeholder for the platform to change
116  * the entrypoint of BL33 and set SPSR and security state.
117  * On FVP we are only setting the security state, entrypoint
118  */
119 void bl2_plat_set_bl33_ep_info(struct image_info *image,
120 			       struct entry_point_info *ep);
121 
122 /* Gets the memory layout for BL32 */
123 void bl2_plat_get_bl32_meminfo(struct meminfo *mem_info);
124 
125 /* Gets the memory layout for BL33 */
126 void bl2_plat_get_bl33_meminfo(struct meminfo *mem_info);
127 
128 
129 #endif /* __PLATFORM_H__ */
130