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