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