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