]>
Commit | Line | Data |
---|---|---|
615c6dd0 | 1 | /** @file\r |
b1f6a7c6 | 2 | Definition of Pei Core Structures and Services\r |
3 | \r | |
15273993 | 4 | Copyright (c) 2006 - 2008, Intel Corporation\r |
192f6d4c | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
615c6dd0 | 13 | **/\r |
192f6d4c | 14 | \r |
15 | #ifndef _PEI_MAIN_H_\r | |
16 | #define _PEI_MAIN_H_\r | |
17 | \r | |
859b72fa | 18 | #include <PiPei.h>\r |
859b72fa A |
19 | #include <Ppi/DxeIpl.h>\r |
20 | #include <Ppi/MemoryDiscovered.h>\r | |
859b72fa | 21 | #include <Ppi/StatusCode.h>\r |
859b72fa | 22 | #include <Ppi/Reset.h>\r |
b0d803fe | 23 | #include <Ppi/FirmwareVolume.h>\r |
24 | #include <Ppi/FirmwareVolumeInfo.h>\r | |
25 | #include <Ppi/Decompress.h>\r | |
26 | #include <Ppi/GuidedSectionExtraction.h>\r | |
27 | #include <Ppi/LoadFile.h>\r | |
28 | #include <Ppi/Security2.h>\r | |
58dcdada | 29 | #include <Ppi/TemporaryRamSupport.h>\r |
859b72fa A |
30 | #include <Library/DebugLib.h>\r |
31 | #include <Library/PeiCoreEntryPoint.h>\r | |
32 | #include <Library/BaseLib.h>\r | |
33 | #include <Library/HobLib.h>\r | |
34 | #include <Library/PerformanceLib.h>\r | |
35 | #include <Library/PeiServicesLib.h>\r | |
36 | #include <Library/ReportStatusCodeLib.h>\r | |
c58cf83d | 37 | #include <Library/PeCoffLib.h>\r |
859b72fa A |
38 | #include <Library/PeCoffGetEntryPointLib.h>\r |
39 | #include <Library/BaseMemoryLib.h>\r | |
b0d803fe | 40 | #include <Library/CacheMaintenanceLib.h>\r |
859b72fa | 41 | #include <Library/TimerLib.h>\r |
177aabe6 | 42 | #include <Library/PcdLib.h>\r |
28dc3c67 | 43 | #include <IndustryStandard/PeImage.h>\r |
14e8823a | 44 | #include <Library/PeiServicesTablePointerLib.h>\r |
b0d803fe | 45 | #include <Library/MemoryAllocationLib.h>\r |
288f9b38 | 46 | #include <Library/PeiPiLib.h>\r |
b0d803fe | 47 | #include <Guid/FirmwareFileSystem2.h>\r |
48 | #include <Guid/AprioriFileName.h>\r | |
192f6d4c | 49 | \r |
15273993 | 50 | ///\r |
51 | /// It is an FFS type extension used for PeiFindFileEx. It indicates current\r | |
52 | /// Ffs searching is for all PEIMs can be dispatched by PeiCore.\r | |
53 | ///\r | |
3a63377f | 54 | #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff\r |
55 | \r | |
b1f6a7c6 | 56 | ///\r |
57 | /// Pei Core private data structures\r | |
58 | ///\r | |
192f6d4c | 59 | typedef union {\r |
60 | EFI_PEI_PPI_DESCRIPTOR *Ppi;\r | |
61 | EFI_PEI_NOTIFY_DESCRIPTOR *Notify;\r | |
62 | VOID *Raw;\r | |
63 | } PEI_PPI_LIST_POINTERS;\r | |
64 | \r | |
40f26b8f | 65 | ///\r |
1cc76977 | 66 | /// PPI database structure which contains two link: PpiList and NotifyList. PpiList\r |
67 | /// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.\r | |
40f26b8f | 68 | ///\r |
192f6d4c | 69 | typedef struct {\r |
1cc76977 | 70 | ///\r |
71 | /// index of end of PpiList link list.\r | |
72 | ///\r | |
192f6d4c | 73 | INTN PpiListEnd;\r |
1cc76977 | 74 | ///\r |
75 | /// index of end of notify link list.\r | |
76 | ///\r | |
192f6d4c | 77 | INTN NotifyListEnd;\r |
1cc76977 | 78 | ///\r |
79 | /// index of the dispatched notify list.\r | |
80 | ///\r | |
192f6d4c | 81 | INTN DispatchListEnd;\r |
1cc76977 | 82 | ///\r |
83 | /// index of last installed Ppi description in PpiList link list.\r | |
84 | ///\r | |
192f6d4c | 85 | INTN LastDispatchedInstall;\r |
1cc76977 | 86 | ///\r |
87 | /// index of last dispatched notify in Notify link list.\r | |
88 | /// \r | |
192f6d4c | 89 | INTN LastDispatchedNotify;\r |
1cc76977 | 90 | ///\r |
91 | /// Ppi database.\r | |
92 | ///\r | |
eaf539d0 | 93 | PEI_PPI_LIST_POINTERS PpiListPtrs[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)];\r |
192f6d4c | 94 | } PEI_PPI_DATABASE;\r |
95 | \r | |
3a63377f | 96 | \r |
3a63377f | 97 | //\r |
98 | // PEI_CORE_FV_HANDE.PeimState\r | |
99 | // Do not change these values as there is code doing math to change states.\r | |
100 | // Look for Private->Fv[FvCount].PeimState[PeimCount]++;\r | |
101 | //\r | |
102 | #define PEIM_STATE_NOT_DISPATCHED 0x00\r | |
103 | #define PEIM_STATE_DISPATCHED 0x01\r | |
104 | #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02\r | |
105 | #define PEIM_STATE_DONE 0x03\r | |
106 | \r | |
107 | typedef struct {\r | |
108 | EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r | |
50cb16d9 | 109 | UINT8 PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r |
177aabe6 | 110 | EFI_PEI_FILE_HANDLE FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r |
3a63377f | 111 | BOOLEAN ScanFv;\r |
112 | } PEI_CORE_FV_HANDLE;\r | |
113 | \r | |
288f9b38 LG |
114 | #define CACHE_SETION_MAX_NUMBER 0x10\r |
115 | typedef struct {\r | |
116 | EFI_COMMON_SECTION_HEADER* Section[CACHE_SETION_MAX_NUMBER];\r | |
117 | VOID* SectionData[CACHE_SETION_MAX_NUMBER];\r | |
118 | UINTN SectionSize[CACHE_SETION_MAX_NUMBER];\r | |
119 | UINTN AllSectionCount;\r | |
120 | UINTN SectionIndex;\r | |
121 | } CACHE_SECTION_DATA;\r | |
122 | \r | |
192f6d4c | 123 | \r |
124 | #define PEI_CORE_HANDLE_SIGNATURE EFI_SIGNATURE_32('P','e','i','C')\r | |
125 | \r | |
40f26b8f | 126 | ///\r |
127 | /// Pei Core private data structure instance\r | |
128 | ///\r | |
192f6d4c | 129 | typedef struct{\r |
130 | UINTN Signature;\r | |
131 | EFI_PEI_SERVICES *PS; // Point to ServiceTableShadow\r | |
132 | PEI_PPI_DATABASE PpiData;\r | |
3a63377f | 133 | UINTN FvCount;\r |
177aabe6 | 134 | PEI_CORE_FV_HANDLE Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r |
135 | EFI_PEI_FILE_HANDLE CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r | |
3a63377f | 136 | UINTN AprioriCount;\r |
50cb16d9 | 137 | UINTN CurrentPeimFvCount;\r |
3a63377f | 138 | UINTN CurrentPeimCount;\r |
139 | EFI_PEI_FILE_HANDLE CurrentFileHandle;\r | |
82b8c8df | 140 | BOOLEAN PeimNeedingDispatch;\r |
141 | BOOLEAN PeimDispatchOnThisPass;\r | |
142 | BOOLEAN PeimDispatcherReenter;\r | |
3a63377f | 143 | UINTN AllFvCount;\r |
177aabe6 | 144 | EFI_PEI_FV_HANDLE AllFv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r |
192f6d4c | 145 | EFI_PEI_HOB_POINTERS HobList;\r |
146 | BOOLEAN SwitchStackSignal;\r | |
147 | BOOLEAN PeiMemoryInstalled;\r | |
148 | EFI_PHYSICAL_ADDRESS StackBase;\r | |
149 | UINT64 StackSize;\r | |
150 | VOID *BottomOfCarHeap;\r | |
151 | VOID *TopOfCarHeap;\r | |
152 | VOID *CpuIo;\r | |
b0d803fe | 153 | EFI_PEI_SECURITY2_PPI *PrivateSecurityPpi;\r |
192f6d4c | 154 | EFI_PEI_SERVICES ServiceTableShadow;\r |
58dcdada | 155 | UINTN SizeOfTemporaryMemory;\r |
192f6d4c | 156 | UINTN SizeOfCacheAsRam;\r |
157 | VOID *MaxTopOfCarHeap;\r | |
b0d803fe | 158 | EFI_PEI_PPI_DESCRIPTOR *XipLoadFile;\r |
58dcdada | 159 | EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin;\r |
160 | UINT64 PhysicalMemoryLength;\r | |
161 | EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop;\r | |
162 | VOID* ShadowedPeiCore;\r | |
288f9b38 | 163 | CACHE_SECTION_DATA CacheSection;\r |
192f6d4c | 164 | } PEI_CORE_INSTANCE;\r |
165 | \r | |
40f26b8f | 166 | ///\r |
167 | /// Pei Core Instance Data Macros\r | |
168 | ///\r | |
192f6d4c | 169 | #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r |
170 | CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)\r | |
171 | \r | |
15273993 | 172 | /**\r |
173 | Function Pointer type for PeiCore function.\r | |
174 | @param SecCoreData Points to a data structure containing information about the PEI core's operating\r | |
175 | environment, such as the size and location of temporary RAM, the stack location and\r | |
176 | the BFV location.\r | |
177 | @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r | |
178 | An empty PPI list consists of a single descriptor with the end-tag\r | |
179 | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r | |
180 | phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r | |
181 | that both the PEI Foundation and any modules can leverage the associated service\r | |
182 | calls and/or code in these early PPIs\r | |
183 | @param Data Pointer to old core data that is used to initialize the\r | |
184 | core's data areas.\r | |
185 | **/\r | |
192f6d4c | 186 | typedef\r |
187 | EFI_STATUS\r | |
15273993 | 188 | (EFIAPI *PEICORE_FUNCTION_POINTER)(\r |
b98c2ab7 | 189 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
190 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r | |
191 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
192f6d4c | 192 | );\r |
193 | \r | |
b1f6a7c6 | 194 | ///\r |
195 | /// Union of temporarily used function pointers (to save stack space)\r | |
196 | ///\r | |
192f6d4c | 197 | typedef union {\r |
15273993 | 198 | PEICORE_FUNCTION_POINTER PeiCore;\r |
1c9d209f | 199 | EFI_PEIM_ENTRY_POINT2 PeimEntry;\r |
192f6d4c | 200 | EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;\r |
201 | EFI_DXE_IPL_PPI *DxeIpl;\r | |
202 | EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r | |
203 | EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;\r | |
204 | VOID *Raw;\r | |
205 | } PEI_CORE_TEMP_POINTERS;\r | |
206 | \r | |
b98c2ab7 | 207 | typedef struct {\r |
208 | CONST EFI_SEC_PEI_HAND_OFF *SecCoreData;\r | |
209 | EFI_PEI_PPI_DESCRIPTOR *PpiList;\r | |
210 | VOID *Data;\r | |
211 | } PEI_CORE_PARAMETERS;\r | |
212 | \r | |
192f6d4c | 213 | //\r |
214 | // PeiCore function\r | |
215 | //\r | |
b1f6a7c6 | 216 | /**\r |
192f6d4c | 217 | \r |
218 | The entry routine to Pei Core, invoked by PeiMain during transition\r | |
219 | from SEC to PEI. After switching stack in the PEI core, it will restart\r | |
220 | with the old core data.\r | |
221 | \r | |
192f6d4c | 222 | \r |
b1f6a7c6 | 223 | @param SecCoreData Points to a data structure containing information about the PEI core's operating\r |
224 | environment, such as the size and location of temporary RAM, the stack location and\r | |
225 | the BFV location.\r | |
226 | @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r | |
227 | An empty PPI list consists of a single descriptor with the end-tag\r | |
228 | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r | |
229 | phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r | |
230 | that both the PEI Foundation and any modules can leverage the associated service\r | |
231 | calls and/or code in these early PPIs\r | |
232 | @param Data Pointer to old core data that is used to initialize the\r | |
192f6d4c | 233 | core's data areas.\r |
234 | \r | |
b1f6a7c6 | 235 | @retval EFI_NOT_FOUND Never reach\r |
192f6d4c | 236 | \r |
b1f6a7c6 | 237 | **/\r |
238 | EFI_STATUS\r | |
239 | EFIAPI\r | |
240 | PeiCore (\r | |
241 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r | |
242 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpList,\r | |
243 | IN VOID *Data\r | |
244 | )\r | |
192f6d4c | 245 | ;\r |
246 | \r | |
247 | //\r | |
248 | // Dispatcher support functions\r | |
249 | //\r | |
250 | \r | |
b1f6a7c6 | 251 | /**\r |
192f6d4c | 252 | \r |
253 | This is the POSTFIX version of the dependency evaluator. When a\r | |
254 | PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on\r | |
255 | the evaluation stack. When that entry is poped from the evaluation\r | |
256 | stack, the PPI is checked if it is installed. This method allows\r | |
257 | some time savings as not all PPIs must be checked for certain\r | |
258 | operation types (AND, OR).\r | |
259 | \r | |
192f6d4c | 260 | \r |
1cc76977 | 261 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 262 | @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to\r |
263 | the BNF described above and is stored in postfix notation.\r | |
192f6d4c | 264 | \r |
b1f6a7c6 | 265 | @retval TRUE if it is a well-formed Grammar\r |
266 | @retval FALSE if the dependency expression overflows the evaluation stack\r | |
267 | if the dependency expression underflows the evaluation stack\r | |
268 | if the dependency expression is not a well-formed Grammar.\r | |
192f6d4c | 269 | \r |
b1f6a7c6 | 270 | **/\r |
271 | BOOLEAN\r | |
272 | PeimDispatchReadiness (\r | |
273 | IN EFI_PEI_SERVICES **PeiServices,\r | |
274 | IN VOID *DependencyExpression\r | |
275 | )\r | |
192f6d4c | 276 | ;\r |
277 | \r | |
b1f6a7c6 | 278 | /**\r |
279 | Conduct PEIM dispatch.\r | |
280 | \r | |
731bd38e | 281 | @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data\r |
1cc76977 | 282 | @param PrivateData Pointer to the private data passed in from caller\r |
192f6d4c | 283 | \r |
b1f6a7c6 | 284 | @retval EFI_SUCCESS Successfully dispatched PEIM.\r |
285 | @retval EFI_NOT_FOUND The dispatch failed.\r | |
286 | \r | |
287 | **/\r | |
b0d803fe | 288 | VOID\r |
192f6d4c | 289 | PeiDispatcher (\r |
5aae0aa7 | 290 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
b0d803fe | 291 | IN PEI_CORE_INSTANCE *PrivateData\r |
192f6d4c | 292 | )\r |
b1f6a7c6 | 293 | ;\r |
192f6d4c | 294 | \r |
b1f6a7c6 | 295 | /**\r |
296 | Initialize the Dispatcher's data members\r | |
192f6d4c | 297 | \r |
b1f6a7c6 | 298 | @param PrivateData PeiCore's private data structure\r |
299 | @param OldCoreData Old data from SecCore\r | |
300 | NULL if being run in non-permament memory mode.\r | |
301 | @param SecCoreData Points to a data structure containing information about the PEI core's operating\r | |
302 | environment, such as the size and location of temporary RAM, the stack location and\r | |
303 | the BFV location.\r | |
192f6d4c | 304 | \r |
b1f6a7c6 | 305 | **/\r |
192f6d4c | 306 | VOID\r |
307 | InitializeDispatcherData (\r | |
b0d803fe | 308 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 309 | IN PEI_CORE_INSTANCE *OldCoreData,\r |
5aae0aa7 | 310 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r |
192f6d4c | 311 | )\r |
192f6d4c | 312 | ;\r |
313 | \r | |
b1f6a7c6 | 314 | /**\r |
315 | This routine parses the Dependency Expression, if available, and\r | |
316 | decides if the module can be executed.\r | |
192f6d4c | 317 | \r |
192f6d4c | 318 | \r |
b1f6a7c6 | 319 | @param Private PeiCore's private data structure\r |
320 | @param FileHandle PEIM's file handle\r | |
731bd38e | 321 | @param PeimCount The index of last dispatched PEIM.\r |
192f6d4c | 322 | \r |
731bd38e | 323 | @retval TRUE Can be dispatched\r |
324 | @retval FALSE Cannot be dispatched\r | |
192f6d4c | 325 | \r |
b1f6a7c6 | 326 | **/\r |
192f6d4c | 327 | BOOLEAN\r |
328 | DepexSatisfied (\r | |
b0d803fe | 329 | IN PEI_CORE_INSTANCE *Private,\r |
330 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
331 | IN UINTN PeimCount\r | |
192f6d4c | 332 | )\r |
192f6d4c | 333 | ;\r |
334 | \r | |
192f6d4c | 335 | //\r |
336 | // PPI support functions\r | |
337 | //\r | |
b1f6a7c6 | 338 | /**\r |
339 | \r | |
340 | Initialize PPI services.\r | |
341 | \r | |
b1f6a7c6 | 342 | @param PrivateData Pointer to the PEI Core data.\r |
343 | @param OldCoreData Pointer to old PEI Core data. \r | |
344 | NULL if being run in non-permament memory mode.\r | |
345 | \r | |
346 | **/\r | |
192f6d4c | 347 | VOID\r |
348 | InitializePpiServices (\r | |
b0d803fe | 349 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 350 | IN PEI_CORE_INSTANCE *OldCoreData\r |
351 | )\r | |
b1f6a7c6 | 352 | ;\r |
192f6d4c | 353 | \r |
b1f6a7c6 | 354 | /**\r |
192f6d4c | 355 | \r |
731bd38e | 356 | Migrate the Hob list from the CAR stack to PEI installed memory.\r |
357 | \r | |
358 | @param PrivateData Pointer to PeiCore's private data structure.\r | |
359 | @param OldCheckingBottom Bottom of temporary memory range. All Ppi in this range\r | |
360 | will be fixup for PpiData and PpiDescriptor pointer.\r | |
361 | @param OldCheckingTop Top of temporary memory range. All Ppi in this range\r | |
362 | will be fixup for PpiData and PpiDescriptor.\r | |
5c5a0601 | 363 | @param Fixup The address difference between\r |
364 | the new Hob list and old Hob list.\r | |
192f6d4c | 365 | \r |
b1f6a7c6 | 366 | **/\r |
192f6d4c | 367 | VOID\r |
368 | ConvertPpiPointers (\r | |
40f26b8f | 369 | IN PEI_CORE_INSTANCE *PrivateData,\r |
370 | IN UINTN OldCheckingBottom,\r | |
371 | IN UINTN OldCheckingTop,\r | |
372 | IN INTN Fixup\r | |
192f6d4c | 373 | )\r |
b1f6a7c6 | 374 | ;\r |
192f6d4c | 375 | \r |
b1f6a7c6 | 376 | /**\r |
192f6d4c | 377 | \r |
731bd38e | 378 | Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.\r |
192f6d4c | 379 | \r |
15273993 | 380 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
381 | @param PpiList Pointer to ppi array that want to be installed.\r | |
192f6d4c | 382 | \r |
15273993 | 383 | @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.\r |
384 | @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer\r | |
731bd38e | 385 | if any PPI in PpiList is not valid\r |
15273993 | 386 | @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI\r |
192f6d4c | 387 | \r |
b1f6a7c6 | 388 | **/\r |
192f6d4c | 389 | EFI_STATUS\r |
390 | EFIAPI\r | |
391 | PeiInstallPpi (\r | |
0c2b5da8 | 392 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
393 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r | |
192f6d4c | 394 | )\r |
b1f6a7c6 | 395 | ;\r |
192f6d4c | 396 | \r |
b1f6a7c6 | 397 | /**\r |
192f6d4c | 398 | \r |
b1f6a7c6 | 399 | Re-Install PPI services.\r |
192f6d4c | 400 | \r |
1cc76977 | 401 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
402 | @param OldPpi Pointer to the old PEI PPI Descriptors.\r | |
403 | @param NewPpi Pointer to the new PEI PPI Descriptors.\r | |
192f6d4c | 404 | \r |
1cc76977 | 405 | @retval EFI_SUCCESS if the operation was successful\r |
406 | @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL\r | |
731bd38e | 407 | if NewPpi is not valid\r |
1cc76977 | 408 | @retval EFI_NOT_FOUND if the PPI was not in the database\r |
192f6d4c | 409 | \r |
b1f6a7c6 | 410 | **/\r |
192f6d4c | 411 | EFI_STATUS\r |
412 | EFIAPI\r | |
413 | PeiReInstallPpi (\r | |
0c2b5da8 | 414 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
415 | IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r | |
416 | IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r | |
192f6d4c | 417 | )\r |
b1f6a7c6 | 418 | ;\r |
192f6d4c | 419 | \r |
b1f6a7c6 | 420 | /**\r |
192f6d4c | 421 | \r |
b1f6a7c6 | 422 | Locate a given named PPI.\r |
192f6d4c | 423 | \r |
192f6d4c | 424 | \r |
1cc76977 | 425 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
426 | @param Guid Pointer to GUID of the PPI.\r | |
427 | @param Instance Instance Number to discover.\r | |
428 | @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,\r | |
b1f6a7c6 | 429 | returns a pointer to the descriptor (includes flags, etc)\r |
1cc76977 | 430 | @param Ppi Pointer to reference the found PPI\r |
192f6d4c | 431 | \r |
b1f6a7c6 | 432 | @retval EFI_SUCCESS if the PPI is in the database\r |
433 | @retval EFI_NOT_FOUND if the PPI is not in the database\r | |
192f6d4c | 434 | \r |
b1f6a7c6 | 435 | **/\r |
192f6d4c | 436 | EFI_STATUS\r |
437 | EFIAPI\r | |
438 | PeiLocatePpi (\r | |
1cc76977 | 439 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
440 | IN CONST EFI_GUID *Guid,\r | |
192f6d4c | 441 | IN UINTN Instance,\r |
442 | IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r | |
443 | IN OUT VOID **Ppi\r | |
444 | )\r | |
b1f6a7c6 | 445 | ;\r |
192f6d4c | 446 | \r |
b1f6a7c6 | 447 | /**\r |
192f6d4c | 448 | \r |
b1f6a7c6 | 449 | Install a notification for a given PPI.\r |
192f6d4c | 450 | \r |
192f6d4c | 451 | \r |
1cc76977 | 452 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
453 | @param NotifyList Pointer to list of Descriptors to notify upon.\r | |
192f6d4c | 454 | \r |
b1f6a7c6 | 455 | @retval EFI_SUCCESS if successful\r |
456 | @retval EFI_OUT_OF_RESOURCES if no space in the database\r | |
457 | @retval EFI_INVALID_PARAMETER if not a good decriptor\r | |
192f6d4c | 458 | \r |
b1f6a7c6 | 459 | **/\r |
192f6d4c | 460 | EFI_STATUS\r |
461 | EFIAPI\r | |
462 | PeiNotifyPpi (\r | |
0c2b5da8 | 463 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
464 | IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r | |
192f6d4c | 465 | )\r |
b1f6a7c6 | 466 | ;\r |
192f6d4c | 467 | \r |
b1f6a7c6 | 468 | /**\r |
192f6d4c | 469 | \r |
b1f6a7c6 | 470 | Process the Notify List at dispatch level.\r |
192f6d4c | 471 | \r |
b1f6a7c6 | 472 | @param PrivateData PeiCore's private data structure.\r |
192f6d4c | 473 | \r |
b1f6a7c6 | 474 | **/\r |
192f6d4c | 475 | VOID\r |
476 | ProcessNotifyList (\r | |
b0d803fe | 477 | IN PEI_CORE_INSTANCE *PrivateData\r |
192f6d4c | 478 | )\r |
b1f6a7c6 | 479 | ;\r |
192f6d4c | 480 | \r |
b1f6a7c6 | 481 | /**\r |
192f6d4c | 482 | \r |
b1f6a7c6 | 483 | Dispatch notifications.\r |
192f6d4c | 484 | \r |
b1f6a7c6 | 485 | @param PrivateData PeiCore's private data structure\r |
486 | @param NotifyType Type of notify to fire.\r | |
487 | @param InstallStartIndex Install Beginning index.\r | |
488 | @param InstallStopIndex Install Ending index.\r | |
489 | @param NotifyStartIndex Notify Beginning index.\r | |
490 | @param NotifyStopIndex Notify Ending index.\r | |
192f6d4c | 491 | \r |
b1f6a7c6 | 492 | **/\r |
192f6d4c | 493 | VOID\r |
494 | DispatchNotify (\r | |
b0d803fe | 495 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 496 | IN UINTN NotifyType,\r |
497 | IN INTN InstallStartIndex,\r | |
498 | IN INTN InstallStopIndex,\r | |
499 | IN INTN NotifyStartIndex,\r | |
500 | IN INTN NotifyStopIndex\r | |
501 | )\r | |
192f6d4c | 502 | ;\r |
503 | \r | |
504 | //\r | |
505 | // Boot mode support functions\r | |
506 | //\r | |
b1f6a7c6 | 507 | /**\r |
508 | This service enables PEIMs to ascertain the present value of the boot mode.\r | |
509 | \r | |
1cc76977 | 510 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 511 | @param BootMode A pointer to contain the value of the boot mode.\r |
512 | \r | |
513 | @retval EFI_SUCCESS The boot mode was returned successfully.\r | |
514 | @retval EFI_INVALID_PARAMETER BootMode is NULL.\r | |
515 | \r | |
516 | **/\r | |
192f6d4c | 517 | EFI_STATUS\r |
518 | EFIAPI\r | |
519 | PeiGetBootMode (\r | |
0c2b5da8 | 520 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 521 | IN OUT EFI_BOOT_MODE *BootMode\r |
522 | )\r | |
b1f6a7c6 | 523 | ;\r |
192f6d4c | 524 | \r |
b1f6a7c6 | 525 | /**\r |
526 | This service enables PEIMs to update the boot mode variable.\r | |
192f6d4c | 527 | \r |
192f6d4c | 528 | \r |
1cc76977 | 529 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
530 | @param BootMode The value of the boot mode to set.\r | |
192f6d4c | 531 | \r |
1cc76977 | 532 | @return EFI_SUCCESS The value was successfully updated\r |
192f6d4c | 533 | \r |
b1f6a7c6 | 534 | **/\r |
192f6d4c | 535 | EFI_STATUS\r |
536 | EFIAPI\r | |
537 | PeiSetBootMode (\r | |
0c2b5da8 | 538 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 539 | IN EFI_BOOT_MODE BootMode\r |
540 | )\r | |
192f6d4c | 541 | ;\r |
542 | \r | |
543 | //\r | |
544 | // Security support functions\r | |
545 | //\r | |
b1f6a7c6 | 546 | /**\r |
547 | \r | |
548 | Initialize the security services.\r | |
549 | \r | |
1cc76977 | 550 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
40f26b8f | 551 | @param OldCoreData Pointer to the old core data.\r |
b1f6a7c6 | 552 | NULL if being run in non-permament memory mode.\r |
553 | \r | |
554 | **/\r | |
192f6d4c | 555 | VOID\r |
556 | InitializeSecurityServices (\r | |
557 | IN EFI_PEI_SERVICES **PeiServices,\r | |
558 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
559 | )\r | |
b1f6a7c6 | 560 | ;\r |
192f6d4c | 561 | \r |
b1f6a7c6 | 562 | /**\r |
563 | Verify a Firmware volume\r | |
192f6d4c | 564 | \r |
40f26b8f | 565 | @param CurrentFvAddress Pointer to the current Firmware Volume under consideration\r |
192f6d4c | 566 | \r |
40f26b8f | 567 | @retval EFI_SUCCESS Firmware Volume is legal\r |
568 | @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test\r | |
192f6d4c | 569 | \r |
b1f6a7c6 | 570 | **/\r |
192f6d4c | 571 | EFI_STATUS\r |
572 | VerifyFv (\r | |
573 | IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress\r | |
574 | )\r | |
b1f6a7c6 | 575 | ;\r |
192f6d4c | 576 | \r |
b1f6a7c6 | 577 | /**\r |
192f6d4c | 578 | \r |
b1f6a7c6 | 579 | Provide a callout to the security verification service.\r |
192f6d4c | 580 | \r |
192f6d4c | 581 | \r |
b1f6a7c6 | 582 | @param PrivateData PeiCore's private data structure\r |
583 | @param VolumeHandle Handle of FV\r | |
584 | @param FileHandle Handle of PEIM's ffs\r | |
192f6d4c | 585 | \r |
b1f6a7c6 | 586 | @retval EFI_SUCCESS Image is OK\r |
587 | @retval EFI_SECURITY_VIOLATION Image is illegal\r | |
192f6d4c | 588 | \r |
b1f6a7c6 | 589 | **/\r |
192f6d4c | 590 | EFI_STATUS\r |
591 | VerifyPeim (\r | |
b0d803fe | 592 | IN PEI_CORE_INSTANCE *PrivateData,\r |
593 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
594 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
192f6d4c | 595 | )\r |
b1f6a7c6 | 596 | ;\r |
192f6d4c | 597 | \r |
b1f6a7c6 | 598 | /**\r |
192f6d4c | 599 | \r |
b1f6a7c6 | 600 | Gets the pointer to the HOB List.\r |
192f6d4c | 601 | \r |
192f6d4c | 602 | \r |
1cc76977 | 603 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 604 | @param HobList Pointer to the HOB List.\r |
192f6d4c | 605 | \r |
b1f6a7c6 | 606 | @retval EFI_SUCCESS Get the pointer of HOB List\r |
607 | @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published\r | |
608 | @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)\r | |
192f6d4c | 609 | \r |
b1f6a7c6 | 610 | **/\r |
192f6d4c | 611 | EFI_STATUS\r |
612 | EFIAPI\r | |
613 | PeiGetHobList (\r | |
0c2b5da8 | 614 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 615 | IN OUT VOID **HobList\r |
616 | )\r | |
b1f6a7c6 | 617 | ;\r |
192f6d4c | 618 | \r |
b1f6a7c6 | 619 | /**\r |
620 | Add a new HOB to the HOB List.\r | |
192f6d4c | 621 | \r |
1cc76977 | 622 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
623 | @param Type Type of the new HOB.\r | |
624 | @param Length Length of the new HOB to allocate.\r | |
625 | @param Hob Pointer to the new HOB.\r | |
192f6d4c | 626 | \r |
b1f6a7c6 | 627 | @return EFI_SUCCESS Success to create hob.\r |
628 | @retval EFI_INVALID_PARAMETER if Hob is NULL\r | |
629 | @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.\r | |
630 | @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.\r | |
192f6d4c | 631 | \r |
b1f6a7c6 | 632 | **/\r |
192f6d4c | 633 | EFI_STATUS\r |
634 | EFIAPI\r | |
635 | PeiCreateHob (\r | |
0c2b5da8 | 636 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 637 | IN UINT16 Type,\r |
638 | IN UINT16 Length,\r | |
639 | IN OUT VOID **Hob\r | |
640 | )\r | |
b1f6a7c6 | 641 | ;\r |
192f6d4c | 642 | \r |
b1f6a7c6 | 643 | /**\r |
192f6d4c | 644 | \r |
b1f6a7c6 | 645 | Builds a Handoff Information Table HOB\r |
192f6d4c | 646 | \r |
b1f6a7c6 | 647 | @param BootMode - Current Bootmode\r |
648 | @param MemoryBegin - Start Memory Address.\r | |
649 | @param MemoryLength - Length of Memory.\r | |
192f6d4c | 650 | \r |
b1f6a7c6 | 651 | @return EFI_SUCCESS Always success to initialize HOB.\r |
192f6d4c | 652 | \r |
b1f6a7c6 | 653 | **/\r |
192f6d4c | 654 | EFI_STATUS\r |
655 | PeiCoreBuildHobHandoffInfoTable (\r | |
656 | IN EFI_BOOT_MODE BootMode,\r | |
657 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r | |
658 | IN UINT64 MemoryLength\r | |
659 | )\r | |
192f6d4c | 660 | ;\r |
661 | \r | |
662 | \r | |
663 | //\r | |
664 | // FFS Fw Volume support functions\r | |
665 | //\r | |
b1f6a7c6 | 666 | /**\r |
667 | Given the input file pointer, search for the next matching file in the\r | |
668 | FFS volume as defined by SearchType. The search starts from FileHeader inside\r | |
669 | the Firmware Volume defined by FwVolHeader.\r | |
670 | \r | |
671 | \r | |
1cc76977 | 672 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 673 | @param SearchType Filter to find only files of this type.\r |
674 | Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r | |
15273993 | 675 | @param FwVolHeader Pointer to the FV header of the volume to search.\r |
676 | @param FileHeader Pointer to the current file from which to begin searching.\r | |
b1f6a7c6 | 677 | This pointer will be updated upon return to reflect the file found.\r |
678 | @retval EFI_NOT_FOUND No files matching the search criteria were found\r | |
679 | @retval EFI_SUCCESS Success to find next file in given volume\r | |
680 | \r | |
681 | **/\r | |
192f6d4c | 682 | EFI_STATUS\r |
683 | EFIAPI\r | |
684 | PeiFfsFindNextFile (\r | |
0c2b5da8 | 685 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 686 | IN UINT8 SearchType,\r |
0c2b5da8 | 687 | IN EFI_PEI_FV_HANDLE FwVolHeader,\r |
688 | IN OUT EFI_PEI_FILE_HANDLE *FileHeader\r | |
192f6d4c | 689 | )\r |
b1f6a7c6 | 690 | ;\r |
192f6d4c | 691 | \r |
b1f6a7c6 | 692 | /**\r |
693 | Given the input file pointer, search for the next matching section in the\r | |
694 | FFS volume.\r | |
192f6d4c | 695 | \r |
1cc76977 | 696 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 697 | @param SectionType Filter to find only sections of this type.\r |
15273993 | 698 | @param FfsFileHeader Pointer to the current file to search.\r |
b1f6a7c6 | 699 | @param SectionData Pointer to the Section matching SectionType in FfsFileHeader.\r |
700 | NULL if section not found\r | |
192f6d4c | 701 | \r |
b1f6a7c6 | 702 | @retval EFI_NOT_FOUND No files matching the search criteria were found\r |
703 | @retval EFI_SUCCESS Success to find section data in given file\r | |
192f6d4c | 704 | \r |
b1f6a7c6 | 705 | **/\r |
192f6d4c | 706 | EFI_STATUS\r |
707 | EFIAPI\r | |
708 | PeiFfsFindSectionData (\r | |
b0d803fe | 709 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 710 | IN EFI_SECTION_TYPE SectionType,\r |
0c2b5da8 | 711 | IN EFI_PEI_FILE_HANDLE FfsFileHeader,\r |
192f6d4c | 712 | IN OUT VOID **SectionData\r |
713 | )\r | |
b1f6a7c6 | 714 | ;\r |
192f6d4c | 715 | \r |
b1f6a7c6 | 716 | /**\r |
717 | search the firmware volumes by index\r | |
192f6d4c | 718 | \r |
15273993 | 719 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
720 | @param Instance Instance of FV to find\r | |
721 | @param FwVolHeader Pointer to found Volume.\r | |
192f6d4c | 722 | \r |
15273993 | 723 | @retval EFI_INVALID_PARAMETER FwVolHeader is NULL\r |
724 | @retval EFI_SUCCESS Firmware volume instance successfully found.\r | |
192f6d4c | 725 | \r |
b1f6a7c6 | 726 | **/\r |
192f6d4c | 727 | EFI_STATUS\r |
728 | EFIAPI\r | |
729 | PeiFvFindNextVolume (\r | |
15273993 | 730 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 731 | IN UINTN Instance,\r |
0c2b5da8 | 732 | IN OUT EFI_PEI_FV_HANDLE *FwVolHeader\r |
192f6d4c | 733 | )\r |
192f6d4c | 734 | ;\r |
735 | \r | |
736 | //\r | |
737 | // Memory support functions\r | |
738 | //\r | |
b1f6a7c6 | 739 | /**\r |
740 | \r | |
741 | Initialize the memory services.\r | |
742 | \r | |
1cc76977 | 743 | @param PrivateData PeiCore's private data structure\r |
b1f6a7c6 | 744 | @param SecCoreData Points to a data structure containing information about the PEI core's operating\r |
745 | environment, such as the size and location of temporary RAM, the stack location and\r | |
746 | the BFV location.\r | |
747 | @param OldCoreData Pointer to the PEI Core data.\r | |
748 | NULL if being run in non-permament memory mode.\r | |
749 | \r | |
750 | **/\r | |
192f6d4c | 751 | VOID\r |
752 | InitializeMemoryServices (\r | |
b0d803fe | 753 | IN PEI_CORE_INSTANCE *PrivateData,\r |
5aae0aa7 | 754 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
192f6d4c | 755 | IN PEI_CORE_INSTANCE *OldCoreData\r |
756 | )\r | |
b1f6a7c6 | 757 | ;\r |
192f6d4c | 758 | \r |
b1f6a7c6 | 759 | /**\r |
192f6d4c | 760 | \r |
b1f6a7c6 | 761 | Install the permanent memory is now available.\r |
762 | Creates HOB (PHIT and Stack).\r | |
192f6d4c | 763 | \r |
1cc76977 | 764 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
765 | @param MemoryBegin Start of memory address.\r | |
766 | @param MemoryLength Length of memory.\r | |
192f6d4c | 767 | \r |
b1f6a7c6 | 768 | @return EFI_SUCCESS Always success.\r |
192f6d4c | 769 | \r |
b1f6a7c6 | 770 | **/\r |
192f6d4c | 771 | EFI_STATUS\r |
772 | EFIAPI\r | |
773 | PeiInstallPeiMemory (\r | |
0c2b5da8 | 774 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 775 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r |
776 | IN UINT64 MemoryLength\r | |
777 | )\r | |
b1f6a7c6 | 778 | ;\r |
192f6d4c | 779 | \r |
b1f6a7c6 | 780 | /**\r |
192f6d4c | 781 | \r |
b1f6a7c6 | 782 | Memory allocation service on permanent memory,\r |
783 | not usable prior to the memory installation.\r | |
192f6d4c | 784 | \r |
192f6d4c | 785 | \r |
1cc76977 | 786 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
787 | @param MemoryType Type of memory to allocate.\r | |
788 | @param Pages Number of pages to allocate.\r | |
789 | @param Memory Pointer of memory allocated.\r | |
192f6d4c | 790 | \r |
b1f6a7c6 | 791 | @retval EFI_SUCCESS The allocation was successful\r |
792 | @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.\r | |
793 | @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available\r | |
794 | @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement\r | |
795 | to allocate the number of pages.\r | |
192f6d4c | 796 | \r |
b1f6a7c6 | 797 | **/\r |
192f6d4c | 798 | EFI_STATUS\r |
799 | EFIAPI\r | |
800 | PeiAllocatePages (\r | |
0c2b5da8 | 801 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 802 | IN EFI_MEMORY_TYPE MemoryType,\r |
803 | IN UINTN Pages,\r | |
804 | OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
805 | )\r | |
b1f6a7c6 | 806 | ;\r |
192f6d4c | 807 | \r |
b1f6a7c6 | 808 | /**\r |
192f6d4c | 809 | \r |
b1f6a7c6 | 810 | Memory allocation service on the CAR.\r |
192f6d4c | 811 | \r |
192f6d4c | 812 | \r |
1cc76977 | 813 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
814 | @param Size Amount of memory required\r | |
815 | @param Buffer Address of pointer to the buffer\r | |
192f6d4c | 816 | \r |
b1f6a7c6 | 817 | @retval EFI_SUCCESS The allocation was successful\r |
818 | @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement\r | |
819 | to allocate the requested size.\r | |
192f6d4c | 820 | \r |
b1f6a7c6 | 821 | **/\r |
192f6d4c | 822 | EFI_STATUS\r |
823 | EFIAPI\r | |
824 | PeiAllocatePool (\r | |
0c2b5da8 | 825 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 826 | IN UINTN Size,\r |
827 | OUT VOID **Buffer\r | |
828 | )\r | |
b1f6a7c6 | 829 | ;\r |
192f6d4c | 830 | \r |
b1f6a7c6 | 831 | /**\r |
192f6d4c | 832 | \r |
b1f6a7c6 | 833 | Routine for load image file.\r |
192f6d4c | 834 | \r |
192f6d4c | 835 | \r |
1cc76977 | 836 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
837 | @param FileHandle Pointer to the FFS file header of the image.\r | |
838 | @param EntryPoint Pointer to entry point of specified image file for output.\r | |
839 | @param AuthenticationState Pointer to attestation authentication state of image.\r | |
192f6d4c | 840 | \r |
1cc76977 | 841 | @retval EFI_SUCCESS Image is successfully loaded.\r |
842 | @retval EFI_NOT_FOUND Fail to locate necessary PPI\r | |
843 | @retval Others Fail to load file.\r | |
192f6d4c | 844 | \r |
b1f6a7c6 | 845 | **/\r |
192f6d4c | 846 | EFI_STATUS\r |
847 | PeiLoadImage (\r | |
848 | IN EFI_PEI_SERVICES **PeiServices,\r | |
b0d803fe | 849 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
850 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r | |
851 | OUT UINT32 *AuthenticationState\r | |
192f6d4c | 852 | )\r |
b1f6a7c6 | 853 | ;\r |
192f6d4c | 854 | \r |
b1f6a7c6 | 855 | /**\r |
192f6d4c | 856 | \r |
b1f6a7c6 | 857 | Core version of the Status Code reporter\r |
192f6d4c | 858 | \r |
192f6d4c | 859 | \r |
1cc76977 | 860 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
861 | @param CodeType Type of Status Code.\r | |
862 | @param Value Value to output for Status Code.\r | |
863 | @param Instance Instance Number of this status code.\r | |
864 | @param CallerId ID of the caller of this status code.\r | |
865 | @param Data Optional data associated with this status code.\r | |
192f6d4c | 866 | \r |
b1f6a7c6 | 867 | @retval EFI_SUCCESS if status code is successfully reported\r |
868 | @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed\r | |
192f6d4c | 869 | \r |
b1f6a7c6 | 870 | **/\r |
192f6d4c | 871 | EFI_STATUS\r |
872 | EFIAPI\r | |
873 | PeiReportStatusCode (\r | |
0c2b5da8 | 874 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 875 | IN EFI_STATUS_CODE_TYPE CodeType,\r |
876 | IN EFI_STATUS_CODE_VALUE Value,\r | |
877 | IN UINT32 Instance,\r | |
0c2b5da8 | 878 | IN CONST EFI_GUID *CallerId,\r |
879 | IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
192f6d4c | 880 | )\r |
b1f6a7c6 | 881 | ;\r |
192f6d4c | 882 | \r |
b1f6a7c6 | 883 | /**\r |
192f6d4c | 884 | \r |
b1f6a7c6 | 885 | Core version of the Reset System\r |
192f6d4c | 886 | \r |
192f6d4c | 887 | \r |
1cc76977 | 888 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
192f6d4c | 889 | \r |
b1f6a7c6 | 890 | @retval EFI_NOT_AVAILABLE_YET PPI not available yet.\r |
891 | @retval EFI_DEVICE_ERROR Did not reset system.\r | |
892 | Otherwise, resets the system.\r | |
192f6d4c | 893 | \r |
b1f6a7c6 | 894 | **/\r |
192f6d4c | 895 | EFI_STATUS\r |
896 | EFIAPI\r | |
897 | PeiResetSystem (\r | |
b0d803fe | 898 | IN CONST EFI_PEI_SERVICES **PeiServices\r |
192f6d4c | 899 | )\r |
b1f6a7c6 | 900 | ;\r |
192f6d4c | 901 | \r |
b1f6a7c6 | 902 | /**\r |
192f6d4c | 903 | \r |
b1f6a7c6 | 904 | Initialize PeiCore Fv List.\r |
192f6d4c | 905 | \r |
192f6d4c | 906 | \r |
b1f6a7c6 | 907 | @param PrivateData - Pointer to PEI_CORE_INSTANCE.\r |
908 | @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.\r | |
192f6d4c | 909 | \r |
b1f6a7c6 | 910 | **/\r |
50cb16d9 | 911 | VOID\r |
b0d803fe | 912 | PeiInitializeFv (\r |
913 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
914 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r | |
915 | )\r | |
b1f6a7c6 | 916 | ;\r |
b0d803fe | 917 | \r |
b1f6a7c6 | 918 | /**\r |
919 | Process Firmware Volum Information once FvInfoPPI install.\r | |
b0d803fe | 920 | \r |
1cc76977 | 921 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
922 | @param NotifyDescriptor Address of the notification descriptor data structure.\r | |
923 | @param Ppi Address of the PPI that was installed.\r | |
50cb16d9 | 924 | \r |
b1f6a7c6 | 925 | @retval EFI_SUCCESS if the interface could be successfully installed\r |
b0d803fe | 926 | \r |
b1f6a7c6 | 927 | **/\r |
b0d803fe | 928 | EFI_STATUS\r |
929 | EFIAPI\r | |
930 | FirmwareVolmeInfoPpiNotifyCallback (\r | |
931 | IN EFI_PEI_SERVICES **PeiServices,\r | |
932 | IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r | |
933 | IN VOID *Ppi\r | |
934 | )\r | |
b1f6a7c6 | 935 | ;\r |
b0d803fe | 936 | \r |
b1f6a7c6 | 937 | /**\r |
50cb16d9 | 938 | \r |
b1f6a7c6 | 939 | Given the input VolumeHandle, search for the next matching name file.\r |
b0d803fe | 940 | \r |
1cc76977 | 941 | @param FileName File name to search.\r |
942 | @param VolumeHandle The current FV to search.\r | |
943 | @param FileHandle Pointer to the file matching name in VolumeHandle.\r | |
944 | NULL if file not found\r | |
b0d803fe | 945 | \r |
15273993 | 946 | @retval EFI_NOT_FOUND No files matching the search criteria were found\r |
947 | @retval EFI_SUCCESS Success to search given file\r | |
b0d803fe | 948 | \r |
b1f6a7c6 | 949 | **/\r |
b0d803fe | 950 | EFI_STATUS\r |
50cb16d9 | 951 | EFIAPI\r |
b0d803fe | 952 | PeiFfsFindFileByName (\r |
953 | IN CONST EFI_GUID *FileName,\r | |
954 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
955 | OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
956 | )\r | |
b1f6a7c6 | 957 | ;\r |
b0d803fe | 958 | \r |
b1f6a7c6 | 959 | /**\r |
b0d803fe | 960 | \r |
b1f6a7c6 | 961 | Returns information about a specific file.\r |
b0d803fe | 962 | \r |
b0d803fe | 963 | \r |
1cc76977 | 964 | @param FileHandle The handle to file.\r |
965 | @param FileInfo Pointer to the file information.\r | |
b0d803fe | 966 | \r |
b1f6a7c6 | 967 | @retval EFI_INVALID_PARAMETER Invalid FileHandle or FileInfo.\r |
968 | @retval EFI_SUCCESS Success to collect file info.\r | |
b0d803fe | 969 | \r |
b1f6a7c6 | 970 | **/\r |
b0d803fe | 971 | EFI_STATUS\r |
50cb16d9 | 972 | EFIAPI\r |
b0d803fe | 973 | PeiFfsGetFileInfo (\r |
974 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
975 | OUT EFI_FV_FILE_INFO *FileInfo\r | |
976 | )\r | |
b1f6a7c6 | 977 | ;\r |
b0d803fe | 978 | \r |
b1f6a7c6 | 979 | /**\r |
b0d803fe | 980 | \r |
b1f6a7c6 | 981 | Collect information of given Fv Volume.\r |
b0d803fe | 982 | \r |
1cc76977 | 983 | @param VolumeHandle The handle to Fv Volume.\r |
984 | @param VolumeInfo The pointer to volume information.\r | |
b0d803fe | 985 | \r |
b1f6a7c6 | 986 | @retval EFI_INVALID_PARAMETER VolumeInfo is NULL\r |
987 | @retval EFI_SUCCESS Success to collect fv info.\r | |
988 | **/\r | |
b0d803fe | 989 | EFI_STATUS\r |
50cb16d9 | 990 | EFIAPI\r |
b0d803fe | 991 | PeiFfsGetVolumeInfo (\r |
992 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
993 | OUT EFI_FV_INFO *VolumeInfo\r | |
994 | )\r | |
b0d803fe | 995 | ;\r |
996 | \r | |
14e8823a | 997 | /**\r |
998 | This routine enable a PEIM to register itself to shadow when PEI Foundation\r | |
999 | discovery permanent memory.\r | |
1000 | \r | |
b1f6a7c6 | 1001 | @param FileHandle File handle of a PEIM.\r |
50cb16d9 | 1002 | \r |
b1f6a7c6 | 1003 | @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.\r |
1004 | @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.\r | |
1005 | @retval EFI_SUCCESS Successfully to register itself.\r | |
14e8823a | 1006 | \r |
50cb16d9 | 1007 | **/\r |
14e8823a | 1008 | EFI_STATUS\r |
1009 | EFIAPI\r | |
1010 | PeiRegisterForShadow (\r | |
1011 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
1012 | )\r | |
1013 | ;\r | |
1014 | \r | |
b1f6a7c6 | 1015 | /**\r |
1016 | Given the input file pointer, search for the next matching file in the\r | |
1017 | FFS volume as defined by SearchType. The search starts from FileHeader inside\r | |
1018 | the Firmware Volume defined by FwVolHeader.\r | |
1019 | \r | |
1020 | \r | |
1021 | @param FvHandle Pointer to the FV header of the volume to search\r | |
1022 | @param FileName File name\r | |
1023 | @param SearchType Filter to find only files of this type.\r | |
1024 | Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r | |
1025 | @param FileHandle This parameter must point to a valid FFS volume.\r | |
1026 | @param AprioriFile Pointer to AprioriFile image in this FV if has\r | |
1027 | \r | |
1028 | @return EFI_NOT_FOUND No files matching the search criteria were found\r | |
1029 | @retval EFI_SUCCESS Success to search given file\r | |
1030 | \r | |
1031 | **/\r | |
b0d803fe | 1032 | EFI_STATUS\r |
1033 | PeiFindFileEx (\r | |
1034 | IN CONST EFI_PEI_FV_HANDLE FvHandle,\r | |
1035 | IN CONST EFI_GUID *FileName, OPTIONAL\r | |
1036 | IN EFI_FV_FILETYPE SearchType,\r | |
1037 | IN OUT EFI_PEI_FILE_HANDLE *FileHandle,\r | |
1038 | IN OUT EFI_PEI_FV_HANDLE *AprioriFile OPTIONAL\r | |
1039 | )\r | |
b0d803fe | 1040 | ;\r |
1041 | \r | |
b1f6a7c6 | 1042 | /**\r |
15273993 | 1043 | Initialize image service that install PeiLoadFilePpi.\r |
b0d803fe | 1044 | \r |
15273993 | 1045 | @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.\r |
1046 | @param OldCoreData Pointer to Old PeiCore's private data.\r | |
1047 | If NULL, PeiCore is entered at first time, stack/heap in temporary memory.\r | |
1048 | If not NULL, PeiCore is entered at second time, stack/heap has been moved\r | |
1049 | to permenent memory.\r | |
b0d803fe | 1050 | \r |
b1f6a7c6 | 1051 | **/\r |
1052 | VOID\r | |
1053 | InitializeImageServices (\r | |
1054 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
1055 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
1056 | )\r | |
b0d803fe | 1057 | ;\r |
1058 | \r | |
288f9b38 LG |
1059 | /**\r |
1060 | Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r | |
1061 | \r | |
1cc76977 | 1062 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 1063 | @param FileHandle File handle of a Fv type file.\r |
288f9b38 | 1064 | @param AuthenticationState Pointer to attestation authentication state of image.\r |
731bd38e | 1065 | If return 0, means pass security checking.\r |
50cb16d9 | 1066 | \r |
b1f6a7c6 | 1067 | @retval EFI_NOT_FOUND FV image can't be found.\r |
1068 | @retval EFI_SUCCESS Successfully to process it.\r | |
288f9b38 LG |
1069 | \r |
1070 | **/\r | |
1071 | EFI_STATUS\r | |
1072 | ProcessFvFile (\r | |
1073 | IN EFI_PEI_SERVICES **PeiServices,\r | |
1074 | IN EFI_PEI_FILE_HANDLE FvFileHandle,\r | |
1075 | OUT UINT32 *AuthenticationState\r | |
1076 | );\r | |
1077 | \r | |
192f6d4c | 1078 | #endif\r |