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