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