]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Pei/PeiMain.h
1. add missing free operation in conditional branch.
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain.h
CommitLineData
615c6dd0 1/** @file\r
b1f6a7c6 2 Definition of Pei Core Structures and Services\r
3 \r
15273993 4Copyright (c) 2006 - 2008, Intel Corporation\r
192f6d4c 5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
615c6dd0 13**/\r
192f6d4c 14\r
15#ifndef _PEI_MAIN_H_\r
16#define _PEI_MAIN_H_\r
17\r
859b72fa 18#include <PiPei.h>\r
859b72fa
A
19#include <Ppi/DxeIpl.h>\r
20#include <Ppi/MemoryDiscovered.h>\r
859b72fa 21#include <Ppi/StatusCode.h>\r
859b72fa 22#include <Ppi/Reset.h>\r
b0d803fe 23#include <Ppi/FirmwareVolume.h>\r
24#include <Ppi/FirmwareVolumeInfo.h>\r
25#include <Ppi/Decompress.h>\r
26#include <Ppi/GuidedSectionExtraction.h>\r
27#include <Ppi/LoadFile.h>\r
28#include <Ppi/Security2.h>\r
58dcdada 29#include <Ppi/TemporaryRamSupport.h>\r
859b72fa
A
30#include <Library/DebugLib.h>\r
31#include <Library/PeiCoreEntryPoint.h>\r
32#include <Library/BaseLib.h>\r
33#include <Library/HobLib.h>\r
34#include <Library/PerformanceLib.h>\r
35#include <Library/PeiServicesLib.h>\r
36#include <Library/ReportStatusCodeLib.h>\r
c58cf83d 37#include <Library/PeCoffLib.h>\r
859b72fa
A
38#include <Library/PeCoffGetEntryPointLib.h>\r
39#include <Library/BaseMemoryLib.h>\r
b0d803fe 40#include <Library/CacheMaintenanceLib.h>\r
859b72fa 41#include <Library/TimerLib.h>\r
177aabe6 42#include <Library/PcdLib.h>\r
28dc3c67 43#include <IndustryStandard/PeImage.h>\r
14e8823a 44#include <Library/PeiServicesTablePointerLib.h>\r
b0d803fe 45#include <Library/MemoryAllocationLib.h>\r
46#include <Guid/FirmwareFileSystem2.h>\r
47#include <Guid/AprioriFileName.h>\r
192f6d4c 48\r
15273993 49///\r
50/// It is an FFS type extension used for PeiFindFileEx. It indicates current\r
51/// Ffs searching is for all PEIMs can be dispatched by PeiCore.\r
52///\r
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
1cc76977 65/// PPI database structure which contains two link: PpiList and NotifyList. PpiList\r
66/// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.\r
40f26b8f 67///\r
192f6d4c 68typedef struct {\r
1cc76977 69 ///\r
70 /// index of end of PpiList link list.\r
71 ///\r
192f6d4c 72 INTN PpiListEnd;\r
1cc76977 73 ///\r
74 /// index of end of notify link list.\r
75 ///\r
192f6d4c 76 INTN NotifyListEnd;\r
1cc76977 77 ///\r
78 /// index of the dispatched notify list.\r
79 ///\r
192f6d4c 80 INTN DispatchListEnd;\r
1cc76977 81 ///\r
82 /// index of last installed Ppi description in PpiList link list.\r
83 ///\r
192f6d4c 84 INTN LastDispatchedInstall;\r
1cc76977 85 ///\r
86 /// index of last dispatched notify in Notify link list.\r
87 /// \r
192f6d4c 88 INTN LastDispatchedNotify;\r
1cc76977 89 ///\r
90 /// Ppi database.\r
91 ///\r
eaf539d0 92 PEI_PPI_LIST_POINTERS PpiListPtrs[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)];\r
192f6d4c 93} PEI_PPI_DATABASE;\r
94\r
3a63377f 95\r
3a63377f 96//\r
97// PEI_CORE_FV_HANDE.PeimState\r
98// Do not change these values as there is code doing math to change states.\r
99// Look for Private->Fv[FvCount].PeimState[PeimCount]++;\r
100//\r
101#define PEIM_STATE_NOT_DISPATCHED 0x00\r
102#define PEIM_STATE_DISPATCHED 0x01\r
103#define PEIM_STATE_REGISITER_FOR_SHADOW 0x02\r
104#define PEIM_STATE_DONE 0x03\r
105\r
106typedef struct {\r
107 EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r
50cb16d9 108 UINT8 PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
177aabe6 109 EFI_PEI_FILE_HANDLE FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
3a63377f 110 BOOLEAN ScanFv;\r
111} PEI_CORE_FV_HANDLE;\r
112\r
288f9b38
LG
113#define CACHE_SETION_MAX_NUMBER 0x10\r
114typedef struct {\r
115 EFI_COMMON_SECTION_HEADER* Section[CACHE_SETION_MAX_NUMBER];\r
116 VOID* SectionData[CACHE_SETION_MAX_NUMBER];\r
117 UINTN SectionSize[CACHE_SETION_MAX_NUMBER];\r
118 UINTN AllSectionCount;\r
119 UINTN SectionIndex;\r
120} CACHE_SECTION_DATA;\r
121\r
192f6d4c 122\r
f3f2e05d 123#define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')\r
192f6d4c 124\r
40f26b8f 125///\r
126/// Pei Core private data structure instance\r
127///\r
192f6d4c 128typedef struct{\r
129 UINTN Signature;\r
130 EFI_PEI_SERVICES *PS; // Point to ServiceTableShadow\r
131 PEI_PPI_DATABASE PpiData;\r
3a63377f 132 UINTN FvCount;\r
177aabe6 133 PEI_CORE_FV_HANDLE Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r
134 EFI_PEI_FILE_HANDLE CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
3a63377f 135 UINTN AprioriCount;\r
50cb16d9 136 UINTN CurrentPeimFvCount;\r
3a63377f 137 UINTN CurrentPeimCount;\r
138 EFI_PEI_FILE_HANDLE CurrentFileHandle;\r
82b8c8df 139 BOOLEAN PeimNeedingDispatch;\r
140 BOOLEAN PeimDispatchOnThisPass;\r
141 BOOLEAN PeimDispatcherReenter;\r
3a63377f 142 UINTN AllFvCount;\r
177aabe6 143 EFI_PEI_FV_HANDLE AllFv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r
192f6d4c 144 EFI_PEI_HOB_POINTERS HobList;\r
145 BOOLEAN SwitchStackSignal;\r
146 BOOLEAN PeiMemoryInstalled;\r
147 EFI_PHYSICAL_ADDRESS StackBase;\r
148 UINT64 StackSize;\r
192f6d4c 149 VOID *CpuIo;\r
b0d803fe 150 EFI_PEI_SECURITY2_PPI *PrivateSecurityPpi;\r
192f6d4c 151 EFI_PEI_SERVICES ServiceTableShadow;\r
b0d803fe 152 EFI_PEI_PPI_DESCRIPTOR *XipLoadFile;\r
58dcdada 153 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin;\r
154 UINT64 PhysicalMemoryLength;\r
155 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop;\r
156 VOID* ShadowedPeiCore;\r
288f9b38 157 CACHE_SECTION_DATA CacheSection;\r
192f6d4c 158} PEI_CORE_INSTANCE;\r
159\r
40f26b8f 160///\r
161/// Pei Core Instance Data Macros\r
162///\r
192f6d4c 163#define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r
164 CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)\r
165\r
15273993 166/**\r
167 Function Pointer type for PeiCore function.\r
111e48f3 168 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size \r
f34aec3b 169 and location of temporary RAM, the stack location and the BFV location.\r
15273993 170 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
171 An empty PPI list consists of a single descriptor with the end-tag\r
172 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r
173 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r
174 that both the PEI Foundation and any modules can leverage the associated service\r
175 calls and/or code in these early PPIs\r
111e48f3 176 @param OldCoreData Pointer to old core data that is used to initialize the\r
15273993 177 core's data areas.\r
178**/\r
192f6d4c 179typedef\r
180EFI_STATUS\r
15273993 181(EFIAPI *PEICORE_FUNCTION_POINTER)(\r
b98c2ab7 182 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
183 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r
184 IN PEI_CORE_INSTANCE *OldCoreData\r
192f6d4c 185 );\r
186\r
b1f6a7c6 187///\r
188/// Union of temporarily used function pointers (to save stack space)\r
189///\r
192f6d4c 190typedef union {\r
15273993 191 PEICORE_FUNCTION_POINTER PeiCore;\r
1c9d209f 192 EFI_PEIM_ENTRY_POINT2 PeimEntry;\r
192f6d4c 193 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;\r
194 EFI_DXE_IPL_PPI *DxeIpl;\r
195 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r
196 EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;\r
197 VOID *Raw;\r
198} PEI_CORE_TEMP_POINTERS;\r
199\r
b98c2ab7 200typedef struct {\r
201 CONST EFI_SEC_PEI_HAND_OFF *SecCoreData;\r
202 EFI_PEI_PPI_DESCRIPTOR *PpiList;\r
203 VOID *Data;\r
204} PEI_CORE_PARAMETERS;\r
205\r
192f6d4c 206//\r
207// PeiCore function\r
208//\r
b1f6a7c6 209/**\r
192f6d4c 210\r
211 The entry routine to Pei Core, invoked by PeiMain during transition\r
212 from SEC to PEI. After switching stack in the PEI core, it will restart\r
213 with the old core data.\r
214\r
192f6d4c 215\r
111e48f3 216 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size \r
f34aec3b 217 and location of temporary RAM, the stack location and the BFV location.\r
b1f6a7c6 218 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
219 An empty PPI list consists of a single descriptor with the end-tag\r
220 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r
221 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r
222 that both the PEI Foundation and any modules can leverage the associated service\r
223 calls and/or code in these early PPIs\r
224 @param Data Pointer to old core data that is used to initialize the\r
192f6d4c 225 core's data areas.\r
226\r
b1f6a7c6 227**/\r
0308e20d 228VOID\r
b1f6a7c6 229EFIAPI\r
230PeiCore (\r
231 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
d976bf31 232 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r
b1f6a7c6 233 IN VOID *Data\r
ed66e1bc 234 );\r
192f6d4c 235\r
236//\r
237// Dispatcher support functions\r
238//\r
239\r
b1f6a7c6 240/**\r
192f6d4c 241\r
242 This is the POSTFIX version of the dependency evaluator. When a\r
243 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on\r
244 the evaluation stack. When that entry is poped from the evaluation\r
245 stack, the PPI is checked if it is installed. This method allows\r
246 some time savings as not all PPIs must be checked for certain\r
247 operation types (AND, OR).\r
248\r
192f6d4c 249\r
1cc76977 250 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 251 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to\r
252 the BNF described above and is stored in postfix notation.\r
192f6d4c 253\r
b1f6a7c6 254 @retval TRUE if it is a well-formed Grammar\r
255 @retval FALSE if the dependency expression overflows the evaluation stack\r
256 if the dependency expression underflows the evaluation stack\r
257 if the dependency expression is not a well-formed Grammar.\r
192f6d4c 258\r
b1f6a7c6 259**/\r
260BOOLEAN\r
261PeimDispatchReadiness (\r
262 IN EFI_PEI_SERVICES **PeiServices,\r
263 IN VOID *DependencyExpression\r
ed66e1bc 264 );\r
192f6d4c 265\r
b1f6a7c6 266/**\r
267 Conduct PEIM dispatch.\r
268\r
731bd38e 269 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data\r
1cc76977 270 @param PrivateData Pointer to the private data passed in from caller\r
192f6d4c 271\r
b1f6a7c6 272**/\r
b0d803fe 273VOID\r
192f6d4c 274PeiDispatcher (\r
5aae0aa7 275 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
b0d803fe 276 IN PEI_CORE_INSTANCE *PrivateData\r
ed66e1bc 277 );\r
192f6d4c 278\r
b1f6a7c6 279/**\r
280 Initialize the Dispatcher's data members\r
192f6d4c 281\r
b1f6a7c6 282 @param PrivateData PeiCore's private data structure\r
283 @param OldCoreData Old data from SecCore\r
284 NULL if being run in non-permament memory mode.\r
aa79b0b3 285 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
286 and location of temporary RAM, the stack location and the BFV location.\r
192f6d4c 287\r
b1f6a7c6 288**/\r
192f6d4c 289VOID\r
290InitializeDispatcherData (\r
b0d803fe 291 IN PEI_CORE_INSTANCE *PrivateData,\r
192f6d4c 292 IN PEI_CORE_INSTANCE *OldCoreData,\r
5aae0aa7 293 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
ed66e1bc 294 );\r
192f6d4c 295\r
b1f6a7c6 296/**\r
297 This routine parses the Dependency Expression, if available, and\r
298 decides if the module can be executed.\r
192f6d4c 299\r
192f6d4c 300\r
b1f6a7c6 301 @param Private PeiCore's private data structure\r
302 @param FileHandle PEIM's file handle\r
731bd38e 303 @param PeimCount The index of last dispatched PEIM.\r
192f6d4c 304\r
731bd38e 305 @retval TRUE Can be dispatched\r
306 @retval FALSE Cannot be dispatched\r
192f6d4c 307\r
b1f6a7c6 308**/\r
192f6d4c 309BOOLEAN\r
310DepexSatisfied (\r
b0d803fe 311 IN PEI_CORE_INSTANCE *Private,\r
312 IN EFI_PEI_FILE_HANDLE FileHandle,\r
313 IN UINTN PeimCount\r
ed66e1bc 314 );\r
192f6d4c 315\r
192f6d4c 316//\r
317// PPI support functions\r
318//\r
b1f6a7c6 319/**\r
320\r
321 Initialize PPI services.\r
322\r
b1f6a7c6 323 @param PrivateData Pointer to the PEI Core data.\r
324 @param OldCoreData Pointer to old PEI Core data. \r
325 NULL if being run in non-permament memory mode.\r
326\r
327**/\r
192f6d4c 328VOID\r
329InitializePpiServices (\r
b0d803fe 330 IN PEI_CORE_INSTANCE *PrivateData,\r
192f6d4c 331 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 332 );\r
192f6d4c 333\r
b1f6a7c6 334/**\r
192f6d4c 335\r
731bd38e 336 Migrate the Hob list from the CAR stack to PEI installed memory.\r
337\r
338 @param PrivateData Pointer to PeiCore's private data structure.\r
339 @param OldCheckingBottom Bottom of temporary memory range. All Ppi in this range\r
340 will be fixup for PpiData and PpiDescriptor pointer.\r
341 @param OldCheckingTop Top of temporary memory range. All Ppi in this range\r
342 will be fixup for PpiData and PpiDescriptor.\r
5c5a0601 343 @param Fixup The address difference between\r
344 the new Hob list and old Hob list.\r
192f6d4c 345\r
b1f6a7c6 346**/\r
192f6d4c 347VOID\r
348ConvertPpiPointers (\r
40f26b8f 349 IN PEI_CORE_INSTANCE *PrivateData,\r
350 IN UINTN OldCheckingBottom,\r
351 IN UINTN OldCheckingTop,\r
352 IN INTN Fixup\r
ed66e1bc 353 );\r
192f6d4c 354\r
b1f6a7c6 355/**\r
192f6d4c 356\r
731bd38e 357 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.\r
192f6d4c 358\r
15273993 359 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
360 @param PpiList Pointer to ppi array that want to be installed.\r
192f6d4c 361\r
15273993 362 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.\r
363 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer\r
731bd38e 364 if any PPI in PpiList is not valid\r
15273993 365 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI\r
192f6d4c 366\r
b1f6a7c6 367**/\r
192f6d4c 368EFI_STATUS\r
369EFIAPI\r
370PeiInstallPpi (\r
0c2b5da8 371 IN CONST EFI_PEI_SERVICES **PeiServices,\r
372 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
ed66e1bc 373 );\r
192f6d4c 374\r
b1f6a7c6 375/**\r
192f6d4c 376\r
b1f6a7c6 377 Re-Install PPI services.\r
192f6d4c 378\r
1cc76977 379 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
380 @param OldPpi Pointer to the old PEI PPI Descriptors.\r
381 @param NewPpi Pointer to the new PEI PPI Descriptors.\r
192f6d4c 382\r
1cc76977 383 @retval EFI_SUCCESS if the operation was successful\r
384 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL\r
731bd38e 385 if NewPpi is not valid\r
1cc76977 386 @retval EFI_NOT_FOUND if the PPI was not in the database\r
192f6d4c 387\r
b1f6a7c6 388**/\r
192f6d4c 389EFI_STATUS\r
390EFIAPI\r
391PeiReInstallPpi (\r
0c2b5da8 392 IN CONST EFI_PEI_SERVICES **PeiServices,\r
393 IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
394 IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
ed66e1bc 395 );\r
192f6d4c 396\r
b1f6a7c6 397/**\r
192f6d4c 398\r
b1f6a7c6 399 Locate a given named PPI.\r
192f6d4c 400\r
192f6d4c 401\r
1cc76977 402 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
403 @param Guid Pointer to GUID of the PPI.\r
404 @param Instance Instance Number to discover.\r
405 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,\r
b1f6a7c6 406 returns a pointer to the descriptor (includes flags, etc)\r
1cc76977 407 @param Ppi Pointer to reference the found PPI\r
192f6d4c 408\r
b1f6a7c6 409 @retval EFI_SUCCESS if the PPI is in the database\r
410 @retval EFI_NOT_FOUND if the PPI is not in the database\r
192f6d4c 411\r
b1f6a7c6 412**/\r
192f6d4c 413EFI_STATUS\r
414EFIAPI\r
415PeiLocatePpi (\r
1cc76977 416 IN CONST EFI_PEI_SERVICES **PeiServices,\r
417 IN CONST EFI_GUID *Guid,\r
192f6d4c 418 IN UINTN Instance,\r
419 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
420 IN OUT VOID **Ppi\r
ed66e1bc 421 );\r
192f6d4c 422\r
b1f6a7c6 423/**\r
192f6d4c 424\r
b1f6a7c6 425 Install a notification for a given PPI.\r
192f6d4c 426\r
192f6d4c 427\r
1cc76977 428 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
429 @param NotifyList Pointer to list of Descriptors to notify upon.\r
192f6d4c 430\r
b1f6a7c6 431 @retval EFI_SUCCESS if successful\r
432 @retval EFI_OUT_OF_RESOURCES if no space in the database\r
433 @retval EFI_INVALID_PARAMETER if not a good decriptor\r
192f6d4c 434\r
b1f6a7c6 435**/\r
192f6d4c 436EFI_STATUS\r
437EFIAPI\r
438PeiNotifyPpi (\r
0c2b5da8 439 IN CONST EFI_PEI_SERVICES **PeiServices,\r
440 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
ed66e1bc 441 );\r
192f6d4c 442\r
b1f6a7c6 443/**\r
192f6d4c 444\r
b1f6a7c6 445 Process the Notify List at dispatch level.\r
192f6d4c 446\r
b1f6a7c6 447 @param PrivateData PeiCore's private data structure.\r
192f6d4c 448\r
b1f6a7c6 449**/\r
192f6d4c 450VOID\r
451ProcessNotifyList (\r
b0d803fe 452 IN PEI_CORE_INSTANCE *PrivateData\r
ed66e1bc 453 );\r
192f6d4c 454\r
b1f6a7c6 455/**\r
192f6d4c 456\r
b1f6a7c6 457 Dispatch notifications.\r
192f6d4c 458\r
b1f6a7c6 459 @param PrivateData PeiCore's private data structure\r
460 @param NotifyType Type of notify to fire.\r
461 @param InstallStartIndex Install Beginning index.\r
462 @param InstallStopIndex Install Ending index.\r
463 @param NotifyStartIndex Notify Beginning index.\r
464 @param NotifyStopIndex Notify Ending index.\r
192f6d4c 465\r
b1f6a7c6 466**/\r
192f6d4c 467VOID\r
468DispatchNotify (\r
b0d803fe 469 IN PEI_CORE_INSTANCE *PrivateData,\r
192f6d4c 470 IN UINTN NotifyType,\r
471 IN INTN InstallStartIndex,\r
472 IN INTN InstallStopIndex,\r
473 IN INTN NotifyStartIndex,\r
474 IN INTN NotifyStopIndex\r
ed66e1bc 475 );\r
192f6d4c 476\r
477//\r
478// Boot mode support functions\r
479//\r
b1f6a7c6 480/**\r
481 This service enables PEIMs to ascertain the present value of the boot mode.\r
482\r
1cc76977 483 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 484 @param BootMode A pointer to contain the value of the boot mode.\r
485\r
486 @retval EFI_SUCCESS The boot mode was returned successfully.\r
487 @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
488\r
489**/\r
192f6d4c 490EFI_STATUS\r
491EFIAPI\r
492PeiGetBootMode (\r
0c2b5da8 493 IN CONST EFI_PEI_SERVICES **PeiServices,\r
d976bf31 494 IN OUT EFI_BOOT_MODE *BootMode\r
ed66e1bc 495 );\r
192f6d4c 496\r
b1f6a7c6 497/**\r
498 This service enables PEIMs to update the boot mode variable.\r
192f6d4c 499\r
192f6d4c 500\r
1cc76977 501 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
502 @param BootMode The value of the boot mode to set.\r
192f6d4c 503\r
1cc76977 504 @return EFI_SUCCESS The value was successfully updated\r
192f6d4c 505\r
b1f6a7c6 506**/\r
192f6d4c 507EFI_STATUS\r
508EFIAPI\r
509PeiSetBootMode (\r
0c2b5da8 510 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 511 IN EFI_BOOT_MODE BootMode\r
ed66e1bc 512 );\r
192f6d4c 513\r
514//\r
515// Security support functions\r
516//\r
b1f6a7c6 517/**\r
518\r
519 Initialize the security services.\r
520\r
1cc76977 521 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
40f26b8f 522 @param OldCoreData Pointer to the old core data.\r
b1f6a7c6 523 NULL if being run in non-permament memory mode.\r
524\r
525**/\r
192f6d4c 526VOID\r
527InitializeSecurityServices (\r
528 IN EFI_PEI_SERVICES **PeiServices,\r
529 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 530 );\r
192f6d4c 531\r
b1f6a7c6 532/**\r
d976bf31 533 Verify a Firmware volume.\r
192f6d4c 534\r
40f26b8f 535 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration\r
192f6d4c 536\r
40f26b8f 537 @retval EFI_SUCCESS Firmware Volume is legal\r
538 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test\r
192f6d4c 539\r
b1f6a7c6 540**/\r
192f6d4c 541EFI_STATUS\r
542VerifyFv (\r
543 IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress\r
ed66e1bc 544 );\r
192f6d4c 545\r
b1f6a7c6 546/**\r
192f6d4c 547\r
b1f6a7c6 548 Provide a callout to the security verification service.\r
192f6d4c 549\r
192f6d4c 550\r
b1f6a7c6 551 @param PrivateData PeiCore's private data structure\r
552 @param VolumeHandle Handle of FV\r
553 @param FileHandle Handle of PEIM's ffs\r
192f6d4c 554\r
b1f6a7c6 555 @retval EFI_SUCCESS Image is OK\r
556 @retval EFI_SECURITY_VIOLATION Image is illegal\r
192f6d4c 557\r
b1f6a7c6 558**/\r
192f6d4c 559EFI_STATUS\r
560VerifyPeim (\r
b0d803fe 561 IN PEI_CORE_INSTANCE *PrivateData,\r
562 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
563 IN EFI_PEI_FILE_HANDLE FileHandle\r
ed66e1bc 564 );\r
192f6d4c 565\r
b1f6a7c6 566/**\r
192f6d4c 567\r
b1f6a7c6 568 Gets the pointer to the HOB List.\r
192f6d4c 569\r
192f6d4c 570\r
1cc76977 571 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 572 @param HobList Pointer to the HOB List.\r
192f6d4c 573\r
b1f6a7c6 574 @retval EFI_SUCCESS Get the pointer of HOB List\r
575 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published\r
576 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)\r
192f6d4c 577\r
b1f6a7c6 578**/\r
192f6d4c 579EFI_STATUS\r
580EFIAPI\r
581PeiGetHobList (\r
0c2b5da8 582 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 583 IN OUT VOID **HobList\r
ed66e1bc 584 );\r
192f6d4c 585\r
b1f6a7c6 586/**\r
587 Add a new HOB to the HOB List.\r
192f6d4c 588\r
1cc76977 589 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
590 @param Type Type of the new HOB.\r
591 @param Length Length of the new HOB to allocate.\r
592 @param Hob Pointer to the new HOB.\r
192f6d4c 593\r
b1f6a7c6 594 @return EFI_SUCCESS Success to create hob.\r
595 @retval EFI_INVALID_PARAMETER if Hob is NULL\r
596 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.\r
597 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.\r
192f6d4c 598\r
b1f6a7c6 599**/\r
192f6d4c 600EFI_STATUS\r
601EFIAPI\r
602PeiCreateHob (\r
0c2b5da8 603 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 604 IN UINT16 Type,\r
605 IN UINT16 Length,\r
606 IN OUT VOID **Hob\r
ed66e1bc 607 );\r
192f6d4c 608\r
b1f6a7c6 609/**\r
192f6d4c 610\r
b1f6a7c6 611 Builds a Handoff Information Table HOB\r
192f6d4c 612\r
b1f6a7c6 613 @param BootMode - Current Bootmode\r
614 @param MemoryBegin - Start Memory Address.\r
615 @param MemoryLength - Length of Memory.\r
192f6d4c 616\r
b1f6a7c6 617 @return EFI_SUCCESS Always success to initialize HOB.\r
192f6d4c 618\r
b1f6a7c6 619**/\r
192f6d4c 620EFI_STATUS\r
621PeiCoreBuildHobHandoffInfoTable (\r
622 IN EFI_BOOT_MODE BootMode,\r
623 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
624 IN UINT64 MemoryLength\r
ed66e1bc 625 );\r
192f6d4c 626\r
627\r
628//\r
629// FFS Fw Volume support functions\r
630//\r
b1f6a7c6 631/**\r
632 Given the input file pointer, search for the next matching file in the\r
633 FFS volume as defined by SearchType. The search starts from FileHeader inside\r
634 the Firmware Volume defined by FwVolHeader.\r
635\r
636\r
1cc76977 637 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 638 @param SearchType Filter to find only files of this type.\r
639 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r
15273993 640 @param FwVolHeader Pointer to the FV header of the volume to search.\r
641 @param FileHeader Pointer to the current file from which to begin searching.\r
b1f6a7c6 642 This pointer will be updated upon return to reflect the file found.\r
643 @retval EFI_NOT_FOUND No files matching the search criteria were found\r
644 @retval EFI_SUCCESS Success to find next file in given volume\r
645\r
646**/\r
192f6d4c 647EFI_STATUS\r
648EFIAPI\r
649PeiFfsFindNextFile (\r
0c2b5da8 650 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 651 IN UINT8 SearchType,\r
0c2b5da8 652 IN EFI_PEI_FV_HANDLE FwVolHeader,\r
653 IN OUT EFI_PEI_FILE_HANDLE *FileHeader\r
ed66e1bc 654 );\r
192f6d4c 655\r
b1f6a7c6 656/**\r
657 Given the input file pointer, search for the next matching section in the\r
658 FFS volume.\r
192f6d4c 659\r
1cc76977 660 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 661 @param SectionType Filter to find only sections of this type.\r
15273993 662 @param FfsFileHeader Pointer to the current file to search.\r
b1f6a7c6 663 @param SectionData Pointer to the Section matching SectionType in FfsFileHeader.\r
664 NULL if section not found\r
192f6d4c 665\r
b1f6a7c6 666 @retval EFI_NOT_FOUND No files matching the search criteria were found\r
667 @retval EFI_SUCCESS Success to find section data in given file\r
192f6d4c 668\r
b1f6a7c6 669**/\r
192f6d4c 670EFI_STATUS\r
671EFIAPI\r
672PeiFfsFindSectionData (\r
b0d803fe 673 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 674 IN EFI_SECTION_TYPE SectionType,\r
0c2b5da8 675 IN EFI_PEI_FILE_HANDLE FfsFileHeader,\r
192f6d4c 676 IN OUT VOID **SectionData\r
ed66e1bc 677 );\r
192f6d4c 678\r
b1f6a7c6 679/**\r
680 search the firmware volumes by index\r
192f6d4c 681\r
15273993 682 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
683 @param Instance Instance of FV to find\r
684 @param FwVolHeader Pointer to found Volume.\r
192f6d4c 685\r
15273993 686 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL\r
687 @retval EFI_SUCCESS Firmware volume instance successfully found.\r
192f6d4c 688\r
b1f6a7c6 689**/\r
192f6d4c 690EFI_STATUS\r
691EFIAPI\r
692PeiFvFindNextVolume (\r
15273993 693 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 694 IN UINTN Instance,\r
0c2b5da8 695 IN OUT EFI_PEI_FV_HANDLE *FwVolHeader\r
ed66e1bc 696 );\r
192f6d4c 697\r
698//\r
699// Memory support functions\r
700//\r
b1f6a7c6 701/**\r
702\r
703 Initialize the memory services.\r
704\r
1cc76977 705 @param PrivateData PeiCore's private data structure\r
111e48f3 706 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size \r
f34aec3b 707 and location of temporary RAM, the stack location and the BFV location.\r
b1f6a7c6 708 @param OldCoreData Pointer to the PEI Core data.\r
709 NULL if being run in non-permament memory mode.\r
710\r
711**/\r
192f6d4c 712VOID\r
713InitializeMemoryServices (\r
b0d803fe 714 IN PEI_CORE_INSTANCE *PrivateData,\r
5aae0aa7 715 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
192f6d4c 716 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 717 );\r
192f6d4c 718\r
b1f6a7c6 719/**\r
192f6d4c 720\r
b1f6a7c6 721 Install the permanent memory is now available.\r
722 Creates HOB (PHIT and Stack).\r
192f6d4c 723\r
1cc76977 724 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
725 @param MemoryBegin Start of memory address.\r
726 @param MemoryLength Length of memory.\r
192f6d4c 727\r
b1f6a7c6 728 @return EFI_SUCCESS Always success.\r
192f6d4c 729\r
b1f6a7c6 730**/\r
192f6d4c 731EFI_STATUS\r
732EFIAPI\r
733PeiInstallPeiMemory (\r
0c2b5da8 734 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 735 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
736 IN UINT64 MemoryLength\r
ed66e1bc 737 );\r
192f6d4c 738\r
b1f6a7c6 739/**\r
192f6d4c 740\r
b1f6a7c6 741 Memory allocation service on permanent memory,\r
742 not usable prior to the memory installation.\r
192f6d4c 743\r
192f6d4c 744\r
1cc76977 745 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
746 @param MemoryType Type of memory to allocate.\r
747 @param Pages Number of pages to allocate.\r
748 @param Memory Pointer of memory allocated.\r
192f6d4c 749\r
b1f6a7c6 750 @retval EFI_SUCCESS The allocation was successful\r
751 @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.\r
752 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available\r
753 @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement\r
754 to allocate the number of pages.\r
192f6d4c 755\r
b1f6a7c6 756**/\r
192f6d4c 757EFI_STATUS\r
758EFIAPI\r
759PeiAllocatePages (\r
0c2b5da8 760 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 761 IN EFI_MEMORY_TYPE MemoryType,\r
762 IN UINTN Pages,\r
763 OUT EFI_PHYSICAL_ADDRESS *Memory\r
ed66e1bc 764 );\r
192f6d4c 765\r
b1f6a7c6 766/**\r
192f6d4c 767\r
b1f6a7c6 768 Memory allocation service on the CAR.\r
192f6d4c 769\r
192f6d4c 770\r
1cc76977 771 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
772 @param Size Amount of memory required\r
773 @param Buffer Address of pointer to the buffer\r
192f6d4c 774\r
b1f6a7c6 775 @retval EFI_SUCCESS The allocation was successful\r
776 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement\r
777 to allocate the requested size.\r
192f6d4c 778\r
b1f6a7c6 779**/\r
192f6d4c 780EFI_STATUS\r
781EFIAPI\r
782PeiAllocatePool (\r
0c2b5da8 783 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 784 IN UINTN Size,\r
785 OUT VOID **Buffer\r
ed66e1bc 786 );\r
192f6d4c 787\r
b1f6a7c6 788/**\r
192f6d4c 789\r
b1f6a7c6 790 Routine for load image file.\r
192f6d4c 791\r
192f6d4c 792\r
1cc76977 793 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
794 @param FileHandle Pointer to the FFS file header of the image.\r
795 @param EntryPoint Pointer to entry point of specified image file for output.\r
796 @param AuthenticationState Pointer to attestation authentication state of image.\r
192f6d4c 797\r
1cc76977 798 @retval EFI_SUCCESS Image is successfully loaded.\r
799 @retval EFI_NOT_FOUND Fail to locate necessary PPI\r
800 @retval Others Fail to load file.\r
192f6d4c 801\r
b1f6a7c6 802**/\r
192f6d4c 803EFI_STATUS\r
804PeiLoadImage (\r
6c7a807a 805 IN CONST EFI_PEI_SERVICES **PeiServices,\r
b0d803fe 806 IN EFI_PEI_FILE_HANDLE FileHandle,\r
807 OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r
808 OUT UINT32 *AuthenticationState\r
ed66e1bc 809 );\r
192f6d4c 810\r
b1f6a7c6 811/**\r
192f6d4c 812\r
b1f6a7c6 813 Core version of the Status Code reporter\r
192f6d4c 814\r
192f6d4c 815\r
1cc76977 816 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
817 @param CodeType Type of Status Code.\r
818 @param Value Value to output for Status Code.\r
819 @param Instance Instance Number of this status code.\r
820 @param CallerId ID of the caller of this status code.\r
821 @param Data Optional data associated with this status code.\r
192f6d4c 822\r
b1f6a7c6 823 @retval EFI_SUCCESS if status code is successfully reported\r
824 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed\r
192f6d4c 825\r
b1f6a7c6 826**/\r
192f6d4c 827EFI_STATUS\r
828EFIAPI\r
829PeiReportStatusCode (\r
0c2b5da8 830 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 831 IN EFI_STATUS_CODE_TYPE CodeType,\r
832 IN EFI_STATUS_CODE_VALUE Value,\r
833 IN UINT32 Instance,\r
0c2b5da8 834 IN CONST EFI_GUID *CallerId,\r
835 IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r
ed66e1bc 836 );\r
192f6d4c 837\r
b1f6a7c6 838/**\r
192f6d4c 839\r
b1f6a7c6 840 Core version of the Reset System\r
192f6d4c 841\r
192f6d4c 842\r
1cc76977 843 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
192f6d4c 844\r
b1f6a7c6 845 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.\r
846 @retval EFI_DEVICE_ERROR Did not reset system.\r
847 Otherwise, resets the system.\r
192f6d4c 848\r
b1f6a7c6 849**/\r
192f6d4c 850EFI_STATUS\r
851EFIAPI\r
852PeiResetSystem (\r
b0d803fe 853 IN CONST EFI_PEI_SERVICES **PeiServices\r
ed66e1bc 854 );\r
192f6d4c 855\r
b1f6a7c6 856/**\r
192f6d4c 857\r
b1f6a7c6 858 Initialize PeiCore Fv List.\r
192f6d4c 859\r
192f6d4c 860\r
b1f6a7c6 861 @param PrivateData - Pointer to PEI_CORE_INSTANCE.\r
862 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.\r
192f6d4c 863\r
b1f6a7c6 864**/\r
50cb16d9 865VOID\r
b0d803fe 866PeiInitializeFv (\r
867 IN PEI_CORE_INSTANCE *PrivateData,\r
868 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
ed66e1bc 869 );\r
b0d803fe 870\r
b1f6a7c6 871/**\r
872 Process Firmware Volum Information once FvInfoPPI install.\r
b0d803fe 873\r
1cc76977 874 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
875 @param NotifyDescriptor Address of the notification descriptor data structure.\r
876 @param Ppi Address of the PPI that was installed.\r
50cb16d9 877\r
b1f6a7c6 878 @retval EFI_SUCCESS if the interface could be successfully installed\r
b0d803fe 879\r
b1f6a7c6 880**/\r
b0d803fe 881EFI_STATUS\r
882EFIAPI\r
883FirmwareVolmeInfoPpiNotifyCallback (\r
884 IN EFI_PEI_SERVICES **PeiServices,\r
885 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
886 IN VOID *Ppi\r
ed66e1bc 887 );\r
b0d803fe 888\r
b1f6a7c6 889/**\r
50cb16d9 890\r
b1f6a7c6 891 Given the input VolumeHandle, search for the next matching name file.\r
b0d803fe 892\r
1cc76977 893 @param FileName File name to search.\r
894 @param VolumeHandle The current FV to search.\r
895 @param FileHandle Pointer to the file matching name in VolumeHandle.\r
896 NULL if file not found\r
b0d803fe 897\r
15273993 898 @retval EFI_NOT_FOUND No files matching the search criteria were found\r
899 @retval EFI_SUCCESS Success to search given file\r
b0d803fe 900\r
b1f6a7c6 901**/\r
b0d803fe 902EFI_STATUS\r
50cb16d9 903EFIAPI\r
b0d803fe 904PeiFfsFindFileByName (\r
905 IN CONST EFI_GUID *FileName,\r
906 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
907 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
ed66e1bc 908 );\r
b0d803fe 909\r
b1f6a7c6 910/**\r
b0d803fe 911\r
b1f6a7c6 912 Returns information about a specific file.\r
b0d803fe 913\r
b0d803fe 914\r
1cc76977 915 @param FileHandle The handle to file.\r
916 @param FileInfo Pointer to the file information.\r
b0d803fe 917\r
b1f6a7c6 918 @retval EFI_INVALID_PARAMETER Invalid FileHandle or FileInfo.\r
919 @retval EFI_SUCCESS Success to collect file info.\r
b0d803fe 920\r
b1f6a7c6 921**/\r
b0d803fe 922EFI_STATUS\r
50cb16d9 923EFIAPI\r
b0d803fe 924PeiFfsGetFileInfo (\r
925 IN EFI_PEI_FILE_HANDLE FileHandle,\r
926 OUT EFI_FV_FILE_INFO *FileInfo\r
ed66e1bc 927 );\r
b0d803fe 928\r
b1f6a7c6 929/**\r
b0d803fe 930\r
b1f6a7c6 931 Collect information of given Fv Volume.\r
b0d803fe 932\r
1cc76977 933 @param VolumeHandle The handle to Fv Volume.\r
934 @param VolumeInfo The pointer to volume information.\r
b0d803fe 935\r
b1f6a7c6 936 @retval EFI_INVALID_PARAMETER VolumeInfo is NULL\r
937 @retval EFI_SUCCESS Success to collect fv info.\r
938**/\r
b0d803fe 939EFI_STATUS\r
50cb16d9 940EFIAPI\r
b0d803fe 941PeiFfsGetVolumeInfo (\r
942 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
943 OUT EFI_FV_INFO *VolumeInfo\r
ed66e1bc 944 );\r
b0d803fe 945\r
14e8823a 946/**\r
947 This routine enable a PEIM to register itself to shadow when PEI Foundation\r
948 discovery permanent memory.\r
949\r
b1f6a7c6 950 @param FileHandle File handle of a PEIM.\r
50cb16d9 951\r
b1f6a7c6 952 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.\r
953 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.\r
954 @retval EFI_SUCCESS Successfully to register itself.\r
14e8823a 955\r
50cb16d9 956**/\r
14e8823a 957EFI_STATUS\r
958EFIAPI\r
959PeiRegisterForShadow (\r
960 IN EFI_PEI_FILE_HANDLE FileHandle\r
ed66e1bc 961 );\r
14e8823a 962\r
b1f6a7c6 963/**\r
964 Given the input file pointer, search for the next matching file in the\r
965 FFS volume as defined by SearchType. The search starts from FileHeader inside\r
966 the Firmware Volume defined by FwVolHeader.\r
967\r
968\r
969 @param FvHandle Pointer to the FV header of the volume to search\r
970 @param FileName File name\r
971 @param SearchType Filter to find only files of this type.\r
972 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r
973 @param FileHandle This parameter must point to a valid FFS volume.\r
974 @param AprioriFile Pointer to AprioriFile image in this FV if has\r
975\r
976 @return EFI_NOT_FOUND No files matching the search criteria were found\r
977 @retval EFI_SUCCESS Success to search given file\r
978\r
979**/\r
b0d803fe 980EFI_STATUS\r
981PeiFindFileEx (\r
982 IN CONST EFI_PEI_FV_HANDLE FvHandle,\r
983 IN CONST EFI_GUID *FileName, OPTIONAL\r
984 IN EFI_FV_FILETYPE SearchType,\r
985 IN OUT EFI_PEI_FILE_HANDLE *FileHandle,\r
986 IN OUT EFI_PEI_FV_HANDLE *AprioriFile OPTIONAL\r
ed66e1bc 987 );\r
b0d803fe 988\r
b1f6a7c6 989/**\r
15273993 990 Initialize image service that install PeiLoadFilePpi.\r
b0d803fe 991\r
15273993 992 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.\r
993 @param OldCoreData Pointer to Old PeiCore's private data.\r
994 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.\r
995 If not NULL, PeiCore is entered at second time, stack/heap has been moved\r
996 to permenent memory.\r
b0d803fe 997\r
b1f6a7c6 998**/\r
999VOID\r
1000InitializeImageServices (\r
1001 IN PEI_CORE_INSTANCE *PrivateData,\r
1002 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 1003 );\r
b0d803fe 1004\r
288f9b38
LG
1005/**\r
1006 Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r
1007\r
1cc76977 1008 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
d976bf31 1009 @param FvFileHandle File handle of a Fv type file.\r
288f9b38 1010 @param AuthenticationState Pointer to attestation authentication state of image.\r
731bd38e 1011 If return 0, means pass security checking.\r
50cb16d9 1012\r
b1f6a7c6 1013 @retval EFI_NOT_FOUND FV image can't be found.\r
1014 @retval EFI_SUCCESS Successfully to process it.\r
288f9b38
LG
1015\r
1016**/\r
1017EFI_STATUS\r
1018ProcessFvFile (\r
6c7a807a 1019 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1020 IN EFI_PEI_FILE_HANDLE FvFileHandle,\r
1021 OUT UINT32 *AuthenticationState\r
288f9b38
LG
1022 );\r
1023\r
aa79b0b3 1024/**\r
1025 The wrapper function of PeiLoadImageLoadImage().\r
1026\r
f34aec3b 1027 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.\r
1028 @param FileHandle Pointer to the FFS file header of the image.\r
1029 @param ImageAddressArg Pointer to PE/TE image.\r
1030 @param ImageSizeArg Size of PE/TE image.\r
1031 @param EntryPoint Pointer to entry point of specified image file for output.\r
1032 @param AuthenticationState Pointer to attestation authentication state of image.\r
aa79b0b3 1033\r
1034 @return Status of PeiLoadImageLoadImage().\r
1035\r
1036**/\r
1037EFI_STATUS\r
1038EFIAPI\r
1039PeiLoadImageLoadImageWrapper (\r
1040 IN CONST EFI_PEI_LOAD_FILE_PPI *This,\r
1041 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1042 OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg, OPTIONAL\r
1043 OUT UINT64 *ImageSizeArg, OPTIONAL\r
1044 OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r
1045 OUT UINT32 *AuthenticationState\r
1046 );\r
1047\r
1048/**\r
1049\r
1050 Provide a callback for when the security PPI is installed.\r
1051\r
1052 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1053 @param NotifyDescriptor The descriptor for the notification event.\r
1054 @param Ppi Pointer to the PPI in question.\r
1055\r
1056 @return Always success\r
1057\r
1058**/\r
1059EFI_STATUS\r
1060EFIAPI\r
1061SecurityPpiNotifyCallback (\r
1062 IN EFI_PEI_SERVICES **PeiServices,\r
1063 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
1064 IN VOID *Ppi\r
1065 );\r
1066\r
192f6d4c 1067#endif\r