UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain.h
CommitLineData
615c6dd0 1/** @file\r
b1f6a7c6 2 Definition of Pei Core Structures and Services\r
d1102dba 3\r
9b23c7ba 4Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
192f6d4c 6\r
615c6dd0 7**/\r
192f6d4c 8\r
9#ifndef _PEI_MAIN_H_\r
10#define _PEI_MAIN_H_\r
11\r
859b72fa 12#include <PiPei.h>\r
859b72fa
A
13#include <Ppi/DxeIpl.h>\r
14#include <Ppi/MemoryDiscovered.h>\r
859b72fa 15#include <Ppi/StatusCode.h>\r
859b72fa 16#include <Ppi/Reset.h>\r
672473ea 17#include <Ppi/Reset2.h>\r
b0d803fe 18#include <Ppi/FirmwareVolume.h>\r
19#include <Ppi/FirmwareVolumeInfo.h>\r
c7935105 20#include <Ppi/FirmwareVolumeInfo2.h>\r
b0d803fe 21#include <Ppi/Decompress.h>\r
22#include <Ppi/GuidedSectionExtraction.h>\r
23#include <Ppi/LoadFile.h>\r
24#include <Ppi/Security2.h>\r
58dcdada 25#include <Ppi/TemporaryRamSupport.h>\r
0f9ebb32 26#include <Ppi/TemporaryRamDone.h>\r
483e2cdd 27#include <Ppi/SecHobData.h>\r
9b23c7ba 28#include <Ppi/PeiCoreFvLocation.h>\r
859b72fa
A
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
c58cf83d 36#include <Library/PeCoffLib.h>\r
859b72fa
A
37#include <Library/PeCoffGetEntryPointLib.h>\r
38#include <Library/BaseMemoryLib.h>\r
b0d803fe 39#include <Library/CacheMaintenanceLib.h>\r
177aabe6 40#include <Library/PcdLib.h>\r
28dc3c67 41#include <IndustryStandard/PeImage.h>\r
14e8823a 42#include <Library/PeiServicesTablePointerLib.h>\r
b0d803fe 43#include <Library/MemoryAllocationLib.h>\r
44#include <Guid/FirmwareFileSystem2.h>\r
890e5417 45#include <Guid/FirmwareFileSystem3.h>\r
b0d803fe 46#include <Guid/AprioriFileName.h>\r
4b68cef0 47#include <Guid/MigratedFvInfo.h>\r
192f6d4c 48\r
15273993 49///\r
50/// It is an FFS type extension used for PeiFindFileEx. It indicates current\r
d39d1260 51/// FFS searching is for all PEIMs can be dispatched by PeiCore.\r
15273993 52///\r
1436aea4 53#define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff\r
3a63377f 54\r
b1f6a7c6 55///\r
56/// Pei Core private data structures\r
57///\r
192f6d4c 58typedef union {\r
1436aea4
MK
59 EFI_PEI_PPI_DESCRIPTOR *Ppi;\r
60 EFI_PEI_NOTIFY_DESCRIPTOR *Notify;\r
61 VOID *Raw;\r
192f6d4c 62} PEI_PPI_LIST_POINTERS;\r
63\r
40f26b8f 64///\r
f2bc359c 65/// Number of PEI_PPI_LIST_POINTERS to grow by each time we run out of room\r
40f26b8f 66///\r
1436aea4
MK
67#define PPI_GROWTH_STEP 64\r
68#define CALLBACK_NOTIFY_GROWTH_STEP 32\r
69#define DISPATCH_NOTIFY_GROWTH_STEP 8\r
f2bc359c 70\r
192f6d4c 71typedef struct {\r
1436aea4
MK
72 UINTN CurrentCount;\r
73 UINTN MaxCount;\r
74 UINTN LastDispatchedCount;\r
1cc76977 75 ///\r
f2bc359c 76 /// MaxCount number of entries.\r
1cc76977 77 ///\r
1436aea4 78 PEI_PPI_LIST_POINTERS *PpiPtrs;\r
f2bc359c
SZ
79} PEI_PPI_LIST;\r
80\r
81typedef struct {\r
1436aea4
MK
82 UINTN CurrentCount;\r
83 UINTN MaxCount;\r
1cc76977 84 ///\r
f2bc359c 85 /// MaxCount number of entries.\r
1cc76977 86 ///\r
1436aea4 87 PEI_PPI_LIST_POINTERS *NotifyPtrs;\r
f2bc359c
SZ
88} PEI_CALLBACK_NOTIFY_LIST;\r
89\r
90typedef struct {\r
1436aea4
MK
91 UINTN CurrentCount;\r
92 UINTN MaxCount;\r
93 UINTN LastDispatchedCount;\r
1cc76977 94 ///\r
f2bc359c 95 /// MaxCount number of entries.\r
1cc76977 96 ///\r
1436aea4 97 PEI_PPI_LIST_POINTERS *NotifyPtrs;\r
f2bc359c
SZ
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
1cc76977 105 ///\r
f2bc359c 106 /// PPI List.\r
1cc76977 107 ///\r
1436aea4 108 PEI_PPI_LIST PpiList;\r
1cc76977 109 ///\r
f2bc359c 110 /// Notify List at dispatch level.\r
d1102dba 111 ///\r
1436aea4 112 PEI_CALLBACK_NOTIFY_LIST CallbackNotifyList;\r
1cc76977 113 ///\r
f2bc359c 114 /// Notify List at callback level.\r
1cc76977 115 ///\r
1436aea4 116 PEI_DISPATCH_NOTIFY_LIST DispatchNotifyList;\r
192f6d4c 117} PEI_PPI_DATABASE;\r
118\r
3a63377f 119//\r
d39d1260 120// PEI_CORE_FV_HANDLE.PeimState\r
3a63377f 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
1436aea4
MK
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
3a63377f 128\r
111e6c92
SZ
129//\r
130// Number of FV instances to grow by each time we run out of room\r
131//\r
1436aea4 132#define FV_GROWTH_STEP 8\r
111e6c92 133\r
3a63377f 134typedef struct {\r
1436aea4
MK
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
fe781940 139 //\r
d39d1260 140 // Pointer to the buffer with the PeimCount number of Entries.\r
fe781940 141 //\r
1436aea4 142 UINT8 *PeimState;\r
fe781940 143 //\r
d39d1260 144 // Pointer to the buffer with the PeimCount number of Entries.\r
fe781940 145 //\r
1436aea4
MK
146 EFI_PEI_FILE_HANDLE *FvFileHandles;\r
147 BOOLEAN ScanFv;\r
148 UINT32 AuthenticationStatus;\r
3a63377f 149} PEI_CORE_FV_HANDLE;\r
150\r
f3358329 151typedef struct {\r
1436aea4
MK
152 EFI_GUID FvFormat;\r
153 VOID *FvInfo;\r
154 UINT32 FvInfoSize;\r
155 UINT32 AuthenticationStatus;\r
156 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor;\r
f3358329 157} PEI_CORE_UNKNOW_FORMAT_FV_INFO;\r
158\r
1436aea4 159#define CACHE_SETION_MAX_NUMBER 0x10\r
288f9b38 160typedef struct {\r
1436aea4
MK
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
288f9b38
LG
167} CACHE_SECTION_DATA;\r
168\r
1436aea4 169#define HOLE_MAX_NUMBER 0x3\r
0f9ebb32 170typedef struct {\r
1436aea4
MK
171 EFI_PHYSICAL_ADDRESS Base;\r
172 UINTN Size;\r
173 UINTN Offset;\r
174 BOOLEAN OffsetPositive;\r
0f9ebb32
LG
175} HOLE_MEMORY_DATA;\r
176\r
ef05e063 177///\r
178/// Forward declaration for PEI_CORE_INSTANCE\r
179///\r
1436aea4 180typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE;\r
ef05e063 181\r
182/**\r
183 Function Pointer type for PeiCore function.\r
d1102dba 184 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
ef05e063 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
192f6d4c 202\r
b62fe570
SZ
203//\r
204// Number of files to grow by each time we run out of room\r
205//\r
1436aea4 206#define TEMP_FILE_GROWTH_STEP 32\r
b62fe570 207\r
f3f2e05d 208#define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')\r
192f6d4c 209\r
40f26b8f 210///\r
211/// Pei Core private data structure instance\r
212///\r
ef05e063 213struct _PEI_CORE_INSTANCE {\r
1436aea4 214 UINTN Signature;\r
d1102dba 215\r
3b428ade 216 ///\r
217 /// Point to ServiceTableShadow\r
218 ///\r
1436aea4
MK
219 EFI_PEI_SERVICES *Ps;\r
220 PEI_PPI_DATABASE PpiData;\r
d1102dba 221\r
3b428ade 222 ///\r
223 /// The count of FVs which contains FFS and could be dispatched by PeiCore.\r
224 ///\r
1436aea4 225 UINTN FvCount;\r
d1102dba 226\r
3b428ade 227 ///\r
111e6c92
SZ
228 /// The max count of FVs which contains FFS and could be dispatched by PeiCore.\r
229 ///\r
1436aea4 230 UINTN MaxFvCount;\r
111e6c92
SZ
231\r
232 ///\r
233 /// Pointer to the buffer with the MaxFvCount number of entries.\r
fe781940 234 /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.\r
3b428ade 235 ///\r
1436aea4 236 PEI_CORE_FV_HANDLE *Fv;\r
fe781940
SZ
237\r
238 ///\r
111e6c92 239 /// Pointer to the buffer with the MaxUnknownFvInfoCount number of entries.\r
fe781940
SZ
240 /// Each entry is for one FV which could not be dispatched by PeiCore.\r
241 ///\r
1436aea4
MK
242 PEI_CORE_UNKNOW_FORMAT_FV_INFO *UnknownFvInfo;\r
243 UINTN MaxUnknownFvInfoCount;\r
244 UINTN UnknownFvInfoCount;\r
d1102dba 245\r
fe781940 246 ///\r
b62fe570 247 /// Pointer to the buffer FvFileHandlers in PEI_CORE_FV_HANDLE specified by CurrentPeimFvCount.\r
fe781940 248 ///\r
1436aea4
MK
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
b2374cec
SZ
271 //\r
272 // Information for migrating memory pages allocated in pre-memory phase.\r
273 //\r
1436aea4
MK
274 HOLE_MEMORY_DATA MemoryPages;\r
275 PEICORE_FUNCTION_POINTER ShadowedPeiCore;\r
276 CACHE_SECTION_DATA CacheSection;\r
54ea99a7 277 //\r
d1102dba
LG
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
d39d1260 280 // and Ps should not be changed since maybe user could get this top address by using the offset to Ps.\r
54ea99a7 281 //\r
1436aea4 282 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress;\r
54ea99a7 283 //\r
284 // The field is define for Loading modules at fixed address feature to tracker the PEI code\r
93b8ed68 285 // memory range usage. It is a bit mapped array in which every bit indicates the corresponding memory page\r
d1102dba 286 // available or not.\r
54ea99a7 287 //\r
288 UINT64 *PeiCodeMemoryRangeUsageBitMap;\r
25973fc3 289 //\r
290 // This field points to the shadowed image read function\r
291 //\r
292 PE_COFF_LOADER_READ_FILE ShadowedImageRead;\r
fe781940 293\r
b62fe570
SZ
294 UINTN TempPeimCount;\r
295\r
fe781940 296 //\r
b62fe570 297 // Pointer to the temp buffer with the TempPeimCount number of entries.\r
fe781940 298 //\r
b62fe570 299 EFI_PEI_FILE_HANDLE *TempFileHandles;\r
fe781940 300 //\r
b62fe570 301 // Pointer to the temp buffer with the TempPeimCount number of entries.\r
fe781940 302 //\r
b62fe570 303 EFI_GUID *TempFileGuid;\r
fe781940 304\r
0f9ebb32
LG
305 //\r
306 // Temp Memory Range is not covered by PeiTempMem and Stack.\r
b2374cec 307 // Those Memory Range will be migrated into physical memory.\r
0f9ebb32
LG
308 //\r
309 HOLE_MEMORY_DATA HoleData[HOLE_MAX_NUMBER];\r
ef05e063 310};\r
192f6d4c 311\r
40f26b8f 312///\r
313/// Pei Core Instance Data Macros\r
314///\r
192f6d4c 315#define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r
4140a663 316 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)\r
192f6d4c 317\r
b1f6a7c6 318///\r
319/// Union of temporarily used function pointers (to save stack space)\r
320///\r
192f6d4c 321typedef union {\r
1436aea4
MK
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
192f6d4c 329} PEI_CORE_TEMP_POINTERS;\r
330\r
b98c2ab7 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
192f6d4c 337//\r
338// PeiCore function\r
339//\r
1436aea4 340\r
b1f6a7c6 341/**\r
192f6d4c 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
192f6d4c 347\r
d1102dba 348 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
f34aec3b 349 and location of temporary RAM, the stack location and the BFV location.\r
b1f6a7c6 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
192f6d4c 357 core's data areas.\r
358\r
b1f6a7c6 359**/\r
0308e20d 360VOID\r
b1f6a7c6 361EFIAPI\r
362PeiCore (\r
1436aea4
MK
363 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
364 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r
365 IN VOID *Data\r
ed66e1bc 366 );\r
192f6d4c 367\r
368//\r
369// Dispatcher support functions\r
370//\r
371\r
b1f6a7c6 372/**\r
192f6d4c 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
d39d1260 376 the evaluation stack. When that entry is popped from the evaluation\r
192f6d4c 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
192f6d4c 381\r
1cc76977 382 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 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
192f6d4c 385\r
b1f6a7c6 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
192f6d4c 390\r
b1f6a7c6 391**/\r
392BOOLEAN\r
393PeimDispatchReadiness (\r
1436aea4
MK
394 IN EFI_PEI_SERVICES **PeiServices,\r
395 IN VOID *DependencyExpression\r
ed66e1bc 396 );\r
192f6d4c 397\r
9bedaec0
MK
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
1436aea4
MK
410 IN EFI_PEI_FILE_HANDLE FileHandle,\r
411 IN EFI_PEI_FILE_HANDLE MigratedFileHandle\r
9bedaec0
MK
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
6c80564b 422 @retval EFI_SUCCESS Successfully migrated installed FVs from temporary RAM to permanent memory.\r
9bedaec0
MK
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
1436aea4
MK
429 IN PEI_CORE_INSTANCE *Private,\r
430 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
9bedaec0
MK
431 );\r
432\r
b1f6a7c6 433/**\r
434 Conduct PEIM dispatch.\r
435\r
731bd38e 436 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data\r
1cc76977 437 @param PrivateData Pointer to the private data passed in from caller\r
192f6d4c 438\r
b1f6a7c6 439**/\r
b0d803fe 440VOID\r
192f6d4c 441PeiDispatcher (\r
5aae0aa7 442 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
b0d803fe 443 IN PEI_CORE_INSTANCE *PrivateData\r
ed66e1bc 444 );\r
192f6d4c 445\r
b1f6a7c6 446/**\r
447 Initialize the Dispatcher's data members\r
192f6d4c 448\r
b1f6a7c6 449 @param PrivateData PeiCore's private data structure\r
450 @param OldCoreData Old data from SecCore\r
d39d1260 451 NULL if being run in non-permanent memory mode.\r
aa79b0b3 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
192f6d4c 454\r
b1f6a7c6 455**/\r
192f6d4c 456VOID\r
457InitializeDispatcherData (\r
1436aea4
MK
458 IN PEI_CORE_INSTANCE *PrivateData,\r
459 IN PEI_CORE_INSTANCE *OldCoreData,\r
460 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
ed66e1bc 461 );\r
192f6d4c 462\r
b1f6a7c6 463/**\r
464 This routine parses the Dependency Expression, if available, and\r
465 decides if the module can be executed.\r
192f6d4c 466\r
192f6d4c 467\r
b1f6a7c6 468 @param Private PeiCore's private data structure\r
469 @param FileHandle PEIM's file handle\r
731bd38e 470 @param PeimCount The index of last dispatched PEIM.\r
192f6d4c 471\r
731bd38e 472 @retval TRUE Can be dispatched\r
473 @retval FALSE Cannot be dispatched\r
192f6d4c 474\r
b1f6a7c6 475**/\r
192f6d4c 476BOOLEAN\r
477DepexSatisfied (\r
1436aea4
MK
478 IN PEI_CORE_INSTANCE *Private,\r
479 IN EFI_PEI_FILE_HANDLE FileHandle,\r
480 IN UINTN PeimCount\r
ed66e1bc 481 );\r
192f6d4c 482\r
192f6d4c 483//\r
484// PPI support functions\r
485//\r
1436aea4 486\r
b1f6a7c6 487/**\r
488\r
489 Initialize PPI services.\r
490\r
b1f6a7c6 491 @param PrivateData Pointer to the PEI Core data.\r
d1102dba 492 @param OldCoreData Pointer to old PEI Core data.\r
d39d1260 493 NULL if being run in non-permanent memory mode.\r
b1f6a7c6 494\r
495**/\r
192f6d4c 496VOID\r
497InitializePpiServices (\r
1436aea4
MK
498 IN PEI_CORE_INSTANCE *PrivateData,\r
499 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 500 );\r
192f6d4c 501\r
b1f6a7c6 502/**\r
192f6d4c 503\r
b2374cec 504 Migrate the Hob list from the temporary memory to PEI installed memory.\r
731bd38e 505\r
d1102dba 506 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
424b7c9f 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
192f6d4c 509\r
b1f6a7c6 510**/\r
192f6d4c 511VOID\r
512ConvertPpiPointers (\r
424b7c9f 513 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
514 IN PEI_CORE_INSTANCE *PrivateData\r
ed66e1bc 515 );\r
192f6d4c 516\r
9bedaec0
MK
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
1436aea4
MK
529 IN PEI_CORE_INSTANCE *PrivateData,\r
530 IN UINTN OrgFvHandle,\r
531 IN UINTN FvHandle,\r
532 IN UINTN FvSize\r
9bedaec0
MK
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
1436aea4
MK
545 IN PEI_CORE_INSTANCE *PrivateData,\r
546 IN PEI_CORE_FV_HANDLE *CoreFvHandle\r
9bedaec0
MK
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
1436aea4 558 IN PEI_CORE_INSTANCE *PrivateData\r
9bedaec0
MK
559 );\r
560\r
b1f6a7c6 561/**\r
192f6d4c 562\r
731bd38e 563 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.\r
192f6d4c 564\r
15273993 565 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
d39d1260 566 @param PpiList Pointer to PPI array that want to be installed.\r
192f6d4c 567\r
15273993 568 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.\r
569 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer\r
731bd38e 570 if any PPI in PpiList is not valid\r
15273993 571 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI\r
192f6d4c 572\r
b1f6a7c6 573**/\r
192f6d4c 574EFI_STATUS\r
575EFIAPI\r
576PeiInstallPpi (\r
0c2b5da8 577 IN CONST EFI_PEI_SERVICES **PeiServices,\r
578 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
ed66e1bc 579 );\r
192f6d4c 580\r
b1f6a7c6 581/**\r
192f6d4c 582\r
b1f6a7c6 583 Re-Install PPI services.\r
192f6d4c 584\r
1cc76977 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
192f6d4c 588\r
1cc76977 589 @retval EFI_SUCCESS if the operation was successful\r
590 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL\r
731bd38e 591 if NewPpi is not valid\r
1cc76977 592 @retval EFI_NOT_FOUND if the PPI was not in the database\r
192f6d4c 593\r
b1f6a7c6 594**/\r
192f6d4c 595EFI_STATUS\r
596EFIAPI\r
597PeiReInstallPpi (\r
0c2b5da8 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
ed66e1bc 601 );\r
192f6d4c 602\r
b1f6a7c6 603/**\r
192f6d4c 604\r
b1f6a7c6 605 Locate a given named PPI.\r
192f6d4c 606\r
192f6d4c 607\r
1cc76977 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
b1f6a7c6 612 returns a pointer to the descriptor (includes flags, etc)\r
1cc76977 613 @param Ppi Pointer to reference the found PPI\r
192f6d4c 614\r
b1f6a7c6 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
192f6d4c 617\r
b1f6a7c6 618**/\r
192f6d4c 619EFI_STATUS\r
620EFIAPI\r
621PeiLocatePpi (\r
1cc76977 622 IN CONST EFI_PEI_SERVICES **PeiServices,\r
623 IN CONST EFI_GUID *Guid,\r
192f6d4c 624 IN UINTN Instance,\r
625 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
626 IN OUT VOID **Ppi\r
ed66e1bc 627 );\r
192f6d4c 628\r
b1f6a7c6 629/**\r
192f6d4c 630\r
b1f6a7c6 631 Install a notification for a given PPI.\r
192f6d4c 632\r
192f6d4c 633\r
1cc76977 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
192f6d4c 636\r
b1f6a7c6 637 @retval EFI_SUCCESS if successful\r
638 @retval EFI_OUT_OF_RESOURCES if no space in the database\r
93b8ed68 639 @retval EFI_INVALID_PARAMETER if not a good descriptor\r
192f6d4c 640\r
b1f6a7c6 641**/\r
192f6d4c 642EFI_STATUS\r
643EFIAPI\r
644PeiNotifyPpi (\r
0c2b5da8 645 IN CONST EFI_PEI_SERVICES **PeiServices,\r
646 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
ed66e1bc 647 );\r
192f6d4c 648\r
b1f6a7c6 649/**\r
192f6d4c 650\r
b1f6a7c6 651 Process the Notify List at dispatch level.\r
192f6d4c 652\r
b1f6a7c6 653 @param PrivateData PeiCore's private data structure.\r
192f6d4c 654\r
b1f6a7c6 655**/\r
192f6d4c 656VOID\r
f2bc359c 657ProcessDispatchNotifyList (\r
b0d803fe 658 IN PEI_CORE_INSTANCE *PrivateData\r
ed66e1bc 659 );\r
192f6d4c 660\r
b1f6a7c6 661/**\r
192f6d4c 662\r
f2bc359c 663 Process notifications.\r
192f6d4c 664\r
b1f6a7c6 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
192f6d4c 671\r
b1f6a7c6 672**/\r
192f6d4c 673VOID\r
f2bc359c 674ProcessNotify (\r
b0d803fe 675 IN PEI_CORE_INSTANCE *PrivateData,\r
1436aea4
MK
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
ed66e1bc 681 );\r
192f6d4c 682\r
884200f9
SZ
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
1436aea4
MK
693 IN CONST EFI_PEI_SERVICES **PeiServices,\r
694 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
884200f9
SZ
695 );\r
696\r
192f6d4c 697//\r
698// Boot mode support functions\r
699//\r
1436aea4 700\r
b1f6a7c6 701/**\r
702 This service enables PEIMs to ascertain the present value of the boot mode.\r
703\r
1cc76977 704 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 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
192f6d4c 711EFI_STATUS\r
712EFIAPI\r
713PeiGetBootMode (\r
0c2b5da8 714 IN CONST EFI_PEI_SERVICES **PeiServices,\r
d976bf31 715 IN OUT EFI_BOOT_MODE *BootMode\r
ed66e1bc 716 );\r
192f6d4c 717\r
b1f6a7c6 718/**\r
719 This service enables PEIMs to update the boot mode variable.\r
192f6d4c 720\r
192f6d4c 721\r
1cc76977 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
192f6d4c 724\r
1cc76977 725 @return EFI_SUCCESS The value was successfully updated\r
192f6d4c 726\r
b1f6a7c6 727**/\r
192f6d4c 728EFI_STATUS\r
729EFIAPI\r
730PeiSetBootMode (\r
0c2b5da8 731 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1436aea4 732 IN EFI_BOOT_MODE BootMode\r
ed66e1bc 733 );\r
192f6d4c 734\r
735//\r
736// Security support functions\r
737//\r
1436aea4 738\r
b1f6a7c6 739/**\r
740\r
741 Initialize the security services.\r
742\r
1cc76977 743 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
40f26b8f 744 @param OldCoreData Pointer to the old core data.\r
d39d1260 745 NULL if being run in non-permanent memory mode.\r
b1f6a7c6 746\r
747**/\r
192f6d4c 748VOID\r
749InitializeSecurityServices (\r
1436aea4
MK
750 IN EFI_PEI_SERVICES **PeiServices,\r
751 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 752 );\r
192f6d4c 753\r
b1f6a7c6 754/**\r
d976bf31 755 Verify a Firmware volume.\r
192f6d4c 756\r
40f26b8f 757 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration\r
192f6d4c 758\r
40f26b8f 759 @retval EFI_SUCCESS Firmware Volume is legal\r
760 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test\r
192f6d4c 761\r
b1f6a7c6 762**/\r
192f6d4c 763EFI_STATUS\r
764VerifyFv (\r
765 IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress\r
ed66e1bc 766 );\r
192f6d4c 767\r
b1f6a7c6 768/**\r
b1f6a7c6 769 Provide a callout to the security verification service.\r
192f6d4c 770\r
b1f6a7c6 771 @param PrivateData PeiCore's private data structure\r
772 @param VolumeHandle Handle of FV\r
d39d1260 773 @param FileHandle Handle of PEIM's FFS\r
c7935105 774 @param AuthenticationStatus Authentication status\r
192f6d4c 775\r
b1f6a7c6 776 @retval EFI_SUCCESS Image is OK\r
777 @retval EFI_SECURITY_VIOLATION Image is illegal\r
c7935105 778 @retval EFI_NOT_FOUND If security PPI is not installed.\r
b1f6a7c6 779**/\r
192f6d4c 780EFI_STATUS\r
781VerifyPeim (\r
1436aea4
MK
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
ed66e1bc 786 );\r
192f6d4c 787\r
b1f6a7c6 788/**\r
192f6d4c 789\r
b1f6a7c6 790 Gets the pointer to the HOB List.\r
192f6d4c 791\r
192f6d4c 792\r
1cc76977 793 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 794 @param HobList Pointer to the HOB List.\r
192f6d4c 795\r
b1f6a7c6 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
192f6d4c 799\r
b1f6a7c6 800**/\r
192f6d4c 801EFI_STATUS\r
802EFIAPI\r
803PeiGetHobList (\r
0c2b5da8 804 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1436aea4 805 IN OUT VOID **HobList\r
ed66e1bc 806 );\r
192f6d4c 807\r
b1f6a7c6 808/**\r
809 Add a new HOB to the HOB List.\r
192f6d4c 810\r
1cc76977 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
192f6d4c 815\r
d39d1260 816 @return EFI_SUCCESS Success to create HOB.\r
b1f6a7c6 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
192f6d4c 820\r
b1f6a7c6 821**/\r
192f6d4c 822EFI_STATUS\r
823EFIAPI\r
824PeiCreateHob (\r
0c2b5da8 825 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1436aea4
MK
826 IN UINT16 Type,\r
827 IN UINT16 Length,\r
828 IN OUT VOID **Hob\r
ed66e1bc 829 );\r
192f6d4c 830\r
b1f6a7c6 831/**\r
192f6d4c 832\r
b1f6a7c6 833 Builds a Handoff Information Table HOB\r
192f6d4c 834\r
b1f6a7c6 835 @param BootMode - Current Bootmode\r
836 @param MemoryBegin - Start Memory Address.\r
837 @param MemoryLength - Length of Memory.\r
192f6d4c 838\r
b1f6a7c6 839 @return EFI_SUCCESS Always success to initialize HOB.\r
192f6d4c 840\r
b1f6a7c6 841**/\r
192f6d4c 842EFI_STATUS\r
843PeiCoreBuildHobHandoffInfoTable (\r
844 IN EFI_BOOT_MODE BootMode,\r
845 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
846 IN UINT64 MemoryLength\r
ed66e1bc 847 );\r
192f6d4c 848\r
483e2cdd
SZ
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
1436aea4
MK
861 IN CONST EFI_PEI_SERVICES **PeiServices,\r
862 IN EFI_HOB_GENERIC_HEADER *SecHobList\r
483e2cdd
SZ
863 );\r
864\r
192f6d4c 865//\r
866// FFS Fw Volume support functions\r
867//\r
1436aea4 868\r
b1f6a7c6 869/**\r
3b428ade 870 Searches for the next matching file in the firmware volume.\r
b1f6a7c6 871\r
1cc76977 872 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 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
aa75dfec 875 @param FvHandle Handle of firmware volume in which to search.\r
3b428ade 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
b1f6a7c6 883\r
884**/\r
192f6d4c 885EFI_STATUS\r
886EFIAPI\r
887PeiFfsFindNextFile (\r
1436aea4
MK
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
ed66e1bc 892 );\r
192f6d4c 893\r
9bedaec0
MK
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
b1f6a7c6 925/**\r
3b428ade 926 Searches for the next matching section within the specified file.\r
192f6d4c 927\r
3b428ade 928 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
b1f6a7c6 929 @param SectionType Filter to find only sections of this type.\r
3b428ade 930 @param FileHandle Pointer to the current file to search.\r
931 @param SectionData A pointer to the discovered section, if successful.\r
b1f6a7c6 932 NULL if section not found\r
192f6d4c 933\r
3b428ade 934 @retval EFI_NOT_FOUND The section was not found.\r
935 @retval EFI_SUCCESS The section was found.\r
192f6d4c 936\r
b1f6a7c6 937**/\r
192f6d4c 938EFI_STATUS\r
939EFIAPI\r
940PeiFfsFindSectionData (\r
1436aea4
MK
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
ed66e1bc 945 );\r
192f6d4c 946\r
c7935105
SZ
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
1436aea4
MK
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
c7935105
SZ
970 );\r
971\r
b1f6a7c6 972/**\r
3b428ade 973 Search the firmware volumes by index\r
192f6d4c 974\r
3b428ade 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
192f6d4c 979\r
3b428ade 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
192f6d4c 983\r
b1f6a7c6 984**/\r
192f6d4c 985EFI_STATUS\r
986EFIAPI\r
3b428ade 987PeiFfsFindNextVolume (\r
1436aea4
MK
988 IN CONST EFI_PEI_SERVICES **PeiServices,\r
989 IN UINTN Instance,\r
990 IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
ed66e1bc 991 );\r
192f6d4c 992\r
993//\r
994// Memory support functions\r
995//\r
1436aea4 996\r
b1f6a7c6 997/**\r
998\r
999 Initialize the memory services.\r
1000\r
1cc76977 1001 @param PrivateData PeiCore's private data structure\r
d1102dba 1002 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
f34aec3b 1003 and location of temporary RAM, the stack location and the BFV location.\r
b1f6a7c6 1004 @param OldCoreData Pointer to the PEI Core data.\r
d39d1260 1005 NULL if being run in non-permanent memory mode.\r
b1f6a7c6 1006\r
1007**/\r
192f6d4c 1008VOID\r
1009InitializeMemoryServices (\r
b0d803fe 1010 IN PEI_CORE_INSTANCE *PrivateData,\r
5aae0aa7 1011 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
192f6d4c 1012 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 1013 );\r
192f6d4c 1014\r
b1f6a7c6 1015/**\r
192f6d4c 1016\r
b1f6a7c6 1017 Install the permanent memory is now available.\r
1018 Creates HOB (PHIT and Stack).\r
192f6d4c 1019\r
1cc76977 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
192f6d4c 1023\r
b1f6a7c6 1024 @return EFI_SUCCESS Always success.\r
192f6d4c 1025\r
b1f6a7c6 1026**/\r
192f6d4c 1027EFI_STATUS\r
1028EFIAPI\r
1029PeiInstallPeiMemory (\r
1436aea4
MK
1030 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1031 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
1032 IN UINT64 MemoryLength\r
ed66e1bc 1033 );\r
192f6d4c 1034\r
b1f6a7c6 1035/**\r
b2374cec
SZ
1036 Migrate memory pages allocated in pre-memory phase.\r
1037 Copy memory pages at temporary heap top to permanent heap top.\r
192f6d4c 1038\r
b2374cec
SZ
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
192f6d4c 1041\r
b2374cec
SZ
1042**/\r
1043VOID\r
1044MigrateMemoryPages (\r
1436aea4
MK
1045 IN PEI_CORE_INSTANCE *Private,\r
1046 IN BOOLEAN TemporaryRamMigrated\r
b2374cec 1047 );\r
192f6d4c 1048\r
9bedaec0
MK
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
1436aea4 1057 IN PEI_CORE_INSTANCE *Private\r
9bedaec0
MK
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
1436aea4
MK
1071 IN PEI_CORE_INSTANCE *PrivateData,\r
1072 IN UINTN OrgFvHandle,\r
1073 IN UINTN FvHandle\r
9bedaec0
MK
1074 );\r
1075\r
b2374cec
SZ
1076/**\r
1077 Migrate MemoryBaseAddress in memory allocation HOBs\r
1078 from the temporary memory to PEI installed memory.\r
192f6d4c 1079\r
b2374cec
SZ
1080 @param[in] PrivateData Pointer to PeiCore's private data structure.\r
1081\r
1082**/\r
1083VOID\r
1084ConvertMemoryAllocationHobs (\r
1436aea4 1085 IN PEI_CORE_INSTANCE *PrivateData\r
b2374cec
SZ
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
192f6d4c 1108\r
b1f6a7c6 1109**/\r
192f6d4c 1110EFI_STATUS\r
1111EFIAPI\r
1112PeiAllocatePages (\r
1436aea4
MK
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
b2374cec
SZ
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
1436aea4
MK
1135 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1136 IN EFI_PHYSICAL_ADDRESS Memory,\r
1137 IN UINTN Pages\r
ed66e1bc 1138 );\r
192f6d4c 1139\r
b1f6a7c6 1140/**\r
192f6d4c 1141\r
3d4d0c34 1142 Memory allocation service on the temporary memory.\r
192f6d4c 1143\r
192f6d4c 1144\r
1cc76977 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
192f6d4c 1148\r
b1f6a7c6 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
192f6d4c 1152\r
b1f6a7c6 1153**/\r
192f6d4c 1154EFI_STATUS\r
1155EFIAPI\r
1156PeiAllocatePool (\r
1436aea4
MK
1157 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1158 IN UINTN Size,\r
1159 OUT VOID **Buffer\r
ed66e1bc 1160 );\r
192f6d4c 1161\r
b1f6a7c6 1162/**\r
192f6d4c 1163\r
b1f6a7c6 1164 Routine for load image file.\r
192f6d4c 1165\r
192f6d4c 1166\r
1cc76977 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
341a658f 1169 @param PeimState The dispatch state of the input PEIM handle.\r
1cc76977 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
192f6d4c 1172\r
1cc76977 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
192f6d4c 1176\r
b1f6a7c6 1177**/\r
192f6d4c 1178EFI_STATUS\r
1179PeiLoadImage (\r
1436aea4
MK
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
ed66e1bc 1185 );\r
192f6d4c 1186\r
b1f6a7c6 1187/**\r
192f6d4c 1188\r
b1f6a7c6 1189 Core version of the Status Code reporter\r
192f6d4c 1190\r
192f6d4c 1191\r
1cc76977 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
192f6d4c 1198\r
b1f6a7c6 1199 @retval EFI_SUCCESS if status code is successfully reported\r
1200 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed\r
192f6d4c 1201\r
b1f6a7c6 1202**/\r
192f6d4c 1203EFI_STATUS\r
1204EFIAPI\r
1205PeiReportStatusCode (\r
1436aea4
MK
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
ed66e1bc 1212 );\r
192f6d4c 1213\r
b1f6a7c6 1214/**\r
192f6d4c 1215\r
b1f6a7c6 1216 Core version of the Reset System\r
192f6d4c 1217\r
192f6d4c 1218\r
1cc76977 1219 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
192f6d4c 1220\r
b1f6a7c6 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
192f6d4c 1224\r
b1f6a7c6 1225**/\r
192f6d4c 1226EFI_STATUS\r
1227EFIAPI\r
1228PeiResetSystem (\r
1436aea4 1229 IN CONST EFI_PEI_SERVICES **PeiServices\r
ed66e1bc 1230 );\r
192f6d4c 1231\r
672473ea
SZ
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
c8721bb2 1237 @param[in] DataSize The size, in bytes, of ResetData.\r
672473ea
SZ
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
eac49c83 1242 system reset.\r
672473ea
SZ
1243\r
1244**/\r
1245VOID\r
1246EFIAPI\r
1247PeiResetSystem2 (\r
1436aea4
MK
1248 IN EFI_RESET_TYPE ResetType,\r
1249 IN EFI_STATUS ResetStatus,\r
1250 IN UINTN DataSize,\r
1251 IN VOID *ResetData OPTIONAL\r
672473ea
SZ
1252 );\r
1253\r
b1f6a7c6 1254/**\r
192f6d4c 1255\r
d39d1260 1256 Initialize PeiCore FV List.\r
192f6d4c 1257\r
192f6d4c 1258\r
b1f6a7c6 1259 @param PrivateData - Pointer to PEI_CORE_INSTANCE.\r
1260 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.\r
192f6d4c 1261\r
b1f6a7c6 1262**/\r
50cb16d9 1263VOID\r
b0d803fe 1264PeiInitializeFv (\r
1436aea4
MK
1265 IN PEI_CORE_INSTANCE *PrivateData,\r
1266 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
ed66e1bc 1267 );\r
b0d803fe 1268\r
b1f6a7c6 1269/**\r
d39d1260 1270 Process Firmware Volume Information once FvInfoPPI install.\r
b0d803fe 1271\r
1cc76977 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
50cb16d9 1275\r
b1f6a7c6 1276 @retval EFI_SUCCESS if the interface could be successfully installed\r
b0d803fe 1277\r
b1f6a7c6 1278**/\r
b0d803fe 1279EFI_STATUS\r
1280EFIAPI\r
d39d1260 1281FirmwareVolumeInfoPpiNotifyCallback (\r
1436aea4
MK
1282 IN EFI_PEI_SERVICES **PeiServices,\r
1283 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
1284 IN VOID *Ppi\r
ed66e1bc 1285 );\r
b0d803fe 1286\r
b1f6a7c6 1287/**\r
50cb16d9 1288\r
b1f6a7c6 1289 Given the input VolumeHandle, search for the next matching name file.\r
b0d803fe 1290\r
1cc76977 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
b0d803fe 1295\r
15273993 1296 @retval EFI_NOT_FOUND No files matching the search criteria were found\r
1297 @retval EFI_SUCCESS Success to search given file\r
b0d803fe 1298\r
b1f6a7c6 1299**/\r
b0d803fe 1300EFI_STATUS\r
50cb16d9 1301EFIAPI\r
b0d803fe 1302PeiFfsFindFileByName (\r
1436aea4
MK
1303 IN CONST EFI_GUID *FileName,\r
1304 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
1305 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
ed66e1bc 1306 );\r
b0d803fe 1307\r
b1f6a7c6 1308/**\r
b1f6a7c6 1309 Returns information about a specific file.\r
b0d803fe 1310\r
3b428ade 1311 @param FileHandle Handle of the file.\r
aa75dfec 1312 @param FileInfo Upon exit, points to the file's information.\r
b0d803fe 1313\r
3b428ade 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
b0d803fe 1317\r
b1f6a7c6 1318**/\r
b0d803fe 1319EFI_STATUS\r
50cb16d9 1320EFIAPI\r
b0d803fe 1321PeiFfsGetFileInfo (\r
1322 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1323 OUT EFI_FV_FILE_INFO *FileInfo\r
ed66e1bc 1324 );\r
b0d803fe 1325\r
c7935105
SZ
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
d1102dba 1338EFIAPI\r
c7935105
SZ
1339PeiFfsGetFileInfo2 (\r
1340 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1341 OUT EFI_FV_FILE_INFO2 *FileInfo\r
1342 );\r
1343\r
b1f6a7c6 1344/**\r
3b428ade 1345 Returns information about the specified volume.\r
b0d803fe 1346\r
3b428ade 1347 @param VolumeHandle Handle of the volume.\r
aa75dfec 1348 @param VolumeInfo Upon exit, points to the volume's information.\r
b0d803fe 1349\r
3b428ade 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
b1f6a7c6 1353**/\r
b0d803fe 1354EFI_STATUS\r
50cb16d9 1355EFIAPI\r
b0d803fe 1356PeiFfsGetVolumeInfo (\r
1357 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
1358 OUT EFI_FV_INFO *VolumeInfo\r
ed66e1bc 1359 );\r
b0d803fe 1360\r
14e8823a 1361/**\r
d3add11e
MK
1362 This routine enables a PEIM to register itself for shadow when the PEI Foundation\r
1363 discovers permanent memory.\r
14e8823a 1364\r
b1f6a7c6 1365 @param FileHandle File handle of a PEIM.\r
50cb16d9 1366\r
b1f6a7c6 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
14e8823a 1370\r
50cb16d9 1371**/\r
14e8823a 1372EFI_STATUS\r
1373EFIAPI\r
1374PeiRegisterForShadow (\r
1436aea4 1375 IN EFI_PEI_FILE_HANDLE FileHandle\r
ed66e1bc 1376 );\r
14e8823a 1377\r
b1f6a7c6 1378/**\r
15273993 1379 Initialize image service that install PeiLoadFilePpi.\r
b0d803fe 1380\r
15273993 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
6393d9c8 1385 to permanent memory.\r
b0d803fe 1386\r
b1f6a7c6 1387**/\r
1388VOID\r
1389InitializeImageServices (\r
1436aea4
MK
1390 IN PEI_CORE_INSTANCE *PrivateData,\r
1391 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 1392 );\r
b0d803fe 1393\r
9bedaec0
MK
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
1436aea4
MK
1406 IN VOID *Pe32Data,\r
1407 IN VOID *ImageAddress\r
9bedaec0
MK
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
1436aea4
MK
1422 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1423 OUT VOID **Pe32Data\r
9bedaec0
MK
1424 );\r
1425\r
aa79b0b3 1426/**\r
1427 The wrapper function of PeiLoadImageLoadImage().\r
1428\r
f34aec3b 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
aa79b0b3 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
e3917e22
MK
1444 OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg OPTIONAL,\r
1445 OUT UINT64 *ImageSizeArg OPTIONAL,\r
aa79b0b3 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
3b428ade 1469/**\r
d39d1260 1470 Get FV image(s) from the FV type file, then install FV INFO(2) PPI, Build FV(2, 3) HOB.\r
3b428ade 1471\r
c7935105 1472 @param PrivateData PeiCore's private data structure\r
d39d1260
MK
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
3b428ade 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
c7935105 1479 @retval EFI_SECURITY_VIOLATION Image is illegal\r
3b428ade 1480 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section\r
d1102dba 1481\r
3b428ade 1482**/\r
1483EFI_STATUS\r
1484ProcessFvFile (\r
1436aea4
MK
1485 IN PEI_CORE_INSTANCE *PrivateData,\r
1486 IN PEI_CORE_FV_HANDLE *ParentFvCoreHandle,\r
1487 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle\r
3b428ade 1488 );\r
d1102dba 1489\r
3b428ade 1490/**\r
d3add11e 1491 Gets a PEI_CORE_FV_HANDLE instance for the next volume according to the given index.\r
d1102dba 1492\r
d3add11e
MK
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
d1102dba 1495\r
3b428ade 1496 @param Private Pointer of PEI_CORE_INSTANCE\r
d3add11e 1497 @param Instance Index of the FV to search\r
d1102dba 1498\r
3b428ade 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
d1102dba 1506\r
8d415937 1507//\r
1508// Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r
d1102dba 1509//\r
8d415937 1510\r
1511/**\r
1512 Memory-based read services.\r
d1102dba
LG
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
8d415937 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
d1102dba 1528 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
8d415937 1529**/\r
1530EFI_STATUS\r
1531EFIAPI\r
1532PeiDefaultMemRead (\r
1436aea4
MK
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
8d415937 1539 );\r
d1102dba 1540\r
8d415937 1541/**\r
1542 Memory-based write services.\r
d1102dba
LG
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
8d415937 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
d1102dba 1558 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
8d415937 1559**/\r
1560EFI_STATUS\r
1561EFIAPI\r
1562PeiDefaultMemWrite (\r
1436aea4
MK
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
8d415937 1569 );\r
d1102dba 1570\r
8d415937 1571/**\r
1572 IO-based read services.\r
d1102dba 1573\r
8d415937 1574 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.\r
d1102dba
LG
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
8d415937 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
1436aea4
MK
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
8d415937 1598 );\r
d1102dba 1599\r
8d415937 1600/**\r
1601 IO-based write services.\r
d1102dba 1602\r
8d415937 1603 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.\r
d1102dba
LG
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
8d415937 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
1436aea4
MK
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
8d415937 1627 );\r
d1102dba 1628\r
8d415937 1629/**\r
1630 8-bit I/O read operations.\r
d1102dba
LG
1631\r
1632 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 1633 return 0.\r
d1102dba 1634\r
8d415937 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
1436aea4
MK
1644 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1645 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1646 IN UINT64 Address\r
8d415937 1647 );\r
d1102dba 1648\r
8d415937 1649/**\r
1650 Reads an 16-bit I/O port.\r
d1102dba
LG
1651\r
1652 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 1653 return 0.\r
d1102dba 1654\r
8d415937 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
1436aea4
MK
1664 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1665 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1666 IN UINT64 Address\r
8d415937 1667 );\r
d1102dba 1668\r
8d415937 1669/**\r
1670 Reads an 32-bit I/O port.\r
d1102dba
LG
1671\r
1672 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 1673 return 0.\r
d1102dba 1674\r
8d415937 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
1436aea4
MK
1684 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1685 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1686 IN UINT64 Address\r
8d415937 1687 );\r
d1102dba 1688\r
8d415937 1689/**\r
1690 Reads an 64-bit I/O port.\r
d1102dba
LG
1691\r
1692 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 1693 return 0.\r
d1102dba 1694\r
8d415937 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
1436aea4
MK
1704 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1705 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1706 IN UINT64 Address\r
8d415937 1707 );\r
d1102dba 1708\r
8d415937 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
1436aea4
MK
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
8d415937 1724 );\r
d1102dba 1725\r
8d415937 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
1436aea4
MK
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
8d415937 1741 );\r
d1102dba 1742\r
8d415937 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
1436aea4
MK
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
8d415937 1758 );\r
d1102dba 1759\r
8d415937 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
1436aea4
MK
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
8d415937 1775 );\r
d1102dba 1776\r
8d415937 1777/**\r
1778 8-bit memory read operations.\r
1779\r
d1102dba 1780 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 1781 return 0.\r
d1102dba 1782\r
8d415937 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
1436aea4
MK
1793 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1794 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1795 IN UINT64 Address\r
8d415937 1796 );\r
d1102dba 1797\r
8d415937 1798/**\r
1799 16-bit memory read operations.\r
1800\r
d1102dba 1801 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 1802 return 0.\r
d1102dba 1803\r
8d415937 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
1436aea4
MK
1814 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1815 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1816 IN UINT64 Address\r
8d415937 1817 );\r
d1102dba 1818\r
8d415937 1819/**\r
1820 32-bit memory read operations.\r
1821\r
d1102dba 1822 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 1823 return 0.\r
d1102dba 1824\r
8d415937 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
1436aea4
MK
1835 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1836 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1837 IN UINT64 Address\r
8d415937 1838 );\r
d1102dba 1839\r
8d415937 1840/**\r
1841 64-bit memory read operations.\r
1842\r
d1102dba 1843 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 1844 return 0.\r
d1102dba 1845\r
8d415937 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
1436aea4
MK
1856 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1857 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1858 IN UINT64 Address\r
8d415937 1859 );\r
d1102dba 1860\r
8d415937 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
1436aea4
MK
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
8d415937 1877 );\r
d1102dba 1878\r
8d415937 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
1436aea4
MK
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
8d415937 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
1436aea4
MK
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
8d415937 1913 );\r
d1102dba 1914\r
8d415937 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
1436aea4
MK
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
8d415937 1931 );\r
d1102dba 1932\r
1436aea4 1933extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi;\r
8d415937 1934\r
1935//\r
1936// Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r
d1102dba 1937//\r
8d415937 1938\r
1939/**\r
1940 Reads from a given location in the PCI configuration space.\r
1941\r
d1102dba
LG
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
8d415937 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
d1102dba 1956\r
8d415937 1957**/\r
1958EFI_STATUS\r
1959EFIAPI\r
1960PeiDefaultPciCfg2Read (\r
1436aea4
MK
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
8d415937 1966 );\r
d1102dba 1967\r
8d415937 1968/**\r
1969 Write to a given location in the PCI configuration space.\r
1970\r
d1102dba
LG
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
8d415937 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
1436aea4
MK
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
8d415937 1994 );\r
d1102dba 1995\r
8d415937 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
1436aea4
MK
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
d1102dba
LG
2024 );\r
2025\r
1436aea4 2026extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi;\r
8d415937 2027\r
8e0e40ed 2028/**\r
2029 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should\r
d1102dba 2030 be re-installed with the instance in permanent memory and all cached FvPpi pointers in\r
6393d9c8 2031 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent\r
8e0e40ed 2032 memory.\r
d1102dba 2033\r
8e0e40ed 2034 @param PrivateData Pointer to PEI_CORE_INSTANCE.\r
d1102dba 2035**/\r
8e0e40ed 2036VOID\r
2037PeiReinitializeFv (\r
1436aea4 2038 IN PEI_CORE_INSTANCE *PrivateData\r
8e0e40ed 2039 );\r
d1102dba 2040\r
192f6d4c 2041#endif\r