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