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