]>
Commit | Line | Data |
---|---|---|
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 | ||
44 | /** | |
45 | Called at the early stage of the Boot phase to know if the memory has already been initialized | |
46 | ||
47 | Running the code from the reset vector does not mean we start from cold boot. In some case, we | |
48 | can go through this code with the memory already initialized. | |
49 | Because this function is called at the early stage, the implementation must not use the stack. | |
50 | Its implementation must probably done in assembly to ensure this requirement. | |
51 | ||
52 | @return Return the condition value into the 'Z' flag | |
53 | ||
54 | **/ | |
55 | VOID ArmPlatformIsMemoryInitialized(VOID); | |
56 | ||
57 | /** | |
58 | Initialize the memory where the initial stacks will reside | |
59 | ||
60 | This memory can contain the initial stacks (Secure and Secure Monitor stacks). | |
61 | In some platform, this region is already initialized and the implementation of this function can | |
62 | do nothing. This memory can also represent the Secure RAM. | |
63 | This function is called before the satck has been set up. Its implementation must ensure the stack | |
64 | pointer is not used (probably required to use assembly language) | |
65 | ||
66 | **/ | |
aa01abaa | 67 | VOID |
68 | ArmPlatformInitializeBootMemory ( | |
69 | VOID | |
70 | ); | |
1d5d0ae9 | 71 | |
a534d714 | 72 | /** |
73 | Return the current Boot Mode | |
74 | ||
75 | This function returns the boot reason on the platform | |
76 | ||
77 | @return Return the current Boot Mode of the platform | |
78 | ||
79 | **/ | |
80 | EFI_BOOT_MODE | |
81 | ArmPlatformGetBootMode ( | |
82 | VOID | |
83 | ); | |
84 | ||
8e06b586 | 85 | /** |
86 | Initialize controllers that must setup at the early stage | |
87 | ||
88 | Some peripherals must be initialized in Secure World. | |
89 | For example, some L2x0 requires to be initialized in Secure World | |
90 | ||
91 | **/ | |
92 | VOID | |
aa01abaa | 93 | ArmPlatformSecInitialize ( |
94 | VOID | |
95 | ); | |
96 | ||
a6caee65 | 97 | /** |
98 | Call before jumping to Normal World | |
99 | ||
100 | This function allows the firmware platform to do extra actions before | |
101 | jumping to the Normal World | |
102 | ||
103 | **/ | |
104 | VOID | |
105 | ArmPlatformSecExtraAction ( | |
0787bc61 | 106 | IN UINTN MpId, |
a6caee65 | 107 | OUT UINTN* JumpAddress |
108 | ); | |
109 | ||
aa01abaa | 110 | /** |
111 | Initialize controllers that must setup in the normal world | |
112 | ||
5cc45b70 | 113 | This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei |
aa01abaa | 114 | in the PEI phase. |
115 | ||
116 | **/ | |
117 | VOID | |
118 | ArmPlatformNormalInitialize ( | |
8e06b586 | 119 | VOID |
120 | ); | |
121 | ||
1d5d0ae9 | 122 | /** |
123 | Initialize the system (or sometimes called permanent) memory | |
124 | ||
125 | This memory is generally represented by the DRAM. | |
126 | ||
127 | **/ | |
aa01abaa | 128 | VOID |
129 | ArmPlatformInitializeSystemMemory ( | |
130 | VOID | |
131 | ); | |
1d5d0ae9 | 132 | |
133 | /** | |
134 | Remap the memory at 0x0 | |
135 | ||
136 | Some platform requires or gives the ability to remap the memory at the address 0x0. | |
137 | This function can do nothing if this feature is not relevant to your platform. | |
138 | ||
139 | **/ | |
aa01abaa | 140 | VOID |
141 | ArmPlatformBootRemapping ( | |
142 | VOID | |
143 | ); | |
1d5d0ae9 | 144 | |
145 | /** | |
146 | Return if Trustzone is supported by your platform | |
147 | ||
148 | A non-zero value must be returned if you want to support a Secure World on your platform. | |
149 | ArmPlatformTrustzoneInit() will later set up the secure regions. | |
150 | This function can return 0 even if Trustzone is supported by your processor. In this case, | |
151 | the platform will continue to run in Secure World. | |
152 | ||
153 | @return A non-zero value if Trustzone supported. | |
154 | ||
155 | **/ | |
aa01abaa | 156 | UINTN |
157 | ArmPlatformTrustzoneSupported ( | |
158 | VOID | |
159 | ); | |
1d5d0ae9 | 160 | |
161 | /** | |
162 | Initialize the Secure peripherals and memory regions | |
163 | ||
164 | If Trustzone is supported by your platform then this function makes the required initialization | |
165 | of the secure peripherals and memory regions. | |
166 | ||
167 | **/ | |
aa01abaa | 168 | VOID |
169 | ArmPlatformTrustzoneInit ( | |
170 | VOID | |
171 | ); | |
1d5d0ae9 | 172 | |
1d5d0ae9 | 173 | /** |
174 | Return the Virtual Memory Map of your platform | |
175 | ||
176 | This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. | |
177 | ||
178 | @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- | |
179 | Virtual Memory mapping. This array must be ended by a zero-filled | |
180 | entry | |
181 | ||
182 | **/ | |
aa01abaa | 183 | VOID |
184 | ArmPlatformGetVirtualMemoryMap ( | |
185 | OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap | |
186 | ); | |
1d5d0ae9 | 187 | |
188 | /** | |
189 | Return the EFI Memory Map of your platform | |
190 | ||
191 | This EFI Memory Map of the System Memory is used by MemoryInitPei module to create the Resource | |
192 | Descriptor HOBs used by DXE core. | |
193 | ||
194 | @param[out] EfiMemoryMap Array of ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR describing an | |
195 | EFI Memory region. This array must be ended by a zero-filled entry | |
196 | ||
197 | **/ | |
964680c1 | 198 | EFI_STATUS |
199 | ArmPlatformGetAdditionalSystemMemory ( | |
200 | OUT ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR** EfiMemoryMap | |
201 | ); | |
1d5d0ae9 | 202 | |
203 | #endif |