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_HANDE.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 // Ponter to the buffer with the PeimCount number of Entries.
143 // Ponter 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 offet 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 poped 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-permament 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-permament 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-permament 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-permament 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
1100 system reset. ResetData is only valid if ResetStatus is something
1101 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
1102 where a minimum amount of ResetData is always required.
1108 IN EFI_RESET_TYPE ResetType
,
1109 IN EFI_STATUS ResetStatus
,
1111 IN VOID
*ResetData OPTIONAL
1116 Initialize PeiCore Fv List.
1119 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1120 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1125 IN PEI_CORE_INSTANCE
*PrivateData
,
1126 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1130 Process Firmware Volum Information once FvInfoPPI install.
1132 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1133 @param NotifyDescriptor Address of the notification descriptor data structure.
1134 @param Ppi Address of the PPI that was installed.
1136 @retval EFI_SUCCESS if the interface could be successfully installed
1141 FirmwareVolmeInfoPpiNotifyCallback (
1142 IN EFI_PEI_SERVICES
**PeiServices
,
1143 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1149 Given the input VolumeHandle, search for the next matching name file.
1151 @param FileName File name to search.
1152 @param VolumeHandle The current FV to search.
1153 @param FileHandle Pointer to the file matching name in VolumeHandle.
1154 NULL if file not found
1156 @retval EFI_NOT_FOUND No files matching the search criteria were found
1157 @retval EFI_SUCCESS Success to search given file
1162 PeiFfsFindFileByName (
1163 IN CONST EFI_GUID
*FileName
,
1164 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1165 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1169 Returns information about a specific file.
1171 @param FileHandle Handle of the file.
1172 @param FileInfo Upon exit, points to the file's information.
1174 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1175 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1176 @retval EFI_SUCCESS File information returned.
1182 IN EFI_PEI_FILE_HANDLE FileHandle
,
1183 OUT EFI_FV_FILE_INFO
*FileInfo
1187 Returns information about a specific file.
1189 @param FileHandle Handle of the file.
1190 @param FileInfo Upon exit, points to the file's information.
1192 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1193 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1194 @retval EFI_SUCCESS File information returned.
1199 PeiFfsGetFileInfo2 (
1200 IN EFI_PEI_FILE_HANDLE FileHandle
,
1201 OUT EFI_FV_FILE_INFO2
*FileInfo
1205 Returns information about the specified volume.
1207 @param VolumeHandle Handle of the volume.
1208 @param VolumeInfo Upon exit, points to the volume's information.
1210 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1211 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1212 @retval EFI_SUCCESS Volume information returned.
1216 PeiFfsGetVolumeInfo (
1217 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1218 OUT EFI_FV_INFO
*VolumeInfo
1222 This routine enable a PEIM to register itself to shadow when PEI Foundation
1223 discovery permanent memory.
1225 @param FileHandle File handle of a PEIM.
1227 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1228 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1229 @retval EFI_SUCCESS Successfully to register itself.
1234 PeiRegisterForShadow (
1235 IN EFI_PEI_FILE_HANDLE FileHandle
1239 Initialize image service that install PeiLoadFilePpi.
1241 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1242 @param OldCoreData Pointer to Old PeiCore's private data.
1243 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1244 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1245 to permanent memory.
1249 InitializeImageServices (
1250 IN PEI_CORE_INSTANCE
*PrivateData
,
1251 IN PEI_CORE_INSTANCE
*OldCoreData
1255 The wrapper function of PeiLoadImageLoadImage().
1257 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1258 @param FileHandle Pointer to the FFS file header of the image.
1259 @param ImageAddressArg Pointer to PE/TE image.
1260 @param ImageSizeArg Size of PE/TE image.
1261 @param EntryPoint Pointer to entry point of specified image file for output.
1262 @param AuthenticationState Pointer to attestation authentication state of image.
1264 @return Status of PeiLoadImageLoadImage().
1269 PeiLoadImageLoadImageWrapper (
1270 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1271 IN EFI_PEI_FILE_HANDLE FileHandle
,
1272 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1273 OUT UINT64
*ImageSizeArg
, OPTIONAL
1274 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1275 OUT UINT32
*AuthenticationState
1280 Provide a callback for when the security PPI is installed.
1282 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1283 @param NotifyDescriptor The descriptor for the notification event.
1284 @param Ppi Pointer to the PPI in question.
1286 @return Always success
1291 SecurityPpiNotifyCallback (
1292 IN EFI_PEI_SERVICES
**PeiServices
,
1293 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1298 Get Fv image(s) from the FV type file, then install FV INFO(2) ppi, Build FV(2, 3) hob.
1300 @param PrivateData PeiCore's private data structure
1301 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
1302 @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
1304 @retval EFI_NOT_FOUND FV image can't be found.
1305 @retval EFI_SUCCESS Successfully to process it.
1306 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1307 @retval EFI_SECURITY_VIOLATION Image is illegal
1308 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1313 IN PEI_CORE_INSTANCE
*PrivateData
,
1314 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1315 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1319 Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
1321 This routine also will install FvInfo ppi for FV hob in PI ways.
1323 @param Private Pointer of PEI_CORE_INSTANCE
1324 @param Instance The index of FV want to be searched.
1326 @return Instance of PEI_CORE_FV_HANDLE.
1328 PEI_CORE_FV_HANDLE
*
1329 FindNextCoreFvHandle (
1330 IN PEI_CORE_INSTANCE
*Private
,
1335 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1339 Memory-based read services.
1341 This function is to perform the Memory Access Read service based on installed
1342 instance of the EFI_PEI_CPU_IO_PPI.
1343 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1344 return EFI_NOT_YET_AVAILABLE.
1346 @param PeiServices An indirect pointer to the PEI Services Table
1347 published by the PEI Foundation.
1348 @param This Pointer to local data for the interface.
1349 @param Width The width of the access. Enumerated in bytes.
1350 @param Address The physical address of the access.
1351 @param Count The number of accesses to perform.
1352 @param Buffer A pointer to the buffer of data.
1354 @retval EFI_SUCCESS The function completed successfully.
1355 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1360 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1361 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1362 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1369 Memory-based write services.
1371 This function is to perform the Memory Access Write service based on installed
1372 instance of the EFI_PEI_CPU_IO_PPI.
1373 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1374 return EFI_NOT_YET_AVAILABLE.
1376 @param PeiServices An indirect pointer to the PEI Services Table
1377 published by the PEI Foundation.
1378 @param This Pointer to local data for the interface.
1379 @param Width The width of the access. Enumerated in bytes.
1380 @param Address The physical address of the access.
1381 @param Count The number of accesses to perform.
1382 @param Buffer A pointer to the buffer of data.
1384 @retval EFI_SUCCESS The function completed successfully.
1385 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1389 PeiDefaultMemWrite (
1390 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1391 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1392 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1399 IO-based read services.
1401 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1402 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1403 return EFI_NOT_YET_AVAILABLE.
1405 @param PeiServices An indirect pointer to the PEI Services Table
1406 published by the PEI Foundation.
1407 @param This Pointer to local data for the interface.
1408 @param Width The width of the access. Enumerated in bytes.
1409 @param Address The physical address of the access.
1410 @param Count The number of accesses to perform.
1411 @param Buffer A pointer to the buffer of data.
1413 @retval EFI_SUCCESS The function completed successfully.
1414 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1419 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1420 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1421 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1428 IO-based write services.
1430 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1431 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1432 return EFI_NOT_YET_AVAILABLE.
1434 @param PeiServices An indirect pointer to the PEI Services Table
1435 published by the PEI Foundation.
1436 @param This Pointer to local data for the interface.
1437 @param Width The width of the access. Enumerated in bytes.
1438 @param Address The physical address of the access.
1439 @param Count The number of accesses to perform.
1440 @param Buffer A pointer to the buffer of data.
1442 @retval EFI_SUCCESS The function completed successfully.
1443 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1448 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1449 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1450 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1457 8-bit I/O read operations.
1459 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1462 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1463 @param This Pointer to local data for the interface.
1464 @param Address The physical address of the access.
1466 @return An 8-bit value returned from the I/O space.
1471 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1472 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1477 Reads an 16-bit I/O port.
1479 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1482 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1483 @param This Pointer to local data for the interface.
1484 @param Address The physical address of the access.
1486 @return A 16-bit value returned from the I/O space.
1490 PeiDefaultIoRead16 (
1491 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1492 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1497 Reads an 32-bit I/O port.
1499 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1502 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1503 @param This Pointer to local data for the interface.
1504 @param Address The physical address of the access.
1506 @return A 32-bit value returned from the I/O space.
1510 PeiDefaultIoRead32 (
1511 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1512 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1517 Reads an 64-bit I/O port.
1519 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1522 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1523 @param This Pointer to local data for the interface.
1524 @param Address The physical address of the access.
1526 @return A 64-bit value returned from the I/O space.
1530 PeiDefaultIoRead64 (
1531 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1532 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1537 8-bit I/O write operations.
1539 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1540 @param This Pointer to local data for the interface.
1541 @param Address The physical address of the access.
1542 @param Data The data to write.
1546 PeiDefaultIoWrite8 (
1547 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1548 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1554 16-bit I/O write operations.
1556 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1557 @param This Pointer to local data for the interface.
1558 @param Address The physical address of the access.
1559 @param Data The data to write.
1563 PeiDefaultIoWrite16 (
1564 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1565 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1571 32-bit I/O write operations.
1573 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1574 @param This Pointer to local data for the interface.
1575 @param Address The physical address of the access.
1576 @param Data The data to write.
1580 PeiDefaultIoWrite32 (
1581 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1582 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1588 64-bit I/O write operations.
1590 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1591 @param This Pointer to local data for the interface.
1592 @param Address The physical address of the access.
1593 @param Data The data to write.
1597 PeiDefaultIoWrite64 (
1598 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1599 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1605 8-bit memory read operations.
1607 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1610 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1611 @param This Pointer to local data for the interface.
1612 @param Address The physical address of the access.
1614 @return An 8-bit value returned from the memory space.
1619 PeiDefaultMemRead8 (
1620 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1621 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1626 16-bit memory read operations.
1628 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1631 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1632 @param This Pointer to local data for the interface.
1633 @param Address The physical address of the access.
1635 @return An 16-bit value returned from the memory space.
1640 PeiDefaultMemRead16 (
1641 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1642 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1647 32-bit memory read operations.
1649 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1652 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1653 @param This Pointer to local data for the interface.
1654 @param Address The physical address of the access.
1656 @return An 32-bit value returned from the memory space.
1661 PeiDefaultMemRead32 (
1662 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1663 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1668 64-bit memory read operations.
1670 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1673 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1674 @param This Pointer to local data for the interface.
1675 @param Address The physical address of the access.
1677 @return An 64-bit value returned from the memory space.
1682 PeiDefaultMemRead64 (
1683 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1684 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1689 8-bit memory write operations.
1691 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1692 @param This Pointer to local data for the interface.
1693 @param Address The physical address of the access.
1694 @param Data The data to write.
1699 PeiDefaultMemWrite8 (
1700 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1701 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1707 16-bit memory write operations.
1709 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1710 @param This Pointer to local data for the interface.
1711 @param Address The physical address of the access.
1712 @param Data The data to write.
1717 PeiDefaultMemWrite16 (
1718 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1719 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1725 32-bit memory write operations.
1727 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1728 @param This Pointer to local data for the interface.
1729 @param Address The physical address of the access.
1730 @param Data The data to write.
1735 PeiDefaultMemWrite32 (
1736 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1737 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1743 64-bit memory write operations.
1745 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1746 @param This Pointer to local data for the interface.
1747 @param Address The physical address of the access.
1748 @param Data The data to write.
1753 PeiDefaultMemWrite64 (
1754 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1755 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1760 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1763 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1767 Reads from a given location in the PCI configuration space.
1769 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1770 return EFI_NOT_YET_AVAILABLE.
1772 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1773 @param This Pointer to local data for the interface.
1774 @param Width The width of the access. Enumerated in bytes.
1775 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1776 @param Address The physical address of the access. The format of
1777 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1778 @param Buffer A pointer to the buffer of data.
1780 @retval EFI_SUCCESS The function completed successfully.
1781 @retval EFI_INVALID_PARAMETER The invalid access width.
1782 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1787 PeiDefaultPciCfg2Read (
1788 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1789 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1790 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1796 Write to a given location in the PCI configuration space.
1798 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1799 return EFI_NOT_YET_AVAILABLE.
1801 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1802 @param This Pointer to local data for the interface.
1803 @param Width The width of the access. Enumerated in bytes.
1804 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1805 @param Address The physical address of the access. The format of
1806 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1807 @param Buffer A pointer to the buffer of data.
1809 @retval EFI_SUCCESS The function completed successfully.
1810 @retval EFI_INVALID_PARAMETER The invalid access width.
1811 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1815 PeiDefaultPciCfg2Write (
1816 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1817 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1818 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1824 This function performs a read-modify-write operation on the contents from a given
1825 location in the PCI configuration space.
1827 @param PeiServices An indirect pointer to the PEI Services Table
1828 published by the PEI Foundation.
1829 @param This Pointer to local data for the interface.
1830 @param Width The width of the access. Enumerated in bytes. Type
1831 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
1832 @param Address The physical address of the access.
1833 @param SetBits Points to value to bitwise-OR with the read configuration value.
1834 The size of the value is determined by Width.
1835 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
1836 The size of the value is determined by Width.
1838 @retval EFI_SUCCESS The function completed successfully.
1839 @retval EFI_INVALID_PARAMETER The invalid access width.
1840 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1844 PeiDefaultPciCfg2Modify (
1845 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1846 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1847 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1853 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
1856 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
1857 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
1858 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
1861 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1865 IN PEI_CORE_INSTANCE
*PrivateData