Commit | Line | Data |
---|---|---|
615c6dd0 | 1 | /** @file\r |
192f6d4c | 2 | \r |
3 | Copyright (c) 2006 - 2007, Intel Corporation\r | |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | PeiMain.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Definition of Pei Core Structures and Services\r | |
19 | \r | |
20 | Revision History\r | |
21 | \r | |
615c6dd0 | 22 | **/\r |
192f6d4c | 23 | \r |
24 | #ifndef _PEI_MAIN_H_\r | |
25 | #define _PEI_MAIN_H_\r | |
26 | \r | |
859b72fa | 27 | #include <PiPei.h>\r |
859b72fa A |
28 | #include <Ppi/DxeIpl.h>\r |
29 | #include <Ppi/MemoryDiscovered.h>\r | |
859b72fa | 30 | #include <Ppi/StatusCode.h>\r |
859b72fa | 31 | #include <Ppi/Reset.h>\r |
b0d803fe | 32 | #include <Ppi/FirmwareVolume.h>\r |
33 | #include <Ppi/FirmwareVolumeInfo.h>\r | |
34 | #include <Ppi/Decompress.h>\r | |
35 | #include <Ppi/GuidedSectionExtraction.h>\r | |
36 | #include <Ppi/LoadFile.h>\r | |
37 | #include <Ppi/Security2.h>\r | |
58dcdada | 38 | #include <Ppi/TemporaryRamSupport.h>\r |
859b72fa A |
39 | #include <Library/DebugLib.h>\r |
40 | #include <Library/PeiCoreEntryPoint.h>\r | |
41 | #include <Library/BaseLib.h>\r | |
42 | #include <Library/HobLib.h>\r | |
43 | #include <Library/PerformanceLib.h>\r | |
44 | #include <Library/PeiServicesLib.h>\r | |
45 | #include <Library/ReportStatusCodeLib.h>\r | |
c58cf83d | 46 | #include <Library/PeCoffLib.h>\r |
859b72fa A |
47 | #include <Library/PeCoffGetEntryPointLib.h>\r |
48 | #include <Library/BaseMemoryLib.h>\r | |
b0d803fe | 49 | #include <Library/CacheMaintenanceLib.h>\r |
859b72fa | 50 | #include <Library/TimerLib.h>\r |
177aabe6 | 51 | #include <Library/PcdLib.h>\r |
28dc3c67 | 52 | #include <IndustryStandard/PeImage.h>\r |
14e8823a | 53 | #include <Library/PeiServicesTablePointerLib.h>\r |
b0d803fe | 54 | #include <Library/MemoryAllocationLib.h>\r |
288f9b38 | 55 | #include <Library/PeiPiLib.h>\r |
b0d803fe | 56 | #include <Guid/FirmwareFileSystem2.h>\r |
57 | #include <Guid/AprioriFileName.h>\r | |
192f6d4c | 58 | \r |
3a63377f | 59 | #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff\r |
60 | \r | |
192f6d4c | 61 | //\r |
62 | // Pei Core private data structures\r | |
63 | //\r | |
64 | typedef union {\r | |
65 | EFI_PEI_PPI_DESCRIPTOR *Ppi;\r | |
66 | EFI_PEI_NOTIFY_DESCRIPTOR *Notify;\r | |
67 | VOID *Raw;\r | |
68 | } PEI_PPI_LIST_POINTERS;\r | |
69 | \r | |
58dcdada | 70 | #define MAX_PPI_DESCRIPTORS 64\r |
192f6d4c | 71 | \r |
72 | typedef struct {\r | |
73 | INTN PpiListEnd;\r | |
74 | INTN NotifyListEnd;\r | |
75 | INTN DispatchListEnd;\r | |
76 | INTN LastDispatchedInstall;\r | |
77 | INTN LastDispatchedNotify;\r | |
78 | PEI_PPI_LIST_POINTERS PpiListPtrs[MAX_PPI_DESCRIPTORS];\r | |
79 | } PEI_PPI_DATABASE;\r | |
80 | \r | |
3a63377f | 81 | \r |
3a63377f | 82 | //\r |
83 | // PEI_CORE_FV_HANDE.PeimState\r | |
84 | // Do not change these values as there is code doing math to change states.\r | |
85 | // Look for Private->Fv[FvCount].PeimState[PeimCount]++;\r | |
86 | //\r | |
87 | #define PEIM_STATE_NOT_DISPATCHED 0x00\r | |
88 | #define PEIM_STATE_DISPATCHED 0x01\r | |
89 | #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02\r | |
90 | #define PEIM_STATE_DONE 0x03\r | |
91 | \r | |
92 | typedef struct {\r | |
93 | EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r | |
50cb16d9 | 94 | UINT8 PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r |
177aabe6 | 95 | EFI_PEI_FILE_HANDLE FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r |
3a63377f | 96 | BOOLEAN ScanFv;\r |
97 | } PEI_CORE_FV_HANDLE;\r | |
98 | \r | |
288f9b38 LG |
99 | #define CACHE_SETION_MAX_NUMBER 0x10\r |
100 | typedef struct {\r | |
101 | EFI_COMMON_SECTION_HEADER* Section[CACHE_SETION_MAX_NUMBER];\r | |
102 | VOID* SectionData[CACHE_SETION_MAX_NUMBER];\r | |
103 | UINTN SectionSize[CACHE_SETION_MAX_NUMBER];\r | |
104 | UINTN AllSectionCount;\r | |
105 | UINTN SectionIndex;\r | |
106 | } CACHE_SECTION_DATA;\r | |
107 | \r | |
192f6d4c | 108 | //\r |
109 | // Pei Core private data structure instance\r | |
110 | //\r | |
111 | \r | |
112 | #define PEI_CORE_HANDLE_SIGNATURE EFI_SIGNATURE_32('P','e','i','C')\r | |
113 | \r | |
114 | typedef struct{\r | |
115 | UINTN Signature;\r | |
116 | EFI_PEI_SERVICES *PS; // Point to ServiceTableShadow\r | |
117 | PEI_PPI_DATABASE PpiData;\r | |
3a63377f | 118 | UINTN FvCount;\r |
177aabe6 | 119 | PEI_CORE_FV_HANDLE Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r |
120 | EFI_PEI_FILE_HANDLE CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r | |
3a63377f | 121 | UINTN AprioriCount;\r |
50cb16d9 | 122 | UINTN CurrentPeimFvCount;\r |
3a63377f | 123 | UINTN CurrentPeimCount;\r |
124 | EFI_PEI_FILE_HANDLE CurrentFileHandle;\r | |
125 | UINTN AllFvCount;\r | |
177aabe6 | 126 | EFI_PEI_FV_HANDLE AllFv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r |
192f6d4c | 127 | EFI_PEI_HOB_POINTERS HobList;\r |
128 | BOOLEAN SwitchStackSignal;\r | |
129 | BOOLEAN PeiMemoryInstalled;\r | |
130 | EFI_PHYSICAL_ADDRESS StackBase;\r | |
131 | UINT64 StackSize;\r | |
132 | VOID *BottomOfCarHeap;\r | |
133 | VOID *TopOfCarHeap;\r | |
134 | VOID *CpuIo;\r | |
b0d803fe | 135 | EFI_PEI_SECURITY2_PPI *PrivateSecurityPpi;\r |
192f6d4c | 136 | EFI_PEI_SERVICES ServiceTableShadow;\r |
58dcdada | 137 | UINTN SizeOfTemporaryMemory;\r |
192f6d4c | 138 | UINTN SizeOfCacheAsRam;\r |
139 | VOID *MaxTopOfCarHeap;\r | |
b0d803fe | 140 | EFI_PEI_PPI_DESCRIPTOR *XipLoadFile;\r |
58dcdada | 141 | EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin;\r |
142 | UINT64 PhysicalMemoryLength;\r | |
143 | EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop;\r | |
144 | VOID* ShadowedPeiCore;\r | |
288f9b38 | 145 | CACHE_SECTION_DATA CacheSection;\r |
192f6d4c | 146 | } PEI_CORE_INSTANCE;\r |
147 | \r | |
148 | //\r | |
149 | // Pei Core Instance Data Macros\r | |
150 | //\r | |
151 | \r | |
152 | #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r | |
153 | CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)\r | |
154 | \r | |
155 | //\r | |
156 | // BUGBUG: Where does this go really?\r | |
157 | //\r | |
158 | typedef\r | |
159 | EFI_STATUS\r | |
160 | (EFIAPI *PEI_CORE_ENTRY_POINT)(\r | |
b98c2ab7 | 161 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
162 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r | |
163 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
192f6d4c | 164 | );\r |
165 | \r | |
166 | //\r | |
167 | // Union of temporarily used function pointers (to save stack space)\r | |
168 | //\r | |
169 | typedef union {\r | |
170 | PEI_CORE_ENTRY_POINT PeiCore;\r | |
1c9d209f | 171 | EFI_PEIM_ENTRY_POINT2 PeimEntry;\r |
192f6d4c | 172 | EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;\r |
173 | EFI_DXE_IPL_PPI *DxeIpl;\r | |
174 | EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r | |
175 | EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;\r | |
176 | VOID *Raw;\r | |
177 | } PEI_CORE_TEMP_POINTERS;\r | |
178 | \r | |
179 | \r | |
b98c2ab7 | 180 | \r |
181 | typedef struct {\r | |
182 | CONST EFI_SEC_PEI_HAND_OFF *SecCoreData;\r | |
183 | EFI_PEI_PPI_DESCRIPTOR *PpiList;\r | |
184 | VOID *Data;\r | |
185 | } PEI_CORE_PARAMETERS;\r | |
186 | \r | |
192f6d4c | 187 | //\r |
188 | // PeiCore function\r | |
189 | //\r | |
190 | EFI_STATUS\r | |
191 | EFIAPI\r | |
192 | PeiCore (\r | |
5aae0aa7 | 193 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
194 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpList,\r | |
195 | IN VOID *Data\r | |
192f6d4c | 196 | )\r |
197 | /*++\r | |
198 | \r | |
199 | Routine Description:\r | |
200 | \r | |
201 | The entry routine to Pei Core, invoked by PeiMain during transition\r | |
202 | from SEC to PEI. After switching stack in the PEI core, it will restart\r | |
203 | with the old core data.\r | |
204 | \r | |
205 | Arguments:\r | |
206 | \r | |
207 | PeiStartupDescriptor - Information and services provided by SEC phase.\r | |
208 | OldCoreData - Pointer to old core data that is used to initialize the\r | |
209 | core's data areas.\r | |
210 | \r | |
211 | Returns:\r | |
212 | \r | |
213 | This function never returns\r | |
214 | EFI_NOT_FOUND - Never reach\r | |
215 | \r | |
216 | --*/\r | |
217 | ;\r | |
218 | \r | |
219 | //\r | |
220 | // Dispatcher support functions\r | |
221 | //\r | |
222 | \r | |
b0d803fe | 223 | BOOLEAN\r |
192f6d4c | 224 | PeimDispatchReadiness (\r |
225 | IN EFI_PEI_SERVICES **PeiServices,\r | |
b0d803fe | 226 | IN VOID *DependencyExpression\r |
192f6d4c | 227 | )\r |
228 | /*++\r | |
229 | \r | |
230 | Routine Description:\r | |
231 | \r | |
232 | This is the POSTFIX version of the dependency evaluator. When a\r | |
233 | PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on\r | |
234 | the evaluation stack. When that entry is poped from the evaluation\r | |
235 | stack, the PPI is checked if it is installed. This method allows\r | |
236 | some time savings as not all PPIs must be checked for certain\r | |
237 | operation types (AND, OR).\r | |
238 | \r | |
239 | Arguments:\r | |
240 | \r | |
241 | PeiServices - Calling context.\r | |
242 | \r | |
243 | DependencyExpression - Pointer to a dependency expression. The Grammar adheres to\r | |
244 | the BNF described above and is stored in postfix notation.\r | |
192f6d4c | 245 | \r |
246 | Returns:\r | |
247 | \r | |
248 | Status = EFI_SUCCESS if it is a well-formed Grammar\r | |
249 | EFI_INVALID_PARAMETER if the dependency expression overflows\r | |
250 | the evaluation stack\r | |
251 | EFI_INVALID_PARAMETER if the dependency expression underflows\r | |
252 | the evaluation stack\r | |
253 | EFI_INVALID_PARAMETER if the dependency expression is not a\r | |
254 | well-formed Grammar.\r | |
255 | --*/\r | |
256 | ;\r | |
257 | \r | |
258 | \r | |
b0d803fe | 259 | VOID\r |
192f6d4c | 260 | PeiDispatcher (\r |
5aae0aa7 | 261 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
b0d803fe | 262 | IN PEI_CORE_INSTANCE *PrivateData\r |
192f6d4c | 263 | )\r |
264 | \r | |
265 | /*++\r | |
266 | \r | |
267 | Routine Description:\r | |
268 | \r | |
269 | Conduct PEIM dispatch.\r | |
270 | \r | |
271 | Arguments:\r | |
272 | \r | |
273 | PeiStartupDescriptor - Pointer to IN EFI_PEI_STARTUP_DESCRIPTOR\r | |
274 | PrivateData - Pointer to the private data passed in from caller\r | |
275 | DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data.\r | |
276 | \r | |
277 | Returns:\r | |
278 | \r | |
279 | EFI_SUCCESS - Successfully dispatched PEIM.\r | |
280 | EFI_NOT_FOUND - The dispatch failed.\r | |
281 | \r | |
282 | --*/\r | |
283 | ;\r | |
284 | \r | |
285 | \r | |
286 | VOID\r | |
287 | InitializeDispatcherData (\r | |
b0d803fe | 288 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 289 | IN PEI_CORE_INSTANCE *OldCoreData,\r |
5aae0aa7 | 290 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r |
192f6d4c | 291 | )\r |
292 | /*++\r | |
293 | \r | |
294 | Routine Description:\r | |
295 | \r | |
296 | Initialize the Dispatcher's data members\r | |
297 | \r | |
298 | Arguments:\r | |
299 | \r | |
300 | PeiServices - The PEI core services table.\r | |
301 | OldCoreData - Pointer to old core data (before switching stack).\r | |
302 | NULL if being run in non-permament memory mode.\r | |
303 | PeiStartupDescriptor - Information and services provided by SEC phase.\r | |
304 | \r | |
305 | \r | |
306 | Returns:\r | |
307 | \r | |
308 | None\r | |
309 | \r | |
310 | --*/\r | |
311 | ;\r | |
312 | \r | |
313 | \r | |
58dcdada | 314 | EFI_STATUS\r |
315 | FindNextPeim (\r | |
316 | IN EFI_PEI_SERVICES **PeiServices,\r | |
317 | IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,\r | |
318 | IN OUT EFI_FFS_FILE_HEADER **PeimFileHeader\r | |
319 | )\r | |
320 | /*++\r | |
321 | \r | |
322 | Routine Description:\r | |
323 | Given the input file pointer, search for the next matching file in the\r | |
324 | FFS volume. The search starts from FileHeader inside\r | |
325 | the Firmware Volume defined by FwVolHeader.\r | |
326 | \r | |
327 | Arguments:\r | |
328 | PeiServices - Pointer to the PEI Core Services Table.\r | |
329 | \r | |
330 | FwVolHeader - Pointer to the FV header of the volume to search.\r | |
331 | This parameter must point to a valid FFS volume.\r | |
332 | \r | |
333 | PeimFileHeader - Pointer to the current file from which to begin searching.\r | |
334 | This pointer will be updated upon return to reflect the file found.\r | |
335 | \r | |
336 | Returns:\r | |
337 | EFI_NOT_FOUND - No files matching the search criteria were found\r | |
338 | EFI_SUCCESS\r | |
339 | \r | |
340 | --*/\r | |
341 | ;\r | |
342 | \r | |
192f6d4c | 343 | BOOLEAN\r |
344 | Dispatched (\r | |
345 | IN UINT8 CurrentPeim,\r | |
346 | IN UINT32 DispatchedPeimBitMap\r | |
347 | )\r | |
348 | /*++\r | |
349 | \r | |
350 | Routine Description:\r | |
351 | \r | |
352 | This routine checks to see if a particular PEIM has been dispatched during\r | |
353 | the PEI core dispatch.\r | |
354 | \r | |
355 | Arguments:\r | |
356 | CurrentPeim - The PEIM/FV in the bit array to check.\r | |
357 | DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.\r | |
358 | \r | |
359 | Returns:\r | |
360 | TRUE if PEIM already dispatched\r | |
361 | FALSE if not\r | |
362 | \r | |
363 | --*/\r | |
364 | ;\r | |
365 | \r | |
366 | VOID\r | |
367 | SetDispatched (\r | |
368 | IN EFI_PEI_SERVICES **PeiServices,\r | |
369 | IN UINT8 CurrentPeim,\r | |
370 | OUT UINT32 *DispatchedPeimBitMap\r | |
371 | )\r | |
372 | /*++\r | |
373 | \r | |
374 | Routine Description:\r | |
375 | \r | |
376 | This routine sets a PEIM as having been dispatched once its entry\r | |
377 | point has been invoked.\r | |
378 | \r | |
379 | Arguments:\r | |
380 | \r | |
381 | PeiServices - The PEI core services table.\r | |
382 | CurrentPeim - The PEIM/FV in the bit array to check.\r | |
383 | DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.\r | |
384 | \r | |
385 | Returns:\r | |
386 | None\r | |
387 | \r | |
388 | --*/\r | |
389 | ;\r | |
390 | \r | |
391 | BOOLEAN\r | |
392 | DepexSatisfied (\r | |
b0d803fe | 393 | IN PEI_CORE_INSTANCE *Private,\r |
394 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
395 | IN UINTN PeimCount\r | |
192f6d4c | 396 | )\r |
397 | /*++\r | |
398 | \r | |
399 | Routine Description:\r | |
400 | \r | |
401 | This routine parses the Dependency Expression, if available, and\r | |
402 | decides if the module can be executed.\r | |
403 | \r | |
404 | Arguments:\r | |
405 | PeiServices - The PEI Service Table\r | |
406 | CurrentPeimAddress - Address of the PEIM Firmware File under investigation\r | |
407 | \r | |
408 | Returns:\r | |
409 | TRUE - Can be dispatched\r | |
410 | FALSE - Cannot be dispatched\r | |
411 | \r | |
412 | --*/\r | |
413 | ;\r | |
414 | \r | |
192f6d4c | 415 | //\r |
416 | // PPI support functions\r | |
417 | //\r | |
418 | VOID\r | |
419 | InitializePpiServices (\r | |
b0d803fe | 420 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 421 | IN PEI_CORE_INSTANCE *OldCoreData\r |
422 | )\r | |
423 | /*++\r | |
424 | \r | |
425 | Routine Description:\r | |
426 | \r | |
427 | Initialize PPI services.\r | |
428 | \r | |
429 | Arguments:\r | |
430 | \r | |
431 | PeiServices - The PEI core services table.\r | |
432 | OldCoreData - Pointer to the PEI Core data.\r | |
433 | NULL if being run in non-permament memory mode.\r | |
434 | \r | |
435 | Returns:\r | |
436 | Nothing\r | |
437 | \r | |
438 | --*/\r | |
439 | ;\r | |
440 | \r | |
441 | VOID\r | |
442 | ConvertPpiPointers (\r | |
58dcdada | 443 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
444 | IN UINTN OldCheckingBottom,\r | |
445 | IN UINTN OldCheckingTop,\r | |
192f6d4c | 446 | IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob\r |
447 | )\r | |
448 | /*++\r | |
449 | \r | |
450 | Routine Description:\r | |
451 | \r | |
452 | Migrate the Hob list from the CAR stack to PEI installed memory.\r | |
453 | \r | |
454 | Arguments:\r | |
455 | \r | |
58dcdada | 456 | PeiServices - The PEI core services table.\r |
457 | OldCheckingBottom - The old checking bottom.\r | |
458 | OldCheckingTop - The old checking top.\r | |
459 | NewHandOffHob - The new handoff HOB list.\r | |
192f6d4c | 460 | \r |
461 | Returns:\r | |
462 | \r | |
463 | --*/\r | |
464 | ;\r | |
465 | \r | |
466 | EFI_STATUS\r | |
467 | EFIAPI\r | |
468 | PeiInstallPpi (\r | |
0c2b5da8 | 469 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
470 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r | |
192f6d4c | 471 | )\r |
472 | /*++\r | |
473 | \r | |
474 | Routine Description:\r | |
475 | \r | |
476 | Install PPI services.\r | |
477 | \r | |
478 | Arguments:\r | |
479 | \r | |
480 | PeiServices - Pointer to the PEI Service Table\r | |
481 | PpiList - Pointer to a list of PEI PPI Descriptors.\r | |
482 | \r | |
483 | Returns:\r | |
484 | \r | |
485 | EFI_SUCCESS - if all PPIs in PpiList are successfully installed.\r | |
486 | EFI_INVALID_PARAMETER - if PpiList is NULL pointer\r | |
487 | EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid\r | |
488 | EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI\r | |
489 | \r | |
490 | --*/\r | |
491 | ;\r | |
492 | \r | |
493 | EFI_STATUS\r | |
494 | EFIAPI\r | |
495 | PeiReInstallPpi (\r | |
0c2b5da8 | 496 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
497 | IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r | |
498 | IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r | |
192f6d4c | 499 | )\r |
500 | /*++\r | |
501 | \r | |
502 | Routine Description:\r | |
503 | \r | |
504 | Re-Install PPI services.\r | |
505 | \r | |
506 | Arguments:\r | |
507 | \r | |
508 | PeiServices - Pointer to the PEI Service Table\r | |
509 | OldPpi - Pointer to the old PEI PPI Descriptors.\r | |
510 | NewPpi - Pointer to the new PEI PPI Descriptors.\r | |
511 | \r | |
512 | Returns:\r | |
513 | \r | |
514 | EFI_SUCCESS - if the operation was successful\r | |
515 | EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL\r | |
516 | EFI_INVALID_PARAMETER - if NewPpi is not valid\r | |
517 | EFI_NOT_FOUND - if the PPI was not in the database\r | |
518 | \r | |
519 | --*/\r | |
520 | ;\r | |
521 | \r | |
522 | EFI_STATUS\r | |
523 | EFIAPI\r | |
524 | PeiLocatePpi (\r | |
0c2b5da8 | 525 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
526 | IN CONST EFI_GUID *Guid,\r | |
192f6d4c | 527 | IN UINTN Instance,\r |
528 | IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r | |
529 | IN OUT VOID **Ppi\r | |
530 | )\r | |
531 | /*++\r | |
532 | \r | |
533 | Routine Description:\r | |
534 | \r | |
535 | Locate a given named PPI.\r | |
536 | \r | |
537 | Arguments:\r | |
538 | \r | |
539 | PeiServices - Pointer to the PEI Service Table\r | |
540 | Guid - Pointer to GUID of the PPI.\r | |
541 | Instance - Instance Number to discover.\r | |
542 | PpiDescriptor - Pointer to reference the found descriptor. If not NULL,\r | |
543 | returns a pointer to the descriptor (includes flags, etc)\r | |
544 | Ppi - Pointer to reference the found PPI\r | |
545 | \r | |
546 | Returns:\r | |
547 | \r | |
548 | Status - EFI_SUCCESS if the PPI is in the database\r | |
549 | EFI_NOT_FOUND if the PPI is not in the database\r | |
550 | --*/\r | |
551 | ;\r | |
552 | \r | |
553 | EFI_STATUS\r | |
554 | EFIAPI\r | |
555 | PeiNotifyPpi (\r | |
0c2b5da8 | 556 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
557 | IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r | |
192f6d4c | 558 | )\r |
559 | /*++\r | |
560 | \r | |
561 | Routine Description:\r | |
562 | \r | |
563 | Install a notification for a given PPI.\r | |
564 | \r | |
565 | Arguments:\r | |
566 | \r | |
567 | PeiServices - Pointer to the PEI Service Table\r | |
568 | NotifyList - Pointer to list of Descriptors to notify upon.\r | |
569 | \r | |
570 | Returns:\r | |
571 | \r | |
572 | Status - EFI_SUCCESS if successful\r | |
573 | EFI_OUT_OF_RESOURCES if no space in the database\r | |
574 | EFI_INVALID_PARAMETER if not a good decriptor\r | |
575 | \r | |
576 | --*/\r | |
577 | ;\r | |
578 | \r | |
579 | VOID\r | |
580 | ProcessNotifyList (\r | |
b0d803fe | 581 | IN PEI_CORE_INSTANCE *PrivateData\r |
192f6d4c | 582 | )\r |
583 | /*++\r | |
584 | \r | |
585 | Routine Description:\r | |
586 | \r | |
587 | Process the Notify List at dispatch level.\r | |
588 | \r | |
589 | Arguments:\r | |
590 | \r | |
591 | PeiServices - Pointer to the PEI Service Table\r | |
592 | \r | |
593 | Returns:\r | |
594 | \r | |
595 | --*/\r | |
596 | ;\r | |
597 | \r | |
598 | VOID\r | |
599 | DispatchNotify (\r | |
b0d803fe | 600 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 601 | IN UINTN NotifyType,\r |
602 | IN INTN InstallStartIndex,\r | |
603 | IN INTN InstallStopIndex,\r | |
604 | IN INTN NotifyStartIndex,\r | |
605 | IN INTN NotifyStopIndex\r | |
606 | )\r | |
607 | /*++\r | |
608 | \r | |
609 | Routine Description:\r | |
610 | \r | |
611 | Dispatch notifications.\r | |
612 | \r | |
613 | Arguments:\r | |
614 | \r | |
615 | PeiServices - Pointer to the PEI Service Table\r | |
616 | NotifyType - Type of notify to fire.\r | |
617 | InstallStartIndex - Install Beginning index.\r | |
618 | InstallStopIndex - Install Ending index.\r | |
619 | NotifyStartIndex - Notify Beginning index.\r | |
620 | NotifyStopIndex - Notify Ending index.\r | |
621 | \r | |
622 | Returns: None\r | |
623 | \r | |
624 | --*/\r | |
625 | ;\r | |
626 | \r | |
627 | //\r | |
628 | // Boot mode support functions\r | |
629 | //\r | |
630 | EFI_STATUS\r | |
631 | EFIAPI\r | |
632 | PeiGetBootMode (\r | |
0c2b5da8 | 633 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 634 | IN OUT EFI_BOOT_MODE *BootMode\r |
635 | )\r | |
636 | /*++\r | |
637 | \r | |
638 | Routine Description:\r | |
639 | \r | |
640 | This service enables PEIMs to ascertain the present value of the boot mode.\r | |
641 | \r | |
642 | Arguments:\r | |
643 | \r | |
644 | PeiServices - The PEI core services table.\r | |
645 | BootMode - A pointer to contain the value of the boot mode.\r | |
646 | \r | |
647 | Returns:\r | |
648 | \r | |
649 | EFI_SUCCESS - The boot mode was returned successfully.\r | |
650 | EFI_INVALID_PARAMETER - BootMode is NULL.\r | |
651 | \r | |
652 | --*/\r | |
653 | ;\r | |
654 | \r | |
655 | EFI_STATUS\r | |
656 | EFIAPI\r | |
657 | PeiSetBootMode (\r | |
0c2b5da8 | 658 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 659 | IN EFI_BOOT_MODE BootMode\r |
660 | )\r | |
661 | /*++\r | |
662 | \r | |
663 | Routine Description:\r | |
664 | \r | |
665 | This service enables PEIMs to update the boot mode variable.\r | |
666 | \r | |
667 | Arguments:\r | |
668 | \r | |
669 | PeiServices - The PEI core services table.\r | |
670 | BootMode - The value of the boot mode to set.\r | |
671 | \r | |
672 | Returns:\r | |
673 | \r | |
674 | EFI_SUCCESS - The value was successfully updated\r | |
675 | \r | |
676 | --*/\r | |
677 | ;\r | |
678 | \r | |
679 | //\r | |
680 | // Security support functions\r | |
681 | //\r | |
682 | VOID\r | |
683 | InitializeSecurityServices (\r | |
684 | IN EFI_PEI_SERVICES **PeiServices,\r | |
685 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
686 | )\r | |
687 | /*++\r | |
688 | \r | |
689 | Routine Description:\r | |
690 | \r | |
691 | Initialize the security services.\r | |
692 | \r | |
693 | Arguments:\r | |
694 | \r | |
695 | PeiServices - The PEI core services table.\r | |
696 | OldCoreData - Pointer to the old core data.\r | |
697 | NULL if being run in non-permament memory mode.\r | |
698 | Returns:\r | |
699 | \r | |
700 | None\r | |
701 | \r | |
702 | --*/\r | |
703 | ;\r | |
704 | \r | |
705 | EFI_STATUS\r | |
706 | VerifyFv (\r | |
707 | IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress\r | |
708 | )\r | |
709 | /*++\r | |
710 | \r | |
711 | Routine Description:\r | |
712 | \r | |
713 | Provide a callout to the OEM FV verification service.\r | |
714 | \r | |
715 | Arguments:\r | |
716 | \r | |
717 | CurrentFvAddress - Pointer to the FV under investigation.\r | |
718 | \r | |
719 | Returns:\r | |
720 | \r | |
721 | Status - EFI_SUCCESS\r | |
722 | \r | |
723 | --*/\r | |
724 | ;\r | |
725 | \r | |
726 | \r | |
727 | EFI_STATUS\r | |
728 | VerifyPeim (\r | |
b0d803fe | 729 | IN PEI_CORE_INSTANCE *PrivateData,\r |
730 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
731 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
192f6d4c | 732 | )\r |
733 | /*++\r | |
734 | \r | |
735 | Routine Description:\r | |
736 | \r | |
737 | Provide a callout to the security verification service.\r | |
738 | \r | |
739 | Arguments:\r | |
740 | \r | |
741 | PeiServices - The PEI core services table.\r | |
742 | CurrentPeimAddress - Pointer to the Firmware File under investigation.\r | |
743 | \r | |
744 | Returns:\r | |
745 | \r | |
746 | EFI_SUCCESS - Image is OK\r | |
747 | EFI_SECURITY_VIOLATION - Image is illegal\r | |
748 | \r | |
749 | --*/\r | |
750 | ;\r | |
751 | \r | |
752 | \r | |
753 | EFI_STATUS\r | |
754 | EFIAPI\r | |
755 | PeiGetHobList (\r | |
0c2b5da8 | 756 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 757 | IN OUT VOID **HobList\r |
758 | )\r | |
759 | /*++\r | |
760 | \r | |
761 | Routine Description:\r | |
762 | \r | |
763 | Gets the pointer to the HOB List.\r | |
764 | \r | |
765 | Arguments:\r | |
766 | \r | |
767 | PeiServices - The PEI core services table.\r | |
768 | HobList - Pointer to the HOB List.\r | |
769 | \r | |
770 | Returns:\r | |
771 | \r | |
772 | EFI_SUCCESS - Get the pointer of HOB List\r | |
773 | EFI_NOT_AVAILABLE_YET - the HOB List is not yet published\r | |
774 | EFI_INVALID_PARAMETER - HobList is NULL (in debug mode)\r | |
775 | \r | |
776 | --*/\r | |
777 | ;\r | |
778 | \r | |
779 | EFI_STATUS\r | |
780 | EFIAPI\r | |
781 | PeiCreateHob (\r | |
0c2b5da8 | 782 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 783 | IN UINT16 Type,\r |
784 | IN UINT16 Length,\r | |
785 | IN OUT VOID **Hob\r | |
786 | )\r | |
787 | /*++\r | |
788 | \r | |
789 | Routine Description:\r | |
790 | \r | |
791 | Add a new HOB to the HOB List.\r | |
792 | \r | |
793 | Arguments:\r | |
794 | \r | |
795 | PeiServices - The PEI core services table.\r | |
796 | Type - Type of the new HOB.\r | |
797 | Length - Length of the new HOB to allocate.\r | |
798 | Hob - Pointer to the new HOB.\r | |
799 | \r | |
800 | Returns:\r | |
801 | \r | |
802 | Status - EFI_SUCCESS\r | |
803 | - EFI_INVALID_PARAMETER if Hob is NULL\r | |
804 | - EFI_NOT_AVAILABLE_YET if HobList is still not available.\r | |
805 | - EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.\r | |
806 | \r | |
807 | --*/\r | |
808 | ;\r | |
809 | \r | |
810 | EFI_STATUS\r | |
811 | PeiCoreBuildHobHandoffInfoTable (\r | |
812 | IN EFI_BOOT_MODE BootMode,\r | |
813 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r | |
814 | IN UINT64 MemoryLength\r | |
815 | )\r | |
816 | /*++\r | |
817 | \r | |
818 | Routine Description:\r | |
819 | \r | |
820 | Builds a Handoff Information Table HOB\r | |
821 | \r | |
822 | Arguments:\r | |
823 | \r | |
824 | BootMode - Current Bootmode\r | |
825 | MemoryBegin - Start Memory Address.\r | |
826 | MemoryLength - Length of Memory.\r | |
827 | \r | |
828 | Returns:\r | |
829 | \r | |
830 | EFI_SUCCESS\r | |
831 | \r | |
832 | --*/\r | |
833 | ;\r | |
834 | \r | |
835 | \r | |
836 | //\r | |
837 | // FFS Fw Volume support functions\r | |
838 | //\r | |
839 | EFI_STATUS\r | |
840 | EFIAPI\r | |
841 | PeiFfsFindNextFile (\r | |
0c2b5da8 | 842 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 843 | IN UINT8 SearchType,\r |
0c2b5da8 | 844 | IN EFI_PEI_FV_HANDLE FwVolHeader,\r |
845 | IN OUT EFI_PEI_FILE_HANDLE *FileHeader\r | |
192f6d4c | 846 | )\r |
847 | /*++\r | |
848 | \r | |
849 | Routine Description:\r | |
850 | Given the input file pointer, search for the next matching file in the\r | |
851 | FFS volume as defined by SearchType. The search starts from FileHeader inside\r | |
852 | the Firmware Volume defined by FwVolHeader.\r | |
853 | \r | |
854 | Arguments:\r | |
855 | PeiServices - Pointer to the PEI Core Services Table.\r | |
856 | \r | |
857 | SearchType - Filter to find only files of this type.\r | |
858 | Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r | |
859 | \r | |
860 | FwVolHeader - Pointer to the FV header of the volume to search.\r | |
861 | This parameter must point to a valid FFS volume.\r | |
862 | \r | |
863 | FileHeader - Pointer to the current file from which to begin searching.\r | |
864 | This pointer will be updated upon return to reflect the file found.\r | |
865 | \r | |
866 | Returns:\r | |
867 | EFI_NOT_FOUND - No files matching the search criteria were found\r | |
868 | EFI_SUCCESS\r | |
869 | \r | |
870 | --*/\r | |
871 | ;\r | |
872 | \r | |
873 | EFI_STATUS\r | |
874 | EFIAPI\r | |
875 | PeiFfsFindSectionData (\r | |
b0d803fe | 876 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 877 | IN EFI_SECTION_TYPE SectionType,\r |
0c2b5da8 | 878 | IN EFI_PEI_FILE_HANDLE FfsFileHeader,\r |
192f6d4c | 879 | IN OUT VOID **SectionData\r |
880 | )\r | |
881 | /*++\r | |
882 | \r | |
883 | Routine Description:\r | |
884 | Given the input file pointer, search for the next matching section in the\r | |
885 | FFS volume.\r | |
886 | \r | |
887 | Arguments:\r | |
888 | PeiServices - Pointer to the PEI Core Services Table.\r | |
889 | SearchType - Filter to find only sections of this type.\r | |
890 | FfsFileHeader - Pointer to the current file to search.\r | |
891 | SectionData - Pointer to the Section matching SectionType in FfsFileHeader.\r | |
892 | - NULL if section not found\r | |
893 | \r | |
894 | Returns:\r | |
895 | EFI_NOT_FOUND - No files matching the search criteria were found\r | |
896 | EFI_SUCCESS\r | |
897 | \r | |
898 | --*/\r | |
899 | ;\r | |
900 | \r | |
901 | EFI_STATUS\r | |
902 | EFIAPI\r | |
903 | PeiFvFindNextVolume (\r | |
0c2b5da8 | 904 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 905 | IN UINTN Instance,\r |
0c2b5da8 | 906 | IN OUT EFI_PEI_FV_HANDLE *FwVolHeader\r |
192f6d4c | 907 | )\r |
908 | /*++\r | |
909 | \r | |
910 | Routine Description:\r | |
911 | \r | |
912 | Return the BFV location\r | |
913 | \r | |
914 | BugBug -- Move this to the location of this code to where the\r | |
915 | other FV and FFS support code lives.\r | |
916 | Also, update to use FindFV for instances #'s >= 1.\r | |
917 | \r | |
918 | Arguments:\r | |
919 | \r | |
920 | PeiServices - The PEI core services table.\r | |
921 | Instance - Instance of FV to find\r | |
922 | FwVolHeader - Pointer to contain the data to return\r | |
923 | \r | |
924 | Returns:\r | |
925 | Pointer to the Firmware Volume instance requested\r | |
926 | \r | |
927 | EFI_INVALID_PARAMETER - FwVolHeader is NULL\r | |
928 | \r | |
929 | EFI_SUCCESS - Firmware volume instance successfully found.\r | |
930 | \r | |
931 | --*/\r | |
932 | ;\r | |
933 | \r | |
934 | //\r | |
935 | // Memory support functions\r | |
936 | //\r | |
937 | VOID\r | |
938 | InitializeMemoryServices (\r | |
b0d803fe | 939 | IN PEI_CORE_INSTANCE *PrivateData,\r |
5aae0aa7 | 940 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
192f6d4c | 941 | IN PEI_CORE_INSTANCE *OldCoreData\r |
942 | )\r | |
943 | /*++\r | |
944 | \r | |
945 | Routine Description:\r | |
946 | \r | |
947 | Initialize the memory services.\r | |
948 | \r | |
949 | Arguments:\r | |
950 | \r | |
951 | PeiServices - The PEI core services table.\r | |
952 | PeiStartupDescriptor - Information and services provided by SEC phase.\r | |
953 | OldCoreData - Pointer to the PEI Core data.\r | |
954 | NULL if being run in non-permament memory mode.\r | |
955 | \r | |
956 | Returns:\r | |
957 | \r | |
958 | None\r | |
959 | \r | |
960 | --*/\r | |
961 | ;\r | |
962 | \r | |
963 | EFI_STATUS\r | |
964 | EFIAPI\r | |
965 | PeiInstallPeiMemory (\r | |
0c2b5da8 | 966 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 967 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r |
968 | IN UINT64 MemoryLength\r | |
969 | )\r | |
970 | /*++\r | |
971 | \r | |
972 | Routine Description:\r | |
973 | \r | |
974 | Install the permanent memory is now available.\r | |
975 | Creates HOB (PHIT and Stack).\r | |
976 | \r | |
977 | Arguments:\r | |
978 | \r | |
979 | PeiServices - The PEI core services table.\r | |
980 | MemoryBegin - Start of memory address.\r | |
981 | MemoryLength - Length of memory.\r | |
982 | \r | |
983 | Returns:\r | |
984 | \r | |
985 | Status - EFI_SUCCESS\r | |
986 | \r | |
987 | --*/\r | |
988 | ;\r | |
989 | \r | |
990 | EFI_STATUS\r | |
991 | EFIAPI\r | |
992 | PeiAllocatePages (\r | |
0c2b5da8 | 993 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 994 | IN EFI_MEMORY_TYPE MemoryType,\r |
995 | IN UINTN Pages,\r | |
996 | OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
997 | )\r | |
998 | /*++\r | |
999 | \r | |
1000 | Routine Description:\r | |
1001 | \r | |
1002 | Memory allocation service on permanent memory,\r | |
1003 | not usable prior to the memory installation.\r | |
1004 | \r | |
1005 | Arguments:\r | |
1006 | \r | |
1007 | PeiServices - The PEI core services table.\r | |
1008 | Type - Type of allocation.\r | |
1009 | MemoryType - Type of memory to allocate.\r | |
1010 | Pages - Number of pages to allocate.\r | |
1011 | Memory - Pointer of memory allocated.\r | |
1012 | \r | |
1013 | Returns:\r | |
1014 | \r | |
1015 | Status - EFI_SUCCESS The allocation was successful\r | |
1016 | EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.\r | |
1017 | EFI_NOT_AVAILABLE_YET Called with permanent memory not available\r | |
1018 | EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement\r | |
1019 | to allocate the number of pages.\r | |
1020 | \r | |
1021 | --*/\r | |
1022 | ;\r | |
1023 | \r | |
1024 | EFI_STATUS\r | |
1025 | EFIAPI\r | |
1026 | PeiAllocatePool (\r | |
0c2b5da8 | 1027 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 1028 | IN UINTN Size,\r |
1029 | OUT VOID **Buffer\r | |
1030 | )\r | |
1031 | /*++\r | |
1032 | \r | |
1033 | Routine Description:\r | |
1034 | \r | |
1035 | Memory allocation service on the CAR.\r | |
1036 | \r | |
1037 | Arguments:\r | |
1038 | \r | |
1039 | PeiServices - The PEI core services table.\r | |
1040 | \r | |
1041 | Size - Amount of memory required\r | |
1042 | \r | |
1043 | Buffer - Address of pointer to the buffer\r | |
1044 | \r | |
1045 | Returns:\r | |
1046 | \r | |
1047 | Status - EFI_SUCCESS The allocation was successful\r | |
1048 | EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement\r | |
1049 | to allocate the requested size.\r | |
1050 | \r | |
1051 | --*/\r | |
1052 | ;\r | |
1053 | \r | |
1054 | EFI_STATUS\r | |
1055 | PeiLoadImage (\r | |
1056 | IN EFI_PEI_SERVICES **PeiServices,\r | |
b0d803fe | 1057 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
1058 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r | |
1059 | OUT UINT32 *AuthenticationState\r | |
192f6d4c | 1060 | )\r |
1061 | /*++\r | |
1062 | \r | |
1063 | Routine Description:\r | |
1064 | \r | |
1065 | Get entry point of a Peim file.\r | |
1066 | \r | |
1067 | Arguments:\r | |
1068 | \r | |
1069 | PeiServices - Calling context.\r | |
1070 | \r | |
1071 | PeimFileHeader - Peim file's header.\r | |
1072 | \r | |
1073 | EntryPoint - Entry point of that Peim file.\r | |
1074 | \r | |
1075 | Returns:\r | |
1076 | \r | |
1077 | Status code.\r | |
1078 | \r | |
1079 | --*/\r | |
1080 | ;\r | |
1081 | \r | |
1082 | \r | |
1083 | EFI_STATUS\r | |
1084 | EFIAPI\r | |
1085 | PeiReportStatusCode (\r | |
0c2b5da8 | 1086 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 1087 | IN EFI_STATUS_CODE_TYPE CodeType,\r |
1088 | IN EFI_STATUS_CODE_VALUE Value,\r | |
1089 | IN UINT32 Instance,\r | |
0c2b5da8 | 1090 | IN CONST EFI_GUID *CallerId,\r |
1091 | IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
192f6d4c | 1092 | )\r |
1093 | /*++\r | |
1094 | \r | |
1095 | Routine Description:\r | |
1096 | \r | |
1097 | Core version of the Status Code reporter\r | |
1098 | \r | |
1099 | Arguments:\r | |
1100 | \r | |
1101 | PeiServices - The PEI core services table.\r | |
1102 | \r | |
1103 | CodeType - Type of Status Code.\r | |
1104 | \r | |
1105 | Value - Value to output for Status Code.\r | |
1106 | \r | |
1107 | Instance - Instance Number of this status code.\r | |
1108 | \r | |
1109 | CallerId - ID of the caller of this status code.\r | |
1110 | \r | |
1111 | Data - Optional data associated with this status code.\r | |
1112 | \r | |
1113 | Returns:\r | |
1114 | \r | |
1115 | Status - EFI_SUCCESS if status code is successfully reported\r | |
1116 | - EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed\r | |
1117 | \r | |
1118 | --*/\r | |
1119 | ;\r | |
1120 | \r | |
1121 | \r | |
1122 | EFI_STATUS\r | |
1123 | EFIAPI\r | |
1124 | PeiResetSystem (\r | |
b0d803fe | 1125 | IN CONST EFI_PEI_SERVICES **PeiServices\r |
192f6d4c | 1126 | )\r |
1127 | /*++\r | |
1128 | \r | |
1129 | Routine Description:\r | |
1130 | \r | |
1131 | Core version of the Reset System\r | |
1132 | \r | |
1133 | Arguments:\r | |
1134 | \r | |
1135 | PeiServices - The PEI core services table.\r | |
1136 | \r | |
1137 | Returns:\r | |
1138 | \r | |
1139 | Status - EFI_NOT_AVAILABLE_YET. PPI not available yet.\r | |
1140 | - EFI_DEVICE_ERROR. Did not reset system.\r | |
1141 | \r | |
1142 | Otherwise, resets the system.\r | |
1143 | \r | |
1144 | --*/\r | |
1145 | ;\r | |
1146 | \r | |
50cb16d9 | 1147 | VOID\r |
b0d803fe | 1148 | PeiInitializeFv (\r |
1149 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
1150 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r | |
1151 | )\r | |
1152 | /*++\r | |
1153 | \r | |
1154 | Routine Description:\r | |
1155 | \r | |
1156 | Initialize PeiCore Fv List.\r | |
1157 | \r | |
1158 | Arguments:\r | |
1159 | PrivateData - Pointer to PEI_CORE_INSTANCE.\r | |
1160 | SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.\r | |
1161 | \r | |
1162 | Returns:\r | |
50cb16d9 | 1163 | NONE\r |
1164 | \r | |
1165 | --*/\r | |
b0d803fe | 1166 | ;\r |
1167 | \r | |
1168 | EFI_STATUS\r | |
1169 | EFIAPI\r | |
1170 | FirmwareVolmeInfoPpiNotifyCallback (\r | |
1171 | IN EFI_PEI_SERVICES **PeiServices,\r | |
1172 | IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r | |
1173 | IN VOID *Ppi\r | |
1174 | )\r | |
1175 | /*++\r | |
1176 | \r | |
1177 | Routine Description:\r | |
1178 | \r | |
1179 | Process Firmware Volum Information once FvInfoPPI install.\r | |
1180 | \r | |
1181 | Arguments:\r | |
1182 | \r | |
1183 | PeiServices - General purpose services available to every PEIM.\r | |
50cb16d9 | 1184 | \r |
b0d803fe | 1185 | Returns:\r |
1186 | \r | |
1187 | Status - EFI_SUCCESS if the interface could be successfully\r | |
1188 | installed\r | |
1189 | \r | |
1190 | --*/\r | |
1191 | ;\r | |
1192 | \r | |
1193 | \r | |
1194 | EFI_STATUS\r | |
50cb16d9 | 1195 | EFIAPI\r |
b0d803fe | 1196 | PeiFfsFindFileByName (\r |
1197 | IN CONST EFI_GUID *FileName,\r | |
1198 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
1199 | OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
1200 | )\r | |
1201 | /*++\r | |
1202 | \r | |
1203 | Routine Description:\r | |
1204 | \r | |
1205 | Given the input VolumeHandle, search for the next matching name file.\r | |
1206 | \r | |
1207 | Arguments:\r | |
1208 | \r | |
1209 | FileName - File name to search.\r | |
1210 | VolumeHandle - The current FV to search.\r | |
1211 | FileHandle - Pointer to the file matching name in VolumeHandle.\r | |
1212 | - NULL if file not found\r | |
1213 | Returns:\r | |
1214 | EFI_STATUS\r | |
50cb16d9 | 1215 | \r |
1216 | --*/\r | |
b0d803fe | 1217 | ;\r |
1218 | \r | |
1219 | \r | |
1220 | EFI_STATUS\r | |
50cb16d9 | 1221 | EFIAPI\r |
b0d803fe | 1222 | PeiFfsGetFileInfo (\r |
1223 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
1224 | OUT EFI_FV_FILE_INFO *FileInfo\r | |
1225 | )\r | |
1226 | /*++\r | |
1227 | \r | |
1228 | Routine Description:\r | |
1229 | \r | |
1230 | Collect information of given file.\r | |
1231 | \r | |
1232 | Arguments:\r | |
1233 | FileHandle - The handle to file.\r | |
1234 | FileInfo - Pointer to the file information.\r | |
1235 | \r | |
1236 | Returns:\r | |
1237 | EFI_STATUS\r | |
50cb16d9 | 1238 | \r |
1239 | --*/\r | |
b0d803fe | 1240 | ;\r |
1241 | \r | |
1242 | EFI_STATUS\r | |
50cb16d9 | 1243 | EFIAPI\r |
b0d803fe | 1244 | PeiFfsGetVolumeInfo (\r |
1245 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
1246 | OUT EFI_FV_INFO *VolumeInfo\r | |
1247 | )\r | |
1248 | /*++\r | |
1249 | \r | |
1250 | Routine Description:\r | |
1251 | \r | |
1252 | Collect information of given Fv Volume.\r | |
1253 | \r | |
1254 | Arguments:\r | |
1255 | VolumeHandle - The handle to Fv Volume.\r | |
1256 | VolumeInfo - The pointer to volume information.\r | |
50cb16d9 | 1257 | \r |
b0d803fe | 1258 | Returns:\r |
1259 | EFI_STATUS\r | |
50cb16d9 | 1260 | \r |
1261 | --*/\r | |
b0d803fe | 1262 | ;\r |
1263 | \r | |
1264 | \r | |
1265 | EFI_STATUS\r | |
1266 | EFIAPI\r | |
1267 | PeiRegisterForShadow (\r | |
1268 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
1269 | )\r | |
1270 | /*++\r | |
1271 | \r | |
1272 | Routine Description:\r | |
1273 | \r | |
1274 | This routine enable a PEIM to register itself to shadow when PEI Foundation\r | |
1275 | discovery permanent memory.\r | |
1276 | \r | |
1277 | Arguments:\r | |
1278 | FileHandle - File handle of a PEIM.\r | |
50cb16d9 | 1279 | \r |
b0d803fe | 1280 | Returns:\r |
1281 | EFI_NOT_FOUND - The file handle doesn't point to PEIM itself.\r | |
1282 | EFI_ALREADY_STARTED - Indicate that the PEIM has been registered itself.\r | |
1283 | EFI_SUCCESS - Successfully to register itself.\r | |
1284 | \r | |
50cb16d9 | 1285 | --*/\r |
b0d803fe | 1286 | ;\r |
1287 | \r | |
1288 | \r | |
14e8823a | 1289 | /**\r |
1290 | This routine enable a PEIM to register itself to shadow when PEI Foundation\r | |
1291 | discovery permanent memory.\r | |
1292 | \r | |
1293 | @param FileHandle File handle of a PEIM.\r | |
50cb16d9 | 1294 | \r |
14e8823a | 1295 | @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.\r |
1296 | @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.\r | |
1297 | @retval EFI_SUCCESS Successfully to register itself.\r | |
1298 | \r | |
50cb16d9 | 1299 | **/\r |
14e8823a | 1300 | EFI_STATUS\r |
1301 | EFIAPI\r | |
1302 | PeiRegisterForShadow (\r | |
1303 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
1304 | )\r | |
1305 | ;\r | |
1306 | \r | |
b0d803fe | 1307 | EFI_STATUS\r |
1308 | PeiFindFileEx (\r | |
1309 | IN CONST EFI_PEI_FV_HANDLE FvHandle,\r | |
1310 | IN CONST EFI_GUID *FileName, OPTIONAL\r | |
1311 | IN EFI_FV_FILETYPE SearchType,\r | |
1312 | IN OUT EFI_PEI_FILE_HANDLE *FileHandle,\r | |
1313 | IN OUT EFI_PEI_FV_HANDLE *AprioriFile OPTIONAL\r | |
1314 | )\r | |
1315 | /*++\r | |
1316 | \r | |
1317 | Routine Description:\r | |
1318 | Given the input file pointer, search for the next matching file in the\r | |
1319 | FFS volume as defined by SearchType. The search starts from FileHeader inside\r | |
1320 | the Firmware Volume defined by FwVolHeader.\r | |
1321 | \r | |
1322 | Arguments:\r | |
1323 | PeiServices - Pointer to the PEI Core Services Table.\r | |
1324 | SearchType - Filter to find only files of this type.\r | |
1325 | Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r | |
1326 | FwVolHeader - Pointer to the FV header of the volume to search.\r | |
1327 | This parameter must point to a valid FFS volume.\r | |
1328 | FileHeader - Pointer to the current file from which to begin searching.\r | |
1329 | This pointer will be updated upon return to reflect the file found.\r | |
50cb16d9 | 1330 | Flag - Indicator for if this is for PEI Dispath search\r |
1331 | \r | |
b0d803fe | 1332 | Returns:\r |
1333 | EFI_NOT_FOUND - No files matching the search criteria were found\r | |
1334 | EFI_SUCCESS\r | |
1335 | \r | |
1336 | --*/\r | |
1337 | ;\r | |
1338 | \r | |
1339 | VOID\r | |
1340 | InitializeImageServices (\r | |
1341 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
1342 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
1343 | )\r | |
1344 | /*++\r | |
1345 | \r | |
1346 | Routine Description:\r | |
1347 | \r | |
c58cf83d | 1348 | Install Pei Load File PPI.\r |
b0d803fe | 1349 | \r |
1350 | Arguments:\r | |
1351 | \r | |
1352 | PrivateData - Pointer to PEI_CORE_INSTANCE.\r | |
1353 | OldCoreData - Pointer to PEI_CORE_INSTANCE.\r | |
1354 | \r | |
1355 | Returns:\r | |
1356 | \r | |
1357 | NONE.\r | |
50cb16d9 | 1358 | \r |
1359 | --*/\r | |
b0d803fe | 1360 | ;\r |
1361 | \r | |
288f9b38 LG |
1362 | /**\r |
1363 | Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r | |
1364 | \r | |
1365 | @param PeiServices Pointer to the PEI Core Services Table.\r | |
1366 | @param FileHandle File handle of a Fv type file.\r | |
1367 | @param AuthenticationState Pointer to attestation authentication state of image.\r | |
1368 | \r | |
50cb16d9 | 1369 | \r |
288f9b38 LG |
1370 | @retval EFI_NOT_FOUND FV image can't be found.\r |
1371 | @retval EFI_SUCCESS Successfully to process it.\r | |
1372 | \r | |
1373 | **/\r | |
1374 | EFI_STATUS\r | |
1375 | ProcessFvFile (\r | |
1376 | IN EFI_PEI_SERVICES **PeiServices,\r | |
1377 | IN EFI_PEI_FILE_HANDLE FvFileHandle,\r | |
1378 | OUT UINT32 *AuthenticationState\r | |
1379 | );\r | |
1380 | \r | |
192f6d4c | 1381 | #endif\r |