]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Core/Pei/PeiMain.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain.h
... / ...
CommitLineData
1/** @file\r
2 Definition of Pei Core Structures and Services\r
3\r
4Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
5SPDX-License-Identifier: BSD-2-Clause-Patent\r
6\r
7**/\r
8\r
9#ifndef _PEI_MAIN_H_\r
10#define _PEI_MAIN_H_\r
11\r
12#include <PiPei.h>\r
13#include <Ppi/DxeIpl.h>\r
14#include <Ppi/MemoryDiscovered.h>\r
15#include <Ppi/StatusCode.h>\r
16#include <Ppi/Reset.h>\r
17#include <Ppi/Reset2.h>\r
18#include <Ppi/FirmwareVolume.h>\r
19#include <Ppi/FirmwareVolumeInfo.h>\r
20#include <Ppi/FirmwareVolumeInfo2.h>\r
21#include <Ppi/Decompress.h>\r
22#include <Ppi/GuidedSectionExtraction.h>\r
23#include <Ppi/LoadFile.h>\r
24#include <Ppi/Security2.h>\r
25#include <Ppi/TemporaryRamSupport.h>\r
26#include <Ppi/TemporaryRamDone.h>\r
27#include <Ppi/SecHobData.h>\r
28#include <Ppi/PeiCoreFvLocation.h>\r
29#include <Library/DebugLib.h>\r
30#include <Library/PeiCoreEntryPoint.h>\r
31#include <Library/BaseLib.h>\r
32#include <Library/HobLib.h>\r
33#include <Library/PerformanceLib.h>\r
34#include <Library/PeiServicesLib.h>\r
35#include <Library/ReportStatusCodeLib.h>\r
36#include <Library/PeCoffLib.h>\r
37#include <Library/PeCoffGetEntryPointLib.h>\r
38#include <Library/BaseMemoryLib.h>\r
39#include <Library/CacheMaintenanceLib.h>\r
40#include <Library/PcdLib.h>\r
41#include <IndustryStandard/PeImage.h>\r
42#include <Library/PeiServicesTablePointerLib.h>\r
43#include <Library/MemoryAllocationLib.h>\r
44#include <Guid/FirmwareFileSystem2.h>\r
45#include <Guid/FirmwareFileSystem3.h>\r
46#include <Guid/AprioriFileName.h>\r
47#include <Guid/MigratedFvInfo.h>\r
48\r
49///\r
50/// It is an FFS type extension used for PeiFindFileEx. It indicates current\r
51/// FFS searching is for all PEIMs can be dispatched by PeiCore.\r
52///\r
53#define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff\r
54\r
55///\r
56/// Pei Core private data structures\r
57///\r
58typedef union {\r
59 EFI_PEI_PPI_DESCRIPTOR *Ppi;\r
60 EFI_PEI_NOTIFY_DESCRIPTOR *Notify;\r
61 VOID *Raw;\r
62} PEI_PPI_LIST_POINTERS;\r
63\r
64///\r
65/// Number of PEI_PPI_LIST_POINTERS to grow by each time we run out of room\r
66///\r
67#define PPI_GROWTH_STEP 64\r
68#define CALLBACK_NOTIFY_GROWTH_STEP 32\r
69#define DISPATCH_NOTIFY_GROWTH_STEP 8\r
70\r
71typedef struct {\r
72 UINTN CurrentCount;\r
73 UINTN MaxCount;\r
74 UINTN LastDispatchedCount;\r
75 ///\r
76 /// MaxCount number of entries.\r
77 ///\r
78 PEI_PPI_LIST_POINTERS *PpiPtrs;\r
79} PEI_PPI_LIST;\r
80\r
81typedef struct {\r
82 UINTN CurrentCount;\r
83 UINTN MaxCount;\r
84 ///\r
85 /// MaxCount number of entries.\r
86 ///\r
87 PEI_PPI_LIST_POINTERS *NotifyPtrs;\r
88} PEI_CALLBACK_NOTIFY_LIST;\r
89\r
90typedef struct {\r
91 UINTN CurrentCount;\r
92 UINTN MaxCount;\r
93 UINTN LastDispatchedCount;\r
94 ///\r
95 /// MaxCount number of entries.\r
96 ///\r
97 PEI_PPI_LIST_POINTERS *NotifyPtrs;\r
98} PEI_DISPATCH_NOTIFY_LIST;\r
99\r
100///\r
101/// PPI database structure which contains three links:\r
102/// PpiList, CallbackNotifyList and DispatchNotifyList.\r
103///\r
104typedef struct {\r
105 ///\r
106 /// PPI List.\r
107 ///\r
108 PEI_PPI_LIST PpiList;\r
109 ///\r
110 /// Notify List at dispatch level.\r
111 ///\r
112 PEI_CALLBACK_NOTIFY_LIST CallbackNotifyList;\r
113 ///\r
114 /// Notify List at callback level.\r
115 ///\r
116 PEI_DISPATCH_NOTIFY_LIST DispatchNotifyList;\r
117} PEI_PPI_DATABASE;\r
118\r
119//\r
120// PEI_CORE_FV_HANDLE.PeimState\r
121// Do not change these values as there is code doing math to change states.\r
122// Look for Private->Fv[FvCount].PeimState[PeimCount]++;\r
123//\r
124#define PEIM_STATE_NOT_DISPATCHED 0x00\r
125#define PEIM_STATE_DISPATCHED 0x01\r
126#define PEIM_STATE_REGISTER_FOR_SHADOW 0x02\r
127#define PEIM_STATE_DONE 0x03\r
128\r
129//\r
130// Number of FV instances to grow by each time we run out of room\r
131//\r
132#define FV_GROWTH_STEP 8\r
133\r
134typedef struct {\r
135 EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r
136 EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;\r
137 EFI_PEI_FV_HANDLE FvHandle;\r
138 UINTN PeimCount;\r
139 //\r
140 // Pointer to the buffer with the PeimCount number of Entries.\r
141 //\r
142 UINT8 *PeimState;\r
143 //\r
144 // Pointer to the buffer with the PeimCount number of Entries.\r
145 //\r
146 EFI_PEI_FILE_HANDLE *FvFileHandles;\r
147 BOOLEAN ScanFv;\r
148 UINT32 AuthenticationStatus;\r
149} PEI_CORE_FV_HANDLE;\r
150\r
151typedef struct {\r
152 EFI_GUID FvFormat;\r
153 VOID *FvInfo;\r
154 UINT32 FvInfoSize;\r
155 UINT32 AuthenticationStatus;\r
156 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor;\r
157} PEI_CORE_UNKNOW_FORMAT_FV_INFO;\r
158\r
159#define CACHE_SETION_MAX_NUMBER 0x10\r
160typedef struct {\r
161 EFI_COMMON_SECTION_HEADER *Section[CACHE_SETION_MAX_NUMBER];\r
162 VOID *SectionData[CACHE_SETION_MAX_NUMBER];\r
163 UINTN SectionSize[CACHE_SETION_MAX_NUMBER];\r
164 UINT32 AuthenticationStatus[CACHE_SETION_MAX_NUMBER];\r
165 UINTN AllSectionCount;\r
166 UINTN SectionIndex;\r
167} CACHE_SECTION_DATA;\r
168\r
169#define HOLE_MAX_NUMBER 0x3\r
170typedef struct {\r
171 EFI_PHYSICAL_ADDRESS Base;\r
172 UINTN Size;\r
173 UINTN Offset;\r
174 BOOLEAN OffsetPositive;\r
175} HOLE_MEMORY_DATA;\r
176\r
177///\r
178/// Forward declaration for PEI_CORE_INSTANCE\r
179///\r
180typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE;\r
181\r
182/**\r
183 Function Pointer type for PeiCore function.\r
184 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
185 and location of temporary RAM, the stack location and the BFV location.\r
186 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
187 An empty PPI list consists of a single descriptor with the end-tag\r
188 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r
189 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r
190 that both the PEI Foundation and any modules can leverage the associated service\r
191 calls and/or code in these early PPIs\r
192 @param OldCoreData Pointer to old core data that is used to initialize the\r
193 core's data areas.\r
194**/\r
195typedef\r
196EFI_STATUS\r
197(EFIAPI *PEICORE_FUNCTION_POINTER)(\r
198 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
199 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r
200 IN PEI_CORE_INSTANCE *OldCoreData\r
201 );\r
202\r
203//\r
204// Number of files to grow by each time we run out of room\r
205//\r
206#define TEMP_FILE_GROWTH_STEP 32\r
207\r
208#define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')\r
209\r
210///\r
211/// Pei Core private data structure instance\r
212///\r
213struct _PEI_CORE_INSTANCE {\r
214 UINTN Signature;\r
215\r
216 ///\r
217 /// Point to ServiceTableShadow\r
218 ///\r
219 EFI_PEI_SERVICES *Ps;\r
220 PEI_PPI_DATABASE PpiData;\r
221\r
222 ///\r
223 /// The count of FVs which contains FFS and could be dispatched by PeiCore.\r
224 ///\r
225 UINTN FvCount;\r
226\r
227 ///\r
228 /// The max count of FVs which contains FFS and could be dispatched by PeiCore.\r
229 ///\r
230 UINTN MaxFvCount;\r
231\r
232 ///\r
233 /// Pointer to the buffer with the MaxFvCount number of entries.\r
234 /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.\r
235 ///\r
236 PEI_CORE_FV_HANDLE *Fv;\r
237\r
238 ///\r
239 /// Pointer to the buffer with the MaxUnknownFvInfoCount number of entries.\r
240 /// Each entry is for one FV which could not be dispatched by PeiCore.\r
241 ///\r
242 PEI_CORE_UNKNOW_FORMAT_FV_INFO *UnknownFvInfo;\r
243 UINTN MaxUnknownFvInfoCount;\r
244 UINTN UnknownFvInfoCount;\r
245\r
246 ///\r
247 /// Pointer to the buffer FvFileHandlers in PEI_CORE_FV_HANDLE specified by CurrentPeimFvCount.\r
248 ///\r
249 EFI_PEI_FILE_HANDLE *CurrentFvFileHandles;\r
250 UINTN AprioriCount;\r
251 UINTN CurrentPeimFvCount;\r
252 UINTN CurrentPeimCount;\r
253 EFI_PEI_FILE_HANDLE CurrentFileHandle;\r
254 BOOLEAN PeimNeedingDispatch;\r
255 BOOLEAN PeimDispatchOnThisPass;\r
256 BOOLEAN PeimDispatcherReenter;\r
257 EFI_PEI_HOB_POINTERS HobList;\r
258 BOOLEAN SwitchStackSignal;\r
259 BOOLEAN PeiMemoryInstalled;\r
260 VOID *CpuIo;\r
261 EFI_PEI_SECURITY2_PPI *PrivateSecurityPpi;\r
262 EFI_PEI_SERVICES ServiceTableShadow;\r
263 EFI_PEI_PPI_DESCRIPTOR *XipLoadFile;\r
264 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin;\r
265 UINT64 PhysicalMemoryLength;\r
266 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop;\r
267 UINTN HeapOffset;\r
268 BOOLEAN HeapOffsetPositive;\r
269 UINTN StackOffset;\r
270 BOOLEAN StackOffsetPositive;\r
271 //\r
272 // Information for migrating memory pages allocated in pre-memory phase.\r
273 //\r
274 HOLE_MEMORY_DATA MemoryPages;\r
275 PEICORE_FUNCTION_POINTER ShadowedPeiCore;\r
276 CACHE_SECTION_DATA CacheSection;\r
277 //\r
278 // For Loading modules at fixed address feature to cache the top address below which the\r
279 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field\r
280 // and Ps should not be changed since maybe user could get this top address by using the offset to Ps.\r
281 //\r
282 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress;\r
283 //\r
284 // The field is define for Loading modules at fixed address feature to tracker the PEI code\r
285 // memory range usage. It is a bit mapped array in which every bit indicates the corresponding memory page\r
286 // available or not.\r
287 //\r
288 UINT64 *PeiCodeMemoryRangeUsageBitMap;\r
289 //\r
290 // This field points to the shadowed image read function\r
291 //\r
292 PE_COFF_LOADER_READ_FILE ShadowedImageRead;\r
293\r
294 UINTN TempPeimCount;\r
295\r
296 //\r
297 // Pointer to the temp buffer with the TempPeimCount number of entries.\r
298 //\r
299 EFI_PEI_FILE_HANDLE *TempFileHandles;\r
300 //\r
301 // Pointer to the temp buffer with the TempPeimCount number of entries.\r
302 //\r
303 EFI_GUID *TempFileGuid;\r
304\r
305 //\r
306 // Temp Memory Range is not covered by PeiTempMem and Stack.\r
307 // Those Memory Range will be migrated into physical memory.\r
308 //\r
309 HOLE_MEMORY_DATA HoleData[HOLE_MAX_NUMBER];\r
310};\r
311\r
312///\r
313/// Pei Core Instance Data Macros\r
314///\r
315#define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r
316 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)\r
317\r
318///\r
319/// Union of temporarily used function pointers (to save stack space)\r
320///\r
321typedef union {\r
322 PEICORE_FUNCTION_POINTER PeiCore;\r
323 EFI_PEIM_ENTRY_POINT2 PeimEntry;\r
324 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;\r
325 EFI_DXE_IPL_PPI *DxeIpl;\r
326 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r
327 EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;\r
328 VOID *Raw;\r
329} PEI_CORE_TEMP_POINTERS;\r
330\r
331typedef struct {\r
332 CONST EFI_SEC_PEI_HAND_OFF *SecCoreData;\r
333 EFI_PEI_PPI_DESCRIPTOR *PpiList;\r
334 VOID *Data;\r
335} PEI_CORE_PARAMETERS;\r
336\r
337//\r
338// PeiCore function\r
339//\r
340\r
341/**\r
342\r
343 The entry routine to Pei Core, invoked by PeiMain during transition\r
344 from SEC to PEI. After switching stack in the PEI core, it will restart\r
345 with the old core data.\r
346\r
347\r
348 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
349 and location of temporary RAM, the stack location and the BFV location.\r
350 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
351 An empty PPI list consists of a single descriptor with the end-tag\r
352 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r
353 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r
354 that both the PEI Foundation and any modules can leverage the associated service\r
355 calls and/or code in these early PPIs\r
356 @param Data Pointer to old core data that is used to initialize the\r
357 core's data areas.\r
358\r
359**/\r
360VOID\r
361EFIAPI\r
362PeiCore (\r
363 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
364 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r
365 IN VOID *Data\r
366 );\r
367\r
368//\r
369// Dispatcher support functions\r
370//\r
371\r
372/**\r
373\r
374 This is the POSTFIX version of the dependency evaluator. When a\r
375 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on\r
376 the evaluation stack. When that entry is popped from the evaluation\r
377 stack, the PPI is checked if it is installed. This method allows\r
378 some time savings as not all PPIs must be checked for certain\r
379 operation types (AND, OR).\r
380\r
381\r
382 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
383 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to\r
384 the BNF described above and is stored in postfix notation.\r
385\r
386 @retval TRUE if it is a well-formed Grammar\r
387 @retval FALSE if the dependency expression overflows the evaluation stack\r
388 if the dependency expression underflows the evaluation stack\r
389 if the dependency expression is not a well-formed Grammar.\r
390\r
391**/\r
392BOOLEAN\r
393PeimDispatchReadiness (\r
394 IN EFI_PEI_SERVICES **PeiServices,\r
395 IN VOID *DependencyExpression\r
396 );\r
397\r
398/**\r
399 Migrate a PEIM from temporary RAM to permanent memory.\r
400\r
401 @param PeimFileHandle Pointer to the FFS file header of the image.\r
402 @param MigratedFileHandle Pointer to the FFS file header of the migrated image.\r
403\r
404 @retval EFI_SUCCESS Sucessfully migrated the PEIM to permanent memory.\r
405\r
406**/\r
407EFI_STATUS\r
408EFIAPI\r
409MigratePeim (\r
410 IN EFI_PEI_FILE_HANDLE FileHandle,\r
411 IN EFI_PEI_FILE_HANDLE MigratedFileHandle\r
412 );\r
413\r
414/**\r
415 Migrate FVs out of temporary RAM before the cache is flushed.\r
416\r
417 @param Private PeiCore's private data structure\r
418 @param SecCoreData Points to a data structure containing information about the PEI core's operating\r
419 environment, such as the size and location of temporary RAM, the stack location and\r
420 the BFV location.\r
421\r
422 @retval EFI_SUCCESS Successfully migrated installed FVs from temporary RAM to permanent memory.\r
423 @retval EFI_OUT_OF_RESOURCES Insufficient memory exists to allocate needed pages.\r
424\r
425**/\r
426EFI_STATUS\r
427EFIAPI\r
428EvacuateTempRam (\r
429 IN PEI_CORE_INSTANCE *Private,\r
430 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
431 );\r
432\r
433/**\r
434 Conduct PEIM dispatch.\r
435\r
436 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data\r
437 @param PrivateData Pointer to the private data passed in from caller\r
438\r
439**/\r
440VOID\r
441PeiDispatcher (\r
442 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
443 IN PEI_CORE_INSTANCE *PrivateData\r
444 );\r
445\r
446/**\r
447 Initialize the Dispatcher's data members\r
448\r
449 @param PrivateData PeiCore's private data structure\r
450 @param OldCoreData Old data from SecCore\r
451 NULL if being run in non-permanent memory mode.\r
452 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
453 and location of temporary RAM, the stack location and the BFV location.\r
454\r
455**/\r
456VOID\r
457InitializeDispatcherData (\r
458 IN PEI_CORE_INSTANCE *PrivateData,\r
459 IN PEI_CORE_INSTANCE *OldCoreData,\r
460 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
461 );\r
462\r
463/**\r
464 This routine parses the Dependency Expression, if available, and\r
465 decides if the module can be executed.\r
466\r
467\r
468 @param Private PeiCore's private data structure\r
469 @param FileHandle PEIM's file handle\r
470 @param PeimCount The index of last dispatched PEIM.\r
471\r
472 @retval TRUE Can be dispatched\r
473 @retval FALSE Cannot be dispatched\r
474\r
475**/\r
476BOOLEAN\r
477DepexSatisfied (\r
478 IN PEI_CORE_INSTANCE *Private,\r
479 IN EFI_PEI_FILE_HANDLE FileHandle,\r
480 IN UINTN PeimCount\r
481 );\r
482\r
483//\r
484// PPI support functions\r
485//\r
486\r
487/**\r
488\r
489 Initialize PPI services.\r
490\r
491 @param PrivateData Pointer to the PEI Core data.\r
492 @param OldCoreData Pointer to old PEI Core data.\r
493 NULL if being run in non-permanent memory mode.\r
494\r
495**/\r
496VOID\r
497InitializePpiServices (\r
498 IN PEI_CORE_INSTANCE *PrivateData,\r
499 IN PEI_CORE_INSTANCE *OldCoreData\r
500 );\r
501\r
502/**\r
503\r
504 Migrate the Hob list from the temporary memory to PEI installed memory.\r
505\r
506 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
507 and location of temporary RAM, the stack location and the BFV location.\r
508 @param PrivateData Pointer to PeiCore's private data structure.\r
509\r
510**/\r
511VOID\r
512ConvertPpiPointers (\r
513 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
514 IN PEI_CORE_INSTANCE *PrivateData\r
515 );\r
516\r
517/**\r
518\r
519 Migrate Notify Pointers inside an FV from temporary memory to permanent memory.\r
520\r
521 @param PrivateData Pointer to PeiCore's private data structure.\r
522 @param OrgFvHandle Address of FV Handle in temporary memory.\r
523 @param FvHandle Address of FV Handle in permanent memory.\r
524 @param FvSize Size of the FV.\r
525\r
526**/\r
527VOID\r
528ConvertPpiPointersFv (\r
529 IN PEI_CORE_INSTANCE *PrivateData,\r
530 IN UINTN OrgFvHandle,\r
531 IN UINTN FvHandle,\r
532 IN UINTN FvSize\r
533 );\r
534\r
535/**\r
536\r
537 Migrate PPI Pointers of PEI_CORE from temporary memory to permanent memory.\r
538\r
539 @param PrivateData Pointer to PeiCore's private data structure.\r
540 @param CoreFvHandle Address of PEI_CORE FV Handle in temporary memory.\r
541\r
542**/\r
543VOID\r
544ConvertPeiCorePpiPointers (\r
545 IN PEI_CORE_INSTANCE *PrivateData,\r
546 IN PEI_CORE_FV_HANDLE *CoreFvHandle\r
547 );\r
548\r
549/**\r
550\r
551 Dumps the PPI lists to debug output.\r
552\r
553 @param PrivateData Points to PeiCore's private instance data.\r
554\r
555**/\r
556VOID\r
557DumpPpiList (\r
558 IN PEI_CORE_INSTANCE *PrivateData\r
559 );\r
560\r
561/**\r
562\r
563 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.\r
564\r
565 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
566 @param PpiList Pointer to PPI array that want to be installed.\r
567\r
568 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.\r
569 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer\r
570 if any PPI in PpiList is not valid\r
571 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI\r
572\r
573**/\r
574EFI_STATUS\r
575EFIAPI\r
576PeiInstallPpi (\r
577 IN CONST EFI_PEI_SERVICES **PeiServices,\r
578 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
579 );\r
580\r
581/**\r
582\r
583 Re-Install PPI services.\r
584\r
585 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
586 @param OldPpi Pointer to the old PEI PPI Descriptors.\r
587 @param NewPpi Pointer to the new PEI PPI Descriptors.\r
588\r
589 @retval EFI_SUCCESS if the operation was successful\r
590 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL\r
591 if NewPpi is not valid\r
592 @retval EFI_NOT_FOUND if the PPI was not in the database\r
593\r
594**/\r
595EFI_STATUS\r
596EFIAPI\r
597PeiReInstallPpi (\r
598 IN CONST EFI_PEI_SERVICES **PeiServices,\r
599 IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
600 IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
601 );\r
602\r
603/**\r
604\r
605 Locate a given named PPI.\r
606\r
607\r
608 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
609 @param Guid Pointer to GUID of the PPI.\r
610 @param Instance Instance Number to discover.\r
611 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,\r
612 returns a pointer to the descriptor (includes flags, etc)\r
613 @param Ppi Pointer to reference the found PPI\r
614\r
615 @retval EFI_SUCCESS if the PPI is in the database\r
616 @retval EFI_NOT_FOUND if the PPI is not in the database\r
617\r
618**/\r
619EFI_STATUS\r
620EFIAPI\r
621PeiLocatePpi (\r
622 IN CONST EFI_PEI_SERVICES **PeiServices,\r
623 IN CONST EFI_GUID *Guid,\r
624 IN UINTN Instance,\r
625 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
626 IN OUT VOID **Ppi\r
627 );\r
628\r
629/**\r
630\r
631 Install a notification for a given PPI.\r
632\r
633\r
634 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
635 @param NotifyList Pointer to list of Descriptors to notify upon.\r
636\r
637 @retval EFI_SUCCESS if successful\r
638 @retval EFI_OUT_OF_RESOURCES if no space in the database\r
639 @retval EFI_INVALID_PARAMETER if not a good descriptor\r
640\r
641**/\r
642EFI_STATUS\r
643EFIAPI\r
644PeiNotifyPpi (\r
645 IN CONST EFI_PEI_SERVICES **PeiServices,\r
646 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
647 );\r
648\r
649/**\r
650\r
651 Process the Notify List at dispatch level.\r
652\r
653 @param PrivateData PeiCore's private data structure.\r
654\r
655**/\r
656VOID\r
657ProcessDispatchNotifyList (\r
658 IN PEI_CORE_INSTANCE *PrivateData\r
659 );\r
660\r
661/**\r
662\r
663 Process notifications.\r
664\r
665 @param PrivateData PeiCore's private data structure\r
666 @param NotifyType Type of notify to fire.\r
667 @param InstallStartIndex Install Beginning index.\r
668 @param InstallStopIndex Install Ending index.\r
669 @param NotifyStartIndex Notify Beginning index.\r
670 @param NotifyStopIndex Notify Ending index.\r
671\r
672**/\r
673VOID\r
674ProcessNotify (\r
675 IN PEI_CORE_INSTANCE *PrivateData,\r
676 IN UINTN NotifyType,\r
677 IN INTN InstallStartIndex,\r
678 IN INTN InstallStopIndex,\r
679 IN INTN NotifyStartIndex,\r
680 IN INTN NotifyStopIndex\r
681 );\r
682\r
683/**\r
684 Process PpiList from SEC phase.\r
685\r
686 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
687 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
688 These PPI's will be installed and/or immediately signaled if they are notification type.\r
689\r
690**/\r
691VOID\r
692ProcessPpiListFromSec (\r
693 IN CONST EFI_PEI_SERVICES **PeiServices,\r
694 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
695 );\r
696\r
697//\r
698// Boot mode support functions\r
699//\r
700\r
701/**\r
702 This service enables PEIMs to ascertain the present value of the boot mode.\r
703\r
704 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
705 @param BootMode A pointer to contain the value of the boot mode.\r
706\r
707 @retval EFI_SUCCESS The boot mode was returned successfully.\r
708 @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
709\r
710**/\r
711EFI_STATUS\r
712EFIAPI\r
713PeiGetBootMode (\r
714 IN CONST EFI_PEI_SERVICES **PeiServices,\r
715 IN OUT EFI_BOOT_MODE *BootMode\r
716 );\r
717\r
718/**\r
719 This service enables PEIMs to update the boot mode variable.\r
720\r
721\r
722 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
723 @param BootMode The value of the boot mode to set.\r
724\r
725 @return EFI_SUCCESS The value was successfully updated\r
726\r
727**/\r
728EFI_STATUS\r
729EFIAPI\r
730PeiSetBootMode (\r
731 IN CONST EFI_PEI_SERVICES **PeiServices,\r
732 IN EFI_BOOT_MODE BootMode\r
733 );\r
734\r
735//\r
736// Security support functions\r
737//\r
738\r
739/**\r
740\r
741 Initialize the security services.\r
742\r
743 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
744 @param OldCoreData Pointer to the old core data.\r
745 NULL if being run in non-permanent memory mode.\r
746\r
747**/\r
748VOID\r
749InitializeSecurityServices (\r
750 IN EFI_PEI_SERVICES **PeiServices,\r
751 IN PEI_CORE_INSTANCE *OldCoreData\r
752 );\r
753\r
754/**\r
755 Verify a Firmware volume.\r
756\r
757 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration\r
758\r
759 @retval EFI_SUCCESS Firmware Volume is legal\r
760 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test\r
761\r
762**/\r
763EFI_STATUS\r
764VerifyFv (\r
765 IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress\r
766 );\r
767\r
768/**\r
769 Provide a callout to the security verification service.\r
770\r
771 @param PrivateData PeiCore's private data structure\r
772 @param VolumeHandle Handle of FV\r
773 @param FileHandle Handle of PEIM's FFS\r
774 @param AuthenticationStatus Authentication status\r
775\r
776 @retval EFI_SUCCESS Image is OK\r
777 @retval EFI_SECURITY_VIOLATION Image is illegal\r
778 @retval EFI_NOT_FOUND If security PPI is not installed.\r
779**/\r
780EFI_STATUS\r
781VerifyPeim (\r
782 IN PEI_CORE_INSTANCE *PrivateData,\r
783 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
784 IN EFI_PEI_FILE_HANDLE FileHandle,\r
785 IN UINT32 AuthenticationStatus\r
786 );\r
787\r
788/**\r
789\r
790 Gets the pointer to the HOB List.\r
791\r
792\r
793 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
794 @param HobList Pointer to the HOB List.\r
795\r
796 @retval EFI_SUCCESS Get the pointer of HOB List\r
797 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published\r
798 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)\r
799\r
800**/\r
801EFI_STATUS\r
802EFIAPI\r
803PeiGetHobList (\r
804 IN CONST EFI_PEI_SERVICES **PeiServices,\r
805 IN OUT VOID **HobList\r
806 );\r
807\r
808/**\r
809 Add a new HOB to the HOB List.\r
810\r
811 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
812 @param Type Type of the new HOB.\r
813 @param Length Length of the new HOB to allocate.\r
814 @param Hob Pointer to the new HOB.\r
815\r
816 @return EFI_SUCCESS Success to create HOB.\r
817 @retval EFI_INVALID_PARAMETER if Hob is NULL\r
818 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.\r
819 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.\r
820\r
821**/\r
822EFI_STATUS\r
823EFIAPI\r
824PeiCreateHob (\r
825 IN CONST EFI_PEI_SERVICES **PeiServices,\r
826 IN UINT16 Type,\r
827 IN UINT16 Length,\r
828 IN OUT VOID **Hob\r
829 );\r
830\r
831/**\r
832\r
833 Builds a Handoff Information Table HOB\r
834\r
835 @param BootMode - Current Bootmode\r
836 @param MemoryBegin - Start Memory Address.\r
837 @param MemoryLength - Length of Memory.\r
838\r
839 @return EFI_SUCCESS Always success to initialize HOB.\r
840\r
841**/\r
842EFI_STATUS\r
843PeiCoreBuildHobHandoffInfoTable (\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 Install SEC HOB data to the HOB List.\r
851\r
852 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
853 @param SecHobList Pointer to SEC HOB List.\r
854\r
855 @return EFI_SUCCESS Success to install SEC HOB data.\r
856 @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.\r
857\r
858**/\r
859EFI_STATUS\r
860PeiInstallSecHobData (\r
861 IN CONST EFI_PEI_SERVICES **PeiServices,\r
862 IN EFI_HOB_GENERIC_HEADER *SecHobList\r
863 );\r
864\r
865//\r
866// FFS Fw Volume support functions\r
867//\r
868\r
869/**\r
870 Searches for the next matching file in the firmware volume.\r
871\r
872 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
873 @param SearchType Filter to find only files of this type.\r
874 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r
875 @param FvHandle Handle of firmware volume in which to search.\r
876 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start\r
877 at the beginning of the firmware volume. On exit, points the file handle of the next file\r
878 in the volume or NULL if there are no more files.\r
879\r
880 @retval EFI_NOT_FOUND The file was not found.\r
881 @retval EFI_NOT_FOUND The header checksum was not zero.\r
882 @retval EFI_SUCCESS The file was found.\r
883\r
884**/\r
885EFI_STATUS\r
886EFIAPI\r
887PeiFfsFindNextFile (\r
888 IN CONST EFI_PEI_SERVICES **PeiServices,\r
889 IN UINT8 SearchType,\r
890 IN EFI_PEI_FV_HANDLE FvHandle,\r
891 IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
892 );\r
893\r
894/**\r
895 Go through the file to search SectionType section.\r
896 Search within encapsulation sections (compression and GUIDed) recursively,\r
897 until the match section is found.\r
898\r
899 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
900 @param SectionType Filter to find only section of this type.\r
901 @param SectionInstance Pointer to the filter to find the specific instance of section.\r
902 @param Section From where to search.\r
903 @param SectionSize The file size to search.\r
904 @param OutputBuffer A pointer to the discovered section, if successful.\r
905 NULL if section not found.\r
906 @param AuthenticationStatus Updated upon return to point to the authentication status for this section.\r
907 @param IsFfs3Fv Indicates the FV format.\r
908\r
909 @return EFI_NOT_FOUND The match section is not found.\r
910 @return EFI_SUCCESS The match section is found.\r
911\r
912**/\r
913EFI_STATUS\r
914ProcessSection (\r
915 IN CONST EFI_PEI_SERVICES **PeiServices,\r
916 IN EFI_SECTION_TYPE SectionType,\r
917 IN OUT UINTN *SectionInstance,\r
918 IN EFI_COMMON_SECTION_HEADER *Section,\r
919 IN UINTN SectionSize,\r
920 OUT VOID **OutputBuffer,\r
921 OUT UINT32 *AuthenticationStatus,\r
922 IN BOOLEAN IsFfs3Fv\r
923 );\r
924\r
925/**\r
926 Searches for the next matching section within the specified file.\r
927\r
928 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
929 @param SectionType Filter to find only sections of this type.\r
930 @param FileHandle Pointer to the current file to search.\r
931 @param SectionData A pointer to the discovered section, if successful.\r
932 NULL if section not found\r
933\r
934 @retval EFI_NOT_FOUND The section was not found.\r
935 @retval EFI_SUCCESS The section was found.\r
936\r
937**/\r
938EFI_STATUS\r
939EFIAPI\r
940PeiFfsFindSectionData (\r
941 IN CONST EFI_PEI_SERVICES **PeiServices,\r
942 IN EFI_SECTION_TYPE SectionType,\r
943 IN EFI_PEI_FILE_HANDLE FileHandle,\r
944 OUT VOID **SectionData\r
945 );\r
946\r
947/**\r
948 Searches for the next matching section within the specified file.\r
949\r
950 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
951 @param SectionType The value of the section type to find.\r
952 @param SectionInstance Section instance to find.\r
953 @param FileHandle Handle of the firmware file to search.\r
954 @param SectionData A pointer to the discovered section, if successful.\r
955 @param AuthenticationStatus A pointer to the authentication status for this section.\r
956\r
957 @retval EFI_SUCCESS The section was found.\r
958 @retval EFI_NOT_FOUND The section was not found.\r
959\r
960**/\r
961EFI_STATUS\r
962EFIAPI\r
963PeiFfsFindSectionData3 (\r
964 IN CONST EFI_PEI_SERVICES **PeiServices,\r
965 IN EFI_SECTION_TYPE SectionType,\r
966 IN UINTN SectionInstance,\r
967 IN EFI_PEI_FILE_HANDLE FileHandle,\r
968 OUT VOID **SectionData,\r
969 OUT UINT32 *AuthenticationStatus\r
970 );\r
971\r
972/**\r
973 Search the firmware volumes by index\r
974\r
975 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
976 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware\r
977 Volume (BFV).\r
978 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.\r
979\r
980 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL\r
981 @retval EFI_NOT_FOUND The volume was not found.\r
982 @retval EFI_SUCCESS The volume was found.\r
983\r
984**/\r
985EFI_STATUS\r
986EFIAPI\r
987PeiFfsFindNextVolume (\r
988 IN CONST EFI_PEI_SERVICES **PeiServices,\r
989 IN UINTN Instance,\r
990 IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
991 );\r
992\r
993//\r
994// Memory support functions\r
995//\r
996\r
997/**\r
998\r
999 Initialize the memory services.\r
1000\r
1001 @param PrivateData PeiCore's private data structure\r
1002 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
1003 and location of temporary RAM, the stack location and the BFV location.\r
1004 @param OldCoreData Pointer to the PEI Core data.\r
1005 NULL if being run in non-permanent memory mode.\r
1006\r
1007**/\r
1008VOID\r
1009InitializeMemoryServices (\r
1010 IN PEI_CORE_INSTANCE *PrivateData,\r
1011 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
1012 IN PEI_CORE_INSTANCE *OldCoreData\r
1013 );\r
1014\r
1015/**\r
1016\r
1017 Install the permanent memory is now available.\r
1018 Creates HOB (PHIT and Stack).\r
1019\r
1020 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1021 @param MemoryBegin Start of memory address.\r
1022 @param MemoryLength Length of memory.\r
1023\r
1024 @return EFI_SUCCESS Always success.\r
1025\r
1026**/\r
1027EFI_STATUS\r
1028EFIAPI\r
1029PeiInstallPeiMemory (\r
1030 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1031 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
1032 IN UINT64 MemoryLength\r
1033 );\r
1034\r
1035/**\r
1036 Migrate memory pages allocated in pre-memory phase.\r
1037 Copy memory pages at temporary heap top to permanent heap top.\r
1038\r
1039 @param[in] Private Pointer to the private data passed in from caller.\r
1040 @param[in] TemporaryRamMigrated Temporary memory has been migrated to permanent memory.\r
1041\r
1042**/\r
1043VOID\r
1044MigrateMemoryPages (\r
1045 IN PEI_CORE_INSTANCE *Private,\r
1046 IN BOOLEAN TemporaryRamMigrated\r
1047 );\r
1048\r
1049/**\r
1050 Removes any FV HOBs whose base address is not in PEI installed memory.\r
1051\r
1052 @param[in] Private Pointer to PeiCore's private data structure.\r
1053\r
1054**/\r
1055VOID\r
1056RemoveFvHobsInTemporaryMemory (\r
1057 IN PEI_CORE_INSTANCE *Private\r
1058 );\r
1059\r
1060/**\r
1061 Migrate the base address in firmware volume allocation HOBs\r
1062 from temporary memory to PEI installed memory.\r
1063\r
1064 @param[in] PrivateData Pointer to PeiCore's private data structure.\r
1065 @param[in] OrgFvHandle Address of FV Handle in temporary memory.\r
1066 @param[in] FvHandle Address of FV Handle in permanent memory.\r
1067\r
1068**/\r
1069VOID\r
1070ConvertFvHob (\r
1071 IN PEI_CORE_INSTANCE *PrivateData,\r
1072 IN UINTN OrgFvHandle,\r
1073 IN UINTN FvHandle\r
1074 );\r
1075\r
1076/**\r
1077 Migrate MemoryBaseAddress in memory allocation HOBs\r
1078 from the temporary memory to PEI installed memory.\r
1079\r
1080 @param[in] PrivateData Pointer to PeiCore's private data structure.\r
1081\r
1082**/\r
1083VOID\r
1084ConvertMemoryAllocationHobs (\r
1085 IN PEI_CORE_INSTANCE *PrivateData\r
1086 );\r
1087\r
1088/**\r
1089 The purpose of the service is to publish an interface that allows\r
1090 PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r
1091\r
1092 Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.\r
1093 After InstallPeiMemory() is called, PEI will allocate pages within the region\r
1094 of memory provided by InstallPeiMemory() service in a best-effort fashion.\r
1095 Location-specific allocations are not managed by the PEI foundation code.\r
1096\r
1097 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1098 @param MemoryType The type of memory to allocate.\r
1099 @param Pages The number of contiguous 4 KB pages to allocate.\r
1100 @param Memory Pointer to a physical address. On output, the address is set to the base\r
1101 of the page range that was allocated.\r
1102\r
1103 @retval EFI_SUCCESS The memory range was successfully allocated.\r
1104 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
1105 @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,\r
1106 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,\r
1107 EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.\r
1108\r
1109**/\r
1110EFI_STATUS\r
1111EFIAPI\r
1112PeiAllocatePages (\r
1113 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1114 IN EFI_MEMORY_TYPE MemoryType,\r
1115 IN UINTN Pages,\r
1116 OUT EFI_PHYSICAL_ADDRESS *Memory\r
1117 );\r
1118\r
1119/**\r
1120 Frees memory pages.\r
1121\r
1122 @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1123 @param[in] Memory The base physical address of the pages to be freed.\r
1124 @param[in] Pages The number of contiguous 4 KB pages to free.\r
1125\r
1126 @retval EFI_SUCCESS The requested pages were freed.\r
1127 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.\r
1128 @retval EFI_NOT_FOUND The requested memory pages were not allocated with\r
1129 AllocatePages().\r
1130\r
1131**/\r
1132EFI_STATUS\r
1133EFIAPI\r
1134PeiFreePages (\r
1135 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1136 IN EFI_PHYSICAL_ADDRESS Memory,\r
1137 IN UINTN Pages\r
1138 );\r
1139\r
1140/**\r
1141\r
1142 Memory allocation service on the temporary memory.\r
1143\r
1144\r
1145 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1146 @param Size Amount of memory required\r
1147 @param Buffer Address of pointer to the buffer\r
1148\r
1149 @retval EFI_SUCCESS The allocation was successful\r
1150 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement\r
1151 to allocate the requested size.\r
1152\r
1153**/\r
1154EFI_STATUS\r
1155EFIAPI\r
1156PeiAllocatePool (\r
1157 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1158 IN UINTN Size,\r
1159 OUT VOID **Buffer\r
1160 );\r
1161\r
1162/**\r
1163\r
1164 Routine for load image file.\r
1165\r
1166\r
1167 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1168 @param FileHandle Pointer to the FFS file header of the image.\r
1169 @param PeimState The dispatch state of the input PEIM handle.\r
1170 @param EntryPoint Pointer to entry point of specified image file for output.\r
1171 @param AuthenticationState Pointer to attestation authentication state of image.\r
1172\r
1173 @retval EFI_SUCCESS Image is successfully loaded.\r
1174 @retval EFI_NOT_FOUND Fail to locate necessary PPI\r
1175 @retval Others Fail to load file.\r
1176\r
1177**/\r
1178EFI_STATUS\r
1179PeiLoadImage (\r
1180 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1181 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1182 IN UINT8 PeimState,\r
1183 OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r
1184 OUT UINT32 *AuthenticationState\r
1185 );\r
1186\r
1187/**\r
1188\r
1189 Core version of the Status Code reporter\r
1190\r
1191\r
1192 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1193 @param CodeType Type of Status Code.\r
1194 @param Value Value to output for Status Code.\r
1195 @param Instance Instance Number of this status code.\r
1196 @param CallerId ID of the caller of this status code.\r
1197 @param Data Optional data associated with this status code.\r
1198\r
1199 @retval EFI_SUCCESS if status code is successfully reported\r
1200 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed\r
1201\r
1202**/\r
1203EFI_STATUS\r
1204EFIAPI\r
1205PeiReportStatusCode (\r
1206 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1207 IN EFI_STATUS_CODE_TYPE CodeType,\r
1208 IN EFI_STATUS_CODE_VALUE Value,\r
1209 IN UINT32 Instance,\r
1210 IN CONST EFI_GUID *CallerId,\r
1211 IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r
1212 );\r
1213\r
1214/**\r
1215\r
1216 Core version of the Reset System\r
1217\r
1218\r
1219 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1220\r
1221 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.\r
1222 @retval EFI_DEVICE_ERROR Did not reset system.\r
1223 Otherwise, resets the system.\r
1224\r
1225**/\r
1226EFI_STATUS\r
1227EFIAPI\r
1228PeiResetSystem (\r
1229 IN CONST EFI_PEI_SERVICES **PeiServices\r
1230 );\r
1231\r
1232/**\r
1233 Resets the entire platform.\r
1234\r
1235 @param[in] ResetType The type of reset to perform.\r
1236 @param[in] ResetStatus The status code for the reset.\r
1237 @param[in] DataSize The size, in bytes, of ResetData.\r
1238 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown\r
1239 the data buffer starts with a Null-terminated string, optionally\r
1240 followed by additional binary data. The string is a description\r
1241 that the caller may use to further indicate the reason for the\r
1242 system reset.\r
1243\r
1244**/\r
1245VOID\r
1246EFIAPI\r
1247PeiResetSystem2 (\r
1248 IN EFI_RESET_TYPE ResetType,\r
1249 IN EFI_STATUS ResetStatus,\r
1250 IN UINTN DataSize,\r
1251 IN VOID *ResetData OPTIONAL\r
1252 );\r
1253\r
1254/**\r
1255\r
1256 Initialize PeiCore FV List.\r
1257\r
1258\r
1259 @param PrivateData - Pointer to PEI_CORE_INSTANCE.\r
1260 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.\r
1261\r
1262**/\r
1263VOID\r
1264PeiInitializeFv (\r
1265 IN PEI_CORE_INSTANCE *PrivateData,\r
1266 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
1267 );\r
1268\r
1269/**\r
1270 Process Firmware Volume Information once FvInfoPPI install.\r
1271\r
1272 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1273 @param NotifyDescriptor Address of the notification descriptor data structure.\r
1274 @param Ppi Address of the PPI that was installed.\r
1275\r
1276 @retval EFI_SUCCESS if the interface could be successfully installed\r
1277\r
1278**/\r
1279EFI_STATUS\r
1280EFIAPI\r
1281FirmwareVolumeInfoPpiNotifyCallback (\r
1282 IN EFI_PEI_SERVICES **PeiServices,\r
1283 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
1284 IN VOID *Ppi\r
1285 );\r
1286\r
1287/**\r
1288\r
1289 Given the input VolumeHandle, search for the next matching name file.\r
1290\r
1291 @param FileName File name to search.\r
1292 @param VolumeHandle The current FV to search.\r
1293 @param FileHandle Pointer to the file matching name in VolumeHandle.\r
1294 NULL if file not found\r
1295\r
1296 @retval EFI_NOT_FOUND No files matching the search criteria were found\r
1297 @retval EFI_SUCCESS Success to search given file\r
1298\r
1299**/\r
1300EFI_STATUS\r
1301EFIAPI\r
1302PeiFfsFindFileByName (\r
1303 IN CONST EFI_GUID *FileName,\r
1304 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
1305 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
1306 );\r
1307\r
1308/**\r
1309 Returns information about a specific file.\r
1310\r
1311 @param FileHandle Handle of the file.\r
1312 @param FileInfo Upon exit, points to the file's information.\r
1313\r
1314 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
1315 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r
1316 @retval EFI_SUCCESS File information returned.\r
1317\r
1318**/\r
1319EFI_STATUS\r
1320EFIAPI\r
1321PeiFfsGetFileInfo (\r
1322 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1323 OUT EFI_FV_FILE_INFO *FileInfo\r
1324 );\r
1325\r
1326/**\r
1327 Returns information about a specific file.\r
1328\r
1329 @param FileHandle Handle of the file.\r
1330 @param FileInfo Upon exit, points to the file's information.\r
1331\r
1332 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
1333 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r
1334 @retval EFI_SUCCESS File information returned.\r
1335\r
1336**/\r
1337EFI_STATUS\r
1338EFIAPI\r
1339PeiFfsGetFileInfo2 (\r
1340 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1341 OUT EFI_FV_FILE_INFO2 *FileInfo\r
1342 );\r
1343\r
1344/**\r
1345 Returns information about the specified volume.\r
1346\r
1347 @param VolumeHandle Handle of the volume.\r
1348 @param VolumeInfo Upon exit, points to the volume's information.\r
1349\r
1350 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.\r
1351 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.\r
1352 @retval EFI_SUCCESS Volume information returned.\r
1353**/\r
1354EFI_STATUS\r
1355EFIAPI\r
1356PeiFfsGetVolumeInfo (\r
1357 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
1358 OUT EFI_FV_INFO *VolumeInfo\r
1359 );\r
1360\r
1361/**\r
1362 This routine enables a PEIM to register itself for shadow when the PEI Foundation\r
1363 discovers permanent memory.\r
1364\r
1365 @param FileHandle File handle of a PEIM.\r
1366\r
1367 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.\r
1368 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.\r
1369 @retval EFI_SUCCESS Successfully to register itself.\r
1370\r
1371**/\r
1372EFI_STATUS\r
1373EFIAPI\r
1374PeiRegisterForShadow (\r
1375 IN EFI_PEI_FILE_HANDLE FileHandle\r
1376 );\r
1377\r
1378/**\r
1379 Initialize image service that install PeiLoadFilePpi.\r
1380\r
1381 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.\r
1382 @param OldCoreData Pointer to Old PeiCore's private data.\r
1383 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.\r
1384 If not NULL, PeiCore is entered at second time, stack/heap has been moved\r
1385 to permanent memory.\r
1386\r
1387**/\r
1388VOID\r
1389InitializeImageServices (\r
1390 IN PEI_CORE_INSTANCE *PrivateData,\r
1391 IN PEI_CORE_INSTANCE *OldCoreData\r
1392 );\r
1393\r
1394/**\r
1395 Loads and relocates a PE/COFF image in place.\r
1396\r
1397 @param Pe32Data The base address of the PE/COFF file that is to be loaded and relocated\r
1398 @param ImageAddress The base address of the relocated PE/COFF image\r
1399\r
1400 @retval EFI_SUCCESS The file was loaded and relocated\r
1401 @retval Others The file not be loaded and error occurred.\r
1402\r
1403**/\r
1404EFI_STATUS\r
1405LoadAndRelocatePeCoffImageInPlace (\r
1406 IN VOID *Pe32Data,\r
1407 IN VOID *ImageAddress\r
1408 );\r
1409\r
1410/**\r
1411 Find the PE32 Data for an FFS file.\r
1412\r
1413 @param FileHandle Pointer to the FFS file header of the image.\r
1414 @param Pe32Data Pointer to a (VOID *) PE32 Data pointer.\r
1415\r
1416 @retval EFI_SUCCESS Image is successfully loaded.\r
1417 @retval EFI_NOT_FOUND Fail to locate PE32 Data.\r
1418\r
1419**/\r
1420EFI_STATUS\r
1421PeiGetPe32Data (\r
1422 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1423 OUT VOID **Pe32Data\r
1424 );\r
1425\r
1426/**\r
1427 The wrapper function of PeiLoadImageLoadImage().\r
1428\r
1429 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.\r
1430 @param FileHandle Pointer to the FFS file header of the image.\r
1431 @param ImageAddressArg Pointer to PE/TE image.\r
1432 @param ImageSizeArg Size of PE/TE image.\r
1433 @param EntryPoint Pointer to entry point of specified image file for output.\r
1434 @param AuthenticationState Pointer to attestation authentication state of image.\r
1435\r
1436 @return Status of PeiLoadImageLoadImage().\r
1437\r
1438**/\r
1439EFI_STATUS\r
1440EFIAPI\r
1441PeiLoadImageLoadImageWrapper (\r
1442 IN CONST EFI_PEI_LOAD_FILE_PPI *This,\r
1443 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1444 OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg OPTIONAL,\r
1445 OUT UINT64 *ImageSizeArg OPTIONAL,\r
1446 OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r
1447 OUT UINT32 *AuthenticationState\r
1448 );\r
1449\r
1450/**\r
1451\r
1452 Provide a callback for when the security PPI is installed.\r
1453\r
1454 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1455 @param NotifyDescriptor The descriptor for the notification event.\r
1456 @param Ppi Pointer to the PPI in question.\r
1457\r
1458 @return Always success\r
1459\r
1460**/\r
1461EFI_STATUS\r
1462EFIAPI\r
1463SecurityPpiNotifyCallback (\r
1464 IN EFI_PEI_SERVICES **PeiServices,\r
1465 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
1466 IN VOID *Ppi\r
1467 );\r
1468\r
1469/**\r
1470 Get FV image(s) from the FV type file, then install FV INFO(2) PPI, Build FV(2, 3) HOB.\r
1471\r
1472 @param PrivateData PeiCore's private data structure\r
1473 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent FV image that contain this FV image.\r
1474 @param ParentFvFileHandle File handle of a FV type file that contain this FV image.\r
1475\r
1476 @retval EFI_NOT_FOUND FV image can't be found.\r
1477 @retval EFI_SUCCESS Successfully to process it.\r
1478 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image\r
1479 @retval EFI_SECURITY_VIOLATION Image is illegal\r
1480 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section\r
1481\r
1482**/\r
1483EFI_STATUS\r
1484ProcessFvFile (\r
1485 IN PEI_CORE_INSTANCE *PrivateData,\r
1486 IN PEI_CORE_FV_HANDLE *ParentFvCoreHandle,\r
1487 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle\r
1488 );\r
1489\r
1490/**\r
1491 Gets a PEI_CORE_FV_HANDLE instance for the next volume according to the given index.\r
1492\r
1493 This routine also will install an instance of the FvInfo PPI for the FV HOB\r
1494 as defined in the PI specification.\r
1495\r
1496 @param Private Pointer of PEI_CORE_INSTANCE\r
1497 @param Instance Index of the FV to search\r
1498\r
1499 @return Instance of PEI_CORE_FV_HANDLE.\r
1500**/\r
1501PEI_CORE_FV_HANDLE *\r
1502FindNextCoreFvHandle (\r
1503 IN PEI_CORE_INSTANCE *Private,\r
1504 IN UINTN Instance\r
1505 );\r
1506\r
1507//\r
1508// Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r
1509//\r
1510\r
1511/**\r
1512 Memory-based read services.\r
1513\r
1514 This function is to perform the Memory Access Read service based on installed\r
1515 instance of the EFI_PEI_CPU_IO_PPI.\r
1516 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1517 return EFI_NOT_YET_AVAILABLE.\r
1518\r
1519 @param PeiServices An indirect pointer to the PEI Services Table\r
1520 published by the PEI Foundation.\r
1521 @param This Pointer to local data for the interface.\r
1522 @param Width The width of the access. Enumerated in bytes.\r
1523 @param Address The physical address of the access.\r
1524 @param Count The number of accesses to perform.\r
1525 @param Buffer A pointer to the buffer of data.\r
1526\r
1527 @retval EFI_SUCCESS The function completed successfully.\r
1528 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
1529**/\r
1530EFI_STATUS\r
1531EFIAPI\r
1532PeiDefaultMemRead (\r
1533 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1534 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1535 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
1536 IN UINT64 Address,\r
1537 IN UINTN Count,\r
1538 IN OUT VOID *Buffer\r
1539 );\r
1540\r
1541/**\r
1542 Memory-based write services.\r
1543\r
1544 This function is to perform the Memory Access Write service based on installed\r
1545 instance of the EFI_PEI_CPU_IO_PPI.\r
1546 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1547 return EFI_NOT_YET_AVAILABLE.\r
1548\r
1549 @param PeiServices An indirect pointer to the PEI Services Table\r
1550 published by the PEI Foundation.\r
1551 @param This Pointer to local data for the interface.\r
1552 @param Width The width of the access. Enumerated in bytes.\r
1553 @param Address The physical address of the access.\r
1554 @param Count The number of accesses to perform.\r
1555 @param Buffer A pointer to the buffer of data.\r
1556\r
1557 @retval EFI_SUCCESS The function completed successfully.\r
1558 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
1559**/\r
1560EFI_STATUS\r
1561EFIAPI\r
1562PeiDefaultMemWrite (\r
1563 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1564 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1565 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
1566 IN UINT64 Address,\r
1567 IN UINTN Count,\r
1568 IN OUT VOID *Buffer\r
1569 );\r
1570\r
1571/**\r
1572 IO-based read services.\r
1573\r
1574 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.\r
1575 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1576 return EFI_NOT_YET_AVAILABLE.\r
1577\r
1578 @param PeiServices An indirect pointer to the PEI Services Table\r
1579 published by the PEI Foundation.\r
1580 @param This Pointer to local data for the interface.\r
1581 @param Width The width of the access. Enumerated in bytes.\r
1582 @param Address The physical address of the access.\r
1583 @param Count The number of accesses to perform.\r
1584 @param Buffer A pointer to the buffer of data.\r
1585\r
1586 @retval EFI_SUCCESS The function completed successfully.\r
1587 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
1588**/\r
1589EFI_STATUS\r
1590EFIAPI\r
1591PeiDefaultIoRead (\r
1592 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1593 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1594 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
1595 IN UINT64 Address,\r
1596 IN UINTN Count,\r
1597 IN OUT VOID *Buffer\r
1598 );\r
1599\r
1600/**\r
1601 IO-based write services.\r
1602\r
1603 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.\r
1604 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1605 return EFI_NOT_YET_AVAILABLE.\r
1606\r
1607 @param PeiServices An indirect pointer to the PEI Services Table\r
1608 published by the PEI Foundation.\r
1609 @param This Pointer to local data for the interface.\r
1610 @param Width The width of the access. Enumerated in bytes.\r
1611 @param Address The physical address of the access.\r
1612 @param Count The number of accesses to perform.\r
1613 @param Buffer A pointer to the buffer of data.\r
1614\r
1615 @retval EFI_SUCCESS The function completed successfully.\r
1616 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
1617**/\r
1618EFI_STATUS\r
1619EFIAPI\r
1620PeiDefaultIoWrite (\r
1621 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1622 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1623 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
1624 IN UINT64 Address,\r
1625 IN UINTN Count,\r
1626 IN OUT VOID *Buffer\r
1627 );\r
1628\r
1629/**\r
1630 8-bit I/O read operations.\r
1631\r
1632 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1633 return 0.\r
1634\r
1635 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1636 @param This Pointer to local data for the interface.\r
1637 @param Address The physical address of the access.\r
1638\r
1639 @return An 8-bit value returned from the I/O space.\r
1640**/\r
1641UINT8\r
1642EFIAPI\r
1643PeiDefaultIoRead8 (\r
1644 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1645 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1646 IN UINT64 Address\r
1647 );\r
1648\r
1649/**\r
1650 Reads an 16-bit I/O port.\r
1651\r
1652 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1653 return 0.\r
1654\r
1655 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1656 @param This Pointer to local data for the interface.\r
1657 @param Address The physical address of the access.\r
1658\r
1659 @return A 16-bit value returned from the I/O space.\r
1660**/\r
1661UINT16\r
1662EFIAPI\r
1663PeiDefaultIoRead16 (\r
1664 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1665 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1666 IN UINT64 Address\r
1667 );\r
1668\r
1669/**\r
1670 Reads an 32-bit I/O port.\r
1671\r
1672 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1673 return 0.\r
1674\r
1675 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1676 @param This Pointer to local data for the interface.\r
1677 @param Address The physical address of the access.\r
1678\r
1679 @return A 32-bit value returned from the I/O space.\r
1680**/\r
1681UINT32\r
1682EFIAPI\r
1683PeiDefaultIoRead32 (\r
1684 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1685 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1686 IN UINT64 Address\r
1687 );\r
1688\r
1689/**\r
1690 Reads an 64-bit I/O port.\r
1691\r
1692 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1693 return 0.\r
1694\r
1695 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1696 @param This Pointer to local data for the interface.\r
1697 @param Address The physical address of the access.\r
1698\r
1699 @return A 64-bit value returned from the I/O space.\r
1700**/\r
1701UINT64\r
1702EFIAPI\r
1703PeiDefaultIoRead64 (\r
1704 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1705 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1706 IN UINT64 Address\r
1707 );\r
1708\r
1709/**\r
1710 8-bit I/O write operations.\r
1711\r
1712 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1713 @param This Pointer to local data for the interface.\r
1714 @param Address The physical address of the access.\r
1715 @param Data The data to write.\r
1716**/\r
1717VOID\r
1718EFIAPI\r
1719PeiDefaultIoWrite8 (\r
1720 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1721 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1722 IN UINT64 Address,\r
1723 IN UINT8 Data\r
1724 );\r
1725\r
1726/**\r
1727 16-bit I/O write operations.\r
1728\r
1729 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1730 @param This Pointer to local data for the interface.\r
1731 @param Address The physical address of the access.\r
1732 @param Data The data to write.\r
1733**/\r
1734VOID\r
1735EFIAPI\r
1736PeiDefaultIoWrite16 (\r
1737 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1738 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1739 IN UINT64 Address,\r
1740 IN UINT16 Data\r
1741 );\r
1742\r
1743/**\r
1744 32-bit I/O write operations.\r
1745\r
1746 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1747 @param This Pointer to local data for the interface.\r
1748 @param Address The physical address of the access.\r
1749 @param Data The data to write.\r
1750**/\r
1751VOID\r
1752EFIAPI\r
1753PeiDefaultIoWrite32 (\r
1754 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1755 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1756 IN UINT64 Address,\r
1757 IN UINT32 Data\r
1758 );\r
1759\r
1760/**\r
1761 64-bit I/O write operations.\r
1762\r
1763 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1764 @param This Pointer to local data for the interface.\r
1765 @param Address The physical address of the access.\r
1766 @param Data The data to write.\r
1767**/\r
1768VOID\r
1769EFIAPI\r
1770PeiDefaultIoWrite64 (\r
1771 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1772 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1773 IN UINT64 Address,\r
1774 IN UINT64 Data\r
1775 );\r
1776\r
1777/**\r
1778 8-bit memory read operations.\r
1779\r
1780 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1781 return 0.\r
1782\r
1783 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1784 @param This Pointer to local data for the interface.\r
1785 @param Address The physical address of the access.\r
1786\r
1787 @return An 8-bit value returned from the memory space.\r
1788\r
1789**/\r
1790UINT8\r
1791EFIAPI\r
1792PeiDefaultMemRead8 (\r
1793 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1794 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1795 IN UINT64 Address\r
1796 );\r
1797\r
1798/**\r
1799 16-bit memory read operations.\r
1800\r
1801 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1802 return 0.\r
1803\r
1804 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1805 @param This Pointer to local data for the interface.\r
1806 @param Address The physical address of the access.\r
1807\r
1808 @return An 16-bit value returned from the memory space.\r
1809\r
1810**/\r
1811UINT16\r
1812EFIAPI\r
1813PeiDefaultMemRead16 (\r
1814 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1815 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1816 IN UINT64 Address\r
1817 );\r
1818\r
1819/**\r
1820 32-bit memory read operations.\r
1821\r
1822 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1823 return 0.\r
1824\r
1825 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1826 @param This Pointer to local data for the interface.\r
1827 @param Address The physical address of the access.\r
1828\r
1829 @return An 32-bit value returned from the memory space.\r
1830\r
1831**/\r
1832UINT32\r
1833EFIAPI\r
1834PeiDefaultMemRead32 (\r
1835 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1836 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1837 IN UINT64 Address\r
1838 );\r
1839\r
1840/**\r
1841 64-bit memory read operations.\r
1842\r
1843 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
1844 return 0.\r
1845\r
1846 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1847 @param This Pointer to local data for the interface.\r
1848 @param Address The physical address of the access.\r
1849\r
1850 @return An 64-bit value returned from the memory space.\r
1851\r
1852**/\r
1853UINT64\r
1854EFIAPI\r
1855PeiDefaultMemRead64 (\r
1856 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1857 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1858 IN UINT64 Address\r
1859 );\r
1860\r
1861/**\r
1862 8-bit memory write operations.\r
1863\r
1864 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1865 @param This Pointer to local data for the interface.\r
1866 @param Address The physical address of the access.\r
1867 @param Data The data to write.\r
1868\r
1869**/\r
1870VOID\r
1871EFIAPI\r
1872PeiDefaultMemWrite8 (\r
1873 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1874 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1875 IN UINT64 Address,\r
1876 IN UINT8 Data\r
1877 );\r
1878\r
1879/**\r
1880 16-bit memory write operations.\r
1881\r
1882 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1883 @param This Pointer to local data for the interface.\r
1884 @param Address The physical address of the access.\r
1885 @param Data The data to write.\r
1886\r
1887**/\r
1888VOID\r
1889EFIAPI\r
1890PeiDefaultMemWrite16 (\r
1891 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1892 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1893 IN UINT64 Address,\r
1894 IN UINT16 Data\r
1895 );\r
1896\r
1897/**\r
1898 32-bit memory write operations.\r
1899\r
1900 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1901 @param This Pointer to local data for the interface.\r
1902 @param Address The physical address of the access.\r
1903 @param Data The data to write.\r
1904\r
1905**/\r
1906VOID\r
1907EFIAPI\r
1908PeiDefaultMemWrite32 (\r
1909 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1910 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1911 IN UINT64 Address,\r
1912 IN UINT32 Data\r
1913 );\r
1914\r
1915/**\r
1916 64-bit memory write operations.\r
1917\r
1918 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1919 @param This Pointer to local data for the interface.\r
1920 @param Address The physical address of the access.\r
1921 @param Data The data to write.\r
1922\r
1923**/\r
1924VOID\r
1925EFIAPI\r
1926PeiDefaultMemWrite64 (\r
1927 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1928 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1929 IN UINT64 Address,\r
1930 IN UINT64 Data\r
1931 );\r
1932\r
1933extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi;\r
1934\r
1935//\r
1936// Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r
1937//\r
1938\r
1939/**\r
1940 Reads from a given location in the PCI configuration space.\r
1941\r
1942 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then\r
1943 return EFI_NOT_YET_AVAILABLE.\r
1944\r
1945 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1946 @param This Pointer to local data for the interface.\r
1947 @param Width The width of the access. Enumerated in bytes.\r
1948 See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
1949 @param Address The physical address of the access. The format of\r
1950 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
1951 @param Buffer A pointer to the buffer of data.\r
1952\r
1953 @retval EFI_SUCCESS The function completed successfully.\r
1954 @retval EFI_INVALID_PARAMETER The invalid access width.\r
1955 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r
1956\r
1957**/\r
1958EFI_STATUS\r
1959EFIAPI\r
1960PeiDefaultPciCfg2Read (\r
1961 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1962 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
1963 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
1964 IN UINT64 Address,\r
1965 IN OUT VOID *Buffer\r
1966 );\r
1967\r
1968/**\r
1969 Write to a given location in the PCI configuration space.\r
1970\r
1971 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then\r
1972 return EFI_NOT_YET_AVAILABLE.\r
1973\r
1974 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1975 @param This Pointer to local data for the interface.\r
1976 @param Width The width of the access. Enumerated in bytes.\r
1977 See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
1978 @param Address The physical address of the access. The format of\r
1979 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
1980 @param Buffer A pointer to the buffer of data.\r
1981\r
1982 @retval EFI_SUCCESS The function completed successfully.\r
1983 @retval EFI_INVALID_PARAMETER The invalid access width.\r
1984 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r
1985**/\r
1986EFI_STATUS\r
1987EFIAPI\r
1988PeiDefaultPciCfg2Write (\r
1989 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1990 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
1991 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
1992 IN UINT64 Address,\r
1993 IN OUT VOID *Buffer\r
1994 );\r
1995\r
1996/**\r
1997 This function performs a read-modify-write operation on the contents from a given\r
1998 location in the PCI configuration space.\r
1999\r
2000 @param PeiServices An indirect pointer to the PEI Services Table\r
2001 published by the PEI Foundation.\r
2002 @param This Pointer to local data for the interface.\r
2003 @param Width The width of the access. Enumerated in bytes. Type\r
2004 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
2005 @param Address The physical address of the access.\r
2006 @param SetBits Points to value to bitwise-OR with the read configuration value.\r
2007 The size of the value is determined by Width.\r
2008 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r
2009 The size of the value is determined by Width.\r
2010\r
2011 @retval EFI_SUCCESS The function completed successfully.\r
2012 @retval EFI_INVALID_PARAMETER The invalid access width.\r
2013 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r
2014**/\r
2015EFI_STATUS\r
2016EFIAPI\r
2017PeiDefaultPciCfg2Modify (\r
2018 IN CONST EFI_PEI_SERVICES **PeiServices,\r
2019 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
2020 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
2021 IN UINT64 Address,\r
2022 IN VOID *SetBits,\r
2023 IN VOID *ClearBits\r
2024 );\r
2025\r
2026extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi;\r
2027\r
2028/**\r
2029 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should\r
2030 be re-installed with the instance in permanent memory and all cached FvPpi pointers in\r
2031 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent\r
2032 memory.\r
2033\r
2034 @param PrivateData Pointer to PEI_CORE_INSTANCE.\r
2035**/\r
2036VOID\r
2037PeiReinitializeFv (\r
2038 IN PEI_CORE_INSTANCE *PrivateData\r
2039 );\r
2040\r
2041#endif\r