2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2018, 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_REGISTER_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
;
237 // Information for migrating memory pages allocated in pre-memory phase.
239 HOLE_MEMORY_DATA MemoryPages
;
240 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
241 CACHE_SECTION_DATA CacheSection
;
243 // For Loading modules at fixed address feature to cache the top address below which the
244 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
245 // and Ps should not be changed since maybe user could get this top address by using the offet to Ps.
247 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
249 // The field is define for Loading modules at fixed address feature to tracker the PEI code
250 // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page
253 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
255 // This field points to the shadowed image read function
257 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
260 // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv + 1 number of entries.
262 EFI_PEI_FILE_HANDLE
*FileHandles
;
264 // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv number of entries.
269 // Temp Memory Range is not covered by PeiTempMem and Stack.
270 // Those Memory Range will be migrated into physical memory.
272 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
276 /// Pei Core Instance Data Macros
278 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
279 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
282 /// Union of temporarily used function pointers (to save stack space)
285 PEICORE_FUNCTION_POINTER PeiCore
;
286 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
287 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
288 EFI_DXE_IPL_PPI
*DxeIpl
;
289 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
290 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
292 } PEI_CORE_TEMP_POINTERS
;
295 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
296 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
298 } PEI_CORE_PARAMETERS
;
305 The entry routine to Pei Core, invoked by PeiMain during transition
306 from SEC to PEI. After switching stack in the PEI core, it will restart
307 with the old core data.
310 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
311 and location of temporary RAM, the stack location and the BFV location.
312 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
313 An empty PPI list consists of a single descriptor with the end-tag
314 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
315 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
316 that both the PEI Foundation and any modules can leverage the associated service
317 calls and/or code in these early PPIs
318 @param Data Pointer to old core data that is used to initialize the
325 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
326 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
331 // Dispatcher support functions
336 This is the POSTFIX version of the dependency evaluator. When a
337 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
338 the evaluation stack. When that entry is poped from the evaluation
339 stack, the PPI is checked if it is installed. This method allows
340 some time savings as not all PPIs must be checked for certain
341 operation types (AND, OR).
344 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
345 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
346 the BNF described above and is stored in postfix notation.
348 @retval TRUE if it is a well-formed Grammar
349 @retval FALSE if the dependency expression overflows the evaluation stack
350 if the dependency expression underflows the evaluation stack
351 if the dependency expression is not a well-formed Grammar.
355 PeimDispatchReadiness (
356 IN EFI_PEI_SERVICES
**PeiServices
,
357 IN VOID
*DependencyExpression
361 Conduct PEIM dispatch.
363 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
364 @param PrivateData Pointer to the private data passed in from caller
369 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
370 IN PEI_CORE_INSTANCE
*PrivateData
374 Initialize the Dispatcher's data members
376 @param PrivateData PeiCore's private data structure
377 @param OldCoreData Old data from SecCore
378 NULL if being run in non-permament memory mode.
379 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
380 and location of temporary RAM, the stack location and the BFV location.
384 InitializeDispatcherData (
385 IN PEI_CORE_INSTANCE
*PrivateData
,
386 IN PEI_CORE_INSTANCE
*OldCoreData
,
387 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
391 This routine parses the Dependency Expression, if available, and
392 decides if the module can be executed.
395 @param Private PeiCore's private data structure
396 @param FileHandle PEIM's file handle
397 @param PeimCount The index of last dispatched PEIM.
399 @retval TRUE Can be dispatched
400 @retval FALSE Cannot be dispatched
405 IN PEI_CORE_INSTANCE
*Private
,
406 IN EFI_PEI_FILE_HANDLE FileHandle
,
411 // PPI support functions
415 Initialize PPI services.
417 @param PrivateData Pointer to the PEI Core data.
418 @param OldCoreData Pointer to old PEI Core data.
419 NULL if being run in non-permament memory mode.
423 InitializePpiServices (
424 IN PEI_CORE_INSTANCE
*PrivateData
,
425 IN PEI_CORE_INSTANCE
*OldCoreData
430 Migrate the Hob list from the temporary memory to PEI installed memory.
432 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
433 and location of temporary RAM, the stack location and the BFV location.
434 @param PrivateData Pointer to PeiCore's private data structure.
439 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
440 IN PEI_CORE_INSTANCE
*PrivateData
445 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
447 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
448 @param PpiList Pointer to ppi array that want to be installed.
450 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
451 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
452 if any PPI in PpiList is not valid
453 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
459 IN CONST EFI_PEI_SERVICES
**PeiServices
,
460 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
465 Re-Install PPI services.
467 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
468 @param OldPpi Pointer to the old PEI PPI Descriptors.
469 @param NewPpi Pointer to the new PEI PPI Descriptors.
471 @retval EFI_SUCCESS if the operation was successful
472 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
473 if NewPpi is not valid
474 @retval EFI_NOT_FOUND if the PPI was not in the database
480 IN CONST EFI_PEI_SERVICES
**PeiServices
,
481 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
482 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
487 Locate a given named PPI.
490 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
491 @param Guid Pointer to GUID of the PPI.
492 @param Instance Instance Number to discover.
493 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
494 returns a pointer to the descriptor (includes flags, etc)
495 @param Ppi Pointer to reference the found PPI
497 @retval EFI_SUCCESS if the PPI is in the database
498 @retval EFI_NOT_FOUND if the PPI is not in the database
504 IN CONST EFI_PEI_SERVICES
**PeiServices
,
505 IN CONST EFI_GUID
*Guid
,
507 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
513 Install a notification for a given PPI.
516 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
517 @param NotifyList Pointer to list of Descriptors to notify upon.
519 @retval EFI_SUCCESS if successful
520 @retval EFI_OUT_OF_RESOURCES if no space in the database
521 @retval EFI_INVALID_PARAMETER if not a good decriptor
527 IN CONST EFI_PEI_SERVICES
**PeiServices
,
528 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
533 Process the Notify List at dispatch level.
535 @param PrivateData PeiCore's private data structure.
540 IN PEI_CORE_INSTANCE
*PrivateData
545 Dispatch notifications.
547 @param PrivateData PeiCore's private data structure
548 @param NotifyType Type of notify to fire.
549 @param InstallStartIndex Install Beginning index.
550 @param InstallStopIndex Install Ending index.
551 @param NotifyStartIndex Notify Beginning index.
552 @param NotifyStopIndex Notify Ending index.
557 IN PEI_CORE_INSTANCE
*PrivateData
,
559 IN INTN InstallStartIndex
,
560 IN INTN InstallStopIndex
,
561 IN INTN NotifyStartIndex
,
562 IN INTN NotifyStopIndex
566 Process PpiList from SEC phase.
568 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
569 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
570 These PPI's will be installed and/or immediately signaled if they are notification type.
574 ProcessPpiListFromSec (
575 IN CONST EFI_PEI_SERVICES
**PeiServices
,
576 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
580 // Boot mode support functions
583 This service enables PEIMs to ascertain the present value of the boot mode.
585 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
586 @param BootMode A pointer to contain the value of the boot mode.
588 @retval EFI_SUCCESS The boot mode was returned successfully.
589 @retval EFI_INVALID_PARAMETER BootMode is NULL.
595 IN CONST EFI_PEI_SERVICES
**PeiServices
,
596 IN OUT EFI_BOOT_MODE
*BootMode
600 This service enables PEIMs to update the boot mode variable.
603 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
604 @param BootMode The value of the boot mode to set.
606 @return EFI_SUCCESS The value was successfully updated
612 IN CONST EFI_PEI_SERVICES
**PeiServices
,
613 IN EFI_BOOT_MODE BootMode
617 // Security support functions
621 Initialize the security services.
623 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
624 @param OldCoreData Pointer to the old core data.
625 NULL if being run in non-permament memory mode.
629 InitializeSecurityServices (
630 IN EFI_PEI_SERVICES
**PeiServices
,
631 IN PEI_CORE_INSTANCE
*OldCoreData
635 Verify a Firmware volume.
637 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
639 @retval EFI_SUCCESS Firmware Volume is legal
640 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
645 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
649 Provide a callout to the security verification service.
651 @param PrivateData PeiCore's private data structure
652 @param VolumeHandle Handle of FV
653 @param FileHandle Handle of PEIM's ffs
654 @param AuthenticationStatus Authentication status
656 @retval EFI_SUCCESS Image is OK
657 @retval EFI_SECURITY_VIOLATION Image is illegal
658 @retval EFI_NOT_FOUND If security PPI is not installed.
662 IN PEI_CORE_INSTANCE
*PrivateData
,
663 IN EFI_PEI_FV_HANDLE VolumeHandle
,
664 IN EFI_PEI_FILE_HANDLE FileHandle
,
665 IN UINT32 AuthenticationStatus
670 Gets the pointer to the HOB List.
673 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
674 @param HobList Pointer to the HOB List.
676 @retval EFI_SUCCESS Get the pointer of HOB List
677 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
678 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
684 IN CONST EFI_PEI_SERVICES
**PeiServices
,
685 IN OUT VOID
**HobList
689 Add a new HOB to the HOB List.
691 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
692 @param Type Type of the new HOB.
693 @param Length Length of the new HOB to allocate.
694 @param Hob Pointer to the new HOB.
696 @return EFI_SUCCESS Success to create hob.
697 @retval EFI_INVALID_PARAMETER if Hob is NULL
698 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
699 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
705 IN CONST EFI_PEI_SERVICES
**PeiServices
,
713 Builds a Handoff Information Table HOB
715 @param BootMode - Current Bootmode
716 @param MemoryBegin - Start Memory Address.
717 @param MemoryLength - Length of Memory.
719 @return EFI_SUCCESS Always success to initialize HOB.
723 PeiCoreBuildHobHandoffInfoTable (
724 IN EFI_BOOT_MODE BootMode
,
725 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
726 IN UINT64 MemoryLength
730 Install SEC HOB data to the HOB List.
732 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
733 @param SecHobList Pointer to SEC HOB List.
735 @return EFI_SUCCESS Success to install SEC HOB data.
736 @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.
740 PeiInstallSecHobData (
741 IN CONST EFI_PEI_SERVICES
**PeiServices
,
742 IN EFI_HOB_GENERIC_HEADER
*SecHobList
747 // FFS Fw Volume support functions
750 Searches for the next matching file in the firmware volume.
752 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
753 @param SearchType Filter to find only files of this type.
754 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
755 @param FvHandle Handle of firmware volume in which to search.
756 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
757 at the beginning of the firmware volume. On exit, points the file handle of the next file
758 in the volume or NULL if there are no more files.
760 @retval EFI_NOT_FOUND The file was not found.
761 @retval EFI_NOT_FOUND The header checksum was not zero.
762 @retval EFI_SUCCESS The file was found.
768 IN CONST EFI_PEI_SERVICES
**PeiServices
,
770 IN EFI_PEI_FV_HANDLE FvHandle
,
771 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
775 Searches for the next matching section within the specified file.
777 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
778 @param SectionType Filter to find only sections of this type.
779 @param FileHandle Pointer to the current file to search.
780 @param SectionData A pointer to the discovered section, if successful.
781 NULL if section not found
783 @retval EFI_NOT_FOUND The section was not found.
784 @retval EFI_SUCCESS The section was found.
789 PeiFfsFindSectionData (
790 IN CONST EFI_PEI_SERVICES
**PeiServices
,
791 IN EFI_SECTION_TYPE SectionType
,
792 IN EFI_PEI_FILE_HANDLE FileHandle
,
793 OUT VOID
**SectionData
797 Searches for the next matching section within the specified file.
799 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
800 @param SectionType The value of the section type to find.
801 @param SectionInstance Section instance to find.
802 @param FileHandle Handle of the firmware file to search.
803 @param SectionData A pointer to the discovered section, if successful.
804 @param AuthenticationStatus A pointer to the authentication status for this section.
806 @retval EFI_SUCCESS The section was found.
807 @retval EFI_NOT_FOUND The section was not found.
812 PeiFfsFindSectionData3 (
813 IN CONST EFI_PEI_SERVICES
**PeiServices
,
814 IN EFI_SECTION_TYPE SectionType
,
815 IN UINTN SectionInstance
,
816 IN EFI_PEI_FILE_HANDLE FileHandle
,
817 OUT VOID
**SectionData
,
818 OUT UINT32
*AuthenticationStatus
822 Search the firmware volumes by index
824 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
825 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
827 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
829 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
830 @retval EFI_NOT_FOUND The volume was not found.
831 @retval EFI_SUCCESS The volume was found.
836 PeiFfsFindNextVolume (
837 IN CONST EFI_PEI_SERVICES
**PeiServices
,
839 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
843 // Memory support functions
847 Initialize the memory services.
849 @param PrivateData PeiCore's private data structure
850 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
851 and location of temporary RAM, the stack location and the BFV location.
852 @param OldCoreData Pointer to the PEI Core data.
853 NULL if being run in non-permament memory mode.
857 InitializeMemoryServices (
858 IN PEI_CORE_INSTANCE
*PrivateData
,
859 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
860 IN PEI_CORE_INSTANCE
*OldCoreData
865 Install the permanent memory is now available.
866 Creates HOB (PHIT and Stack).
868 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
869 @param MemoryBegin Start of memory address.
870 @param MemoryLength Length of memory.
872 @return EFI_SUCCESS Always success.
877 PeiInstallPeiMemory (
878 IN CONST EFI_PEI_SERVICES
**PeiServices
,
879 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
880 IN UINT64 MemoryLength
884 Migrate memory pages allocated in pre-memory phase.
885 Copy memory pages at temporary heap top to permanent heap top.
887 @param[in] Private Pointer to the private data passed in from caller.
888 @param[in] TemporaryRamMigrated Temporary memory has been migrated to permanent memory.
893 IN PEI_CORE_INSTANCE
*Private
,
894 IN BOOLEAN TemporaryRamMigrated
898 Migrate MemoryBaseAddress in memory allocation HOBs
899 from the temporary memory to PEI installed memory.
901 @param[in] PrivateData Pointer to PeiCore's private data structure.
905 ConvertMemoryAllocationHobs (
906 IN PEI_CORE_INSTANCE
*PrivateData
910 The purpose of the service is to publish an interface that allows
911 PEIMs to allocate memory ranges that are managed by the PEI Foundation.
913 Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.
914 After InstallPeiMemory() is called, PEI will allocate pages within the region
915 of memory provided by InstallPeiMemory() service in a best-effort fashion.
916 Location-specific allocations are not managed by the PEI foundation code.
918 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
919 @param MemoryType The type of memory to allocate.
920 @param Pages The number of contiguous 4 KB pages to allocate.
921 @param Memory Pointer to a physical address. On output, the address is set to the base
922 of the page range that was allocated.
924 @retval EFI_SUCCESS The memory range was successfully allocated.
925 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
926 @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,
927 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,
928 EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.
934 IN CONST EFI_PEI_SERVICES
**PeiServices
,
935 IN EFI_MEMORY_TYPE MemoryType
,
937 OUT EFI_PHYSICAL_ADDRESS
*Memory
943 @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
944 @param[in] Memory The base physical address of the pages to be freed.
945 @param[in] Pages The number of contiguous 4 KB pages to free.
947 @retval EFI_SUCCESS The requested pages were freed.
948 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
949 @retval EFI_NOT_FOUND The requested memory pages were not allocated with
956 IN CONST EFI_PEI_SERVICES
**PeiServices
,
957 IN EFI_PHYSICAL_ADDRESS Memory
,
963 Memory allocation service on the temporary memory.
966 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
967 @param Size Amount of memory required
968 @param Buffer Address of pointer to the buffer
970 @retval EFI_SUCCESS The allocation was successful
971 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
972 to allocate the requested size.
978 IN CONST EFI_PEI_SERVICES
**PeiServices
,
985 Routine for load image file.
988 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
989 @param FileHandle Pointer to the FFS file header of the image.
990 @param PeimState The dispatch state of the input PEIM handle.
991 @param EntryPoint Pointer to entry point of specified image file for output.
992 @param AuthenticationState Pointer to attestation authentication state of image.
994 @retval EFI_SUCCESS Image is successfully loaded.
995 @retval EFI_NOT_FOUND Fail to locate necessary PPI
996 @retval Others Fail to load file.
1001 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1002 IN EFI_PEI_FILE_HANDLE FileHandle
,
1004 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1005 OUT UINT32
*AuthenticationState
1010 Core version of the Status Code reporter
1013 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1014 @param CodeType Type of Status Code.
1015 @param Value Value to output for Status Code.
1016 @param Instance Instance Number of this status code.
1017 @param CallerId ID of the caller of this status code.
1018 @param Data Optional data associated with this status code.
1020 @retval EFI_SUCCESS if status code is successfully reported
1021 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1026 PeiReportStatusCode (
1027 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1028 IN EFI_STATUS_CODE_TYPE CodeType
,
1029 IN EFI_STATUS_CODE_VALUE Value
,
1031 IN CONST EFI_GUID
*CallerId
,
1032 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1037 Core version of the Reset System
1040 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1042 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
1043 @retval EFI_DEVICE_ERROR Did not reset system.
1044 Otherwise, resets the system.
1050 IN CONST EFI_PEI_SERVICES
**PeiServices
1054 Resets the entire platform.
1056 @param[in] ResetType The type of reset to perform.
1057 @param[in] ResetStatus The status code for the reset.
1058 @param[in] DataSize The size, in bytes, of ResetData.
1059 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
1060 the data buffer starts with a Null-terminated string, optionally
1061 followed by additional binary data. The string is a description
1062 that the caller may use to further indicate the reason for the
1063 system reset. ResetData is only valid if ResetStatus is something
1064 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
1065 where a minimum amount of ResetData is always required.
1071 IN EFI_RESET_TYPE ResetType
,
1072 IN EFI_STATUS ResetStatus
,
1074 IN VOID
*ResetData OPTIONAL
1079 Initialize PeiCore Fv List.
1082 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1083 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1088 IN PEI_CORE_INSTANCE
*PrivateData
,
1089 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1093 Process Firmware Volum Information once FvInfoPPI install.
1095 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1096 @param NotifyDescriptor Address of the notification descriptor data structure.
1097 @param Ppi Address of the PPI that was installed.
1099 @retval EFI_SUCCESS if the interface could be successfully installed
1104 FirmwareVolmeInfoPpiNotifyCallback (
1105 IN EFI_PEI_SERVICES
**PeiServices
,
1106 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1112 Given the input VolumeHandle, search for the next matching name file.
1114 @param FileName File name to search.
1115 @param VolumeHandle The current FV to search.
1116 @param FileHandle Pointer to the file matching name in VolumeHandle.
1117 NULL if file not found
1119 @retval EFI_NOT_FOUND No files matching the search criteria were found
1120 @retval EFI_SUCCESS Success to search given file
1125 PeiFfsFindFileByName (
1126 IN CONST EFI_GUID
*FileName
,
1127 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1128 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1132 Returns information about a specific file.
1134 @param FileHandle Handle of the file.
1135 @param FileInfo Upon exit, points to the file's information.
1137 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1138 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1139 @retval EFI_SUCCESS File information returned.
1145 IN EFI_PEI_FILE_HANDLE FileHandle
,
1146 OUT EFI_FV_FILE_INFO
*FileInfo
1150 Returns information about a specific file.
1152 @param FileHandle Handle of the file.
1153 @param FileInfo Upon exit, points to the file's information.
1155 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1156 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1157 @retval EFI_SUCCESS File information returned.
1162 PeiFfsGetFileInfo2 (
1163 IN EFI_PEI_FILE_HANDLE FileHandle
,
1164 OUT EFI_FV_FILE_INFO2
*FileInfo
1168 Returns information about the specified volume.
1170 @param VolumeHandle Handle of the volume.
1171 @param VolumeInfo Upon exit, points to the volume's information.
1173 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1174 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1175 @retval EFI_SUCCESS Volume information returned.
1179 PeiFfsGetVolumeInfo (
1180 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1181 OUT EFI_FV_INFO
*VolumeInfo
1185 This routine enable a PEIM to register itself to shadow when PEI Foundation
1186 discovery permanent memory.
1188 @param FileHandle File handle of a PEIM.
1190 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1191 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1192 @retval EFI_SUCCESS Successfully to register itself.
1197 PeiRegisterForShadow (
1198 IN EFI_PEI_FILE_HANDLE FileHandle
1202 Initialize image service that install PeiLoadFilePpi.
1204 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1205 @param OldCoreData Pointer to Old PeiCore's private data.
1206 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1207 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1208 to permanent memory.
1212 InitializeImageServices (
1213 IN PEI_CORE_INSTANCE
*PrivateData
,
1214 IN PEI_CORE_INSTANCE
*OldCoreData
1218 The wrapper function of PeiLoadImageLoadImage().
1220 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1221 @param FileHandle Pointer to the FFS file header of the image.
1222 @param ImageAddressArg Pointer to PE/TE image.
1223 @param ImageSizeArg Size of PE/TE image.
1224 @param EntryPoint Pointer to entry point of specified image file for output.
1225 @param AuthenticationState Pointer to attestation authentication state of image.
1227 @return Status of PeiLoadImageLoadImage().
1232 PeiLoadImageLoadImageWrapper (
1233 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1234 IN EFI_PEI_FILE_HANDLE FileHandle
,
1235 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1236 OUT UINT64
*ImageSizeArg
, OPTIONAL
1237 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1238 OUT UINT32
*AuthenticationState
1243 Provide a callback for when the security PPI is installed.
1245 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1246 @param NotifyDescriptor The descriptor for the notification event.
1247 @param Ppi Pointer to the PPI in question.
1249 @return Always success
1254 SecurityPpiNotifyCallback (
1255 IN EFI_PEI_SERVICES
**PeiServices
,
1256 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1261 Get Fv image(s) from the FV type file, then install FV INFO(2) ppi, Build FV(2, 3) hob.
1263 @param PrivateData PeiCore's private data structure
1264 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
1265 @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
1267 @retval EFI_NOT_FOUND FV image can't be found.
1268 @retval EFI_SUCCESS Successfully to process it.
1269 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1270 @retval EFI_SECURITY_VIOLATION Image is illegal
1271 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1276 IN PEI_CORE_INSTANCE
*PrivateData
,
1277 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1278 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1282 Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
1284 This routine also will install FvInfo ppi for FV hob in PI ways.
1286 @param Private Pointer of PEI_CORE_INSTANCE
1287 @param Instance The index of FV want to be searched.
1289 @return Instance of PEI_CORE_FV_HANDLE.
1291 PEI_CORE_FV_HANDLE
*
1292 FindNextCoreFvHandle (
1293 IN PEI_CORE_INSTANCE
*Private
,
1298 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1302 Memory-based read services.
1304 This function is to perform the Memory Access Read service based on installed
1305 instance of the EFI_PEI_CPU_IO_PPI.
1306 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1307 return EFI_NOT_YET_AVAILABLE.
1309 @param PeiServices An indirect pointer to the PEI Services Table
1310 published by the PEI Foundation.
1311 @param This Pointer to local data for the interface.
1312 @param Width The width of the access. Enumerated in bytes.
1313 @param Address The physical address of the access.
1314 @param Count The number of accesses to perform.
1315 @param Buffer A pointer to the buffer of data.
1317 @retval EFI_SUCCESS The function completed successfully.
1318 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1323 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1324 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1325 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1332 Memory-based write services.
1334 This function is to perform the Memory Access Write service based on installed
1335 instance of the EFI_PEI_CPU_IO_PPI.
1336 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1337 return EFI_NOT_YET_AVAILABLE.
1339 @param PeiServices An indirect pointer to the PEI Services Table
1340 published by the PEI Foundation.
1341 @param This Pointer to local data for the interface.
1342 @param Width The width of the access. Enumerated in bytes.
1343 @param Address The physical address of the access.
1344 @param Count The number of accesses to perform.
1345 @param Buffer A pointer to the buffer of data.
1347 @retval EFI_SUCCESS The function completed successfully.
1348 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1352 PeiDefaultMemWrite (
1353 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1354 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1355 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1362 IO-based read services.
1364 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1365 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1366 return EFI_NOT_YET_AVAILABLE.
1368 @param PeiServices An indirect pointer to the PEI Services Table
1369 published by the PEI Foundation.
1370 @param This Pointer to local data for the interface.
1371 @param Width The width of the access. Enumerated in bytes.
1372 @param Address The physical address of the access.
1373 @param Count The number of accesses to perform.
1374 @param Buffer A pointer to the buffer of data.
1376 @retval EFI_SUCCESS The function completed successfully.
1377 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1382 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1383 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1384 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1391 IO-based write services.
1393 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1394 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1395 return EFI_NOT_YET_AVAILABLE.
1397 @param PeiServices An indirect pointer to the PEI Services Table
1398 published by the PEI Foundation.
1399 @param This Pointer to local data for the interface.
1400 @param Width The width of the access. Enumerated in bytes.
1401 @param Address The physical address of the access.
1402 @param Count The number of accesses to perform.
1403 @param Buffer A pointer to the buffer of data.
1405 @retval EFI_SUCCESS The function completed successfully.
1406 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1411 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1412 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1413 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1420 8-bit I/O read operations.
1422 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1425 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1426 @param This Pointer to local data for the interface.
1427 @param Address The physical address of the access.
1429 @return An 8-bit value returned from the I/O space.
1434 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1435 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1440 Reads an 16-bit I/O port.
1442 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1445 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1446 @param This Pointer to local data for the interface.
1447 @param Address The physical address of the access.
1449 @return A 16-bit value returned from the I/O space.
1453 PeiDefaultIoRead16 (
1454 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1455 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1460 Reads an 32-bit I/O port.
1462 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1465 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1466 @param This Pointer to local data for the interface.
1467 @param Address The physical address of the access.
1469 @return A 32-bit value returned from the I/O space.
1473 PeiDefaultIoRead32 (
1474 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1475 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1480 Reads an 64-bit I/O port.
1482 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1485 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1486 @param This Pointer to local data for the interface.
1487 @param Address The physical address of the access.
1489 @return A 64-bit value returned from the I/O space.
1493 PeiDefaultIoRead64 (
1494 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1495 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1500 8-bit I/O write operations.
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.
1505 @param Data The data to write.
1509 PeiDefaultIoWrite8 (
1510 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1511 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1517 16-bit I/O write operations.
1519 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1520 @param This Pointer to local data for the interface.
1521 @param Address The physical address of the access.
1522 @param Data The data to write.
1526 PeiDefaultIoWrite16 (
1527 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1528 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1534 32-bit I/O write operations.
1536 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1537 @param This Pointer to local data for the interface.
1538 @param Address The physical address of the access.
1539 @param Data The data to write.
1543 PeiDefaultIoWrite32 (
1544 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1545 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1551 64-bit I/O write operations.
1553 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1554 @param This Pointer to local data for the interface.
1555 @param Address The physical address of the access.
1556 @param Data The data to write.
1560 PeiDefaultIoWrite64 (
1561 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1562 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1568 8-bit memory read operations.
1570 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
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.
1577 @return An 8-bit value returned from the memory space.
1582 PeiDefaultMemRead8 (
1583 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1584 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1589 16-bit memory read operations.
1591 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1594 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1595 @param This Pointer to local data for the interface.
1596 @param Address The physical address of the access.
1598 @return An 16-bit value returned from the memory space.
1603 PeiDefaultMemRead16 (
1604 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1605 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1610 32-bit memory read operations.
1612 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1615 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1616 @param This Pointer to local data for the interface.
1617 @param Address The physical address of the access.
1619 @return An 32-bit value returned from the memory space.
1624 PeiDefaultMemRead32 (
1625 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1626 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1631 64-bit memory read operations.
1633 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1636 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1637 @param This Pointer to local data for the interface.
1638 @param Address The physical address of the access.
1640 @return An 64-bit value returned from the memory space.
1645 PeiDefaultMemRead64 (
1646 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1647 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1652 8-bit memory write operations.
1654 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1655 @param This Pointer to local data for the interface.
1656 @param Address The physical address of the access.
1657 @param Data The data to write.
1662 PeiDefaultMemWrite8 (
1663 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1664 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1670 16-bit memory write operations.
1672 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1673 @param This Pointer to local data for the interface.
1674 @param Address The physical address of the access.
1675 @param Data The data to write.
1680 PeiDefaultMemWrite16 (
1681 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1682 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1688 32-bit memory write operations.
1690 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1691 @param This Pointer to local data for the interface.
1692 @param Address The physical address of the access.
1693 @param Data The data to write.
1698 PeiDefaultMemWrite32 (
1699 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1700 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1706 64-bit memory write operations.
1708 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1709 @param This Pointer to local data for the interface.
1710 @param Address The physical address of the access.
1711 @param Data The data to write.
1716 PeiDefaultMemWrite64 (
1717 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1718 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1723 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1726 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1730 Reads from a given location in the PCI configuration space.
1732 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1733 return EFI_NOT_YET_AVAILABLE.
1735 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1736 @param This Pointer to local data for the interface.
1737 @param Width The width of the access. Enumerated in bytes.
1738 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1739 @param Address The physical address of the access. The format of
1740 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1741 @param Buffer A pointer to the buffer of data.
1743 @retval EFI_SUCCESS The function completed successfully.
1744 @retval EFI_INVALID_PARAMETER The invalid access width.
1745 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1750 PeiDefaultPciCfg2Read (
1751 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1752 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1753 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1759 Write to a given location in the PCI configuration space.
1761 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1762 return EFI_NOT_YET_AVAILABLE.
1764 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1765 @param This Pointer to local data for the interface.
1766 @param Width The width of the access. Enumerated in bytes.
1767 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1768 @param Address The physical address of the access. The format of
1769 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1770 @param Buffer A pointer to the buffer of data.
1772 @retval EFI_SUCCESS The function completed successfully.
1773 @retval EFI_INVALID_PARAMETER The invalid access width.
1774 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1778 PeiDefaultPciCfg2Write (
1779 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1780 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1781 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1787 This function performs a read-modify-write operation on the contents from a given
1788 location in the PCI configuration space.
1790 @param PeiServices An indirect pointer to the PEI Services Table
1791 published by the PEI Foundation.
1792 @param This Pointer to local data for the interface.
1793 @param Width The width of the access. Enumerated in bytes. Type
1794 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
1795 @param Address The physical address of the access.
1796 @param SetBits Points to value to bitwise-OR with the read configuration value.
1797 The size of the value is determined by Width.
1798 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
1799 The size of the value is determined by Width.
1801 @retval EFI_SUCCESS The function completed successfully.
1802 @retval EFI_INVALID_PARAMETER The invalid access width.
1803 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1807 PeiDefaultPciCfg2Modify (
1808 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1809 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1810 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1816 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
1819 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
1820 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
1821 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
1824 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1828 IN PEI_CORE_INSTANCE
*PrivateData