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