1d5d0ae9 |
1 | /** @file |
2 | * |
3 | * Copyright (c) 2011, ARM Limited. All rights reserved. |
4 | * |
5 | * This program and the accompanying materials |
6 | * are licensed and made available under the terms and conditions of the BSD License |
7 | * which accompanies this distribution. The full text of the license may be found at |
8 | * http://opensource.org/licenses/bsd-license.php |
9 | * |
10 | * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, |
11 | * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. |
12 | * |
13 | **/ |
14 | |
15 | #ifndef _ARMPLATFORMLIB_H_ |
16 | #define _ARMPLATFORMLIB_H_ |
17 | |
18 | // |
19 | // The package level header files this module uses |
20 | // |
21 | #include <PiPei.h> |
22 | // |
23 | // The protocols, PPI and GUID defintions for this module |
24 | // |
25 | #include <Ppi/MasterBootMode.h> |
26 | #include <Ppi/BootInRecoveryMode.h> |
27 | #include <Guid/MemoryTypeInformation.h> |
28 | |
29 | #include <Library/ArmLib.h> |
1d5d0ae9 |
30 | |
31 | /** |
32 | This structure is used by ArmVExpressGetEfiMemoryMap to describes a region of the EFI memory map |
33 | |
34 | Every EFI regions of the system memory described by their physical start address and their size |
35 | can have different attributes. Some regions can be tested and other untested. |
36 | |
37 | **/ |
38 | typedef struct { |
39 | EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; |
40 | EFI_PHYSICAL_ADDRESS PhysicalStart; |
41 | UINT64 NumberOfBytes; |
42 | } ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR; |
43 | |
1d5d0ae9 |
44 | /** |
45 | Initialize the memory where the initial stacks will reside |
46 | |
47 | This memory can contain the initial stacks (Secure and Secure Monitor stacks). |
48 | In some platform, this region is already initialized and the implementation of this function can |
49 | do nothing. This memory can also represent the Secure RAM. |
50 | This function is called before the satck has been set up. Its implementation must ensure the stack |
51 | pointer is not used (probably required to use assembly language) |
52 | |
53 | **/ |
aa01abaa |
54 | VOID |
55 | ArmPlatformInitializeBootMemory ( |
56 | VOID |
57 | ); |
1d5d0ae9 |
58 | |
a534d714 |
59 | /** |
60 | Return the current Boot Mode |
61 | |
62 | This function returns the boot reason on the platform |
63 | |
64 | @return Return the current Boot Mode of the platform |
65 | |
66 | **/ |
67 | EFI_BOOT_MODE |
68 | ArmPlatformGetBootMode ( |
69 | VOID |
70 | ); |
71 | |
44e272fd |
72 | /** |
73 | Call at the beginning of the platform boot up |
74 | |
75 | This function allows the firmware platform to do extra actions at the early |
76 | stage of the platform power up. |
77 | |
78 | Note: This function must be implemented in assembler as there is no stack set up yet |
79 | |
80 | **/ |
81 | VOID |
82 | ArmPlatformSecBootAction ( |
83 | VOID |
84 | ); |
85 | |
8e06b586 |
86 | /** |
87 | Initialize controllers that must setup at the early stage |
88 | |
89 | Some peripherals must be initialized in Secure World. |
90 | For example, some L2x0 requires to be initialized in Secure World |
91 | |
92 | **/ |
93 | VOID |
aa01abaa |
94 | ArmPlatformSecInitialize ( |
95 | VOID |
96 | ); |
97 | |
a6caee65 |
98 | /** |
99 | Call before jumping to Normal World |
100 | |
101 | This function allows the firmware platform to do extra actions before |
102 | jumping to the Normal World |
103 | |
104 | **/ |
105 | VOID |
106 | ArmPlatformSecExtraAction ( |
0787bc61 |
107 | IN UINTN MpId, |
a6caee65 |
108 | OUT UINTN* JumpAddress |
109 | ); |
110 | |
aa01abaa |
111 | /** |
112 | Initialize controllers that must setup in the normal world |
113 | |
5cc45b70 |
114 | This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei |
aa01abaa |
115 | in the PEI phase. |
116 | |
117 | **/ |
118 | VOID |
119 | ArmPlatformNormalInitialize ( |
8e06b586 |
120 | VOID |
121 | ); |
122 | |
1d5d0ae9 |
123 | /** |
124 | Initialize the system (or sometimes called permanent) memory |
125 | |
126 | This memory is generally represented by the DRAM. |
127 | |
128 | **/ |
aa01abaa |
129 | VOID |
130 | ArmPlatformInitializeSystemMemory ( |
131 | VOID |
132 | ); |
1d5d0ae9 |
133 | |
134 | /** |
135 | Remap the memory at 0x0 |
136 | |
137 | Some platform requires or gives the ability to remap the memory at the address 0x0. |
138 | This function can do nothing if this feature is not relevant to your platform. |
139 | |
140 | **/ |
aa01abaa |
141 | VOID |
142 | ArmPlatformBootRemapping ( |
143 | VOID |
144 | ); |
1d5d0ae9 |
145 | |
146 | /** |
147 | Return if Trustzone is supported by your platform |
148 | |
149 | A non-zero value must be returned if you want to support a Secure World on your platform. |
150 | ArmPlatformTrustzoneInit() will later set up the secure regions. |
151 | This function can return 0 even if Trustzone is supported by your processor. In this case, |
152 | the platform will continue to run in Secure World. |
153 | |
154 | @return A non-zero value if Trustzone supported. |
155 | |
156 | **/ |
aa01abaa |
157 | UINTN |
158 | ArmPlatformTrustzoneSupported ( |
159 | VOID |
160 | ); |
1d5d0ae9 |
161 | |
162 | /** |
163 | Initialize the Secure peripherals and memory regions |
164 | |
165 | If Trustzone is supported by your platform then this function makes the required initialization |
166 | of the secure peripherals and memory regions. |
167 | |
168 | **/ |
aa01abaa |
169 | VOID |
170 | ArmPlatformTrustzoneInit ( |
171 | VOID |
172 | ); |
1d5d0ae9 |
173 | |
1d5d0ae9 |
174 | /** |
175 | Return the Virtual Memory Map of your platform |
176 | |
177 | This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. |
178 | |
179 | @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- |
180 | Virtual Memory mapping. This array must be ended by a zero-filled |
181 | entry |
182 | |
183 | **/ |
aa01abaa |
184 | VOID |
185 | ArmPlatformGetVirtualMemoryMap ( |
186 | OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap |
187 | ); |
1d5d0ae9 |
188 | |
189 | /** |
190 | Return the EFI Memory Map of your platform |
191 | |
192 | This EFI Memory Map of the System Memory is used by MemoryInitPei module to create the Resource |
193 | Descriptor HOBs used by DXE core. |
194 | |
195 | @param[out] EfiMemoryMap Array of ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR describing an |
196 | EFI Memory region. This array must be ended by a zero-filled entry |
197 | |
198 | **/ |
964680c1 |
199 | EFI_STATUS |
200 | ArmPlatformGetAdditionalSystemMemory ( |
201 | OUT ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR** EfiMemoryMap |
202 | ); |
1d5d0ae9 |
203 | |
204 | #endif |