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