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