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