]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Pei/PeiMain.h
1. Enable use-cases in PEI using SecurityPPI co-equal to the use-cases in DXE using...
[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
c7935105 4Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
cd5ebaa0 5This program and the accompanying materials\r
192f6d4c 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
c7935105 25#include <Ppi/FirmwareVolumeInfo2.h>\r
b0d803fe 26#include <Ppi/Decompress.h>\r
27#include <Ppi/GuidedSectionExtraction.h>\r
28#include <Ppi/LoadFile.h>\r
29#include <Ppi/Security2.h>\r
58dcdada 30#include <Ppi/TemporaryRamSupport.h>\r
859b72fa
A
31#include <Library/DebugLib.h>\r
32#include <Library/PeiCoreEntryPoint.h>\r
33#include <Library/BaseLib.h>\r
34#include <Library/HobLib.h>\r
35#include <Library/PerformanceLib.h>\r
36#include <Library/PeiServicesLib.h>\r
37#include <Library/ReportStatusCodeLib.h>\r
c58cf83d 38#include <Library/PeCoffLib.h>\r
859b72fa
A
39#include <Library/PeCoffGetEntryPointLib.h>\r
40#include <Library/BaseMemoryLib.h>\r
b0d803fe 41#include <Library/CacheMaintenanceLib.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
890e5417 47#include <Guid/FirmwareFileSystem3.h>\r
b0d803fe 48#include <Guid/AprioriFileName.h>\r
192f6d4c 49\r
15273993 50///\r
51/// It is an FFS type extension used for PeiFindFileEx. It indicates current\r
52/// Ffs searching is for all PEIMs can be dispatched by PeiCore.\r
53///\r
3a63377f 54#define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff\r
55\r
b1f6a7c6 56///\r
57/// Pei Core private data structures\r
58///\r
192f6d4c 59typedef union {\r
60 EFI_PEI_PPI_DESCRIPTOR *Ppi;\r
61 EFI_PEI_NOTIFY_DESCRIPTOR *Notify;\r
62 VOID *Raw;\r
63} PEI_PPI_LIST_POINTERS;\r
64\r
40f26b8f 65///\r
1cc76977 66/// PPI database structure which contains two link: PpiList and NotifyList. PpiList\r
67/// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.\r
40f26b8f 68///\r
192f6d4c 69typedef struct {\r
1cc76977 70 ///\r
71 /// index of end of PpiList link list.\r
72 ///\r
192f6d4c 73 INTN PpiListEnd;\r
1cc76977 74 ///\r
75 /// index of end of notify link list.\r
76 ///\r
192f6d4c 77 INTN NotifyListEnd;\r
1cc76977 78 ///\r
79 /// index of the dispatched notify list.\r
80 ///\r
192f6d4c 81 INTN DispatchListEnd;\r
1cc76977 82 ///\r
83 /// index of last installed Ppi description in PpiList link list.\r
84 ///\r
192f6d4c 85 INTN LastDispatchedInstall;\r
1cc76977 86 ///\r
87 /// index of last dispatched notify in Notify link list.\r
88 /// \r
192f6d4c 89 INTN LastDispatchedNotify;\r
1cc76977 90 ///\r
91 /// Ppi database.\r
92 ///\r
eaf539d0 93 PEI_PPI_LIST_POINTERS PpiListPtrs[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)];\r
192f6d4c 94} PEI_PPI_DATABASE;\r
95\r
3a63377f 96\r
3a63377f 97//\r
98// PEI_CORE_FV_HANDE.PeimState\r
99// Do not change these values as there is code doing math to change states.\r
100// Look for Private->Fv[FvCount].PeimState[PeimCount]++;\r
101//\r
102#define PEIM_STATE_NOT_DISPATCHED 0x00\r
103#define PEIM_STATE_DISPATCHED 0x01\r
104#define PEIM_STATE_REGISITER_FOR_SHADOW 0x02\r
105#define PEIM_STATE_DONE 0x03\r
106\r
107typedef struct {\r
108 EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r
3b428ade 109 EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;\r
110 EFI_PEI_FV_HANDLE FvHandle;\r
50cb16d9 111 UINT8 PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
177aabe6 112 EFI_PEI_FILE_HANDLE FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
3a63377f 113 BOOLEAN ScanFv;\r
c7935105 114 UINT32 AuthenticationStatus;\r
3a63377f 115} PEI_CORE_FV_HANDLE;\r
116\r
f3358329 117typedef struct {\r
118 EFI_GUID FvFormat;\r
119 VOID *FvInfo;\r
120 UINT32 FvInfoSize;\r
c7935105 121 UINT32 AuthenticationStatus;\r
f3358329 122 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor;\r
123} PEI_CORE_UNKNOW_FORMAT_FV_INFO;\r
124\r
288f9b38
LG
125#define CACHE_SETION_MAX_NUMBER 0x10\r
126typedef struct {\r
127 EFI_COMMON_SECTION_HEADER* Section[CACHE_SETION_MAX_NUMBER];\r
128 VOID* SectionData[CACHE_SETION_MAX_NUMBER];\r
129 UINTN SectionSize[CACHE_SETION_MAX_NUMBER];\r
c7935105 130 UINT32 AuthenticationStatus[CACHE_SETION_MAX_NUMBER];\r
288f9b38
LG
131 UINTN AllSectionCount;\r
132 UINTN SectionIndex;\r
133} CACHE_SECTION_DATA;\r
134\r
ef05e063 135///\r
136/// Forward declaration for PEI_CORE_INSTANCE\r
137///\r
138typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE;\r
139\r
140\r
141/**\r
142 Function Pointer type for PeiCore function.\r
143 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size \r
144 and location of temporary RAM, the stack location and the BFV location.\r
145 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
146 An empty PPI list consists of a single descriptor with the end-tag\r
147 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r
148 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r
149 that both the PEI Foundation and any modules can leverage the associated service\r
150 calls and/or code in these early PPIs\r
151 @param OldCoreData Pointer to old core data that is used to initialize the\r
152 core's data areas.\r
153**/\r
154typedef\r
155EFI_STATUS\r
156(EFIAPI *PEICORE_FUNCTION_POINTER)(\r
157 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
158 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r
159 IN PEI_CORE_INSTANCE *OldCoreData\r
160 );\r
192f6d4c 161\r
f3f2e05d 162#define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')\r
192f6d4c 163\r
40f26b8f 164///\r
165/// Pei Core private data structure instance\r
166///\r
ef05e063 167struct _PEI_CORE_INSTANCE {\r
192f6d4c 168 UINTN Signature;\r
3b428ade 169 \r
170 ///\r
171 /// Point to ServiceTableShadow\r
172 ///\r
4140a663 173 EFI_PEI_SERVICES *Ps;\r
192f6d4c 174 PEI_PPI_DATABASE PpiData;\r
3b428ade 175 \r
176 ///\r
177 /// The count of FVs which contains FFS and could be dispatched by PeiCore.\r
178 ///\r
3a63377f 179 UINTN FvCount;\r
3b428ade 180 \r
181 ///\r
182 /// The instance arrary for FVs which contains FFS and could be dispatched by PeiCore.\r
183 ///\r
177aabe6 184 PEI_CORE_FV_HANDLE Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r
f3358329 185 PEI_CORE_UNKNOW_FORMAT_FV_INFO UnknownFvInfo[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r
186 UINTN UnknownFvInfoCount;\r
187 \r
177aabe6 188 EFI_PEI_FILE_HANDLE CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r
3a63377f 189 UINTN AprioriCount;\r
50cb16d9 190 UINTN CurrentPeimFvCount;\r
3a63377f 191 UINTN CurrentPeimCount;\r
192 EFI_PEI_FILE_HANDLE CurrentFileHandle;\r
82b8c8df 193 BOOLEAN PeimNeedingDispatch;\r
194 BOOLEAN PeimDispatchOnThisPass;\r
195 BOOLEAN PeimDispatcherReenter;\r
192f6d4c 196 EFI_PEI_HOB_POINTERS HobList;\r
197 BOOLEAN SwitchStackSignal;\r
198 BOOLEAN PeiMemoryInstalled;\r
192f6d4c 199 VOID *CpuIo;\r
b0d803fe 200 EFI_PEI_SECURITY2_PPI *PrivateSecurityPpi;\r
192f6d4c 201 EFI_PEI_SERVICES ServiceTableShadow;\r
b0d803fe 202 EFI_PEI_PPI_DESCRIPTOR *XipLoadFile;\r
58dcdada 203 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin;\r
204 UINT64 PhysicalMemoryLength;\r
205 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop;\r
ef05e063 206 UINTN HeapOffset;\r
207 BOOLEAN HeapOffsetPositive;\r
424b7c9f 208 UINTN StackOffset;\r
209 BOOLEAN StackOffsetPositive;\r
ef05e063 210 PEICORE_FUNCTION_POINTER ShadowedPeiCore;\r
288f9b38 211 CACHE_SECTION_DATA CacheSection;\r
54ea99a7 212 //\r
213 // For Loading modules at fixed address feature to cache the top address below which the \r
214 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field \r
4140a663 215 // and Ps should not be changed since maybe user could get this top address by using the offet to Ps. \r
54ea99a7 216 //\r
217 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress;\r
218 //\r
219 // The field is define for Loading modules at fixed address feature to tracker the PEI code\r
220 // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page\r
221 // available or not. \r
222 //\r
223 UINT64 *PeiCodeMemoryRangeUsageBitMap;\r
25973fc3 224 //\r
225 // This field points to the shadowed image read function\r
226 //\r
227 PE_COFF_LOADER_READ_FILE ShadowedImageRead;\r
ef05e063 228};\r
192f6d4c 229\r
40f26b8f 230///\r
231/// Pei Core Instance Data Macros\r
232///\r
192f6d4c 233#define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r
4140a663 234 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)\r
192f6d4c 235\r
b1f6a7c6 236///\r
237/// Union of temporarily used function pointers (to save stack space)\r
238///\r
192f6d4c 239typedef union {\r
15273993 240 PEICORE_FUNCTION_POINTER PeiCore;\r
1c9d209f 241 EFI_PEIM_ENTRY_POINT2 PeimEntry;\r
192f6d4c 242 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;\r
243 EFI_DXE_IPL_PPI *DxeIpl;\r
244 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r
245 EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;\r
246 VOID *Raw;\r
247} PEI_CORE_TEMP_POINTERS;\r
248\r
b98c2ab7 249typedef struct {\r
250 CONST EFI_SEC_PEI_HAND_OFF *SecCoreData;\r
251 EFI_PEI_PPI_DESCRIPTOR *PpiList;\r
252 VOID *Data;\r
253} PEI_CORE_PARAMETERS;\r
254\r
192f6d4c 255//\r
256// PeiCore function\r
257//\r
b1f6a7c6 258/**\r
192f6d4c 259\r
260 The entry routine to Pei Core, invoked by PeiMain during transition\r
261 from SEC to PEI. After switching stack in the PEI core, it will restart\r
262 with the old core data.\r
263\r
192f6d4c 264\r
111e48f3 265 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size \r
f34aec3b 266 and location of temporary RAM, the stack location and the BFV location.\r
b1f6a7c6 267 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
268 An empty PPI list consists of a single descriptor with the end-tag\r
269 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r
270 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r
271 that both the PEI Foundation and any modules can leverage the associated service\r
272 calls and/or code in these early PPIs\r
273 @param Data Pointer to old core data that is used to initialize the\r
192f6d4c 274 core's data areas.\r
275\r
b1f6a7c6 276**/\r
0308e20d 277VOID\r
b1f6a7c6 278EFIAPI\r
279PeiCore (\r
280 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
d976bf31 281 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r
b1f6a7c6 282 IN VOID *Data\r
ed66e1bc 283 );\r
192f6d4c 284\r
285//\r
286// Dispatcher support functions\r
287//\r
288\r
b1f6a7c6 289/**\r
192f6d4c 290\r
291 This is the POSTFIX version of the dependency evaluator. When a\r
292 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on\r
293 the evaluation stack. When that entry is poped from the evaluation\r
294 stack, the PPI is checked if it is installed. This method allows\r
295 some time savings as not all PPIs must be checked for certain\r
296 operation types (AND, OR).\r
297\r
192f6d4c 298\r
1cc76977 299 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 300 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to\r
301 the BNF described above and is stored in postfix notation.\r
192f6d4c 302\r
b1f6a7c6 303 @retval TRUE if it is a well-formed Grammar\r
304 @retval FALSE if the dependency expression overflows the evaluation stack\r
305 if the dependency expression underflows the evaluation stack\r
306 if the dependency expression is not a well-formed Grammar.\r
192f6d4c 307\r
b1f6a7c6 308**/\r
309BOOLEAN\r
310PeimDispatchReadiness (\r
311 IN EFI_PEI_SERVICES **PeiServices,\r
312 IN VOID *DependencyExpression\r
ed66e1bc 313 );\r
192f6d4c 314\r
b1f6a7c6 315/**\r
316 Conduct PEIM dispatch.\r
317\r
731bd38e 318 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data\r
1cc76977 319 @param PrivateData Pointer to the private data passed in from caller\r
192f6d4c 320\r
b1f6a7c6 321**/\r
b0d803fe 322VOID\r
192f6d4c 323PeiDispatcher (\r
5aae0aa7 324 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
b0d803fe 325 IN PEI_CORE_INSTANCE *PrivateData\r
ed66e1bc 326 );\r
192f6d4c 327\r
b1f6a7c6 328/**\r
329 Initialize the Dispatcher's data members\r
192f6d4c 330\r
b1f6a7c6 331 @param PrivateData PeiCore's private data structure\r
332 @param OldCoreData Old data from SecCore\r
333 NULL if being run in non-permament memory mode.\r
aa79b0b3 334 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r
335 and location of temporary RAM, the stack location and the BFV location.\r
192f6d4c 336\r
b1f6a7c6 337**/\r
192f6d4c 338VOID\r
339InitializeDispatcherData (\r
b0d803fe 340 IN PEI_CORE_INSTANCE *PrivateData,\r
192f6d4c 341 IN PEI_CORE_INSTANCE *OldCoreData,\r
5aae0aa7 342 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
ed66e1bc 343 );\r
192f6d4c 344\r
b1f6a7c6 345/**\r
346 This routine parses the Dependency Expression, if available, and\r
347 decides if the module can be executed.\r
192f6d4c 348\r
192f6d4c 349\r
b1f6a7c6 350 @param Private PeiCore's private data structure\r
351 @param FileHandle PEIM's file handle\r
731bd38e 352 @param PeimCount The index of last dispatched PEIM.\r
192f6d4c 353\r
731bd38e 354 @retval TRUE Can be dispatched\r
355 @retval FALSE Cannot be dispatched\r
192f6d4c 356\r
b1f6a7c6 357**/\r
192f6d4c 358BOOLEAN\r
359DepexSatisfied (\r
b0d803fe 360 IN PEI_CORE_INSTANCE *Private,\r
361 IN EFI_PEI_FILE_HANDLE FileHandle,\r
362 IN UINTN PeimCount\r
ed66e1bc 363 );\r
192f6d4c 364\r
192f6d4c 365//\r
366// PPI support functions\r
367//\r
b1f6a7c6 368/**\r
369\r
370 Initialize PPI services.\r
371\r
b1f6a7c6 372 @param PrivateData Pointer to the PEI Core data.\r
373 @param OldCoreData Pointer to old PEI Core data. \r
374 NULL if being run in non-permament memory mode.\r
375\r
376**/\r
192f6d4c 377VOID\r
378InitializePpiServices (\r
b0d803fe 379 IN PEI_CORE_INSTANCE *PrivateData,\r
192f6d4c 380 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 381 );\r
192f6d4c 382\r
b1f6a7c6 383/**\r
192f6d4c 384\r
3d4d0c34 385 Migrate the Hob list from the temporary memory stack to PEI installed memory.\r
731bd38e 386\r
424b7c9f 387 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size \r
388 and location of temporary RAM, the stack location and the BFV location.\r
389 @param PrivateData Pointer to PeiCore's private data structure.\r
192f6d4c 390\r
b1f6a7c6 391**/\r
192f6d4c 392VOID\r
393ConvertPpiPointers (\r
424b7c9f 394 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
395 IN PEI_CORE_INSTANCE *PrivateData\r
ed66e1bc 396 );\r
192f6d4c 397\r
b1f6a7c6 398/**\r
192f6d4c 399\r
731bd38e 400 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.\r
192f6d4c 401\r
15273993 402 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
403 @param PpiList Pointer to ppi array that want to be installed.\r
192f6d4c 404\r
15273993 405 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.\r
406 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer\r
731bd38e 407 if any PPI in PpiList is not valid\r
15273993 408 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI\r
192f6d4c 409\r
b1f6a7c6 410**/\r
192f6d4c 411EFI_STATUS\r
412EFIAPI\r
413PeiInstallPpi (\r
0c2b5da8 414 IN CONST EFI_PEI_SERVICES **PeiServices,\r
415 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
ed66e1bc 416 );\r
192f6d4c 417\r
b1f6a7c6 418/**\r
192f6d4c 419\r
b1f6a7c6 420 Re-Install PPI services.\r
192f6d4c 421\r
1cc76977 422 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
423 @param OldPpi Pointer to the old PEI PPI Descriptors.\r
424 @param NewPpi Pointer to the new PEI PPI Descriptors.\r
192f6d4c 425\r
1cc76977 426 @retval EFI_SUCCESS if the operation was successful\r
427 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL\r
731bd38e 428 if NewPpi is not valid\r
1cc76977 429 @retval EFI_NOT_FOUND if the PPI was not in the database\r
192f6d4c 430\r
b1f6a7c6 431**/\r
192f6d4c 432EFI_STATUS\r
433EFIAPI\r
434PeiReInstallPpi (\r
0c2b5da8 435 IN CONST EFI_PEI_SERVICES **PeiServices,\r
436 IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
437 IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
ed66e1bc 438 );\r
192f6d4c 439\r
b1f6a7c6 440/**\r
192f6d4c 441\r
b1f6a7c6 442 Locate a given named PPI.\r
192f6d4c 443\r
192f6d4c 444\r
1cc76977 445 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
446 @param Guid Pointer to GUID of the PPI.\r
447 @param Instance Instance Number to discover.\r
448 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,\r
b1f6a7c6 449 returns a pointer to the descriptor (includes flags, etc)\r
1cc76977 450 @param Ppi Pointer to reference the found PPI\r
192f6d4c 451\r
b1f6a7c6 452 @retval EFI_SUCCESS if the PPI is in the database\r
453 @retval EFI_NOT_FOUND if the PPI is not in the database\r
192f6d4c 454\r
b1f6a7c6 455**/\r
192f6d4c 456EFI_STATUS\r
457EFIAPI\r
458PeiLocatePpi (\r
1cc76977 459 IN CONST EFI_PEI_SERVICES **PeiServices,\r
460 IN CONST EFI_GUID *Guid,\r
192f6d4c 461 IN UINTN Instance,\r
462 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
463 IN OUT VOID **Ppi\r
ed66e1bc 464 );\r
192f6d4c 465\r
b1f6a7c6 466/**\r
192f6d4c 467\r
b1f6a7c6 468 Install a notification for a given PPI.\r
192f6d4c 469\r
192f6d4c 470\r
1cc76977 471 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
472 @param NotifyList Pointer to list of Descriptors to notify upon.\r
192f6d4c 473\r
b1f6a7c6 474 @retval EFI_SUCCESS if successful\r
475 @retval EFI_OUT_OF_RESOURCES if no space in the database\r
476 @retval EFI_INVALID_PARAMETER if not a good decriptor\r
192f6d4c 477\r
b1f6a7c6 478**/\r
192f6d4c 479EFI_STATUS\r
480EFIAPI\r
481PeiNotifyPpi (\r
0c2b5da8 482 IN CONST EFI_PEI_SERVICES **PeiServices,\r
483 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
ed66e1bc 484 );\r
192f6d4c 485\r
b1f6a7c6 486/**\r
192f6d4c 487\r
b1f6a7c6 488 Process the Notify List at dispatch level.\r
192f6d4c 489\r
b1f6a7c6 490 @param PrivateData PeiCore's private data structure.\r
192f6d4c 491\r
b1f6a7c6 492**/\r
192f6d4c 493VOID\r
494ProcessNotifyList (\r
b0d803fe 495 IN PEI_CORE_INSTANCE *PrivateData\r
ed66e1bc 496 );\r
192f6d4c 497\r
b1f6a7c6 498/**\r
192f6d4c 499\r
b1f6a7c6 500 Dispatch notifications.\r
192f6d4c 501\r
b1f6a7c6 502 @param PrivateData PeiCore's private data structure\r
503 @param NotifyType Type of notify to fire.\r
504 @param InstallStartIndex Install Beginning index.\r
505 @param InstallStopIndex Install Ending index.\r
506 @param NotifyStartIndex Notify Beginning index.\r
507 @param NotifyStopIndex Notify Ending index.\r
192f6d4c 508\r
b1f6a7c6 509**/\r
192f6d4c 510VOID\r
511DispatchNotify (\r
b0d803fe 512 IN PEI_CORE_INSTANCE *PrivateData,\r
192f6d4c 513 IN UINTN NotifyType,\r
514 IN INTN InstallStartIndex,\r
515 IN INTN InstallStopIndex,\r
516 IN INTN NotifyStartIndex,\r
517 IN INTN NotifyStopIndex\r
ed66e1bc 518 );\r
192f6d4c 519\r
520//\r
521// Boot mode support functions\r
522//\r
b1f6a7c6 523/**\r
524 This service enables PEIMs to ascertain the present value of the boot mode.\r
525\r
1cc76977 526 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 527 @param BootMode A pointer to contain the value of the boot mode.\r
528\r
529 @retval EFI_SUCCESS The boot mode was returned successfully.\r
530 @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
531\r
532**/\r
192f6d4c 533EFI_STATUS\r
534EFIAPI\r
535PeiGetBootMode (\r
0c2b5da8 536 IN CONST EFI_PEI_SERVICES **PeiServices,\r
d976bf31 537 IN OUT EFI_BOOT_MODE *BootMode\r
ed66e1bc 538 );\r
192f6d4c 539\r
b1f6a7c6 540/**\r
541 This service enables PEIMs to update the boot mode variable.\r
192f6d4c 542\r
192f6d4c 543\r
1cc76977 544 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
545 @param BootMode The value of the boot mode to set.\r
192f6d4c 546\r
1cc76977 547 @return EFI_SUCCESS The value was successfully updated\r
192f6d4c 548\r
b1f6a7c6 549**/\r
192f6d4c 550EFI_STATUS\r
551EFIAPI\r
552PeiSetBootMode (\r
0c2b5da8 553 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 554 IN EFI_BOOT_MODE BootMode\r
ed66e1bc 555 );\r
192f6d4c 556\r
557//\r
558// Security support functions\r
559//\r
b1f6a7c6 560/**\r
561\r
562 Initialize the security services.\r
563\r
1cc76977 564 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
40f26b8f 565 @param OldCoreData Pointer to the old core data.\r
b1f6a7c6 566 NULL if being run in non-permament memory mode.\r
567\r
568**/\r
192f6d4c 569VOID\r
570InitializeSecurityServices (\r
571 IN EFI_PEI_SERVICES **PeiServices,\r
572 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 573 );\r
192f6d4c 574\r
b1f6a7c6 575/**\r
d976bf31 576 Verify a Firmware volume.\r
192f6d4c 577\r
40f26b8f 578 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration\r
192f6d4c 579\r
40f26b8f 580 @retval EFI_SUCCESS Firmware Volume is legal\r
581 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test\r
192f6d4c 582\r
b1f6a7c6 583**/\r
192f6d4c 584EFI_STATUS\r
585VerifyFv (\r
586 IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress\r
ed66e1bc 587 );\r
192f6d4c 588\r
b1f6a7c6 589/**\r
b1f6a7c6 590 Provide a callout to the security verification service.\r
192f6d4c 591\r
b1f6a7c6 592 @param PrivateData PeiCore's private data structure\r
593 @param VolumeHandle Handle of FV\r
594 @param FileHandle Handle of PEIM's ffs\r
c7935105 595 @param AuthenticationStatus Authentication status\r
192f6d4c 596\r
b1f6a7c6 597 @retval EFI_SUCCESS Image is OK\r
598 @retval EFI_SECURITY_VIOLATION Image is illegal\r
c7935105 599 @retval EFI_NOT_FOUND If security PPI is not installed.\r
b1f6a7c6 600**/\r
192f6d4c 601EFI_STATUS\r
602VerifyPeim (\r
b0d803fe 603 IN PEI_CORE_INSTANCE *PrivateData,\r
604 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
c7935105
SZ
605 IN EFI_PEI_FILE_HANDLE FileHandle,\r
606 IN UINT32 AuthenticationStatus\r
ed66e1bc 607 );\r
192f6d4c 608\r
b1f6a7c6 609/**\r
192f6d4c 610\r
b1f6a7c6 611 Gets the pointer to the HOB List.\r
192f6d4c 612\r
192f6d4c 613\r
1cc76977 614 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 615 @param HobList Pointer to the HOB List.\r
192f6d4c 616\r
b1f6a7c6 617 @retval EFI_SUCCESS Get the pointer of HOB List\r
618 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published\r
619 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)\r
192f6d4c 620\r
b1f6a7c6 621**/\r
192f6d4c 622EFI_STATUS\r
623EFIAPI\r
624PeiGetHobList (\r
0c2b5da8 625 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 626 IN OUT VOID **HobList\r
ed66e1bc 627 );\r
192f6d4c 628\r
b1f6a7c6 629/**\r
630 Add a new HOB to the HOB List.\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 Type Type of the new HOB.\r
634 @param Length Length of the new HOB to allocate.\r
635 @param Hob Pointer to the new HOB.\r
192f6d4c 636\r
b1f6a7c6 637 @return EFI_SUCCESS Success to create hob.\r
638 @retval EFI_INVALID_PARAMETER if Hob is NULL\r
639 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.\r
640 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.\r
192f6d4c 641\r
b1f6a7c6 642**/\r
192f6d4c 643EFI_STATUS\r
644EFIAPI\r
645PeiCreateHob (\r
0c2b5da8 646 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 647 IN UINT16 Type,\r
648 IN UINT16 Length,\r
649 IN OUT VOID **Hob\r
ed66e1bc 650 );\r
192f6d4c 651\r
b1f6a7c6 652/**\r
192f6d4c 653\r
b1f6a7c6 654 Builds a Handoff Information Table HOB\r
192f6d4c 655\r
b1f6a7c6 656 @param BootMode - Current Bootmode\r
657 @param MemoryBegin - Start Memory Address.\r
658 @param MemoryLength - Length of Memory.\r
192f6d4c 659\r
b1f6a7c6 660 @return EFI_SUCCESS Always success to initialize HOB.\r
192f6d4c 661\r
b1f6a7c6 662**/\r
192f6d4c 663EFI_STATUS\r
664PeiCoreBuildHobHandoffInfoTable (\r
665 IN EFI_BOOT_MODE BootMode,\r
666 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
667 IN UINT64 MemoryLength\r
ed66e1bc 668 );\r
192f6d4c 669\r
670\r
671//\r
672// FFS Fw Volume support functions\r
673//\r
b1f6a7c6 674/**\r
3b428ade 675 Searches for the next matching file in the firmware volume.\r
b1f6a7c6 676\r
1cc76977 677 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 678 @param SearchType Filter to find only files of this type.\r
679 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r
aa75dfec 680 @param FvHandle Handle of firmware volume in which to search.\r
3b428ade 681 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start\r
682 at the beginning of the firmware volume. On exit, points the file handle of the next file\r
683 in the volume or NULL if there are no more files.\r
684\r
685 @retval EFI_NOT_FOUND The file was not found.\r
686 @retval EFI_NOT_FOUND The header checksum was not zero.\r
687 @retval EFI_SUCCESS The file was found.\r
b1f6a7c6 688\r
689**/\r
192f6d4c 690EFI_STATUS\r
691EFIAPI\r
692PeiFfsFindNextFile (\r
0c2b5da8 693 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 694 IN UINT8 SearchType,\r
3b428ade 695 IN EFI_PEI_FV_HANDLE FvHandle,\r
696 IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
ed66e1bc 697 );\r
192f6d4c 698\r
b1f6a7c6 699/**\r
3b428ade 700 Searches for the next matching section within the specified file.\r
192f6d4c 701\r
3b428ade 702 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
b1f6a7c6 703 @param SectionType Filter to find only sections of this type.\r
3b428ade 704 @param FileHandle Pointer to the current file to search.\r
705 @param SectionData A pointer to the discovered section, if successful.\r
b1f6a7c6 706 NULL if section not found\r
192f6d4c 707\r
3b428ade 708 @retval EFI_NOT_FOUND The section was not found.\r
709 @retval EFI_SUCCESS The section was found.\r
192f6d4c 710\r
b1f6a7c6 711**/\r
192f6d4c 712EFI_STATUS\r
713EFIAPI\r
714PeiFfsFindSectionData (\r
3b428ade 715 IN CONST EFI_PEI_SERVICES **PeiServices,\r
716 IN EFI_SECTION_TYPE SectionType,\r
717 IN EFI_PEI_FILE_HANDLE FileHandle,\r
718 OUT VOID **SectionData\r
ed66e1bc 719 );\r
192f6d4c 720\r
c7935105
SZ
721/**\r
722 Searches for the next matching section within the specified file.\r
723\r
724 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
725 @param SectionType The value of the section type to find.\r
726 @param SectionInstance Section instance to find.\r
727 @param FileHandle Handle of the firmware file to search.\r
728 @param SectionData A pointer to the discovered section, if successful.\r
729 @param AuthenticationStatus A pointer to the authentication status for this section.\r
730\r
731 @retval EFI_SUCCESS The section was found.\r
732 @retval EFI_NOT_FOUND The section was not found.\r
733\r
734**/\r
735EFI_STATUS\r
736EFIAPI\r
737PeiFfsFindSectionData3 (\r
738 IN CONST EFI_PEI_SERVICES **PeiServices,\r
739 IN EFI_SECTION_TYPE SectionType,\r
740 IN UINTN SectionInstance,\r
741 IN EFI_PEI_FILE_HANDLE FileHandle,\r
742 OUT VOID **SectionData,\r
743 OUT UINT32 *AuthenticationStatus\r
744 );\r
745\r
b1f6a7c6 746/**\r
3b428ade 747 Search the firmware volumes by index\r
192f6d4c 748\r
3b428ade 749 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
750 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware\r
751 Volume (BFV).\r
752 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.\r
192f6d4c 753\r
3b428ade 754 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL\r
755 @retval EFI_NOT_FOUND The volume was not found.\r
756 @retval EFI_SUCCESS The volume was found.\r
192f6d4c 757\r
b1f6a7c6 758**/\r
192f6d4c 759EFI_STATUS\r
760EFIAPI\r
3b428ade 761PeiFfsFindNextVolume (\r
15273993 762 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 763 IN UINTN Instance,\r
aa75dfec 764 IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
ed66e1bc 765 );\r
192f6d4c 766\r
767//\r
768// Memory support functions\r
769//\r
b1f6a7c6 770/**\r
771\r
772 Initialize the memory services.\r
773\r
1cc76977 774 @param PrivateData PeiCore's private data structure\r
111e48f3 775 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size \r
f34aec3b 776 and location of temporary RAM, the stack location and the BFV location.\r
b1f6a7c6 777 @param OldCoreData Pointer to the PEI Core data.\r
778 NULL if being run in non-permament memory mode.\r
779\r
780**/\r
192f6d4c 781VOID\r
782InitializeMemoryServices (\r
b0d803fe 783 IN PEI_CORE_INSTANCE *PrivateData,\r
5aae0aa7 784 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
192f6d4c 785 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 786 );\r
192f6d4c 787\r
b1f6a7c6 788/**\r
192f6d4c 789\r
b1f6a7c6 790 Install the permanent memory is now available.\r
791 Creates HOB (PHIT and Stack).\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 MemoryBegin Start of memory address.\r
795 @param MemoryLength Length of memory.\r
192f6d4c 796\r
b1f6a7c6 797 @return EFI_SUCCESS Always success.\r
192f6d4c 798\r
b1f6a7c6 799**/\r
192f6d4c 800EFI_STATUS\r
801EFIAPI\r
802PeiInstallPeiMemory (\r
0c2b5da8 803 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 804 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
805 IN UINT64 MemoryLength\r
ed66e1bc 806 );\r
192f6d4c 807\r
b1f6a7c6 808/**\r
192f6d4c 809\r
b1f6a7c6 810 Memory allocation service on permanent memory,\r
811 not usable prior to the memory installation.\r
192f6d4c 812\r
192f6d4c 813\r
1cc76977 814 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
815 @param MemoryType Type of memory to allocate.\r
816 @param Pages Number of pages to allocate.\r
817 @param Memory Pointer of memory allocated.\r
192f6d4c 818\r
b1f6a7c6 819 @retval EFI_SUCCESS The allocation was successful\r
820 @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.\r
821 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available\r
822 @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement\r
823 to allocate the number of pages.\r
192f6d4c 824\r
b1f6a7c6 825**/\r
192f6d4c 826EFI_STATUS\r
827EFIAPI\r
828PeiAllocatePages (\r
0c2b5da8 829 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 830 IN EFI_MEMORY_TYPE MemoryType,\r
831 IN UINTN Pages,\r
832 OUT EFI_PHYSICAL_ADDRESS *Memory\r
ed66e1bc 833 );\r
192f6d4c 834\r
b1f6a7c6 835/**\r
192f6d4c 836\r
3d4d0c34 837 Memory allocation service on the temporary memory.\r
192f6d4c 838\r
192f6d4c 839\r
1cc76977 840 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
841 @param Size Amount of memory required\r
842 @param Buffer Address of pointer to the buffer\r
192f6d4c 843\r
b1f6a7c6 844 @retval EFI_SUCCESS The allocation was successful\r
845 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement\r
846 to allocate the requested size.\r
192f6d4c 847\r
b1f6a7c6 848**/\r
192f6d4c 849EFI_STATUS\r
850EFIAPI\r
851PeiAllocatePool (\r
0c2b5da8 852 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 853 IN UINTN Size,\r
854 OUT VOID **Buffer\r
ed66e1bc 855 );\r
192f6d4c 856\r
b1f6a7c6 857/**\r
192f6d4c 858\r
b1f6a7c6 859 Routine for load image file.\r
192f6d4c 860\r
192f6d4c 861\r
1cc76977 862 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
863 @param FileHandle Pointer to the FFS file header of the image.\r
341a658f 864 @param PeimState The dispatch state of the input PEIM handle.\r
1cc76977 865 @param EntryPoint Pointer to entry point of specified image file for output.\r
866 @param AuthenticationState Pointer to attestation authentication state of image.\r
192f6d4c 867\r
1cc76977 868 @retval EFI_SUCCESS Image is successfully loaded.\r
869 @retval EFI_NOT_FOUND Fail to locate necessary PPI\r
870 @retval Others Fail to load file.\r
192f6d4c 871\r
b1f6a7c6 872**/\r
192f6d4c 873EFI_STATUS\r
874PeiLoadImage (\r
6c7a807a 875 IN CONST EFI_PEI_SERVICES **PeiServices,\r
b0d803fe 876 IN EFI_PEI_FILE_HANDLE FileHandle,\r
341a658f 877 IN UINT8 PeimState,\r
b0d803fe 878 OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r
879 OUT UINT32 *AuthenticationState\r
ed66e1bc 880 );\r
192f6d4c 881\r
b1f6a7c6 882/**\r
192f6d4c 883\r
b1f6a7c6 884 Core version of the Status Code reporter\r
192f6d4c 885\r
192f6d4c 886\r
1cc76977 887 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
888 @param CodeType Type of Status Code.\r
889 @param Value Value to output for Status Code.\r
890 @param Instance Instance Number of this status code.\r
891 @param CallerId ID of the caller of this status code.\r
892 @param Data Optional data associated with this status code.\r
192f6d4c 893\r
b1f6a7c6 894 @retval EFI_SUCCESS if status code is successfully reported\r
895 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed\r
192f6d4c 896\r
b1f6a7c6 897**/\r
192f6d4c 898EFI_STATUS\r
899EFIAPI\r
900PeiReportStatusCode (\r
0c2b5da8 901 IN CONST EFI_PEI_SERVICES **PeiServices,\r
192f6d4c 902 IN EFI_STATUS_CODE_TYPE CodeType,\r
903 IN EFI_STATUS_CODE_VALUE Value,\r
904 IN UINT32 Instance,\r
0c2b5da8 905 IN CONST EFI_GUID *CallerId,\r
906 IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r
ed66e1bc 907 );\r
192f6d4c 908\r
b1f6a7c6 909/**\r
192f6d4c 910\r
b1f6a7c6 911 Core version of the Reset System\r
192f6d4c 912\r
192f6d4c 913\r
1cc76977 914 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
192f6d4c 915\r
b1f6a7c6 916 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.\r
917 @retval EFI_DEVICE_ERROR Did not reset system.\r
918 Otherwise, resets the system.\r
192f6d4c 919\r
b1f6a7c6 920**/\r
192f6d4c 921EFI_STATUS\r
922EFIAPI\r
923PeiResetSystem (\r
b0d803fe 924 IN CONST EFI_PEI_SERVICES **PeiServices\r
ed66e1bc 925 );\r
192f6d4c 926\r
b1f6a7c6 927/**\r
192f6d4c 928\r
b1f6a7c6 929 Initialize PeiCore Fv List.\r
192f6d4c 930\r
192f6d4c 931\r
b1f6a7c6 932 @param PrivateData - Pointer to PEI_CORE_INSTANCE.\r
933 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.\r
192f6d4c 934\r
b1f6a7c6 935**/\r
50cb16d9 936VOID\r
b0d803fe 937PeiInitializeFv (\r
938 IN PEI_CORE_INSTANCE *PrivateData,\r
939 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r
ed66e1bc 940 );\r
b0d803fe 941\r
b1f6a7c6 942/**\r
943 Process Firmware Volum Information once FvInfoPPI install.\r
b0d803fe 944\r
1cc76977 945 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
946 @param NotifyDescriptor Address of the notification descriptor data structure.\r
947 @param Ppi Address of the PPI that was installed.\r
50cb16d9 948\r
b1f6a7c6 949 @retval EFI_SUCCESS if the interface could be successfully installed\r
b0d803fe 950\r
b1f6a7c6 951**/\r
b0d803fe 952EFI_STATUS\r
953EFIAPI\r
954FirmwareVolmeInfoPpiNotifyCallback (\r
955 IN EFI_PEI_SERVICES **PeiServices,\r
956 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
957 IN VOID *Ppi\r
ed66e1bc 958 );\r
b0d803fe 959\r
b1f6a7c6 960/**\r
50cb16d9 961\r
b1f6a7c6 962 Given the input VolumeHandle, search for the next matching name file.\r
b0d803fe 963\r
1cc76977 964 @param FileName File name to search.\r
965 @param VolumeHandle The current FV to search.\r
966 @param FileHandle Pointer to the file matching name in VolumeHandle.\r
967 NULL if file not found\r
b0d803fe 968\r
15273993 969 @retval EFI_NOT_FOUND No files matching the search criteria were found\r
970 @retval EFI_SUCCESS Success to search given file\r
b0d803fe 971\r
b1f6a7c6 972**/\r
b0d803fe 973EFI_STATUS\r
50cb16d9 974EFIAPI\r
b0d803fe 975PeiFfsFindFileByName (\r
976 IN CONST EFI_GUID *FileName,\r
977 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
978 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
ed66e1bc 979 );\r
b0d803fe 980\r
b1f6a7c6 981/**\r
b1f6a7c6 982 Returns information about a specific file.\r
b0d803fe 983\r
3b428ade 984 @param FileHandle Handle of the file.\r
aa75dfec 985 @param FileInfo Upon exit, points to the file's information.\r
b0d803fe 986\r
3b428ade 987 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
988 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r
989 @retval EFI_SUCCESS File information returned.\r
b0d803fe 990\r
b1f6a7c6 991**/\r
b0d803fe 992EFI_STATUS\r
50cb16d9 993EFIAPI\r
b0d803fe 994PeiFfsGetFileInfo (\r
995 IN EFI_PEI_FILE_HANDLE FileHandle,\r
996 OUT EFI_FV_FILE_INFO *FileInfo\r
ed66e1bc 997 );\r
b0d803fe 998\r
c7935105
SZ
999/**\r
1000 Returns information about a specific file.\r
1001\r
1002 @param FileHandle Handle of the file.\r
1003 @param FileInfo Upon exit, points to the file's information.\r
1004\r
1005 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
1006 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r
1007 @retval EFI_SUCCESS File information returned.\r
1008\r
1009**/\r
1010EFI_STATUS\r
1011EFIAPI \r
1012PeiFfsGetFileInfo2 (\r
1013 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1014 OUT EFI_FV_FILE_INFO2 *FileInfo\r
1015 );\r
1016\r
b1f6a7c6 1017/**\r
3b428ade 1018 Returns information about the specified volume.\r
b0d803fe 1019\r
3b428ade 1020 @param VolumeHandle Handle of the volume.\r
aa75dfec 1021 @param VolumeInfo Upon exit, points to the volume's information.\r
b0d803fe 1022\r
3b428ade 1023 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.\r
1024 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.\r
1025 @retval EFI_SUCCESS Volume information returned.\r
b1f6a7c6 1026**/\r
b0d803fe 1027EFI_STATUS\r
50cb16d9 1028EFIAPI\r
b0d803fe 1029PeiFfsGetVolumeInfo (\r
1030 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
1031 OUT EFI_FV_INFO *VolumeInfo\r
ed66e1bc 1032 );\r
b0d803fe 1033\r
14e8823a 1034/**\r
1035 This routine enable a PEIM to register itself to shadow when PEI Foundation\r
1036 discovery permanent memory.\r
1037\r
b1f6a7c6 1038 @param FileHandle File handle of a PEIM.\r
50cb16d9 1039\r
b1f6a7c6 1040 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.\r
1041 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.\r
1042 @retval EFI_SUCCESS Successfully to register itself.\r
14e8823a 1043\r
50cb16d9 1044**/\r
14e8823a 1045EFI_STATUS\r
1046EFIAPI\r
1047PeiRegisterForShadow (\r
1048 IN EFI_PEI_FILE_HANDLE FileHandle\r
ed66e1bc 1049 );\r
14e8823a 1050\r
b1f6a7c6 1051/**\r
15273993 1052 Initialize image service that install PeiLoadFilePpi.\r
b0d803fe 1053\r
15273993 1054 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.\r
1055 @param OldCoreData Pointer to Old PeiCore's private data.\r
1056 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.\r
1057 If not NULL, PeiCore is entered at second time, stack/heap has been moved\r
1058 to permenent memory.\r
b0d803fe 1059\r
b1f6a7c6 1060**/\r
1061VOID\r
1062InitializeImageServices (\r
1063 IN PEI_CORE_INSTANCE *PrivateData,\r
1064 IN PEI_CORE_INSTANCE *OldCoreData\r
ed66e1bc 1065 );\r
b0d803fe 1066\r
aa79b0b3 1067/**\r
1068 The wrapper function of PeiLoadImageLoadImage().\r
1069\r
f34aec3b 1070 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.\r
1071 @param FileHandle Pointer to the FFS file header of the image.\r
1072 @param ImageAddressArg Pointer to PE/TE image.\r
1073 @param ImageSizeArg Size of PE/TE image.\r
1074 @param EntryPoint Pointer to entry point of specified image file for output.\r
1075 @param AuthenticationState Pointer to attestation authentication state of image.\r
aa79b0b3 1076\r
1077 @return Status of PeiLoadImageLoadImage().\r
1078\r
1079**/\r
1080EFI_STATUS\r
1081EFIAPI\r
1082PeiLoadImageLoadImageWrapper (\r
1083 IN CONST EFI_PEI_LOAD_FILE_PPI *This,\r
1084 IN EFI_PEI_FILE_HANDLE FileHandle,\r
1085 OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg, OPTIONAL\r
1086 OUT UINT64 *ImageSizeArg, OPTIONAL\r
1087 OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r
1088 OUT UINT32 *AuthenticationState\r
1089 );\r
1090\r
1091/**\r
1092\r
1093 Provide a callback for when the security PPI is installed.\r
1094\r
1095 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
1096 @param NotifyDescriptor The descriptor for the notification event.\r
1097 @param Ppi Pointer to the PPI in question.\r
1098\r
1099 @return Always success\r
1100\r
1101**/\r
1102EFI_STATUS\r
1103EFIAPI\r
1104SecurityPpiNotifyCallback (\r
1105 IN EFI_PEI_SERVICES **PeiServices,\r
1106 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
1107 IN VOID *Ppi\r
1108 );\r
1109\r
3b428ade 1110/**\r
c7935105 1111 Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV hob.\r
3b428ade 1112\r
c7935105 1113 @param PrivateData PeiCore's private data structure\r
3b428ade 1114 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.\r
1115 @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.\r
1116\r
1117 @retval EFI_NOT_FOUND FV image can't be found.\r
1118 @retval EFI_SUCCESS Successfully to process it.\r
1119 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image\r
c7935105 1120 @retval EFI_SECURITY_VIOLATION Image is illegal\r
3b428ade 1121 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section\r
1122 \r
1123**/\r
1124EFI_STATUS\r
1125ProcessFvFile (\r
c7935105 1126 IN PEI_CORE_INSTANCE *PrivateData,\r
3b428ade 1127 IN PEI_CORE_FV_HANDLE *ParentFvCoreHandle,\r
1128 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle\r
1129 );\r
1130 \r
1131/**\r
1132 Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.\r
1133 \r
1134 This routine also will install FvInfo ppi for FV hob in PI ways.\r
1135 \r
1136 @param Private Pointer of PEI_CORE_INSTANCE\r
1137 @param Instance The index of FV want to be searched.\r
1138 \r
1139 @return Instance of PEI_CORE_FV_HANDLE.\r
1140**/\r
1141PEI_CORE_FV_HANDLE *\r
1142FindNextCoreFvHandle (\r
1143 IN PEI_CORE_INSTANCE *Private,\r
1144 IN UINTN Instance\r
1145 );\r
1146 \r
8d415937 1147//\r
1148// Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r
1149// \r
1150\r
1151/**\r
1152 Memory-based read services.\r
1153 \r
1154 This function is to perform the Memory Access Read service based on installed \r
1155 instance of the EFI_PEI_CPU_IO_PPI. \r
1156 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1157 return EFI_NOT_YET_AVAILABLE. \r
1158 \r
1159 @param PeiServices An indirect pointer to the PEI Services Table\r
1160 published by the PEI Foundation.\r
1161 @param This Pointer to local data for the interface.\r
1162 @param Width The width of the access. Enumerated in bytes.\r
1163 @param Address The physical address of the access.\r
1164 @param Count The number of accesses to perform.\r
1165 @param Buffer A pointer to the buffer of data.\r
1166\r
1167 @retval EFI_SUCCESS The function completed successfully.\r
1168 @retval EFI_NOT_YET_AVAILABLE The service has not been installed. \r
1169**/\r
1170EFI_STATUS\r
1171EFIAPI\r
1172PeiDefaultMemRead (\r
1173 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1174 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1175 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
1176 IN UINT64 Address,\r
1177 IN UINTN Count,\r
1178 IN OUT VOID *Buffer\r
1179 );\r
1180 \r
1181/**\r
1182 Memory-based write services.\r
1183 \r
1184 This function is to perform the Memory Access Write service based on installed \r
1185 instance of the EFI_PEI_CPU_IO_PPI. \r
1186 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1187 return EFI_NOT_YET_AVAILABLE. \r
1188 \r
1189 @param PeiServices An indirect pointer to the PEI Services Table\r
1190 published by the PEI Foundation.\r
1191 @param This Pointer to local data for the interface.\r
1192 @param Width The width of the access. Enumerated in bytes.\r
1193 @param Address The physical address of the access.\r
1194 @param Count The number of accesses to perform.\r
1195 @param Buffer A pointer to the buffer of data.\r
1196\r
1197 @retval EFI_SUCCESS The function completed successfully.\r
1198 @retval EFI_NOT_YET_AVAILABLE The service has not been installed. \r
1199**/\r
1200EFI_STATUS\r
1201EFIAPI\r
1202PeiDefaultMemWrite (\r
1203 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1204 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1205 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
1206 IN UINT64 Address,\r
1207 IN UINTN Count,\r
1208 IN OUT VOID *Buffer\r
1209 );\r
1210 \r
1211/**\r
1212 IO-based read services.\r
1213 \r
1214 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.\r
1215 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1216 return EFI_NOT_YET_AVAILABLE. \r
1217 \r
1218 @param PeiServices An indirect pointer to the PEI Services Table\r
1219 published by the PEI Foundation.\r
1220 @param This Pointer to local data for the interface.\r
1221 @param Width The width of the access. Enumerated in bytes.\r
1222 @param Address The physical address of the access.\r
1223 @param Count The number of accesses to perform.\r
1224 @param Buffer A pointer to the buffer of data.\r
1225\r
1226 @retval EFI_SUCCESS The function completed successfully.\r
1227 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
1228**/\r
1229EFI_STATUS\r
1230EFIAPI\r
1231PeiDefaultIoRead (\r
1232 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1233 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1234 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
1235 IN UINT64 Address,\r
1236 IN UINTN Count,\r
1237 IN OUT VOID *Buffer\r
1238 );\r
1239 \r
1240/**\r
1241 IO-based write services.\r
1242 \r
1243 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.\r
1244 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1245 return EFI_NOT_YET_AVAILABLE. \r
1246 \r
1247 @param PeiServices An indirect pointer to the PEI Services Table\r
1248 published by the PEI Foundation.\r
1249 @param This Pointer to local data for the interface.\r
1250 @param Width The width of the access. Enumerated in bytes.\r
1251 @param Address The physical address of the access.\r
1252 @param Count The number of accesses to perform.\r
1253 @param Buffer A pointer to the buffer of data.\r
1254\r
1255 @retval EFI_SUCCESS The function completed successfully.\r
1256 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
1257**/\r
1258EFI_STATUS\r
1259EFIAPI\r
1260PeiDefaultIoWrite (\r
1261 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1262 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1263 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
1264 IN UINT64 Address,\r
1265 IN UINTN Count,\r
1266 IN OUT VOID *Buffer\r
1267 );\r
1268 \r
1269/**\r
1270 8-bit I/O read operations.\r
1271 \r
1272 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1273 return 0.\r
1274 \r
1275 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1276 @param This Pointer to local data for the interface.\r
1277 @param Address The physical address of the access.\r
1278\r
1279 @return An 8-bit value returned from the I/O space.\r
1280**/\r
1281UINT8\r
1282EFIAPI\r
1283PeiDefaultIoRead8 (\r
1284 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1285 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1286 IN UINT64 Address\r
1287 );\r
1288 \r
1289/**\r
1290 Reads an 16-bit I/O port.\r
1291 \r
1292 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1293 return 0.\r
1294 \r
1295 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1296 @param This Pointer to local data for the interface.\r
1297 @param Address The physical address of the access.\r
1298\r
1299 @return A 16-bit value returned from the I/O space.\r
1300**/\r
1301UINT16\r
1302EFIAPI\r
1303PeiDefaultIoRead16 (\r
1304 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1305 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1306 IN UINT64 Address\r
1307 );\r
1308 \r
1309/**\r
1310 Reads an 32-bit I/O port.\r
1311 \r
1312 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1313 return 0.\r
1314 \r
1315 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1316 @param This Pointer to local data for the interface.\r
1317 @param Address The physical address of the access.\r
1318\r
1319 @return A 32-bit value returned from the I/O space.\r
1320**/\r
1321UINT32\r
1322EFIAPI\r
1323PeiDefaultIoRead32 (\r
1324 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1325 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1326 IN UINT64 Address\r
1327 );\r
1328 \r
1329/**\r
1330 Reads an 64-bit I/O port.\r
1331 \r
1332 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1333 return 0.\r
1334 \r
1335 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1336 @param This Pointer to local data for the interface.\r
1337 @param Address The physical address of the access.\r
1338\r
1339 @return A 64-bit value returned from the I/O space.\r
1340**/\r
1341UINT64\r
1342EFIAPI\r
1343PeiDefaultIoRead64 (\r
1344 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1345 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1346 IN UINT64 Address\r
1347 );\r
1348 \r
1349/**\r
1350 8-bit I/O write operations.\r
1351\r
1352 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1353 @param This Pointer to local data for the interface.\r
1354 @param Address The physical address of the access.\r
1355 @param Data The data to write.\r
1356**/\r
1357VOID\r
1358EFIAPI\r
1359PeiDefaultIoWrite8 (\r
1360 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1361 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1362 IN UINT64 Address,\r
1363 IN UINT8 Data\r
1364 );\r
1365 \r
1366/**\r
1367 16-bit I/O write operations.\r
1368\r
1369 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1370 @param This Pointer to local data for the interface.\r
1371 @param Address The physical address of the access.\r
1372 @param Data The data to write.\r
1373**/\r
1374VOID\r
1375EFIAPI\r
1376PeiDefaultIoWrite16 (\r
1377 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1378 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1379 IN UINT64 Address,\r
1380 IN UINT16 Data\r
1381 );\r
1382 \r
1383/**\r
1384 32-bit I/O write operations.\r
1385\r
1386 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1387 @param This Pointer to local data for the interface.\r
1388 @param Address The physical address of the access.\r
1389 @param Data The data to write.\r
1390**/\r
1391VOID\r
1392EFIAPI\r
1393PeiDefaultIoWrite32 (\r
1394 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1395 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1396 IN UINT64 Address,\r
1397 IN UINT32 Data\r
1398 );\r
1399 \r
1400/**\r
1401 64-bit I/O write operations.\r
1402\r
1403 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1404 @param This Pointer to local data for the interface.\r
1405 @param Address The physical address of the access.\r
1406 @param Data The data to write.\r
1407**/\r
1408VOID\r
1409EFIAPI\r
1410PeiDefaultIoWrite64 (\r
1411 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1412 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1413 IN UINT64 Address,\r
1414 IN UINT64 Data\r
1415 );\r
1416 \r
1417/**\r
1418 8-bit memory read operations.\r
1419\r
1420 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1421 return 0.\r
1422 \r
1423 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1424 @param This Pointer to local data for the interface.\r
1425 @param Address The physical address of the access.\r
1426\r
1427 @return An 8-bit value returned from the memory space.\r
1428\r
1429**/\r
1430UINT8\r
1431EFIAPI\r
1432PeiDefaultMemRead8 (\r
1433 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1434 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1435 IN UINT64 Address\r
1436 );\r
1437 \r
1438/**\r
1439 16-bit memory read operations.\r
1440\r
1441 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1442 return 0.\r
1443 \r
1444 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1445 @param This Pointer to local data for the interface.\r
1446 @param Address The physical address of the access.\r
1447\r
1448 @return An 16-bit value returned from the memory space.\r
1449\r
1450**/\r
1451UINT16\r
1452EFIAPI\r
1453PeiDefaultMemRead16 (\r
1454 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1455 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1456 IN UINT64 Address\r
1457 );\r
1458 \r
1459/**\r
1460 32-bit memory read operations.\r
1461\r
1462 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1463 return 0.\r
1464 \r
1465 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1466 @param This Pointer to local data for the interface.\r
1467 @param Address The physical address of the access.\r
1468\r
1469 @return An 32-bit value returned from the memory space.\r
1470\r
1471**/\r
1472UINT32\r
1473EFIAPI\r
1474PeiDefaultMemRead32 (\r
1475 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1476 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1477 IN UINT64 Address\r
1478 );\r
1479 \r
1480/**\r
1481 64-bit memory read operations.\r
1482\r
1483 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r
1484 return 0.\r
1485 \r
1486 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1487 @param This Pointer to local data for the interface.\r
1488 @param Address The physical address of the access.\r
1489\r
1490 @return An 64-bit value returned from the memory space.\r
1491\r
1492**/\r
1493UINT64\r
1494EFIAPI\r
1495PeiDefaultMemRead64 (\r
1496 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1497 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1498 IN UINT64 Address\r
1499 );\r
1500 \r
1501/**\r
1502 8-bit memory write operations.\r
1503\r
1504 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1505 @param This Pointer to local data for the interface.\r
1506 @param Address The physical address of the access.\r
1507 @param Data The data to write.\r
1508\r
1509**/\r
1510VOID\r
1511EFIAPI\r
1512PeiDefaultMemWrite8 (\r
1513 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1514 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1515 IN UINT64 Address,\r
1516 IN UINT8 Data\r
1517 );\r
1518 \r
1519/**\r
1520 16-bit memory write operations.\r
1521\r
1522 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1523 @param This Pointer to local data for the interface.\r
1524 @param Address The physical address of the access.\r
1525 @param Data The data to write.\r
1526\r
1527**/\r
1528VOID\r
1529EFIAPI\r
1530PeiDefaultMemWrite16 (\r
1531 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1532 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1533 IN UINT64 Address,\r
1534 IN UINT16 Data\r
1535 );\r
1536\r
1537/**\r
1538 32-bit memory write operations.\r
1539\r
1540 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1541 @param This Pointer to local data for the interface.\r
1542 @param Address The physical address of the access.\r
1543 @param Data The data to write.\r
1544\r
1545**/\r
1546VOID\r
1547EFIAPI\r
1548PeiDefaultMemWrite32 (\r
1549 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1550 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1551 IN UINT64 Address,\r
1552 IN UINT32 Data\r
1553 );\r
1554 \r
1555/**\r
1556 64-bit memory write operations.\r
1557\r
1558 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1559 @param This Pointer to local data for the interface.\r
1560 @param Address The physical address of the access.\r
1561 @param Data The data to write.\r
1562\r
1563**/\r
1564VOID\r
1565EFIAPI\r
1566PeiDefaultMemWrite64 (\r
1567 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1568 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
1569 IN UINT64 Address,\r
1570 IN UINT64 Data\r
1571 );\r
1572 \r
1573extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi; \r
1574\r
1575//\r
1576// Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r
1577// \r
1578\r
1579/**\r
1580 Reads from a given location in the PCI configuration space.\r
1581\r
1582 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then \r
1583 return EFI_NOT_YET_AVAILABLE. \r
1584 \r
1585 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1586 @param This Pointer to local data for the interface.\r
1587 @param Width The width of the access. Enumerated in bytes.\r
1588 See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
1589 @param Address The physical address of the access. The format of\r
1590 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
1591 @param Buffer A pointer to the buffer of data.\r
1592\r
1593 @retval EFI_SUCCESS The function completed successfully.\r
1594 @retval EFI_INVALID_PARAMETER The invalid access width.\r
1595 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r
1596 \r
1597**/\r
1598EFI_STATUS\r
1599EFIAPI\r
1600PeiDefaultPciCfg2Read (\r
1601 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1602 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
1603 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
1604 IN UINT64 Address,\r
1605 IN OUT VOID *Buffer\r
1606 );\r
1607 \r
1608/**\r
1609 Write to a given location in the PCI configuration space.\r
1610\r
1611 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then \r
1612 return EFI_NOT_YET_AVAILABLE. \r
1613 \r
1614 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
1615 @param This Pointer to local data for the interface.\r
1616 @param Width The width of the access. Enumerated in bytes.\r
1617 See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
1618 @param Address The physical address of the access. The format of\r
1619 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
1620 @param Buffer A pointer to the buffer of data.\r
1621\r
1622 @retval EFI_SUCCESS The function completed successfully.\r
1623 @retval EFI_INVALID_PARAMETER The invalid access width.\r
1624 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r
1625**/\r
1626EFI_STATUS\r
1627EFIAPI\r
1628PeiDefaultPciCfg2Write (\r
1629 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1630 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
1631 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
1632 IN UINT64 Address,\r
1633 IN OUT VOID *Buffer\r
1634 );\r
1635 \r
1636/**\r
1637 This function performs a read-modify-write operation on the contents from a given\r
1638 location in the PCI configuration space.\r
1639\r
1640 @param PeiServices An indirect pointer to the PEI Services Table\r
1641 published by the PEI Foundation.\r
1642 @param This Pointer to local data for the interface.\r
1643 @param Width The width of the access. Enumerated in bytes. Type\r
1644 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
1645 @param Address The physical address of the access.\r
1646 @param SetBits Points to value to bitwise-OR with the read configuration value.\r
1647 The size of the value is determined by Width.\r
1648 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r
1649 The size of the value is determined by Width.\r
1650\r
1651 @retval EFI_SUCCESS The function completed successfully.\r
1652 @retval EFI_INVALID_PARAMETER The invalid access width.\r
1653 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r
1654**/\r
1655EFI_STATUS\r
1656EFIAPI\r
1657PeiDefaultPciCfg2Modify (\r
1658 IN CONST EFI_PEI_SERVICES **PeiServices,\r
1659 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
1660 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
1661 IN UINT64 Address,\r
1662 IN VOID *SetBits,\r
1663 IN VOID *ClearBits\r
1664 ); \r
1665 \r
1666extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi;\r
1667\r
8e0e40ed 1668/**\r
1669 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should\r
1670 be re-installed with the instance in permanent memory and all cached FvPpi pointers in \r
1671 PrivateData->Fv[] array should be fixed up to be pointed to the one in permenant\r
1672 memory.\r
1673 \r
1674 @param PrivateData Pointer to PEI_CORE_INSTANCE.\r
1675**/ \r
1676VOID\r
1677PeiReinitializeFv (\r
1678 IN PEI_CORE_INSTANCE *PrivateData\r
1679 );\r
1680 \r
192f6d4c 1681#endif\r