]>
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> | |
30 | #include <ArmPlatform.h> | |
31 | ||
32 | /** | |
33 | This structure is used by ArmVExpressGetEfiMemoryMap to describes a region of the EFI memory map | |
34 | ||
35 | Every EFI regions of the system memory described by their physical start address and their size | |
36 | can have different attributes. Some regions can be tested and other untested. | |
37 | ||
38 | **/ | |
39 | typedef struct { | |
40 | EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; | |
41 | EFI_PHYSICAL_ADDRESS PhysicalStart; | |
42 | UINT64 NumberOfBytes; | |
43 | } ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR; | |
44 | ||
45 | /** | |
46 | Called at the early stage of the Boot phase to know if the memory has already been initialized | |
47 | ||
48 | Running the code from the reset vector does not mean we start from cold boot. In some case, we | |
49 | can go through this code with the memory already initialized. | |
50 | Because this function is called at the early stage, the implementation must not use the stack. | |
51 | Its implementation must probably done in assembly to ensure this requirement. | |
52 | ||
53 | @return Return the condition value into the 'Z' flag | |
54 | ||
55 | **/ | |
56 | VOID ArmPlatformIsMemoryInitialized(VOID); | |
57 | ||
58 | /** | |
59 | Initialize the memory where the initial stacks will reside | |
60 | ||
61 | This memory can contain the initial stacks (Secure and Secure Monitor stacks). | |
62 | In some platform, this region is already initialized and the implementation of this function can | |
63 | do nothing. This memory can also represent the Secure RAM. | |
64 | This function is called before the satck has been set up. Its implementation must ensure the stack | |
65 | pointer is not used (probably required to use assembly language) | |
66 | ||
67 | **/ | |
aa01abaa | 68 | VOID |
69 | ArmPlatformInitializeBootMemory ( | |
70 | VOID | |
71 | ); | |
1d5d0ae9 | 72 | |
a534d714 | 73 | /** |
74 | Return the current Boot Mode | |
75 | ||
76 | This function returns the boot reason on the platform | |
77 | ||
78 | @return Return the current Boot Mode of the platform | |
79 | ||
80 | **/ | |
81 | EFI_BOOT_MODE | |
82 | ArmPlatformGetBootMode ( | |
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 | ||
98 | /** | |
99 | Initialize controllers that must setup in the normal world | |
100 | ||
101 | This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim | |
102 | in the PEI phase. | |
103 | ||
104 | **/ | |
105 | VOID | |
106 | ArmPlatformNormalInitialize ( | |
8e06b586 | 107 | VOID |
108 | ); | |
109 | ||
1d5d0ae9 | 110 | /** |
111 | Initialize the system (or sometimes called permanent) memory | |
112 | ||
113 | This memory is generally represented by the DRAM. | |
114 | ||
115 | **/ | |
aa01abaa | 116 | VOID |
117 | ArmPlatformInitializeSystemMemory ( | |
118 | VOID | |
119 | ); | |
1d5d0ae9 | 120 | |
121 | /** | |
122 | Remap the memory at 0x0 | |
123 | ||
124 | Some platform requires or gives the ability to remap the memory at the address 0x0. | |
125 | This function can do nothing if this feature is not relevant to your platform. | |
126 | ||
127 | **/ | |
aa01abaa | 128 | VOID |
129 | ArmPlatformBootRemapping ( | |
130 | VOID | |
131 | ); | |
1d5d0ae9 | 132 | |
133 | /** | |
134 | Return if Trustzone is supported by your platform | |
135 | ||
136 | A non-zero value must be returned if you want to support a Secure World on your platform. | |
137 | ArmPlatformTrustzoneInit() will later set up the secure regions. | |
138 | This function can return 0 even if Trustzone is supported by your processor. In this case, | |
139 | the platform will continue to run in Secure World. | |
140 | ||
141 | @return A non-zero value if Trustzone supported. | |
142 | ||
143 | **/ | |
aa01abaa | 144 | UINTN |
145 | ArmPlatformTrustzoneSupported ( | |
146 | VOID | |
147 | ); | |
1d5d0ae9 | 148 | |
149 | /** | |
150 | Initialize the Secure peripherals and memory regions | |
151 | ||
152 | If Trustzone is supported by your platform then this function makes the required initialization | |
153 | of the secure peripherals and memory regions. | |
154 | ||
155 | **/ | |
aa01abaa | 156 | VOID |
157 | ArmPlatformTrustzoneInit ( | |
158 | VOID | |
159 | ); | |
1d5d0ae9 | 160 | |
161 | /** | |
162 | Return the information about the memory region in permanent memory used by PEI | |
163 | ||
164 | One of the PEI Module must install the permament memory used by PEI. This function returns the | |
165 | information about this region for your platform to this PEIM module. | |
166 | ||
167 | @param[out] PeiMemoryBase Base of the memory region used by PEI core and modules | |
168 | @param[out] PeiMemorySize Size of the memory region used by PEI core and modules | |
169 | ||
170 | **/ | |
171 | VOID ArmPlatformGetPeiMemory ( | |
172 | OUT UINTN* PeiMemoryBase, | |
173 | OUT UINTN* PeiMemorySize | |
174 | ); | |
175 | ||
176 | /** | |
177 | Return the Virtual Memory Map of your platform | |
178 | ||
179 | This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. | |
180 | ||
181 | @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- | |
182 | Virtual Memory mapping. This array must be ended by a zero-filled | |
183 | entry | |
184 | ||
185 | **/ | |
aa01abaa | 186 | VOID |
187 | ArmPlatformGetVirtualMemoryMap ( | |
188 | OUT ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap | |
189 | ); | |
1d5d0ae9 | 190 | |
191 | /** | |
192 | Return the EFI Memory Map of your platform | |
193 | ||
194 | This EFI Memory Map of the System Memory is used by MemoryInitPei module to create the Resource | |
195 | Descriptor HOBs used by DXE core. | |
196 | ||
197 | @param[out] EfiMemoryMap Array of ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR describing an | |
198 | EFI Memory region. This array must be ended by a zero-filled entry | |
199 | ||
200 | **/ | |
964680c1 | 201 | EFI_STATUS |
202 | ArmPlatformGetAdditionalSystemMemory ( | |
203 | OUT ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR** EfiMemoryMap | |
204 | ); | |
1d5d0ae9 | 205 | |
206 | #endif |