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