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