]>
Commit | Line | Data |
---|---|---|
192f6d4c | 1 | /*++\r |
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 | |
22 | --*/\r | |
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 | |
415 | #if defined (MDE_CPU_IPF)\r | |
416 | //\r | |
417 | // In Ipf we should make special changes for the PHIT pointers to support\r | |
418 | // recovery boot in cache mode.\r | |
419 | //\r | |
420 | #define SWITCH_TO_CACHE_MODE(CoreData) SwitchToCacheMode(CoreData)\r | |
421 | #define CACHE_MODE_ADDRESS_MASK 0x7FFFFFFFFFFFFFFFULL\r | |
422 | VOID\r | |
423 | SwitchToCacheMode (\r | |
424 | IN PEI_CORE_INSTANCE *CoreData\r | |
425 | )\r | |
426 | /*++\r | |
427 | \r | |
428 | Routine Description:\r | |
429 | \r | |
430 | Switch the PHIT pointers to cache mode after InstallPeiMemory in CAR.\r | |
431 | \r | |
432 | Arguments:\r | |
433 | \r | |
434 | CoreData - The PEI core Private Data\r | |
435 | \r | |
436 | Returns:\r | |
437 | \r | |
438 | --*/\r | |
439 | ;\r | |
440 | \r | |
441 | #else\r | |
442 | \r | |
443 | #define SWITCH_TO_CACHE_MODE(CoreData)\r | |
444 | \r | |
445 | #endif\r | |
446 | \r | |
447 | //\r | |
448 | // PPI support functions\r | |
449 | //\r | |
450 | VOID\r | |
451 | InitializePpiServices (\r | |
b0d803fe | 452 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 453 | IN PEI_CORE_INSTANCE *OldCoreData\r |
454 | )\r | |
455 | /*++\r | |
456 | \r | |
457 | Routine Description:\r | |
458 | \r | |
459 | Initialize PPI services.\r | |
460 | \r | |
461 | Arguments:\r | |
462 | \r | |
463 | PeiServices - The PEI core services table.\r | |
464 | OldCoreData - Pointer to the PEI Core data.\r | |
465 | NULL if being run in non-permament memory mode.\r | |
466 | \r | |
467 | Returns:\r | |
468 | Nothing\r | |
469 | \r | |
470 | --*/\r | |
471 | ;\r | |
472 | \r | |
473 | VOID\r | |
474 | ConvertPpiPointers (\r | |
58dcdada | 475 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
476 | IN UINTN OldCheckingBottom,\r | |
477 | IN UINTN OldCheckingTop,\r | |
192f6d4c | 478 | IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob\r |
479 | )\r | |
480 | /*++\r | |
481 | \r | |
482 | Routine Description:\r | |
483 | \r | |
484 | Migrate the Hob list from the CAR stack to PEI installed memory.\r | |
485 | \r | |
486 | Arguments:\r | |
487 | \r | |
58dcdada | 488 | PeiServices - The PEI core services table.\r |
489 | OldCheckingBottom - The old checking bottom.\r | |
490 | OldCheckingTop - The old checking top.\r | |
491 | NewHandOffHob - The new handoff HOB list.\r | |
192f6d4c | 492 | \r |
493 | Returns:\r | |
494 | \r | |
495 | --*/\r | |
496 | ;\r | |
497 | \r | |
498 | EFI_STATUS\r | |
499 | EFIAPI\r | |
500 | PeiInstallPpi (\r | |
0c2b5da8 | 501 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
502 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r | |
192f6d4c | 503 | )\r |
504 | /*++\r | |
505 | \r | |
506 | Routine Description:\r | |
507 | \r | |
508 | Install PPI services.\r | |
509 | \r | |
510 | Arguments:\r | |
511 | \r | |
512 | PeiServices - Pointer to the PEI Service Table\r | |
513 | PpiList - Pointer to a list of PEI PPI Descriptors.\r | |
514 | \r | |
515 | Returns:\r | |
516 | \r | |
517 | EFI_SUCCESS - if all PPIs in PpiList are successfully installed.\r | |
518 | EFI_INVALID_PARAMETER - if PpiList is NULL pointer\r | |
519 | EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid\r | |
520 | EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI\r | |
521 | \r | |
522 | --*/\r | |
523 | ;\r | |
524 | \r | |
525 | EFI_STATUS\r | |
526 | EFIAPI\r | |
527 | PeiReInstallPpi (\r | |
0c2b5da8 | 528 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
529 | IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r | |
530 | IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r | |
192f6d4c | 531 | )\r |
532 | /*++\r | |
533 | \r | |
534 | Routine Description:\r | |
535 | \r | |
536 | Re-Install PPI services.\r | |
537 | \r | |
538 | Arguments:\r | |
539 | \r | |
540 | PeiServices - Pointer to the PEI Service Table\r | |
541 | OldPpi - Pointer to the old PEI PPI Descriptors.\r | |
542 | NewPpi - Pointer to the new PEI PPI Descriptors.\r | |
543 | \r | |
544 | Returns:\r | |
545 | \r | |
546 | EFI_SUCCESS - if the operation was successful\r | |
547 | EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL\r | |
548 | EFI_INVALID_PARAMETER - if NewPpi is not valid\r | |
549 | EFI_NOT_FOUND - if the PPI was not in the database\r | |
550 | \r | |
551 | --*/\r | |
552 | ;\r | |
553 | \r | |
554 | EFI_STATUS\r | |
555 | EFIAPI\r | |
556 | PeiLocatePpi (\r | |
0c2b5da8 | 557 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
558 | IN CONST EFI_GUID *Guid,\r | |
192f6d4c | 559 | IN UINTN Instance,\r |
560 | IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r | |
561 | IN OUT VOID **Ppi\r | |
562 | )\r | |
563 | /*++\r | |
564 | \r | |
565 | Routine Description:\r | |
566 | \r | |
567 | Locate a given named PPI.\r | |
568 | \r | |
569 | Arguments:\r | |
570 | \r | |
571 | PeiServices - Pointer to the PEI Service Table\r | |
572 | Guid - Pointer to GUID of the PPI.\r | |
573 | Instance - Instance Number to discover.\r | |
574 | PpiDescriptor - Pointer to reference the found descriptor. If not NULL,\r | |
575 | returns a pointer to the descriptor (includes flags, etc)\r | |
576 | Ppi - Pointer to reference the found PPI\r | |
577 | \r | |
578 | Returns:\r | |
579 | \r | |
580 | Status - EFI_SUCCESS if the PPI is in the database\r | |
581 | EFI_NOT_FOUND if the PPI is not in the database\r | |
582 | --*/\r | |
583 | ;\r | |
584 | \r | |
585 | EFI_STATUS\r | |
586 | EFIAPI\r | |
587 | PeiNotifyPpi (\r | |
0c2b5da8 | 588 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
589 | IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r | |
192f6d4c | 590 | )\r |
591 | /*++\r | |
592 | \r | |
593 | Routine Description:\r | |
594 | \r | |
595 | Install a notification for a given PPI.\r | |
596 | \r | |
597 | Arguments:\r | |
598 | \r | |
599 | PeiServices - Pointer to the PEI Service Table\r | |
600 | NotifyList - Pointer to list of Descriptors to notify upon.\r | |
601 | \r | |
602 | Returns:\r | |
603 | \r | |
604 | Status - EFI_SUCCESS if successful\r | |
605 | EFI_OUT_OF_RESOURCES if no space in the database\r | |
606 | EFI_INVALID_PARAMETER if not a good decriptor\r | |
607 | \r | |
608 | --*/\r | |
609 | ;\r | |
610 | \r | |
611 | VOID\r | |
612 | ProcessNotifyList (\r | |
b0d803fe | 613 | IN PEI_CORE_INSTANCE *PrivateData\r |
192f6d4c | 614 | )\r |
615 | /*++\r | |
616 | \r | |
617 | Routine Description:\r | |
618 | \r | |
619 | Process the Notify List at dispatch level.\r | |
620 | \r | |
621 | Arguments:\r | |
622 | \r | |
623 | PeiServices - Pointer to the PEI Service Table\r | |
624 | \r | |
625 | Returns:\r | |
626 | \r | |
627 | --*/\r | |
628 | ;\r | |
629 | \r | |
630 | VOID\r | |
631 | DispatchNotify (\r | |
b0d803fe | 632 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 633 | IN UINTN NotifyType,\r |
634 | IN INTN InstallStartIndex,\r | |
635 | IN INTN InstallStopIndex,\r | |
636 | IN INTN NotifyStartIndex,\r | |
637 | IN INTN NotifyStopIndex\r | |
638 | )\r | |
639 | /*++\r | |
640 | \r | |
641 | Routine Description:\r | |
642 | \r | |
643 | Dispatch notifications.\r | |
644 | \r | |
645 | Arguments:\r | |
646 | \r | |
647 | PeiServices - Pointer to the PEI Service Table\r | |
648 | NotifyType - Type of notify to fire.\r | |
649 | InstallStartIndex - Install Beginning index.\r | |
650 | InstallStopIndex - Install Ending index.\r | |
651 | NotifyStartIndex - Notify Beginning index.\r | |
652 | NotifyStopIndex - Notify Ending index.\r | |
653 | \r | |
654 | Returns: None\r | |
655 | \r | |
656 | --*/\r | |
657 | ;\r | |
658 | \r | |
659 | //\r | |
660 | // Boot mode support functions\r | |
661 | //\r | |
662 | EFI_STATUS\r | |
663 | EFIAPI\r | |
664 | PeiGetBootMode (\r | |
0c2b5da8 | 665 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 666 | IN OUT EFI_BOOT_MODE *BootMode\r |
667 | )\r | |
668 | /*++\r | |
669 | \r | |
670 | Routine Description:\r | |
671 | \r | |
672 | This service enables PEIMs to ascertain the present value of the boot mode.\r | |
673 | \r | |
674 | Arguments:\r | |
675 | \r | |
676 | PeiServices - The PEI core services table.\r | |
677 | BootMode - A pointer to contain the value of the boot mode.\r | |
678 | \r | |
679 | Returns:\r | |
680 | \r | |
681 | EFI_SUCCESS - The boot mode was returned successfully.\r | |
682 | EFI_INVALID_PARAMETER - BootMode is NULL.\r | |
683 | \r | |
684 | --*/\r | |
685 | ;\r | |
686 | \r | |
687 | EFI_STATUS\r | |
688 | EFIAPI\r | |
689 | PeiSetBootMode (\r | |
0c2b5da8 | 690 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 691 | IN EFI_BOOT_MODE BootMode\r |
692 | )\r | |
693 | /*++\r | |
694 | \r | |
695 | Routine Description:\r | |
696 | \r | |
697 | This service enables PEIMs to update the boot mode variable.\r | |
698 | \r | |
699 | Arguments:\r | |
700 | \r | |
701 | PeiServices - The PEI core services table.\r | |
702 | BootMode - The value of the boot mode to set.\r | |
703 | \r | |
704 | Returns:\r | |
705 | \r | |
706 | EFI_SUCCESS - The value was successfully updated\r | |
707 | \r | |
708 | --*/\r | |
709 | ;\r | |
710 | \r | |
711 | //\r | |
712 | // Security support functions\r | |
713 | //\r | |
714 | VOID\r | |
715 | InitializeSecurityServices (\r | |
716 | IN EFI_PEI_SERVICES **PeiServices,\r | |
717 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
718 | )\r | |
719 | /*++\r | |
720 | \r | |
721 | Routine Description:\r | |
722 | \r | |
723 | Initialize the security services.\r | |
724 | \r | |
725 | Arguments:\r | |
726 | \r | |
727 | PeiServices - The PEI core services table.\r | |
728 | OldCoreData - Pointer to the old core data.\r | |
729 | NULL if being run in non-permament memory mode.\r | |
730 | Returns:\r | |
731 | \r | |
732 | None\r | |
733 | \r | |
734 | --*/\r | |
735 | ;\r | |
736 | \r | |
737 | EFI_STATUS\r | |
738 | VerifyFv (\r | |
739 | IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress\r | |
740 | )\r | |
741 | /*++\r | |
742 | \r | |
743 | Routine Description:\r | |
744 | \r | |
745 | Provide a callout to the OEM FV verification service.\r | |
746 | \r | |
747 | Arguments:\r | |
748 | \r | |
749 | CurrentFvAddress - Pointer to the FV under investigation.\r | |
750 | \r | |
751 | Returns:\r | |
752 | \r | |
753 | Status - EFI_SUCCESS\r | |
754 | \r | |
755 | --*/\r | |
756 | ;\r | |
757 | \r | |
758 | \r | |
759 | EFI_STATUS\r | |
760 | VerifyPeim (\r | |
b0d803fe | 761 | IN PEI_CORE_INSTANCE *PrivateData,\r |
762 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
763 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
192f6d4c | 764 | )\r |
765 | /*++\r | |
766 | \r | |
767 | Routine Description:\r | |
768 | \r | |
769 | Provide a callout to the security verification service.\r | |
770 | \r | |
771 | Arguments:\r | |
772 | \r | |
773 | PeiServices - The PEI core services table.\r | |
774 | CurrentPeimAddress - Pointer to the Firmware File under investigation.\r | |
775 | \r | |
776 | Returns:\r | |
777 | \r | |
778 | EFI_SUCCESS - Image is OK\r | |
779 | EFI_SECURITY_VIOLATION - Image is illegal\r | |
780 | \r | |
781 | --*/\r | |
782 | ;\r | |
783 | \r | |
784 | \r | |
785 | EFI_STATUS\r | |
786 | EFIAPI\r | |
787 | PeiGetHobList (\r | |
0c2b5da8 | 788 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 789 | IN OUT VOID **HobList\r |
790 | )\r | |
791 | /*++\r | |
792 | \r | |
793 | Routine Description:\r | |
794 | \r | |
795 | Gets the pointer to the HOB List.\r | |
796 | \r | |
797 | Arguments:\r | |
798 | \r | |
799 | PeiServices - The PEI core services table.\r | |
800 | HobList - Pointer to the HOB List.\r | |
801 | \r | |
802 | Returns:\r | |
803 | \r | |
804 | EFI_SUCCESS - Get the pointer of HOB List\r | |
805 | EFI_NOT_AVAILABLE_YET - the HOB List is not yet published\r | |
806 | EFI_INVALID_PARAMETER - HobList is NULL (in debug mode)\r | |
807 | \r | |
808 | --*/\r | |
809 | ;\r | |
810 | \r | |
811 | EFI_STATUS\r | |
812 | EFIAPI\r | |
813 | PeiCreateHob (\r | |
0c2b5da8 | 814 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 815 | IN UINT16 Type,\r |
816 | IN UINT16 Length,\r | |
817 | IN OUT VOID **Hob\r | |
818 | )\r | |
819 | /*++\r | |
820 | \r | |
821 | Routine Description:\r | |
822 | \r | |
823 | Add a new HOB to the HOB List.\r | |
824 | \r | |
825 | Arguments:\r | |
826 | \r | |
827 | PeiServices - The PEI core services table.\r | |
828 | Type - Type of the new HOB.\r | |
829 | Length - Length of the new HOB to allocate.\r | |
830 | Hob - Pointer to the new HOB.\r | |
831 | \r | |
832 | Returns:\r | |
833 | \r | |
834 | Status - EFI_SUCCESS\r | |
835 | - EFI_INVALID_PARAMETER if Hob is NULL\r | |
836 | - EFI_NOT_AVAILABLE_YET if HobList is still not available.\r | |
837 | - EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.\r | |
838 | \r | |
839 | --*/\r | |
840 | ;\r | |
841 | \r | |
842 | EFI_STATUS\r | |
843 | PeiCoreBuildHobHandoffInfoTable (\r | |
844 | IN EFI_BOOT_MODE BootMode,\r | |
845 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r | |
846 | IN UINT64 MemoryLength\r | |
847 | )\r | |
848 | /*++\r | |
849 | \r | |
850 | Routine Description:\r | |
851 | \r | |
852 | Builds a Handoff Information Table HOB\r | |
853 | \r | |
854 | Arguments:\r | |
855 | \r | |
856 | BootMode - Current Bootmode\r | |
857 | MemoryBegin - Start Memory Address.\r | |
858 | MemoryLength - Length of Memory.\r | |
859 | \r | |
860 | Returns:\r | |
861 | \r | |
862 | EFI_SUCCESS\r | |
863 | \r | |
864 | --*/\r | |
865 | ;\r | |
866 | \r | |
867 | \r | |
868 | //\r | |
869 | // FFS Fw Volume support functions\r | |
870 | //\r | |
871 | EFI_STATUS\r | |
872 | EFIAPI\r | |
873 | PeiFfsFindNextFile (\r | |
0c2b5da8 | 874 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 875 | IN UINT8 SearchType,\r |
0c2b5da8 | 876 | IN EFI_PEI_FV_HANDLE FwVolHeader,\r |
877 | IN OUT EFI_PEI_FILE_HANDLE *FileHeader\r | |
192f6d4c | 878 | )\r |
879 | /*++\r | |
880 | \r | |
881 | Routine Description:\r | |
882 | Given the input file pointer, search for the next matching file in the\r | |
883 | FFS volume as defined by SearchType. The search starts from FileHeader inside\r | |
884 | the Firmware Volume defined by FwVolHeader.\r | |
885 | \r | |
886 | Arguments:\r | |
887 | PeiServices - Pointer to the PEI Core Services Table.\r | |
888 | \r | |
889 | SearchType - Filter to find only files of this type.\r | |
890 | Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r | |
891 | \r | |
892 | FwVolHeader - Pointer to the FV header of the volume to search.\r | |
893 | This parameter must point to a valid FFS volume.\r | |
894 | \r | |
895 | FileHeader - Pointer to the current file from which to begin searching.\r | |
896 | This pointer will be updated upon return to reflect the file found.\r | |
897 | \r | |
898 | Returns:\r | |
899 | EFI_NOT_FOUND - No files matching the search criteria were found\r | |
900 | EFI_SUCCESS\r | |
901 | \r | |
902 | --*/\r | |
903 | ;\r | |
904 | \r | |
905 | EFI_STATUS\r | |
906 | EFIAPI\r | |
907 | PeiFfsFindSectionData (\r | |
b0d803fe | 908 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 909 | IN EFI_SECTION_TYPE SectionType,\r |
0c2b5da8 | 910 | IN EFI_PEI_FILE_HANDLE FfsFileHeader,\r |
192f6d4c | 911 | IN OUT VOID **SectionData\r |
912 | )\r | |
913 | /*++\r | |
914 | \r | |
915 | Routine Description:\r | |
916 | Given the input file pointer, search for the next matching section in the\r | |
917 | FFS volume.\r | |
918 | \r | |
919 | Arguments:\r | |
920 | PeiServices - Pointer to the PEI Core Services Table.\r | |
921 | SearchType - Filter to find only sections of this type.\r | |
922 | FfsFileHeader - Pointer to the current file to search.\r | |
923 | SectionData - Pointer to the Section matching SectionType in FfsFileHeader.\r | |
924 | - NULL if section not found\r | |
925 | \r | |
926 | Returns:\r | |
927 | EFI_NOT_FOUND - No files matching the search criteria were found\r | |
928 | EFI_SUCCESS\r | |
929 | \r | |
930 | --*/\r | |
931 | ;\r | |
932 | \r | |
933 | EFI_STATUS\r | |
934 | EFIAPI\r | |
935 | PeiFvFindNextVolume (\r | |
0c2b5da8 | 936 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 937 | IN UINTN Instance,\r |
0c2b5da8 | 938 | IN OUT EFI_PEI_FV_HANDLE *FwVolHeader\r |
192f6d4c | 939 | )\r |
940 | /*++\r | |
941 | \r | |
942 | Routine Description:\r | |
943 | \r | |
944 | Return the BFV location\r | |
945 | \r | |
946 | BugBug -- Move this to the location of this code to where the\r | |
947 | other FV and FFS support code lives.\r | |
948 | Also, update to use FindFV for instances #'s >= 1.\r | |
949 | \r | |
950 | Arguments:\r | |
951 | \r | |
952 | PeiServices - The PEI core services table.\r | |
953 | Instance - Instance of FV to find\r | |
954 | FwVolHeader - Pointer to contain the data to return\r | |
955 | \r | |
956 | Returns:\r | |
957 | Pointer to the Firmware Volume instance requested\r | |
958 | \r | |
959 | EFI_INVALID_PARAMETER - FwVolHeader is NULL\r | |
960 | \r | |
961 | EFI_SUCCESS - Firmware volume instance successfully found.\r | |
962 | \r | |
963 | --*/\r | |
964 | ;\r | |
965 | \r | |
966 | //\r | |
967 | // Memory support functions\r | |
968 | //\r | |
969 | VOID\r | |
970 | InitializeMemoryServices (\r | |
b0d803fe | 971 | IN PEI_CORE_INSTANCE *PrivateData,\r |
5aae0aa7 | 972 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
192f6d4c | 973 | IN PEI_CORE_INSTANCE *OldCoreData\r |
974 | )\r | |
975 | /*++\r | |
976 | \r | |
977 | Routine Description:\r | |
978 | \r | |
979 | Initialize the memory services.\r | |
980 | \r | |
981 | Arguments:\r | |
982 | \r | |
983 | PeiServices - The PEI core services table.\r | |
984 | PeiStartupDescriptor - Information and services provided by SEC phase.\r | |
985 | OldCoreData - Pointer to the PEI Core data.\r | |
986 | NULL if being run in non-permament memory mode.\r | |
987 | \r | |
988 | Returns:\r | |
989 | \r | |
990 | None\r | |
991 | \r | |
992 | --*/\r | |
993 | ;\r | |
994 | \r | |
995 | EFI_STATUS\r | |
996 | EFIAPI\r | |
997 | PeiInstallPeiMemory (\r | |
0c2b5da8 | 998 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 999 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r |
1000 | IN UINT64 MemoryLength\r | |
1001 | )\r | |
1002 | /*++\r | |
1003 | \r | |
1004 | Routine Description:\r | |
1005 | \r | |
1006 | Install the permanent memory is now available.\r | |
1007 | Creates HOB (PHIT and Stack).\r | |
1008 | \r | |
1009 | Arguments:\r | |
1010 | \r | |
1011 | PeiServices - The PEI core services table.\r | |
1012 | MemoryBegin - Start of memory address.\r | |
1013 | MemoryLength - Length of memory.\r | |
1014 | \r | |
1015 | Returns:\r | |
1016 | \r | |
1017 | Status - EFI_SUCCESS\r | |
1018 | \r | |
1019 | --*/\r | |
1020 | ;\r | |
1021 | \r | |
1022 | EFI_STATUS\r | |
1023 | EFIAPI\r | |
1024 | PeiAllocatePages (\r | |
0c2b5da8 | 1025 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 1026 | IN EFI_MEMORY_TYPE MemoryType,\r |
1027 | IN UINTN Pages,\r | |
1028 | OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
1029 | )\r | |
1030 | /*++\r | |
1031 | \r | |
1032 | Routine Description:\r | |
1033 | \r | |
1034 | Memory allocation service on permanent memory,\r | |
1035 | not usable prior to the memory installation.\r | |
1036 | \r | |
1037 | Arguments:\r | |
1038 | \r | |
1039 | PeiServices - The PEI core services table.\r | |
1040 | Type - Type of allocation.\r | |
1041 | MemoryType - Type of memory to allocate.\r | |
1042 | Pages - Number of pages to allocate.\r | |
1043 | Memory - Pointer of memory allocated.\r | |
1044 | \r | |
1045 | Returns:\r | |
1046 | \r | |
1047 | Status - EFI_SUCCESS The allocation was successful\r | |
1048 | EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.\r | |
1049 | EFI_NOT_AVAILABLE_YET Called with permanent memory not available\r | |
1050 | EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement\r | |
1051 | to allocate the number of pages.\r | |
1052 | \r | |
1053 | --*/\r | |
1054 | ;\r | |
1055 | \r | |
1056 | EFI_STATUS\r | |
1057 | EFIAPI\r | |
1058 | PeiAllocatePool (\r | |
0c2b5da8 | 1059 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 1060 | IN UINTN Size,\r |
1061 | OUT VOID **Buffer\r | |
1062 | )\r | |
1063 | /*++\r | |
1064 | \r | |
1065 | Routine Description:\r | |
1066 | \r | |
1067 | Memory allocation service on the CAR.\r | |
1068 | \r | |
1069 | Arguments:\r | |
1070 | \r | |
1071 | PeiServices - The PEI core services table.\r | |
1072 | \r | |
1073 | Size - Amount of memory required\r | |
1074 | \r | |
1075 | Buffer - Address of pointer to the buffer\r | |
1076 | \r | |
1077 | Returns:\r | |
1078 | \r | |
1079 | Status - EFI_SUCCESS The allocation was successful\r | |
1080 | EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement\r | |
1081 | to allocate the requested size.\r | |
1082 | \r | |
1083 | --*/\r | |
1084 | ;\r | |
1085 | \r | |
1086 | EFI_STATUS\r | |
1087 | PeiLoadImage (\r | |
1088 | IN EFI_PEI_SERVICES **PeiServices,\r | |
b0d803fe | 1089 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
1090 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r | |
1091 | OUT UINT32 *AuthenticationState\r | |
192f6d4c | 1092 | )\r |
1093 | /*++\r | |
1094 | \r | |
1095 | Routine Description:\r | |
1096 | \r | |
1097 | Get entry point of a Peim file.\r | |
1098 | \r | |
1099 | Arguments:\r | |
1100 | \r | |
1101 | PeiServices - Calling context.\r | |
1102 | \r | |
1103 | PeimFileHeader - Peim file's header.\r | |
1104 | \r | |
1105 | EntryPoint - Entry point of that Peim file.\r | |
1106 | \r | |
1107 | Returns:\r | |
1108 | \r | |
1109 | Status code.\r | |
1110 | \r | |
1111 | --*/\r | |
1112 | ;\r | |
1113 | \r | |
1114 | \r | |
1115 | EFI_STATUS\r | |
1116 | EFIAPI\r | |
1117 | PeiReportStatusCode (\r | |
0c2b5da8 | 1118 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 1119 | IN EFI_STATUS_CODE_TYPE CodeType,\r |
1120 | IN EFI_STATUS_CODE_VALUE Value,\r | |
1121 | IN UINT32 Instance,\r | |
0c2b5da8 | 1122 | IN CONST EFI_GUID *CallerId,\r |
1123 | IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
192f6d4c | 1124 | )\r |
1125 | /*++\r | |
1126 | \r | |
1127 | Routine Description:\r | |
1128 | \r | |
1129 | Core version of the Status Code reporter\r | |
1130 | \r | |
1131 | Arguments:\r | |
1132 | \r | |
1133 | PeiServices - The PEI core services table.\r | |
1134 | \r | |
1135 | CodeType - Type of Status Code.\r | |
1136 | \r | |
1137 | Value - Value to output for Status Code.\r | |
1138 | \r | |
1139 | Instance - Instance Number of this status code.\r | |
1140 | \r | |
1141 | CallerId - ID of the caller of this status code.\r | |
1142 | \r | |
1143 | Data - Optional data associated with this status code.\r | |
1144 | \r | |
1145 | Returns:\r | |
1146 | \r | |
1147 | Status - EFI_SUCCESS if status code is successfully reported\r | |
1148 | - EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed\r | |
1149 | \r | |
1150 | --*/\r | |
1151 | ;\r | |
1152 | \r | |
1153 | \r | |
1154 | EFI_STATUS\r | |
1155 | EFIAPI\r | |
1156 | PeiResetSystem (\r | |
b0d803fe | 1157 | IN CONST EFI_PEI_SERVICES **PeiServices\r |
192f6d4c | 1158 | )\r |
1159 | /*++\r | |
1160 | \r | |
1161 | Routine Description:\r | |
1162 | \r | |
1163 | Core version of the Reset System\r | |
1164 | \r | |
1165 | Arguments:\r | |
1166 | \r | |
1167 | PeiServices - The PEI core services table.\r | |
1168 | \r | |
1169 | Returns:\r | |
1170 | \r | |
1171 | Status - EFI_NOT_AVAILABLE_YET. PPI not available yet.\r | |
1172 | - EFI_DEVICE_ERROR. Did not reset system.\r | |
1173 | \r | |
1174 | Otherwise, resets the system.\r | |
1175 | \r | |
1176 | --*/\r | |
1177 | ;\r | |
1178 | \r | |
50cb16d9 | 1179 | VOID\r |
b0d803fe | 1180 | PeiInitializeFv (\r |
1181 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
1182 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r | |
1183 | )\r | |
1184 | /*++\r | |
1185 | \r | |
1186 | Routine Description:\r | |
1187 | \r | |
1188 | Initialize PeiCore Fv List.\r | |
1189 | \r | |
1190 | Arguments:\r | |
1191 | PrivateData - Pointer to PEI_CORE_INSTANCE.\r | |
1192 | SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.\r | |
1193 | \r | |
1194 | Returns:\r | |
50cb16d9 | 1195 | NONE\r |
1196 | \r | |
1197 | --*/\r | |
b0d803fe | 1198 | ;\r |
1199 | \r | |
1200 | EFI_STATUS\r | |
1201 | EFIAPI\r | |
1202 | FirmwareVolmeInfoPpiNotifyCallback (\r | |
1203 | IN EFI_PEI_SERVICES **PeiServices,\r | |
1204 | IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r | |
1205 | IN VOID *Ppi\r | |
1206 | )\r | |
1207 | /*++\r | |
1208 | \r | |
1209 | Routine Description:\r | |
1210 | \r | |
1211 | Process Firmware Volum Information once FvInfoPPI install.\r | |
1212 | \r | |
1213 | Arguments:\r | |
1214 | \r | |
1215 | PeiServices - General purpose services available to every PEIM.\r | |
50cb16d9 | 1216 | \r |
b0d803fe | 1217 | Returns:\r |
1218 | \r | |
1219 | Status - EFI_SUCCESS if the interface could be successfully\r | |
1220 | installed\r | |
1221 | \r | |
1222 | --*/\r | |
1223 | ;\r | |
1224 | \r | |
1225 | \r | |
1226 | EFI_STATUS\r | |
50cb16d9 | 1227 | EFIAPI\r |
b0d803fe | 1228 | PeiFfsFindFileByName (\r |
1229 | IN CONST EFI_GUID *FileName,\r | |
1230 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
1231 | OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
1232 | )\r | |
1233 | /*++\r | |
1234 | \r | |
1235 | Routine Description:\r | |
1236 | \r | |
1237 | Given the input VolumeHandle, search for the next matching name file.\r | |
1238 | \r | |
1239 | Arguments:\r | |
1240 | \r | |
1241 | FileName - File name to search.\r | |
1242 | VolumeHandle - The current FV to search.\r | |
1243 | FileHandle - Pointer to the file matching name in VolumeHandle.\r | |
1244 | - NULL if file not found\r | |
1245 | Returns:\r | |
1246 | EFI_STATUS\r | |
50cb16d9 | 1247 | \r |
1248 | --*/\r | |
b0d803fe | 1249 | ;\r |
1250 | \r | |
1251 | \r | |
1252 | EFI_STATUS\r | |
50cb16d9 | 1253 | EFIAPI\r |
b0d803fe | 1254 | PeiFfsGetFileInfo (\r |
1255 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
1256 | OUT EFI_FV_FILE_INFO *FileInfo\r | |
1257 | )\r | |
1258 | /*++\r | |
1259 | \r | |
1260 | Routine Description:\r | |
1261 | \r | |
1262 | Collect information of given file.\r | |
1263 | \r | |
1264 | Arguments:\r | |
1265 | FileHandle - The handle to file.\r | |
1266 | FileInfo - Pointer to the file information.\r | |
1267 | \r | |
1268 | Returns:\r | |
1269 | EFI_STATUS\r | |
50cb16d9 | 1270 | \r |
1271 | --*/\r | |
b0d803fe | 1272 | ;\r |
1273 | \r | |
1274 | EFI_STATUS\r | |
50cb16d9 | 1275 | EFIAPI\r |
b0d803fe | 1276 | PeiFfsGetVolumeInfo (\r |
1277 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
1278 | OUT EFI_FV_INFO *VolumeInfo\r | |
1279 | )\r | |
1280 | /*++\r | |
1281 | \r | |
1282 | Routine Description:\r | |
1283 | \r | |
1284 | Collect information of given Fv Volume.\r | |
1285 | \r | |
1286 | Arguments:\r | |
1287 | VolumeHandle - The handle to Fv Volume.\r | |
1288 | VolumeInfo - The pointer to volume information.\r | |
50cb16d9 | 1289 | \r |
b0d803fe | 1290 | Returns:\r |
1291 | EFI_STATUS\r | |
50cb16d9 | 1292 | \r |
1293 | --*/\r | |
b0d803fe | 1294 | ;\r |
1295 | \r | |
1296 | \r | |
1297 | EFI_STATUS\r | |
1298 | EFIAPI\r | |
1299 | PeiRegisterForShadow (\r | |
1300 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
1301 | )\r | |
1302 | /*++\r | |
1303 | \r | |
1304 | Routine Description:\r | |
1305 | \r | |
1306 | This routine enable a PEIM to register itself to shadow when PEI Foundation\r | |
1307 | discovery permanent memory.\r | |
1308 | \r | |
1309 | Arguments:\r | |
1310 | FileHandle - File handle of a PEIM.\r | |
50cb16d9 | 1311 | \r |
b0d803fe | 1312 | Returns:\r |
1313 | EFI_NOT_FOUND - The file handle doesn't point to PEIM itself.\r | |
1314 | EFI_ALREADY_STARTED - Indicate that the PEIM has been registered itself.\r | |
1315 | EFI_SUCCESS - Successfully to register itself.\r | |
1316 | \r | |
50cb16d9 | 1317 | --*/\r |
b0d803fe | 1318 | ;\r |
1319 | \r | |
1320 | \r | |
14e8823a | 1321 | /**\r |
1322 | This routine enable a PEIM to register itself to shadow when PEI Foundation\r | |
1323 | discovery permanent memory.\r | |
1324 | \r | |
1325 | @param FileHandle File handle of a PEIM.\r | |
50cb16d9 | 1326 | \r |
14e8823a | 1327 | @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.\r |
1328 | @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.\r | |
1329 | @retval EFI_SUCCESS Successfully to register itself.\r | |
1330 | \r | |
50cb16d9 | 1331 | **/\r |
14e8823a | 1332 | EFI_STATUS\r |
1333 | EFIAPI\r | |
1334 | PeiRegisterForShadow (\r | |
1335 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
1336 | )\r | |
1337 | ;\r | |
1338 | \r | |
192f6d4c | 1339 | /**\r |
1340 | Transfers control to a function starting with a new stack.\r | |
1341 | \r | |
1342 | Transfers control to the function specified by EntryPoint using the new stack\r | |
1343 | specified by NewStack and passing in the parameters specified by Context1 and\r | |
1344 | Context2. Context1 and Context2 are optional and may be NULL. The function\r | |
1345 | EntryPoint must never return.\r | |
1346 | \r | |
1347 | If EntryPoint is NULL, then ASSERT().\r | |
1348 | If NewStack is NULL, then ASSERT().\r | |
1349 | \r | |
1350 | @param EntryPoint A pointer to function to call with the new stack.\r | |
1351 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
1352 | function.\r | |
1353 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
1354 | function.\r | |
1355 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
1356 | function.\r | |
1357 | @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's\r | |
1358 | Reserved on other architectures.\r | |
1359 | \r | |
1360 | **/\r | |
1361 | VOID\r | |
1362 | EFIAPI\r | |
1363 | PeiSwitchStacks (\r | |
1364 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
1365 | IN VOID *Context1, OPTIONAL\r | |
1366 | IN VOID *Context2, OPTIONAL\r | |
1367 | IN VOID *NewStack,\r | |
1368 | IN VOID *NewBsp\r | |
1369 | );\r | |
1370 | \r | |
b0d803fe | 1371 | EFI_STATUS\r |
1372 | PeiFindFileEx (\r | |
1373 | IN CONST EFI_PEI_FV_HANDLE FvHandle,\r | |
1374 | IN CONST EFI_GUID *FileName, OPTIONAL\r | |
1375 | IN EFI_FV_FILETYPE SearchType,\r | |
1376 | IN OUT EFI_PEI_FILE_HANDLE *FileHandle,\r | |
1377 | IN OUT EFI_PEI_FV_HANDLE *AprioriFile OPTIONAL\r | |
1378 | )\r | |
1379 | /*++\r | |
1380 | \r | |
1381 | Routine Description:\r | |
1382 | Given the input file pointer, search for the next matching file in the\r | |
1383 | FFS volume as defined by SearchType. The search starts from FileHeader inside\r | |
1384 | the Firmware Volume defined by FwVolHeader.\r | |
1385 | \r | |
1386 | Arguments:\r | |
1387 | PeiServices - Pointer to the PEI Core Services Table.\r | |
1388 | SearchType - Filter to find only files of this type.\r | |
1389 | Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r | |
1390 | FwVolHeader - Pointer to the FV header of the volume to search.\r | |
1391 | This parameter must point to a valid FFS volume.\r | |
1392 | FileHeader - Pointer to the current file from which to begin searching.\r | |
1393 | This pointer will be updated upon return to reflect the file found.\r | |
50cb16d9 | 1394 | Flag - Indicator for if this is for PEI Dispath search\r |
1395 | \r | |
b0d803fe | 1396 | Returns:\r |
1397 | EFI_NOT_FOUND - No files matching the search criteria were found\r | |
1398 | EFI_SUCCESS\r | |
1399 | \r | |
1400 | --*/\r | |
1401 | ;\r | |
1402 | \r | |
1403 | VOID\r | |
1404 | InitializeImageServices (\r | |
1405 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
1406 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
1407 | )\r | |
1408 | /*++\r | |
1409 | \r | |
1410 | Routine Description:\r | |
1411 | \r | |
c58cf83d | 1412 | Install Pei Load File PPI.\r |
b0d803fe | 1413 | \r |
1414 | Arguments:\r | |
1415 | \r | |
1416 | PrivateData - Pointer to PEI_CORE_INSTANCE.\r | |
1417 | OldCoreData - Pointer to PEI_CORE_INSTANCE.\r | |
1418 | \r | |
1419 | Returns:\r | |
1420 | \r | |
1421 | NONE.\r | |
50cb16d9 | 1422 | \r |
1423 | --*/\r | |
b0d803fe | 1424 | ;\r |
1425 | \r | |
288f9b38 LG |
1426 | /**\r |
1427 | Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r | |
1428 | \r | |
1429 | @param PeiServices Pointer to the PEI Core Services Table.\r | |
1430 | @param FileHandle File handle of a Fv type file.\r | |
1431 | @param AuthenticationState Pointer to attestation authentication state of image.\r | |
1432 | \r | |
50cb16d9 | 1433 | \r |
288f9b38 LG |
1434 | @retval EFI_NOT_FOUND FV image can't be found.\r |
1435 | @retval EFI_SUCCESS Successfully to process it.\r | |
1436 | \r | |
1437 | **/\r | |
1438 | EFI_STATUS\r | |
1439 | ProcessFvFile (\r | |
1440 | IN EFI_PEI_SERVICES **PeiServices,\r | |
1441 | IN EFI_PEI_FILE_HANDLE FvFileHandle,\r | |
1442 | OUT UINT32 *AuthenticationState\r | |
1443 | );\r | |
1444 | \r | |
192f6d4c | 1445 | #endif\r |