2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <Ppi/DxeIpl.h>
20 #include <Ppi/MemoryDiscovered.h>
21 #include <Ppi/StatusCode.h>
22 #include <Ppi/Reset.h>
23 #include <Ppi/Reset2.h>
24 #include <Ppi/FirmwareVolume.h>
25 #include <Ppi/FirmwareVolumeInfo.h>
26 #include <Ppi/FirmwareVolumeInfo2.h>
27 #include <Ppi/Decompress.h>
28 #include <Ppi/GuidedSectionExtraction.h>
29 #include <Ppi/LoadFile.h>
30 #include <Ppi/Security2.h>
31 #include <Ppi/TemporaryRamSupport.h>
32 #include <Ppi/TemporaryRamDone.h>
33 #include <Ppi/SecHobData.h>
34 #include <Library/DebugLib.h>
35 #include <Library/PeiCoreEntryPoint.h>
36 #include <Library/BaseLib.h>
37 #include <Library/HobLib.h>
38 #include <Library/PerformanceLib.h>
39 #include <Library/PeiServicesLib.h>
40 #include <Library/ReportStatusCodeLib.h>
41 #include <Library/PeCoffLib.h>
42 #include <Library/PeCoffGetEntryPointLib.h>
43 #include <Library/BaseMemoryLib.h>
44 #include <Library/CacheMaintenanceLib.h>
45 #include <Library/PcdLib.h>
46 #include <IndustryStandard/PeImage.h>
47 #include <Library/PeiServicesTablePointerLib.h>
48 #include <Library/MemoryAllocationLib.h>
49 #include <Guid/FirmwareFileSystem2.h>
50 #include <Guid/FirmwareFileSystem3.h>
51 #include <Guid/AprioriFileName.h>
54 /// It is an FFS type extension used for PeiFindFileEx. It indicates current
55 /// Ffs searching is for all PEIMs can be dispatched by PeiCore.
57 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
60 /// Pei Core private data structures
63 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
64 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
66 } PEI_PPI_LIST_POINTERS
;
69 /// PPI database structure which contains two link: PpiList and NotifyList. PpiList
70 /// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.
74 /// index of end of PpiList link list.
78 /// index of end of notify link list.
82 /// index of the dispatched notify list.
86 /// index of last installed Ppi description in PpiList link list.
88 INTN LastDispatchedInstall
;
90 /// index of last dispatched notify in Notify link list.
92 INTN LastDispatchedNotify
;
94 /// Ppi database has the PcdPeiCoreMaxPpiSupported number of entries.
96 PEI_PPI_LIST_POINTERS
*PpiListPtrs
;
101 // PEI_CORE_FV_HANDE.PeimState
102 // Do not change these values as there is code doing math to change states.
103 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
105 #define PEIM_STATE_NOT_DISPATCHED 0x00
106 #define PEIM_STATE_DISPATCHED 0x01
107 #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02
108 #define PEIM_STATE_DONE 0x03
111 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
112 EFI_PEI_FIRMWARE_VOLUME_PPI
*FvPpi
;
113 EFI_PEI_FV_HANDLE FvHandle
;
115 // Ponter to the buffer with the PcdPeiCoreMaxPeimPerFv number of Entries.
119 // Ponter to the buffer with the PcdPeiCoreMaxPeimPerFv number of Entries.
121 EFI_PEI_FILE_HANDLE
*FvFileHandles
;
123 UINT32 AuthenticationStatus
;
124 } PEI_CORE_FV_HANDLE
;
130 UINT32 AuthenticationStatus
;
131 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor
;
132 } PEI_CORE_UNKNOW_FORMAT_FV_INFO
;
134 #define CACHE_SETION_MAX_NUMBER 0x10
136 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
137 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
138 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
139 UINT32 AuthenticationStatus
[CACHE_SETION_MAX_NUMBER
];
140 UINTN AllSectionCount
;
142 } CACHE_SECTION_DATA
;
144 #define HOLE_MAX_NUMBER 0x3
146 EFI_PHYSICAL_ADDRESS Base
;
149 BOOLEAN OffsetPositive
;
153 /// Forward declaration for PEI_CORE_INSTANCE
155 typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE
;
159 Function Pointer type for PeiCore function.
160 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
161 and location of temporary RAM, the stack location and the BFV location.
162 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
163 An empty PPI list consists of a single descriptor with the end-tag
164 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
165 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
166 that both the PEI Foundation and any modules can leverage the associated service
167 calls and/or code in these early PPIs
168 @param OldCoreData Pointer to old core data that is used to initialize the
173 (EFIAPI
*PEICORE_FUNCTION_POINTER
)(
174 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
175 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
176 IN PEI_CORE_INSTANCE
*OldCoreData
179 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
182 /// Pei Core private data structure instance
184 struct _PEI_CORE_INSTANCE
{
188 /// Point to ServiceTableShadow
190 EFI_PEI_SERVICES
*Ps
;
191 PEI_PPI_DATABASE PpiData
;
194 /// The count of FVs which contains FFS and could be dispatched by PeiCore.
199 /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.
200 /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.
202 PEI_CORE_FV_HANDLE
*Fv
;
205 /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.
206 /// Each entry is for one FV which could not be dispatched by PeiCore.
208 PEI_CORE_UNKNOW_FORMAT_FV_INFO
*UnknownFvInfo
;
209 UINTN UnknownFvInfoCount
;
212 /// Pointer to the buffer with the PcdPeiCoreMaxPeimPerFv number of entries.
214 EFI_PEI_FILE_HANDLE
*CurrentFvFileHandles
;
216 UINTN CurrentPeimFvCount
;
217 UINTN CurrentPeimCount
;
218 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
219 BOOLEAN PeimNeedingDispatch
;
220 BOOLEAN PeimDispatchOnThisPass
;
221 BOOLEAN PeimDispatcherReenter
;
222 EFI_PEI_HOB_POINTERS HobList
;
223 BOOLEAN SwitchStackSignal
;
224 BOOLEAN PeiMemoryInstalled
;
226 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
227 EFI_PEI_SERVICES ServiceTableShadow
;
228 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
229 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
230 UINT64 PhysicalMemoryLength
;
231 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
233 BOOLEAN HeapOffsetPositive
;
235 BOOLEAN StackOffsetPositive
;
236 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
237 CACHE_SECTION_DATA CacheSection
;
239 // For Loading modules at fixed address feature to cache the top address below which the
240 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
241 // and Ps should not be changed since maybe user could get this top address by using the offet to Ps.
243 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
245 // The field is define for Loading modules at fixed address feature to tracker the PEI code
246 // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page
249 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
251 // This field points to the shadowed image read function
253 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
256 // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv + 1 number of entries.
258 EFI_PEI_FILE_HANDLE
*FileHandles
;
260 // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv number of entries.
265 // Temp Memory Range is not covered by PeiTempMem and Stack.
266 // Those Memory Range will be migrated into phisical memory.
268 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
272 /// Pei Core Instance Data Macros
274 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
275 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
278 /// Union of temporarily used function pointers (to save stack space)
281 PEICORE_FUNCTION_POINTER PeiCore
;
282 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
283 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
284 EFI_DXE_IPL_PPI
*DxeIpl
;
285 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
286 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
288 } PEI_CORE_TEMP_POINTERS
;
291 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
292 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
294 } PEI_CORE_PARAMETERS
;
301 The entry routine to Pei Core, invoked by PeiMain during transition
302 from SEC to PEI. After switching stack in the PEI core, it will restart
303 with the old core data.
306 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
307 and location of temporary RAM, the stack location and the BFV location.
308 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
309 An empty PPI list consists of a single descriptor with the end-tag
310 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
311 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
312 that both the PEI Foundation and any modules can leverage the associated service
313 calls and/or code in these early PPIs
314 @param Data Pointer to old core data that is used to initialize the
321 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
322 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
327 // Dispatcher support functions
332 This is the POSTFIX version of the dependency evaluator. When a
333 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
334 the evaluation stack. When that entry is poped from the evaluation
335 stack, the PPI is checked if it is installed. This method allows
336 some time savings as not all PPIs must be checked for certain
337 operation types (AND, OR).
340 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
341 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
342 the BNF described above and is stored in postfix notation.
344 @retval TRUE if it is a well-formed Grammar
345 @retval FALSE if the dependency expression overflows the evaluation stack
346 if the dependency expression underflows the evaluation stack
347 if the dependency expression is not a well-formed Grammar.
351 PeimDispatchReadiness (
352 IN EFI_PEI_SERVICES
**PeiServices
,
353 IN VOID
*DependencyExpression
357 Conduct PEIM dispatch.
359 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
360 @param PrivateData Pointer to the private data passed in from caller
365 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
366 IN PEI_CORE_INSTANCE
*PrivateData
370 Initialize the Dispatcher's data members
372 @param PrivateData PeiCore's private data structure
373 @param OldCoreData Old data from SecCore
374 NULL if being run in non-permament memory mode.
375 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
376 and location of temporary RAM, the stack location and the BFV location.
380 InitializeDispatcherData (
381 IN PEI_CORE_INSTANCE
*PrivateData
,
382 IN PEI_CORE_INSTANCE
*OldCoreData
,
383 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
387 This routine parses the Dependency Expression, if available, and
388 decides if the module can be executed.
391 @param Private PeiCore's private data structure
392 @param FileHandle PEIM's file handle
393 @param PeimCount The index of last dispatched PEIM.
395 @retval TRUE Can be dispatched
396 @retval FALSE Cannot be dispatched
401 IN PEI_CORE_INSTANCE
*Private
,
402 IN EFI_PEI_FILE_HANDLE FileHandle
,
407 // PPI support functions
411 Initialize PPI services.
413 @param PrivateData Pointer to the PEI Core data.
414 @param OldCoreData Pointer to old PEI Core data.
415 NULL if being run in non-permament memory mode.
419 InitializePpiServices (
420 IN PEI_CORE_INSTANCE
*PrivateData
,
421 IN PEI_CORE_INSTANCE
*OldCoreData
426 Migrate the Hob list from the temporary memory stack to PEI installed memory.
428 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
429 and location of temporary RAM, the stack location and the BFV location.
430 @param PrivateData Pointer to PeiCore's private data structure.
435 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
436 IN PEI_CORE_INSTANCE
*PrivateData
441 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
443 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
444 @param PpiList Pointer to ppi array that want to be installed.
446 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
447 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
448 if any PPI in PpiList is not valid
449 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
455 IN CONST EFI_PEI_SERVICES
**PeiServices
,
456 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
461 Re-Install PPI services.
463 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
464 @param OldPpi Pointer to the old PEI PPI Descriptors.
465 @param NewPpi Pointer to the new PEI PPI Descriptors.
467 @retval EFI_SUCCESS if the operation was successful
468 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
469 if NewPpi is not valid
470 @retval EFI_NOT_FOUND if the PPI was not in the database
476 IN CONST EFI_PEI_SERVICES
**PeiServices
,
477 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
478 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
483 Locate a given named PPI.
486 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
487 @param Guid Pointer to GUID of the PPI.
488 @param Instance Instance Number to discover.
489 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
490 returns a pointer to the descriptor (includes flags, etc)
491 @param Ppi Pointer to reference the found PPI
493 @retval EFI_SUCCESS if the PPI is in the database
494 @retval EFI_NOT_FOUND if the PPI is not in the database
500 IN CONST EFI_PEI_SERVICES
**PeiServices
,
501 IN CONST EFI_GUID
*Guid
,
503 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
509 Install a notification for a given PPI.
512 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
513 @param NotifyList Pointer to list of Descriptors to notify upon.
515 @retval EFI_SUCCESS if successful
516 @retval EFI_OUT_OF_RESOURCES if no space in the database
517 @retval EFI_INVALID_PARAMETER if not a good decriptor
523 IN CONST EFI_PEI_SERVICES
**PeiServices
,
524 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
529 Process the Notify List at dispatch level.
531 @param PrivateData PeiCore's private data structure.
536 IN PEI_CORE_INSTANCE
*PrivateData
541 Dispatch notifications.
543 @param PrivateData PeiCore's private data structure
544 @param NotifyType Type of notify to fire.
545 @param InstallStartIndex Install Beginning index.
546 @param InstallStopIndex Install Ending index.
547 @param NotifyStartIndex Notify Beginning index.
548 @param NotifyStopIndex Notify Ending index.
553 IN PEI_CORE_INSTANCE
*PrivateData
,
555 IN INTN InstallStartIndex
,
556 IN INTN InstallStopIndex
,
557 IN INTN NotifyStartIndex
,
558 IN INTN NotifyStopIndex
562 Process PpiList from SEC phase.
564 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
565 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
566 These PPI's will be installed and/or immediately signaled if they are notification type.
570 ProcessPpiListFromSec (
571 IN CONST EFI_PEI_SERVICES
**PeiServices
,
572 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
576 // Boot mode support functions
579 This service enables PEIMs to ascertain the present value of the boot mode.
581 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
582 @param BootMode A pointer to contain the value of the boot mode.
584 @retval EFI_SUCCESS The boot mode was returned successfully.
585 @retval EFI_INVALID_PARAMETER BootMode is NULL.
591 IN CONST EFI_PEI_SERVICES
**PeiServices
,
592 IN OUT EFI_BOOT_MODE
*BootMode
596 This service enables PEIMs to update the boot mode variable.
599 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
600 @param BootMode The value of the boot mode to set.
602 @return EFI_SUCCESS The value was successfully updated
608 IN CONST EFI_PEI_SERVICES
**PeiServices
,
609 IN EFI_BOOT_MODE BootMode
613 // Security support functions
617 Initialize the security services.
619 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
620 @param OldCoreData Pointer to the old core data.
621 NULL if being run in non-permament memory mode.
625 InitializeSecurityServices (
626 IN EFI_PEI_SERVICES
**PeiServices
,
627 IN PEI_CORE_INSTANCE
*OldCoreData
631 Verify a Firmware volume.
633 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
635 @retval EFI_SUCCESS Firmware Volume is legal
636 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
641 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
645 Provide a callout to the security verification service.
647 @param PrivateData PeiCore's private data structure
648 @param VolumeHandle Handle of FV
649 @param FileHandle Handle of PEIM's ffs
650 @param AuthenticationStatus Authentication status
652 @retval EFI_SUCCESS Image is OK
653 @retval EFI_SECURITY_VIOLATION Image is illegal
654 @retval EFI_NOT_FOUND If security PPI is not installed.
658 IN PEI_CORE_INSTANCE
*PrivateData
,
659 IN EFI_PEI_FV_HANDLE VolumeHandle
,
660 IN EFI_PEI_FILE_HANDLE FileHandle
,
661 IN UINT32 AuthenticationStatus
666 Gets the pointer to the HOB List.
669 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
670 @param HobList Pointer to the HOB List.
672 @retval EFI_SUCCESS Get the pointer of HOB List
673 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
674 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
680 IN CONST EFI_PEI_SERVICES
**PeiServices
,
681 IN OUT VOID
**HobList
685 Add a new HOB to the HOB List.
687 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
688 @param Type Type of the new HOB.
689 @param Length Length of the new HOB to allocate.
690 @param Hob Pointer to the new HOB.
692 @return EFI_SUCCESS Success to create hob.
693 @retval EFI_INVALID_PARAMETER if Hob is NULL
694 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
695 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
701 IN CONST EFI_PEI_SERVICES
**PeiServices
,
709 Builds a Handoff Information Table HOB
711 @param BootMode - Current Bootmode
712 @param MemoryBegin - Start Memory Address.
713 @param MemoryLength - Length of Memory.
715 @return EFI_SUCCESS Always success to initialize HOB.
719 PeiCoreBuildHobHandoffInfoTable (
720 IN EFI_BOOT_MODE BootMode
,
721 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
722 IN UINT64 MemoryLength
726 Install SEC HOB data to the HOB List.
728 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
729 @param SecHobList Pointer to SEC HOB List.
731 @return EFI_SUCCESS Success to install SEC HOB data.
732 @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.
736 PeiInstallSecHobData (
737 IN CONST EFI_PEI_SERVICES
**PeiServices
,
738 IN EFI_HOB_GENERIC_HEADER
*SecHobList
743 // FFS Fw Volume support functions
746 Searches for the next matching file in the firmware volume.
748 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
749 @param SearchType Filter to find only files of this type.
750 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
751 @param FvHandle Handle of firmware volume in which to search.
752 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
753 at the beginning of the firmware volume. On exit, points the file handle of the next file
754 in the volume or NULL if there are no more files.
756 @retval EFI_NOT_FOUND The file was not found.
757 @retval EFI_NOT_FOUND The header checksum was not zero.
758 @retval EFI_SUCCESS The file was found.
764 IN CONST EFI_PEI_SERVICES
**PeiServices
,
766 IN EFI_PEI_FV_HANDLE FvHandle
,
767 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
771 Searches for the next matching section within the specified file.
773 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
774 @param SectionType Filter to find only sections of this type.
775 @param FileHandle Pointer to the current file to search.
776 @param SectionData A pointer to the discovered section, if successful.
777 NULL if section not found
779 @retval EFI_NOT_FOUND The section was not found.
780 @retval EFI_SUCCESS The section was found.
785 PeiFfsFindSectionData (
786 IN CONST EFI_PEI_SERVICES
**PeiServices
,
787 IN EFI_SECTION_TYPE SectionType
,
788 IN EFI_PEI_FILE_HANDLE FileHandle
,
789 OUT VOID
**SectionData
793 Searches for the next matching section within the specified file.
795 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
796 @param SectionType The value of the section type to find.
797 @param SectionInstance Section instance to find.
798 @param FileHandle Handle of the firmware file to search.
799 @param SectionData A pointer to the discovered section, if successful.
800 @param AuthenticationStatus A pointer to the authentication status for this section.
802 @retval EFI_SUCCESS The section was found.
803 @retval EFI_NOT_FOUND The section was not found.
808 PeiFfsFindSectionData3 (
809 IN CONST EFI_PEI_SERVICES
**PeiServices
,
810 IN EFI_SECTION_TYPE SectionType
,
811 IN UINTN SectionInstance
,
812 IN EFI_PEI_FILE_HANDLE FileHandle
,
813 OUT VOID
**SectionData
,
814 OUT UINT32
*AuthenticationStatus
818 Search the firmware volumes by index
820 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
821 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
823 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
825 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
826 @retval EFI_NOT_FOUND The volume was not found.
827 @retval EFI_SUCCESS The volume was found.
832 PeiFfsFindNextVolume (
833 IN CONST EFI_PEI_SERVICES
**PeiServices
,
835 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
839 // Memory support functions
843 Initialize the memory services.
845 @param PrivateData PeiCore's private data structure
846 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
847 and location of temporary RAM, the stack location and the BFV location.
848 @param OldCoreData Pointer to the PEI Core data.
849 NULL if being run in non-permament memory mode.
853 InitializeMemoryServices (
854 IN PEI_CORE_INSTANCE
*PrivateData
,
855 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
856 IN PEI_CORE_INSTANCE
*OldCoreData
861 Install the permanent memory is now available.
862 Creates HOB (PHIT and Stack).
864 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
865 @param MemoryBegin Start of memory address.
866 @param MemoryLength Length of memory.
868 @return EFI_SUCCESS Always success.
873 PeiInstallPeiMemory (
874 IN CONST EFI_PEI_SERVICES
**PeiServices
,
875 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
876 IN UINT64 MemoryLength
881 Memory allocation service on permanent memory,
882 not usable prior to the memory installation.
885 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
886 @param MemoryType Type of memory to allocate.
887 @param Pages Number of pages to allocate.
888 @param Memory Pointer of memory allocated.
890 @retval EFI_SUCCESS The allocation was successful
891 @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
892 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available
893 @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
894 to allocate the number of pages.
900 IN CONST EFI_PEI_SERVICES
**PeiServices
,
901 IN EFI_MEMORY_TYPE MemoryType
,
903 OUT EFI_PHYSICAL_ADDRESS
*Memory
908 Memory allocation service on the temporary memory.
911 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
912 @param Size Amount of memory required
913 @param Buffer Address of pointer to the buffer
915 @retval EFI_SUCCESS The allocation was successful
916 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
917 to allocate the requested size.
923 IN CONST EFI_PEI_SERVICES
**PeiServices
,
930 Routine for load image file.
933 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
934 @param FileHandle Pointer to the FFS file header of the image.
935 @param PeimState The dispatch state of the input PEIM handle.
936 @param EntryPoint Pointer to entry point of specified image file for output.
937 @param AuthenticationState Pointer to attestation authentication state of image.
939 @retval EFI_SUCCESS Image is successfully loaded.
940 @retval EFI_NOT_FOUND Fail to locate necessary PPI
941 @retval Others Fail to load file.
946 IN CONST EFI_PEI_SERVICES
**PeiServices
,
947 IN EFI_PEI_FILE_HANDLE FileHandle
,
949 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
950 OUT UINT32
*AuthenticationState
955 Core version of the Status Code reporter
958 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
959 @param CodeType Type of Status Code.
960 @param Value Value to output for Status Code.
961 @param Instance Instance Number of this status code.
962 @param CallerId ID of the caller of this status code.
963 @param Data Optional data associated with this status code.
965 @retval EFI_SUCCESS if status code is successfully reported
966 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
971 PeiReportStatusCode (
972 IN CONST EFI_PEI_SERVICES
**PeiServices
,
973 IN EFI_STATUS_CODE_TYPE CodeType
,
974 IN EFI_STATUS_CODE_VALUE Value
,
976 IN CONST EFI_GUID
*CallerId
,
977 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
982 Core version of the Reset System
985 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
987 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
988 @retval EFI_DEVICE_ERROR Did not reset system.
989 Otherwise, resets the system.
995 IN CONST EFI_PEI_SERVICES
**PeiServices
999 Resets the entire platform.
1001 @param[in] ResetType The type of reset to perform.
1002 @param[in] ResetStatus The status code for the reset.
1003 @param[in] DataSize The size, in bytes, of ResetData.
1004 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
1005 the data buffer starts with a Null-terminated string, optionally
1006 followed by additional binary data. The string is a description
1007 that the caller may use to further indicate the reason for the
1008 system reset. ResetData is only valid if ResetStatus is something
1009 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
1010 where a minimum amount of ResetData is always required.
1016 IN EFI_RESET_TYPE ResetType
,
1017 IN EFI_STATUS ResetStatus
,
1019 IN VOID
*ResetData OPTIONAL
1024 Initialize PeiCore Fv List.
1027 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1028 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1033 IN PEI_CORE_INSTANCE
*PrivateData
,
1034 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1038 Process Firmware Volum Information once FvInfoPPI install.
1040 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1041 @param NotifyDescriptor Address of the notification descriptor data structure.
1042 @param Ppi Address of the PPI that was installed.
1044 @retval EFI_SUCCESS if the interface could be successfully installed
1049 FirmwareVolmeInfoPpiNotifyCallback (
1050 IN EFI_PEI_SERVICES
**PeiServices
,
1051 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1057 Given the input VolumeHandle, search for the next matching name file.
1059 @param FileName File name to search.
1060 @param VolumeHandle The current FV to search.
1061 @param FileHandle Pointer to the file matching name in VolumeHandle.
1062 NULL if file not found
1064 @retval EFI_NOT_FOUND No files matching the search criteria were found
1065 @retval EFI_SUCCESS Success to search given file
1070 PeiFfsFindFileByName (
1071 IN CONST EFI_GUID
*FileName
,
1072 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1073 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1077 Returns information about a specific file.
1079 @param FileHandle Handle of the file.
1080 @param FileInfo Upon exit, points to the file's information.
1082 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1083 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1084 @retval EFI_SUCCESS File information returned.
1090 IN EFI_PEI_FILE_HANDLE FileHandle
,
1091 OUT EFI_FV_FILE_INFO
*FileInfo
1095 Returns information about a specific file.
1097 @param FileHandle Handle of the file.
1098 @param FileInfo Upon exit, points to the file's information.
1100 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1101 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1102 @retval EFI_SUCCESS File information returned.
1107 PeiFfsGetFileInfo2 (
1108 IN EFI_PEI_FILE_HANDLE FileHandle
,
1109 OUT EFI_FV_FILE_INFO2
*FileInfo
1113 Returns information about the specified volume.
1115 @param VolumeHandle Handle of the volume.
1116 @param VolumeInfo Upon exit, points to the volume's information.
1118 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1119 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1120 @retval EFI_SUCCESS Volume information returned.
1124 PeiFfsGetVolumeInfo (
1125 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1126 OUT EFI_FV_INFO
*VolumeInfo
1130 This routine enable a PEIM to register itself to shadow when PEI Foundation
1131 discovery permanent memory.
1133 @param FileHandle File handle of a PEIM.
1135 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1136 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1137 @retval EFI_SUCCESS Successfully to register itself.
1142 PeiRegisterForShadow (
1143 IN EFI_PEI_FILE_HANDLE FileHandle
1147 Initialize image service that install PeiLoadFilePpi.
1149 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1150 @param OldCoreData Pointer to Old PeiCore's private data.
1151 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1152 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1153 to permanent memory.
1157 InitializeImageServices (
1158 IN PEI_CORE_INSTANCE
*PrivateData
,
1159 IN PEI_CORE_INSTANCE
*OldCoreData
1163 The wrapper function of PeiLoadImageLoadImage().
1165 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1166 @param FileHandle Pointer to the FFS file header of the image.
1167 @param ImageAddressArg Pointer to PE/TE image.
1168 @param ImageSizeArg Size of PE/TE image.
1169 @param EntryPoint Pointer to entry point of specified image file for output.
1170 @param AuthenticationState Pointer to attestation authentication state of image.
1172 @return Status of PeiLoadImageLoadImage().
1177 PeiLoadImageLoadImageWrapper (
1178 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1179 IN EFI_PEI_FILE_HANDLE FileHandle
,
1180 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1181 OUT UINT64
*ImageSizeArg
, OPTIONAL
1182 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1183 OUT UINT32
*AuthenticationState
1188 Provide a callback for when the security PPI is installed.
1190 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1191 @param NotifyDescriptor The descriptor for the notification event.
1192 @param Ppi Pointer to the PPI in question.
1194 @return Always success
1199 SecurityPpiNotifyCallback (
1200 IN EFI_PEI_SERVICES
**PeiServices
,
1201 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1206 Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV hob.
1208 @param PrivateData PeiCore's private data structure
1209 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
1210 @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
1212 @retval EFI_NOT_FOUND FV image can't be found.
1213 @retval EFI_SUCCESS Successfully to process it.
1214 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1215 @retval EFI_SECURITY_VIOLATION Image is illegal
1216 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1221 IN PEI_CORE_INSTANCE
*PrivateData
,
1222 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1223 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1227 Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
1229 This routine also will install FvInfo ppi for FV hob in PI ways.
1231 @param Private Pointer of PEI_CORE_INSTANCE
1232 @param Instance The index of FV want to be searched.
1234 @return Instance of PEI_CORE_FV_HANDLE.
1236 PEI_CORE_FV_HANDLE
*
1237 FindNextCoreFvHandle (
1238 IN PEI_CORE_INSTANCE
*Private
,
1243 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1247 Memory-based read services.
1249 This function is to perform the Memory Access Read service based on installed
1250 instance of the EFI_PEI_CPU_IO_PPI.
1251 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1252 return EFI_NOT_YET_AVAILABLE.
1254 @param PeiServices An indirect pointer to the PEI Services Table
1255 published by the PEI Foundation.
1256 @param This Pointer to local data for the interface.
1257 @param Width The width of the access. Enumerated in bytes.
1258 @param Address The physical address of the access.
1259 @param Count The number of accesses to perform.
1260 @param Buffer A pointer to the buffer of data.
1262 @retval EFI_SUCCESS The function completed successfully.
1263 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1268 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1269 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1270 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1277 Memory-based write services.
1279 This function is to perform the Memory Access Write service based on installed
1280 instance of the EFI_PEI_CPU_IO_PPI.
1281 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1282 return EFI_NOT_YET_AVAILABLE.
1284 @param PeiServices An indirect pointer to the PEI Services Table
1285 published by the PEI Foundation.
1286 @param This Pointer to local data for the interface.
1287 @param Width The width of the access. Enumerated in bytes.
1288 @param Address The physical address of the access.
1289 @param Count The number of accesses to perform.
1290 @param Buffer A pointer to the buffer of data.
1292 @retval EFI_SUCCESS The function completed successfully.
1293 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1297 PeiDefaultMemWrite (
1298 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1299 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1300 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1307 IO-based read services.
1309 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1310 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1311 return EFI_NOT_YET_AVAILABLE.
1313 @param PeiServices An indirect pointer to the PEI Services Table
1314 published by the PEI Foundation.
1315 @param This Pointer to local data for the interface.
1316 @param Width The width of the access. Enumerated in bytes.
1317 @param Address The physical address of the access.
1318 @param Count The number of accesses to perform.
1319 @param Buffer A pointer to the buffer of data.
1321 @retval EFI_SUCCESS The function completed successfully.
1322 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1327 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1328 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1329 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1336 IO-based write services.
1338 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1339 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1340 return EFI_NOT_YET_AVAILABLE.
1342 @param PeiServices An indirect pointer to the PEI Services Table
1343 published by the PEI Foundation.
1344 @param This Pointer to local data for the interface.
1345 @param Width The width of the access. Enumerated in bytes.
1346 @param Address The physical address of the access.
1347 @param Count The number of accesses to perform.
1348 @param Buffer A pointer to the buffer of data.
1350 @retval EFI_SUCCESS The function completed successfully.
1351 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1356 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1357 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1358 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1365 8-bit I/O read operations.
1367 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1370 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1371 @param This Pointer to local data for the interface.
1372 @param Address The physical address of the access.
1374 @return An 8-bit value returned from the I/O space.
1379 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1380 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1385 Reads an 16-bit I/O port.
1387 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1390 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1391 @param This Pointer to local data for the interface.
1392 @param Address The physical address of the access.
1394 @return A 16-bit value returned from the I/O space.
1398 PeiDefaultIoRead16 (
1399 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1400 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1405 Reads an 32-bit I/O port.
1407 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1410 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1411 @param This Pointer to local data for the interface.
1412 @param Address The physical address of the access.
1414 @return A 32-bit value returned from the I/O space.
1418 PeiDefaultIoRead32 (
1419 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1420 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1425 Reads an 64-bit I/O port.
1427 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1430 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1431 @param This Pointer to local data for the interface.
1432 @param Address The physical address of the access.
1434 @return A 64-bit value returned from the I/O space.
1438 PeiDefaultIoRead64 (
1439 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1440 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1445 8-bit I/O write operations.
1447 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1448 @param This Pointer to local data for the interface.
1449 @param Address The physical address of the access.
1450 @param Data The data to write.
1454 PeiDefaultIoWrite8 (
1455 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1456 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1462 16-bit I/O write operations.
1464 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1465 @param This Pointer to local data for the interface.
1466 @param Address The physical address of the access.
1467 @param Data The data to write.
1471 PeiDefaultIoWrite16 (
1472 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1473 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1479 32-bit I/O write operations.
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.
1484 @param Data The data to write.
1488 PeiDefaultIoWrite32 (
1489 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1490 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1496 64-bit I/O write operations.
1498 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1499 @param This Pointer to local data for the interface.
1500 @param Address The physical address of the access.
1501 @param Data The data to write.
1505 PeiDefaultIoWrite64 (
1506 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1507 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1513 8-bit memory read operations.
1515 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1518 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1519 @param This Pointer to local data for the interface.
1520 @param Address The physical address of the access.
1522 @return An 8-bit value returned from the memory space.
1527 PeiDefaultMemRead8 (
1528 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1529 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1534 16-bit memory read operations.
1536 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
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.
1543 @return An 16-bit value returned from the memory space.
1548 PeiDefaultMemRead16 (
1549 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1550 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1555 32-bit memory read operations.
1557 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1560 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1561 @param This Pointer to local data for the interface.
1562 @param Address The physical address of the access.
1564 @return An 32-bit value returned from the memory space.
1569 PeiDefaultMemRead32 (
1570 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1571 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1576 64-bit memory read operations.
1578 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1581 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1582 @param This Pointer to local data for the interface.
1583 @param Address The physical address of the access.
1585 @return An 64-bit value returned from the memory space.
1590 PeiDefaultMemRead64 (
1591 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1592 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1597 8-bit memory write operations.
1599 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1600 @param This Pointer to local data for the interface.
1601 @param Address The physical address of the access.
1602 @param Data The data to write.
1607 PeiDefaultMemWrite8 (
1608 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1609 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1615 16-bit memory write operations.
1617 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1618 @param This Pointer to local data for the interface.
1619 @param Address The physical address of the access.
1620 @param Data The data to write.
1625 PeiDefaultMemWrite16 (
1626 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1627 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1633 32-bit memory write operations.
1635 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1636 @param This Pointer to local data for the interface.
1637 @param Address The physical address of the access.
1638 @param Data The data to write.
1643 PeiDefaultMemWrite32 (
1644 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1645 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1651 64-bit memory write operations.
1653 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1654 @param This Pointer to local data for the interface.
1655 @param Address The physical address of the access.
1656 @param Data The data to write.
1661 PeiDefaultMemWrite64 (
1662 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1663 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1668 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1671 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1675 Reads from a given location in the PCI configuration space.
1677 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1678 return EFI_NOT_YET_AVAILABLE.
1680 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1681 @param This Pointer to local data for the interface.
1682 @param Width The width of the access. Enumerated in bytes.
1683 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1684 @param Address The physical address of the access. The format of
1685 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1686 @param Buffer A pointer to the buffer of data.
1688 @retval EFI_SUCCESS The function completed successfully.
1689 @retval EFI_INVALID_PARAMETER The invalid access width.
1690 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1695 PeiDefaultPciCfg2Read (
1696 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1697 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1698 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1704 Write to a given location in the PCI configuration space.
1706 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1707 return EFI_NOT_YET_AVAILABLE.
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 Width The width of the access. Enumerated in bytes.
1712 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1713 @param Address The physical address of the access. The format of
1714 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1715 @param Buffer A pointer to the buffer of data.
1717 @retval EFI_SUCCESS The function completed successfully.
1718 @retval EFI_INVALID_PARAMETER The invalid access width.
1719 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1723 PeiDefaultPciCfg2Write (
1724 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1725 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1726 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1732 This function performs a read-modify-write operation on the contents from a given
1733 location in the PCI configuration space.
1735 @param PeiServices An indirect pointer to the PEI Services Table
1736 published by the PEI Foundation.
1737 @param This Pointer to local data for the interface.
1738 @param Width The width of the access. Enumerated in bytes. Type
1739 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
1740 @param Address The physical address of the access.
1741 @param SetBits Points to value to bitwise-OR with the read configuration value.
1742 The size of the value is determined by Width.
1743 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
1744 The size of the value is determined by Width.
1746 @retval EFI_SUCCESS The function completed successfully.
1747 @retval EFI_INVALID_PARAMETER The invalid access width.
1748 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1752 PeiDefaultPciCfg2Modify (
1753 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1754 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1755 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1761 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
1764 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
1765 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
1766 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
1769 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1773 IN PEI_CORE_INSTANCE
*PrivateData