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