2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
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>
49 /// It is an FFS type extension used for PeiFindFileEx. It indicates current
50 /// FFS searching is for all PEIMs can be dispatched by PeiCore.
52 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
55 /// Pei Core private data structures
58 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
59 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
61 } PEI_PPI_LIST_POINTERS
;
64 /// Number of PEI_PPI_LIST_POINTERS to grow by each time we run out of room
66 #define PPI_GROWTH_STEP 64
67 #define CALLBACK_NOTIFY_GROWTH_STEP 32
68 #define DISPATCH_NOTIFY_GROWTH_STEP 8
73 UINTN LastDispatchedCount
;
75 /// MaxCount number of entries.
77 PEI_PPI_LIST_POINTERS
*PpiPtrs
;
84 /// MaxCount number of entries.
86 PEI_PPI_LIST_POINTERS
*NotifyPtrs
;
87 } PEI_CALLBACK_NOTIFY_LIST
;
92 UINTN LastDispatchedCount
;
94 /// MaxCount number of entries.
96 PEI_PPI_LIST_POINTERS
*NotifyPtrs
;
97 } PEI_DISPATCH_NOTIFY_LIST
;
100 /// PPI database structure which contains three links:
101 /// PpiList, CallbackNotifyList and DispatchNotifyList.
107 PEI_PPI_LIST PpiList
;
109 /// Notify List at dispatch level.
111 PEI_CALLBACK_NOTIFY_LIST CallbackNotifyList
;
113 /// Notify List at callback level.
115 PEI_DISPATCH_NOTIFY_LIST DispatchNotifyList
;
119 // PEI_CORE_FV_HANDLE.PeimState
120 // Do not change these values as there is code doing math to change states.
121 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
123 #define PEIM_STATE_NOT_DISPATCHED 0x00
124 #define PEIM_STATE_DISPATCHED 0x01
125 #define PEIM_STATE_REGISTER_FOR_SHADOW 0x02
126 #define PEIM_STATE_DONE 0x03
129 // Number of FV instances to grow by each time we run out of room
131 #define FV_GROWTH_STEP 8
134 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
135 EFI_PEI_FIRMWARE_VOLUME_PPI
*FvPpi
;
136 EFI_PEI_FV_HANDLE FvHandle
;
139 // Pointer to the buffer with the PeimCount number of Entries.
143 // Pointer to the buffer with the PeimCount number of Entries.
145 EFI_PEI_FILE_HANDLE
*FvFileHandles
;
147 UINT32 AuthenticationStatus
;
148 } PEI_CORE_FV_HANDLE
;
154 UINT32 AuthenticationStatus
;
155 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor
;
156 } PEI_CORE_UNKNOW_FORMAT_FV_INFO
;
158 #define CACHE_SETION_MAX_NUMBER 0x10
160 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
161 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
162 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
163 UINT32 AuthenticationStatus
[CACHE_SETION_MAX_NUMBER
];
164 UINTN AllSectionCount
;
166 } CACHE_SECTION_DATA
;
168 #define HOLE_MAX_NUMBER 0x3
170 EFI_PHYSICAL_ADDRESS Base
;
173 BOOLEAN OffsetPositive
;
177 /// Forward declaration for PEI_CORE_INSTANCE
179 typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE
;
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
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
204 // Number of files to grow by each time we run out of room
206 #define TEMP_FILE_GROWTH_STEP 32
208 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
211 /// Pei Core private data structure instance
213 struct _PEI_CORE_INSTANCE
{
217 /// Point to ServiceTableShadow
219 EFI_PEI_SERVICES
*Ps
;
220 PEI_PPI_DATABASE PpiData
;
223 /// The count of FVs which contains FFS and could be dispatched by PeiCore.
228 /// The max count of FVs which contains FFS and could be dispatched by PeiCore.
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.
236 PEI_CORE_FV_HANDLE
*Fv
;
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.
242 PEI_CORE_UNKNOW_FORMAT_FV_INFO
*UnknownFvInfo
;
243 UINTN MaxUnknownFvInfoCount
;
244 UINTN UnknownFvInfoCount
;
247 /// Pointer to the buffer FvFileHandlers in PEI_CORE_FV_HANDLE specified by CurrentPeimFvCount.
249 EFI_PEI_FILE_HANDLE
*CurrentFvFileHandles
;
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
;
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
;
268 BOOLEAN HeapOffsetPositive
;
270 BOOLEAN StackOffsetPositive
;
272 // Information for migrating memory pages allocated in pre-memory phase.
274 HOLE_MEMORY_DATA MemoryPages
;
275 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
276 CACHE_SECTION_DATA CacheSection
;
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.
282 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
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 correspoding memory page
288 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
290 // This field points to the shadowed image read function
292 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
297 // Pointer to the temp buffer with the TempPeimCount number of entries.
299 EFI_PEI_FILE_HANDLE
*TempFileHandles
;
301 // Pointer to the temp buffer with the TempPeimCount number of entries.
303 EFI_GUID
*TempFileGuid
;
306 // Temp Memory Range is not covered by PeiTempMem and Stack.
307 // Those Memory Range will be migrated into physical memory.
309 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
313 /// Pei Core Instance Data Macros
315 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
316 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
319 /// Union of temporarily used function pointers (to save stack space)
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
;
329 } PEI_CORE_TEMP_POINTERS
;
332 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
333 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
335 } PEI_CORE_PARAMETERS
;
342 The entry routine to Pei Core, invoked by PeiMain during transition
343 from SEC to PEI. After switching stack in the PEI core, it will restart
344 with the old core data.
347 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
348 and location of temporary RAM, the stack location and the BFV location.
349 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
350 An empty PPI list consists of a single descriptor with the end-tag
351 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
352 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
353 that both the PEI Foundation and any modules can leverage the associated service
354 calls and/or code in these early PPIs
355 @param Data Pointer to old core data that is used to initialize the
362 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
363 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
368 // Dispatcher support functions
373 This is the POSTFIX version of the dependency evaluator. When a
374 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
375 the evaluation stack. When that entry is popped from the evaluation
376 stack, the PPI is checked if it is installed. This method allows
377 some time savings as not all PPIs must be checked for certain
378 operation types (AND, OR).
381 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
382 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
383 the BNF described above and is stored in postfix notation.
385 @retval TRUE if it is a well-formed Grammar
386 @retval FALSE if the dependency expression overflows the evaluation stack
387 if the dependency expression underflows the evaluation stack
388 if the dependency expression is not a well-formed Grammar.
392 PeimDispatchReadiness (
393 IN EFI_PEI_SERVICES
**PeiServices
,
394 IN VOID
*DependencyExpression
398 Conduct PEIM dispatch.
400 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
401 @param PrivateData Pointer to the private data passed in from caller
406 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
407 IN PEI_CORE_INSTANCE
*PrivateData
411 Initialize the Dispatcher's data members
413 @param PrivateData PeiCore's private data structure
414 @param OldCoreData Old data from SecCore
415 NULL if being run in non-permanent memory mode.
416 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
417 and location of temporary RAM, the stack location and the BFV location.
421 InitializeDispatcherData (
422 IN PEI_CORE_INSTANCE
*PrivateData
,
423 IN PEI_CORE_INSTANCE
*OldCoreData
,
424 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
428 This routine parses the Dependency Expression, if available, and
429 decides if the module can be executed.
432 @param Private PeiCore's private data structure
433 @param FileHandle PEIM's file handle
434 @param PeimCount The index of last dispatched PEIM.
436 @retval TRUE Can be dispatched
437 @retval FALSE Cannot be dispatched
442 IN PEI_CORE_INSTANCE
*Private
,
443 IN EFI_PEI_FILE_HANDLE FileHandle
,
448 // PPI support functions
452 Initialize PPI services.
454 @param PrivateData Pointer to the PEI Core data.
455 @param OldCoreData Pointer to old PEI Core data.
456 NULL if being run in non-permanent memory mode.
460 InitializePpiServices (
461 IN PEI_CORE_INSTANCE
*PrivateData
,
462 IN PEI_CORE_INSTANCE
*OldCoreData
467 Migrate the Hob list from the temporary memory to PEI installed memory.
469 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
470 and location of temporary RAM, the stack location and the BFV location.
471 @param PrivateData Pointer to PeiCore's private data structure.
476 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
477 IN PEI_CORE_INSTANCE
*PrivateData
482 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
484 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
485 @param PpiList Pointer to PPI array that want to be installed.
487 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
488 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
489 if any PPI in PpiList is not valid
490 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
496 IN CONST EFI_PEI_SERVICES
**PeiServices
,
497 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
502 Re-Install PPI services.
504 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
505 @param OldPpi Pointer to the old PEI PPI Descriptors.
506 @param NewPpi Pointer to the new PEI PPI Descriptors.
508 @retval EFI_SUCCESS if the operation was successful
509 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
510 if NewPpi is not valid
511 @retval EFI_NOT_FOUND if the PPI was not in the database
517 IN CONST EFI_PEI_SERVICES
**PeiServices
,
518 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
519 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
524 Locate a given named PPI.
527 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
528 @param Guid Pointer to GUID of the PPI.
529 @param Instance Instance Number to discover.
530 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
531 returns a pointer to the descriptor (includes flags, etc)
532 @param Ppi Pointer to reference the found PPI
534 @retval EFI_SUCCESS if the PPI is in the database
535 @retval EFI_NOT_FOUND if the PPI is not in the database
541 IN CONST EFI_PEI_SERVICES
**PeiServices
,
542 IN CONST EFI_GUID
*Guid
,
544 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
550 Install a notification for a given PPI.
553 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
554 @param NotifyList Pointer to list of Descriptors to notify upon.
556 @retval EFI_SUCCESS if successful
557 @retval EFI_OUT_OF_RESOURCES if no space in the database
558 @retval EFI_INVALID_PARAMETER if not a good decriptor
564 IN CONST EFI_PEI_SERVICES
**PeiServices
,
565 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
570 Process the Notify List at dispatch level.
572 @param PrivateData PeiCore's private data structure.
576 ProcessDispatchNotifyList (
577 IN PEI_CORE_INSTANCE
*PrivateData
582 Process notifications.
584 @param PrivateData PeiCore's private data structure
585 @param NotifyType Type of notify to fire.
586 @param InstallStartIndex Install Beginning index.
587 @param InstallStopIndex Install Ending index.
588 @param NotifyStartIndex Notify Beginning index.
589 @param NotifyStopIndex Notify Ending index.
594 IN PEI_CORE_INSTANCE
*PrivateData
,
596 IN INTN InstallStartIndex
,
597 IN INTN InstallStopIndex
,
598 IN INTN NotifyStartIndex
,
599 IN INTN NotifyStopIndex
603 Process PpiList from SEC phase.
605 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
606 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
607 These PPI's will be installed and/or immediately signaled if they are notification type.
611 ProcessPpiListFromSec (
612 IN CONST EFI_PEI_SERVICES
**PeiServices
,
613 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
617 // Boot mode support functions
620 This service enables PEIMs to ascertain the present value of the boot mode.
622 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
623 @param BootMode A pointer to contain the value of the boot mode.
625 @retval EFI_SUCCESS The boot mode was returned successfully.
626 @retval EFI_INVALID_PARAMETER BootMode is NULL.
632 IN CONST EFI_PEI_SERVICES
**PeiServices
,
633 IN OUT EFI_BOOT_MODE
*BootMode
637 This service enables PEIMs to update the boot mode variable.
640 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
641 @param BootMode The value of the boot mode to set.
643 @return EFI_SUCCESS The value was successfully updated
649 IN CONST EFI_PEI_SERVICES
**PeiServices
,
650 IN EFI_BOOT_MODE BootMode
654 // Security support functions
658 Initialize the security services.
660 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
661 @param OldCoreData Pointer to the old core data.
662 NULL if being run in non-permanent memory mode.
666 InitializeSecurityServices (
667 IN EFI_PEI_SERVICES
**PeiServices
,
668 IN PEI_CORE_INSTANCE
*OldCoreData
672 Verify a Firmware volume.
674 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
676 @retval EFI_SUCCESS Firmware Volume is legal
677 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
682 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
686 Provide a callout to the security verification service.
688 @param PrivateData PeiCore's private data structure
689 @param VolumeHandle Handle of FV
690 @param FileHandle Handle of PEIM's FFS
691 @param AuthenticationStatus Authentication status
693 @retval EFI_SUCCESS Image is OK
694 @retval EFI_SECURITY_VIOLATION Image is illegal
695 @retval EFI_NOT_FOUND If security PPI is not installed.
699 IN PEI_CORE_INSTANCE
*PrivateData
,
700 IN EFI_PEI_FV_HANDLE VolumeHandle
,
701 IN EFI_PEI_FILE_HANDLE FileHandle
,
702 IN UINT32 AuthenticationStatus
707 Gets the pointer to the HOB List.
710 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
711 @param HobList Pointer to the HOB List.
713 @retval EFI_SUCCESS Get the pointer of HOB List
714 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
715 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
721 IN CONST EFI_PEI_SERVICES
**PeiServices
,
722 IN OUT VOID
**HobList
726 Add a new HOB to the HOB List.
728 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
729 @param Type Type of the new HOB.
730 @param Length Length of the new HOB to allocate.
731 @param Hob Pointer to the new HOB.
733 @return EFI_SUCCESS Success to create HOB.
734 @retval EFI_INVALID_PARAMETER if Hob is NULL
735 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
736 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
742 IN CONST EFI_PEI_SERVICES
**PeiServices
,
750 Builds a Handoff Information Table HOB
752 @param BootMode - Current Bootmode
753 @param MemoryBegin - Start Memory Address.
754 @param MemoryLength - Length of Memory.
756 @return EFI_SUCCESS Always success to initialize HOB.
760 PeiCoreBuildHobHandoffInfoTable (
761 IN EFI_BOOT_MODE BootMode
,
762 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
763 IN UINT64 MemoryLength
767 Install SEC HOB data to the HOB List.
769 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
770 @param SecHobList Pointer to SEC HOB List.
772 @return EFI_SUCCESS Success to install SEC HOB data.
773 @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.
777 PeiInstallSecHobData (
778 IN CONST EFI_PEI_SERVICES
**PeiServices
,
779 IN EFI_HOB_GENERIC_HEADER
*SecHobList
784 // FFS Fw Volume support functions
787 Searches for the next matching file in the firmware volume.
789 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
790 @param SearchType Filter to find only files of this type.
791 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
792 @param FvHandle Handle of firmware volume in which to search.
793 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
794 at the beginning of the firmware volume. On exit, points the file handle of the next file
795 in the volume or NULL if there are no more files.
797 @retval EFI_NOT_FOUND The file was not found.
798 @retval EFI_NOT_FOUND The header checksum was not zero.
799 @retval EFI_SUCCESS The file was found.
805 IN CONST EFI_PEI_SERVICES
**PeiServices
,
807 IN EFI_PEI_FV_HANDLE FvHandle
,
808 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
812 Searches for the next matching section within the specified file.
814 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
815 @param SectionType Filter to find only sections of this type.
816 @param FileHandle Pointer to the current file to search.
817 @param SectionData A pointer to the discovered section, if successful.
818 NULL if section not found
820 @retval EFI_NOT_FOUND The section was not found.
821 @retval EFI_SUCCESS The section was found.
826 PeiFfsFindSectionData (
827 IN CONST EFI_PEI_SERVICES
**PeiServices
,
828 IN EFI_SECTION_TYPE SectionType
,
829 IN EFI_PEI_FILE_HANDLE FileHandle
,
830 OUT VOID
**SectionData
834 Searches for the next matching section within the specified file.
836 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
837 @param SectionType The value of the section type to find.
838 @param SectionInstance Section instance to find.
839 @param FileHandle Handle of the firmware file to search.
840 @param SectionData A pointer to the discovered section, if successful.
841 @param AuthenticationStatus A pointer to the authentication status for this section.
843 @retval EFI_SUCCESS The section was found.
844 @retval EFI_NOT_FOUND The section was not found.
849 PeiFfsFindSectionData3 (
850 IN CONST EFI_PEI_SERVICES
**PeiServices
,
851 IN EFI_SECTION_TYPE SectionType
,
852 IN UINTN SectionInstance
,
853 IN EFI_PEI_FILE_HANDLE FileHandle
,
854 OUT VOID
**SectionData
,
855 OUT UINT32
*AuthenticationStatus
859 Search the firmware volumes by index
861 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
862 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
864 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
866 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
867 @retval EFI_NOT_FOUND The volume was not found.
868 @retval EFI_SUCCESS The volume was found.
873 PeiFfsFindNextVolume (
874 IN CONST EFI_PEI_SERVICES
**PeiServices
,
876 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
880 // Memory support functions
884 Initialize the memory services.
886 @param PrivateData PeiCore's private data structure
887 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
888 and location of temporary RAM, the stack location and the BFV location.
889 @param OldCoreData Pointer to the PEI Core data.
890 NULL if being run in non-permanent memory mode.
894 InitializeMemoryServices (
895 IN PEI_CORE_INSTANCE
*PrivateData
,
896 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
897 IN PEI_CORE_INSTANCE
*OldCoreData
902 Install the permanent memory is now available.
903 Creates HOB (PHIT and Stack).
905 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
906 @param MemoryBegin Start of memory address.
907 @param MemoryLength Length of memory.
909 @return EFI_SUCCESS Always success.
914 PeiInstallPeiMemory (
915 IN CONST EFI_PEI_SERVICES
**PeiServices
,
916 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
917 IN UINT64 MemoryLength
921 Migrate memory pages allocated in pre-memory phase.
922 Copy memory pages at temporary heap top to permanent heap top.
924 @param[in] Private Pointer to the private data passed in from caller.
925 @param[in] TemporaryRamMigrated Temporary memory has been migrated to permanent memory.
930 IN PEI_CORE_INSTANCE
*Private
,
931 IN BOOLEAN TemporaryRamMigrated
935 Migrate MemoryBaseAddress in memory allocation HOBs
936 from the temporary memory to PEI installed memory.
938 @param[in] PrivateData Pointer to PeiCore's private data structure.
942 ConvertMemoryAllocationHobs (
943 IN PEI_CORE_INSTANCE
*PrivateData
947 The purpose of the service is to publish an interface that allows
948 PEIMs to allocate memory ranges that are managed by the PEI Foundation.
950 Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.
951 After InstallPeiMemory() is called, PEI will allocate pages within the region
952 of memory provided by InstallPeiMemory() service in a best-effort fashion.
953 Location-specific allocations are not managed by the PEI foundation code.
955 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
956 @param MemoryType The type of memory to allocate.
957 @param Pages The number of contiguous 4 KB pages to allocate.
958 @param Memory Pointer to a physical address. On output, the address is set to the base
959 of the page range that was allocated.
961 @retval EFI_SUCCESS The memory range was successfully allocated.
962 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
963 @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,
964 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,
965 EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.
971 IN CONST EFI_PEI_SERVICES
**PeiServices
,
972 IN EFI_MEMORY_TYPE MemoryType
,
974 OUT EFI_PHYSICAL_ADDRESS
*Memory
980 @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
981 @param[in] Memory The base physical address of the pages to be freed.
982 @param[in] Pages The number of contiguous 4 KB pages to free.
984 @retval EFI_SUCCESS The requested pages were freed.
985 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
986 @retval EFI_NOT_FOUND The requested memory pages were not allocated with
993 IN CONST EFI_PEI_SERVICES
**PeiServices
,
994 IN EFI_PHYSICAL_ADDRESS Memory
,
1000 Memory allocation service on the temporary memory.
1003 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1004 @param Size Amount of memory required
1005 @param Buffer Address of pointer to the buffer
1007 @retval EFI_SUCCESS The allocation was successful
1008 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1009 to allocate the requested size.
1015 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1022 Routine for load image file.
1025 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1026 @param FileHandle Pointer to the FFS file header of the image.
1027 @param PeimState The dispatch state of the input PEIM handle.
1028 @param EntryPoint Pointer to entry point of specified image file for output.
1029 @param AuthenticationState Pointer to attestation authentication state of image.
1031 @retval EFI_SUCCESS Image is successfully loaded.
1032 @retval EFI_NOT_FOUND Fail to locate necessary PPI
1033 @retval Others Fail to load file.
1038 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1039 IN EFI_PEI_FILE_HANDLE FileHandle
,
1041 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1042 OUT UINT32
*AuthenticationState
1047 Core version of the Status Code reporter
1050 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1051 @param CodeType Type of Status Code.
1052 @param Value Value to output for Status Code.
1053 @param Instance Instance Number of this status code.
1054 @param CallerId ID of the caller of this status code.
1055 @param Data Optional data associated with this status code.
1057 @retval EFI_SUCCESS if status code is successfully reported
1058 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1063 PeiReportStatusCode (
1064 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1065 IN EFI_STATUS_CODE_TYPE CodeType
,
1066 IN EFI_STATUS_CODE_VALUE Value
,
1068 IN CONST EFI_GUID
*CallerId
,
1069 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1074 Core version of the Reset System
1077 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1079 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
1080 @retval EFI_DEVICE_ERROR Did not reset system.
1081 Otherwise, resets the system.
1087 IN CONST EFI_PEI_SERVICES
**PeiServices
1091 Resets the entire platform.
1093 @param[in] ResetType The type of reset to perform.
1094 @param[in] ResetStatus The status code for the reset.
1095 @param[in] DataSize The size, in bytes, of ResetData.
1096 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
1097 the data buffer starts with a Null-terminated string, optionally
1098 followed by additional binary data. The string is a description
1099 that the caller may use to further indicate the reason for the
1106 IN EFI_RESET_TYPE ResetType
,
1107 IN EFI_STATUS ResetStatus
,
1109 IN VOID
*ResetData OPTIONAL
1114 Initialize PeiCore FV List.
1117 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1118 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1123 IN PEI_CORE_INSTANCE
*PrivateData
,
1124 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1128 Process Firmware Volume Information once FvInfoPPI install.
1130 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1131 @param NotifyDescriptor Address of the notification descriptor data structure.
1132 @param Ppi Address of the PPI that was installed.
1134 @retval EFI_SUCCESS if the interface could be successfully installed
1139 FirmwareVolumeInfoPpiNotifyCallback (
1140 IN EFI_PEI_SERVICES
**PeiServices
,
1141 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1147 Given the input VolumeHandle, search for the next matching name file.
1149 @param FileName File name to search.
1150 @param VolumeHandle The current FV to search.
1151 @param FileHandle Pointer to the file matching name in VolumeHandle.
1152 NULL if file not found
1154 @retval EFI_NOT_FOUND No files matching the search criteria were found
1155 @retval EFI_SUCCESS Success to search given file
1160 PeiFfsFindFileByName (
1161 IN CONST EFI_GUID
*FileName
,
1162 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1163 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1167 Returns information about a specific file.
1169 @param FileHandle Handle of the file.
1170 @param FileInfo Upon exit, points to the file's information.
1172 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1173 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1174 @retval EFI_SUCCESS File information returned.
1180 IN EFI_PEI_FILE_HANDLE FileHandle
,
1181 OUT EFI_FV_FILE_INFO
*FileInfo
1185 Returns information about a specific file.
1187 @param FileHandle Handle of the file.
1188 @param FileInfo Upon exit, points to the file's information.
1190 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1191 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1192 @retval EFI_SUCCESS File information returned.
1197 PeiFfsGetFileInfo2 (
1198 IN EFI_PEI_FILE_HANDLE FileHandle
,
1199 OUT EFI_FV_FILE_INFO2
*FileInfo
1203 Returns information about the specified volume.
1205 @param VolumeHandle Handle of the volume.
1206 @param VolumeInfo Upon exit, points to the volume's information.
1208 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1209 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1210 @retval EFI_SUCCESS Volume information returned.
1214 PeiFfsGetVolumeInfo (
1215 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1216 OUT EFI_FV_INFO
*VolumeInfo
1220 This routine enables a PEIM to register itself for shadow when the PEI Foundation
1221 discovers permanent memory.
1223 @param FileHandle File handle of a PEIM.
1225 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1226 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1227 @retval EFI_SUCCESS Successfully to register itself.
1232 PeiRegisterForShadow (
1233 IN EFI_PEI_FILE_HANDLE FileHandle
1237 Initialize image service that install PeiLoadFilePpi.
1239 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1240 @param OldCoreData Pointer to Old PeiCore's private data.
1241 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1242 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1243 to permanent memory.
1247 InitializeImageServices (
1248 IN PEI_CORE_INSTANCE
*PrivateData
,
1249 IN PEI_CORE_INSTANCE
*OldCoreData
1253 The wrapper function of PeiLoadImageLoadImage().
1255 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1256 @param FileHandle Pointer to the FFS file header of the image.
1257 @param ImageAddressArg Pointer to PE/TE image.
1258 @param ImageSizeArg Size of PE/TE image.
1259 @param EntryPoint Pointer to entry point of specified image file for output.
1260 @param AuthenticationState Pointer to attestation authentication state of image.
1262 @return Status of PeiLoadImageLoadImage().
1267 PeiLoadImageLoadImageWrapper (
1268 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1269 IN EFI_PEI_FILE_HANDLE FileHandle
,
1270 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1271 OUT UINT64
*ImageSizeArg
, OPTIONAL
1272 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1273 OUT UINT32
*AuthenticationState
1278 Provide a callback for when the security PPI is installed.
1280 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1281 @param NotifyDescriptor The descriptor for the notification event.
1282 @param Ppi Pointer to the PPI in question.
1284 @return Always success
1289 SecurityPpiNotifyCallback (
1290 IN EFI_PEI_SERVICES
**PeiServices
,
1291 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1296 Get FV image(s) from the FV type file, then install FV INFO(2) PPI, Build FV(2, 3) HOB.
1298 @param PrivateData PeiCore's private data structure
1299 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent FV image that contain this FV image.
1300 @param ParentFvFileHandle File handle of a FV type file that contain this FV image.
1302 @retval EFI_NOT_FOUND FV image can't be found.
1303 @retval EFI_SUCCESS Successfully to process it.
1304 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1305 @retval EFI_SECURITY_VIOLATION Image is illegal
1306 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1311 IN PEI_CORE_INSTANCE
*PrivateData
,
1312 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1313 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1317 Gets a PEI_CORE_FV_HANDLE instance for the next volume according to the given index.
1319 This routine also will install an instance of the FvInfo PPI for the FV HOB
1320 as defined in the PI specification.
1322 @param Private Pointer of PEI_CORE_INSTANCE
1323 @param Instance Index of the FV to search
1325 @return Instance of PEI_CORE_FV_HANDLE.
1327 PEI_CORE_FV_HANDLE
*
1328 FindNextCoreFvHandle (
1329 IN PEI_CORE_INSTANCE
*Private
,
1334 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1338 Memory-based read services.
1340 This function is to perform the Memory Access Read service based on installed
1341 instance of the EFI_PEI_CPU_IO_PPI.
1342 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1343 return EFI_NOT_YET_AVAILABLE.
1345 @param PeiServices An indirect pointer to the PEI Services Table
1346 published by the PEI Foundation.
1347 @param This Pointer to local data for the interface.
1348 @param Width The width of the access. Enumerated in bytes.
1349 @param Address The physical address of the access.
1350 @param Count The number of accesses to perform.
1351 @param Buffer A pointer to the buffer of data.
1353 @retval EFI_SUCCESS The function completed successfully.
1354 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1359 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1360 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1361 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1368 Memory-based write services.
1370 This function is to perform the Memory Access Write service based on installed
1371 instance of the EFI_PEI_CPU_IO_PPI.
1372 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1373 return EFI_NOT_YET_AVAILABLE.
1375 @param PeiServices An indirect pointer to the PEI Services Table
1376 published by the PEI Foundation.
1377 @param This Pointer to local data for the interface.
1378 @param Width The width of the access. Enumerated in bytes.
1379 @param Address The physical address of the access.
1380 @param Count The number of accesses to perform.
1381 @param Buffer A pointer to the buffer of data.
1383 @retval EFI_SUCCESS The function completed successfully.
1384 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1388 PeiDefaultMemWrite (
1389 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1390 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1391 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1398 IO-based read services.
1400 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1401 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1402 return EFI_NOT_YET_AVAILABLE.
1404 @param PeiServices An indirect pointer to the PEI Services Table
1405 published by the PEI Foundation.
1406 @param This Pointer to local data for the interface.
1407 @param Width The width of the access. Enumerated in bytes.
1408 @param Address The physical address of the access.
1409 @param Count The number of accesses to perform.
1410 @param Buffer A pointer to the buffer of data.
1412 @retval EFI_SUCCESS The function completed successfully.
1413 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1418 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1419 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1420 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1427 IO-based write services.
1429 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1430 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1431 return EFI_NOT_YET_AVAILABLE.
1433 @param PeiServices An indirect pointer to the PEI Services Table
1434 published by the PEI Foundation.
1435 @param This Pointer to local data for the interface.
1436 @param Width The width of the access. Enumerated in bytes.
1437 @param Address The physical address of the access.
1438 @param Count The number of accesses to perform.
1439 @param Buffer A pointer to the buffer of data.
1441 @retval EFI_SUCCESS The function completed successfully.
1442 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1447 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1448 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1449 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1456 8-bit I/O read operations.
1458 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1461 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1462 @param This Pointer to local data for the interface.
1463 @param Address The physical address of the access.
1465 @return An 8-bit value returned from the I/O space.
1470 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1471 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1476 Reads an 16-bit I/O port.
1478 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1481 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1482 @param This Pointer to local data for the interface.
1483 @param Address The physical address of the access.
1485 @return A 16-bit value returned from the I/O space.
1489 PeiDefaultIoRead16 (
1490 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1491 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1496 Reads an 32-bit I/O port.
1498 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1501 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1502 @param This Pointer to local data for the interface.
1503 @param Address The physical address of the access.
1505 @return A 32-bit value returned from the I/O space.
1509 PeiDefaultIoRead32 (
1510 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1511 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1516 Reads an 64-bit I/O port.
1518 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1521 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1522 @param This Pointer to local data for the interface.
1523 @param Address The physical address of the access.
1525 @return A 64-bit value returned from the I/O space.
1529 PeiDefaultIoRead64 (
1530 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1531 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1536 8-bit I/O write operations.
1538 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1539 @param This Pointer to local data for the interface.
1540 @param Address The physical address of the access.
1541 @param Data The data to write.
1545 PeiDefaultIoWrite8 (
1546 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1547 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1553 16-bit I/O write operations.
1555 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1556 @param This Pointer to local data for the interface.
1557 @param Address The physical address of the access.
1558 @param Data The data to write.
1562 PeiDefaultIoWrite16 (
1563 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1564 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1570 32-bit I/O write operations.
1572 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1573 @param This Pointer to local data for the interface.
1574 @param Address The physical address of the access.
1575 @param Data The data to write.
1579 PeiDefaultIoWrite32 (
1580 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1581 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1587 64-bit I/O write operations.
1589 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1590 @param This Pointer to local data for the interface.
1591 @param Address The physical address of the access.
1592 @param Data The data to write.
1596 PeiDefaultIoWrite64 (
1597 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1598 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1604 8-bit memory read operations.
1606 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1609 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1610 @param This Pointer to local data for the interface.
1611 @param Address The physical address of the access.
1613 @return An 8-bit value returned from the memory space.
1618 PeiDefaultMemRead8 (
1619 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1620 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1625 16-bit memory read operations.
1627 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1630 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1631 @param This Pointer to local data for the interface.
1632 @param Address The physical address of the access.
1634 @return An 16-bit value returned from the memory space.
1639 PeiDefaultMemRead16 (
1640 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1641 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1646 32-bit memory read operations.
1648 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1651 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1652 @param This Pointer to local data for the interface.
1653 @param Address The physical address of the access.
1655 @return An 32-bit value returned from the memory space.
1660 PeiDefaultMemRead32 (
1661 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1662 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1667 64-bit memory read operations.
1669 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1672 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1673 @param This Pointer to local data for the interface.
1674 @param Address The physical address of the access.
1676 @return An 64-bit value returned from the memory space.
1681 PeiDefaultMemRead64 (
1682 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1683 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1688 8-bit memory write operations.
1690 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1691 @param This Pointer to local data for the interface.
1692 @param Address The physical address of the access.
1693 @param Data The data to write.
1698 PeiDefaultMemWrite8 (
1699 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1700 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1706 16-bit memory write operations.
1708 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1709 @param This Pointer to local data for the interface.
1710 @param Address The physical address of the access.
1711 @param Data The data to write.
1716 PeiDefaultMemWrite16 (
1717 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1718 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1724 32-bit memory write operations.
1726 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1727 @param This Pointer to local data for the interface.
1728 @param Address The physical address of the access.
1729 @param Data The data to write.
1734 PeiDefaultMemWrite32 (
1735 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1736 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1742 64-bit memory write operations.
1744 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1745 @param This Pointer to local data for the interface.
1746 @param Address The physical address of the access.
1747 @param Data The data to write.
1752 PeiDefaultMemWrite64 (
1753 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1754 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1759 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1762 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1766 Reads from a given location in the PCI configuration space.
1768 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1769 return EFI_NOT_YET_AVAILABLE.
1771 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1772 @param This Pointer to local data for the interface.
1773 @param Width The width of the access. Enumerated in bytes.
1774 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1775 @param Address The physical address of the access. The format of
1776 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1777 @param Buffer A pointer to the buffer of data.
1779 @retval EFI_SUCCESS The function completed successfully.
1780 @retval EFI_INVALID_PARAMETER The invalid access width.
1781 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1786 PeiDefaultPciCfg2Read (
1787 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1788 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1789 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1795 Write to a given location in the PCI configuration space.
1797 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1798 return EFI_NOT_YET_AVAILABLE.
1800 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1801 @param This Pointer to local data for the interface.
1802 @param Width The width of the access. Enumerated in bytes.
1803 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1804 @param Address The physical address of the access. The format of
1805 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1806 @param Buffer A pointer to the buffer of data.
1808 @retval EFI_SUCCESS The function completed successfully.
1809 @retval EFI_INVALID_PARAMETER The invalid access width.
1810 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1814 PeiDefaultPciCfg2Write (
1815 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1816 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1817 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1823 This function performs a read-modify-write operation on the contents from a given
1824 location in the PCI configuration space.
1826 @param PeiServices An indirect pointer to the PEI Services Table
1827 published by the PEI Foundation.
1828 @param This Pointer to local data for the interface.
1829 @param Width The width of the access. Enumerated in bytes. Type
1830 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
1831 @param Address The physical address of the access.
1832 @param SetBits Points to value to bitwise-OR with the read configuration value.
1833 The size of the value is determined by Width.
1834 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
1835 The size of the value is determined by Width.
1837 @retval EFI_SUCCESS The function completed successfully.
1838 @retval EFI_INVALID_PARAMETER The invalid access width.
1839 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1843 PeiDefaultPciCfg2Modify (
1844 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1845 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1846 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1852 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
1855 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
1856 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
1857 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
1860 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1864 IN PEI_CORE_INSTANCE
*PrivateData