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
;
116 // Ponter to the buffer with the PeimCount number of Entries.
120 // Ponter to the buffer with the PeimCount number of Entries.
122 EFI_PEI_FILE_HANDLE
*FvFileHandles
;
124 UINT32 AuthenticationStatus
;
125 } PEI_CORE_FV_HANDLE
;
131 UINT32 AuthenticationStatus
;
132 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor
;
133 } PEI_CORE_UNKNOW_FORMAT_FV_INFO
;
135 #define CACHE_SETION_MAX_NUMBER 0x10
137 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
138 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
139 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
140 UINT32 AuthenticationStatus
[CACHE_SETION_MAX_NUMBER
];
141 UINTN AllSectionCount
;
143 } CACHE_SECTION_DATA
;
145 #define HOLE_MAX_NUMBER 0x3
147 EFI_PHYSICAL_ADDRESS Base
;
150 BOOLEAN OffsetPositive
;
154 /// Forward declaration for PEI_CORE_INSTANCE
156 typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE
;
160 Function Pointer type for PeiCore function.
161 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
162 and location of temporary RAM, the stack location and the BFV location.
163 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
164 An empty PPI list consists of a single descriptor with the end-tag
165 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
166 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
167 that both the PEI Foundation and any modules can leverage the associated service
168 calls and/or code in these early PPIs
169 @param OldCoreData Pointer to old core data that is used to initialize the
174 (EFIAPI
*PEICORE_FUNCTION_POINTER
)(
175 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
176 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
177 IN PEI_CORE_INSTANCE
*OldCoreData
181 // Number of files to grow by each time we run out of room
183 #define TEMP_FILE_GROWTH_STEP 32
185 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
188 /// Pei Core private data structure instance
190 struct _PEI_CORE_INSTANCE
{
194 /// Point to ServiceTableShadow
196 EFI_PEI_SERVICES
*Ps
;
197 PEI_PPI_DATABASE PpiData
;
200 /// The count of FVs which contains FFS and could be dispatched by PeiCore.
205 /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.
206 /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.
208 PEI_CORE_FV_HANDLE
*Fv
;
211 /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.
212 /// Each entry is for one FV which could not be dispatched by PeiCore.
214 PEI_CORE_UNKNOW_FORMAT_FV_INFO
*UnknownFvInfo
;
215 UINTN UnknownFvInfoCount
;
218 /// Pointer to the buffer FvFileHandlers in PEI_CORE_FV_HANDLE specified by CurrentPeimFvCount.
220 EFI_PEI_FILE_HANDLE
*CurrentFvFileHandles
;
222 UINTN CurrentPeimFvCount
;
223 UINTN CurrentPeimCount
;
224 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
225 BOOLEAN PeimNeedingDispatch
;
226 BOOLEAN PeimDispatchOnThisPass
;
227 BOOLEAN PeimDispatcherReenter
;
228 EFI_PEI_HOB_POINTERS HobList
;
229 BOOLEAN SwitchStackSignal
;
230 BOOLEAN PeiMemoryInstalled
;
232 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
233 EFI_PEI_SERVICES ServiceTableShadow
;
234 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
235 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
236 UINT64 PhysicalMemoryLength
;
237 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
239 BOOLEAN HeapOffsetPositive
;
241 BOOLEAN StackOffsetPositive
;
243 // Information for migrating memory pages allocated in pre-memory phase.
245 HOLE_MEMORY_DATA MemoryPages
;
246 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
247 CACHE_SECTION_DATA CacheSection
;
249 // For Loading modules at fixed address feature to cache the top address below which the
250 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
251 // and Ps should not be changed since maybe user could get this top address by using the offet to Ps.
253 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
255 // The field is define for Loading modules at fixed address feature to tracker the PEI code
256 // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page
259 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
261 // This field points to the shadowed image read function
263 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
268 // Pointer to the temp buffer with the TempPeimCount number of entries.
270 EFI_PEI_FILE_HANDLE
*TempFileHandles
;
272 // Pointer to the temp buffer with the TempPeimCount number of entries.
274 EFI_GUID
*TempFileGuid
;
277 // Temp Memory Range is not covered by PeiTempMem and Stack.
278 // Those Memory Range will be migrated into physical memory.
280 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
284 /// Pei Core Instance Data Macros
286 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
287 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
290 /// Union of temporarily used function pointers (to save stack space)
293 PEICORE_FUNCTION_POINTER PeiCore
;
294 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
295 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
296 EFI_DXE_IPL_PPI
*DxeIpl
;
297 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
298 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
300 } PEI_CORE_TEMP_POINTERS
;
303 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
304 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
306 } PEI_CORE_PARAMETERS
;
313 The entry routine to Pei Core, invoked by PeiMain during transition
314 from SEC to PEI. After switching stack in the PEI core, it will restart
315 with the old core data.
318 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
319 and location of temporary RAM, the stack location and the BFV location.
320 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
321 An empty PPI list consists of a single descriptor with the end-tag
322 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
323 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
324 that both the PEI Foundation and any modules can leverage the associated service
325 calls and/or code in these early PPIs
326 @param Data Pointer to old core data that is used to initialize the
333 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
334 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
339 // Dispatcher support functions
344 This is the POSTFIX version of the dependency evaluator. When a
345 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
346 the evaluation stack. When that entry is poped from the evaluation
347 stack, the PPI is checked if it is installed. This method allows
348 some time savings as not all PPIs must be checked for certain
349 operation types (AND, OR).
352 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
353 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
354 the BNF described above and is stored in postfix notation.
356 @retval TRUE if it is a well-formed Grammar
357 @retval FALSE if the dependency expression overflows the evaluation stack
358 if the dependency expression underflows the evaluation stack
359 if the dependency expression is not a well-formed Grammar.
363 PeimDispatchReadiness (
364 IN EFI_PEI_SERVICES
**PeiServices
,
365 IN VOID
*DependencyExpression
369 Conduct PEIM dispatch.
371 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
372 @param PrivateData Pointer to the private data passed in from caller
377 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
378 IN PEI_CORE_INSTANCE
*PrivateData
382 Initialize the Dispatcher's data members
384 @param PrivateData PeiCore's private data structure
385 @param OldCoreData Old data from SecCore
386 NULL if being run in non-permament memory mode.
387 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
388 and location of temporary RAM, the stack location and the BFV location.
392 InitializeDispatcherData (
393 IN PEI_CORE_INSTANCE
*PrivateData
,
394 IN PEI_CORE_INSTANCE
*OldCoreData
,
395 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
399 This routine parses the Dependency Expression, if available, and
400 decides if the module can be executed.
403 @param Private PeiCore's private data structure
404 @param FileHandle PEIM's file handle
405 @param PeimCount The index of last dispatched PEIM.
407 @retval TRUE Can be dispatched
408 @retval FALSE Cannot be dispatched
413 IN PEI_CORE_INSTANCE
*Private
,
414 IN EFI_PEI_FILE_HANDLE FileHandle
,
419 // PPI support functions
423 Initialize PPI services.
425 @param PrivateData Pointer to the PEI Core data.
426 @param OldCoreData Pointer to old PEI Core data.
427 NULL if being run in non-permament memory mode.
431 InitializePpiServices (
432 IN PEI_CORE_INSTANCE
*PrivateData
,
433 IN PEI_CORE_INSTANCE
*OldCoreData
438 Migrate the Hob list from the temporary memory to PEI installed memory.
440 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
441 and location of temporary RAM, the stack location and the BFV location.
442 @param PrivateData Pointer to PeiCore's private data structure.
447 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
448 IN PEI_CORE_INSTANCE
*PrivateData
453 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
455 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
456 @param PpiList Pointer to ppi array that want to be installed.
458 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
459 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
460 if any PPI in PpiList is not valid
461 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
467 IN CONST EFI_PEI_SERVICES
**PeiServices
,
468 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
473 Re-Install PPI services.
475 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
476 @param OldPpi Pointer to the old PEI PPI Descriptors.
477 @param NewPpi Pointer to the new PEI PPI Descriptors.
479 @retval EFI_SUCCESS if the operation was successful
480 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
481 if NewPpi is not valid
482 @retval EFI_NOT_FOUND if the PPI was not in the database
488 IN CONST EFI_PEI_SERVICES
**PeiServices
,
489 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
490 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
495 Locate a given named PPI.
498 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
499 @param Guid Pointer to GUID of the PPI.
500 @param Instance Instance Number to discover.
501 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
502 returns a pointer to the descriptor (includes flags, etc)
503 @param Ppi Pointer to reference the found PPI
505 @retval EFI_SUCCESS if the PPI is in the database
506 @retval EFI_NOT_FOUND if the PPI is not in the database
512 IN CONST EFI_PEI_SERVICES
**PeiServices
,
513 IN CONST EFI_GUID
*Guid
,
515 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
521 Install a notification for a given PPI.
524 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
525 @param NotifyList Pointer to list of Descriptors to notify upon.
527 @retval EFI_SUCCESS if successful
528 @retval EFI_OUT_OF_RESOURCES if no space in the database
529 @retval EFI_INVALID_PARAMETER if not a good decriptor
535 IN CONST EFI_PEI_SERVICES
**PeiServices
,
536 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
541 Process the Notify List at dispatch level.
543 @param PrivateData PeiCore's private data structure.
548 IN PEI_CORE_INSTANCE
*PrivateData
553 Dispatch notifications.
555 @param PrivateData PeiCore's private data structure
556 @param NotifyType Type of notify to fire.
557 @param InstallStartIndex Install Beginning index.
558 @param InstallStopIndex Install Ending index.
559 @param NotifyStartIndex Notify Beginning index.
560 @param NotifyStopIndex Notify Ending index.
565 IN PEI_CORE_INSTANCE
*PrivateData
,
567 IN INTN InstallStartIndex
,
568 IN INTN InstallStopIndex
,
569 IN INTN NotifyStartIndex
,
570 IN INTN NotifyStopIndex
574 Process PpiList from SEC phase.
576 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
577 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
578 These PPI's will be installed and/or immediately signaled if they are notification type.
582 ProcessPpiListFromSec (
583 IN CONST EFI_PEI_SERVICES
**PeiServices
,
584 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
588 // Boot mode support functions
591 This service enables PEIMs to ascertain the present value of the boot mode.
593 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
594 @param BootMode A pointer to contain the value of the boot mode.
596 @retval EFI_SUCCESS The boot mode was returned successfully.
597 @retval EFI_INVALID_PARAMETER BootMode is NULL.
603 IN CONST EFI_PEI_SERVICES
**PeiServices
,
604 IN OUT EFI_BOOT_MODE
*BootMode
608 This service enables PEIMs to update the boot mode variable.
611 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
612 @param BootMode The value of the boot mode to set.
614 @return EFI_SUCCESS The value was successfully updated
620 IN CONST EFI_PEI_SERVICES
**PeiServices
,
621 IN EFI_BOOT_MODE BootMode
625 // Security support functions
629 Initialize the security services.
631 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
632 @param OldCoreData Pointer to the old core data.
633 NULL if being run in non-permament memory mode.
637 InitializeSecurityServices (
638 IN EFI_PEI_SERVICES
**PeiServices
,
639 IN PEI_CORE_INSTANCE
*OldCoreData
643 Verify a Firmware volume.
645 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
647 @retval EFI_SUCCESS Firmware Volume is legal
648 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
653 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
657 Provide a callout to the security verification service.
659 @param PrivateData PeiCore's private data structure
660 @param VolumeHandle Handle of FV
661 @param FileHandle Handle of PEIM's ffs
662 @param AuthenticationStatus Authentication status
664 @retval EFI_SUCCESS Image is OK
665 @retval EFI_SECURITY_VIOLATION Image is illegal
666 @retval EFI_NOT_FOUND If security PPI is not installed.
670 IN PEI_CORE_INSTANCE
*PrivateData
,
671 IN EFI_PEI_FV_HANDLE VolumeHandle
,
672 IN EFI_PEI_FILE_HANDLE FileHandle
,
673 IN UINT32 AuthenticationStatus
678 Gets the pointer to the HOB List.
681 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
682 @param HobList Pointer to the HOB List.
684 @retval EFI_SUCCESS Get the pointer of HOB List
685 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
686 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
692 IN CONST EFI_PEI_SERVICES
**PeiServices
,
693 IN OUT VOID
**HobList
697 Add a new HOB to the HOB List.
699 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
700 @param Type Type of the new HOB.
701 @param Length Length of the new HOB to allocate.
702 @param Hob Pointer to the new HOB.
704 @return EFI_SUCCESS Success to create hob.
705 @retval EFI_INVALID_PARAMETER if Hob is NULL
706 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
707 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
713 IN CONST EFI_PEI_SERVICES
**PeiServices
,
721 Builds a Handoff Information Table HOB
723 @param BootMode - Current Bootmode
724 @param MemoryBegin - Start Memory Address.
725 @param MemoryLength - Length of Memory.
727 @return EFI_SUCCESS Always success to initialize HOB.
731 PeiCoreBuildHobHandoffInfoTable (
732 IN EFI_BOOT_MODE BootMode
,
733 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
734 IN UINT64 MemoryLength
738 Install SEC HOB data to the HOB List.
740 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
741 @param SecHobList Pointer to SEC HOB List.
743 @return EFI_SUCCESS Success to install SEC HOB data.
744 @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.
748 PeiInstallSecHobData (
749 IN CONST EFI_PEI_SERVICES
**PeiServices
,
750 IN EFI_HOB_GENERIC_HEADER
*SecHobList
755 // FFS Fw Volume support functions
758 Searches for the next matching file in the firmware volume.
760 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
761 @param SearchType Filter to find only files of this type.
762 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
763 @param FvHandle Handle of firmware volume in which to search.
764 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
765 at the beginning of the firmware volume. On exit, points the file handle of the next file
766 in the volume or NULL if there are no more files.
768 @retval EFI_NOT_FOUND The file was not found.
769 @retval EFI_NOT_FOUND The header checksum was not zero.
770 @retval EFI_SUCCESS The file was found.
776 IN CONST EFI_PEI_SERVICES
**PeiServices
,
778 IN EFI_PEI_FV_HANDLE FvHandle
,
779 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
783 Searches for the next matching section within the specified file.
785 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
786 @param SectionType Filter to find only sections of this type.
787 @param FileHandle Pointer to the current file to search.
788 @param SectionData A pointer to the discovered section, if successful.
789 NULL if section not found
791 @retval EFI_NOT_FOUND The section was not found.
792 @retval EFI_SUCCESS The section was found.
797 PeiFfsFindSectionData (
798 IN CONST EFI_PEI_SERVICES
**PeiServices
,
799 IN EFI_SECTION_TYPE SectionType
,
800 IN EFI_PEI_FILE_HANDLE FileHandle
,
801 OUT VOID
**SectionData
805 Searches for the next matching section within the specified file.
807 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
808 @param SectionType The value of the section type to find.
809 @param SectionInstance Section instance to find.
810 @param FileHandle Handle of the firmware file to search.
811 @param SectionData A pointer to the discovered section, if successful.
812 @param AuthenticationStatus A pointer to the authentication status for this section.
814 @retval EFI_SUCCESS The section was found.
815 @retval EFI_NOT_FOUND The section was not found.
820 PeiFfsFindSectionData3 (
821 IN CONST EFI_PEI_SERVICES
**PeiServices
,
822 IN EFI_SECTION_TYPE SectionType
,
823 IN UINTN SectionInstance
,
824 IN EFI_PEI_FILE_HANDLE FileHandle
,
825 OUT VOID
**SectionData
,
826 OUT UINT32
*AuthenticationStatus
830 Search the firmware volumes by index
832 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
833 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
835 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
837 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
838 @retval EFI_NOT_FOUND The volume was not found.
839 @retval EFI_SUCCESS The volume was found.
844 PeiFfsFindNextVolume (
845 IN CONST EFI_PEI_SERVICES
**PeiServices
,
847 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
851 // Memory support functions
855 Initialize the memory services.
857 @param PrivateData PeiCore's private data structure
858 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
859 and location of temporary RAM, the stack location and the BFV location.
860 @param OldCoreData Pointer to the PEI Core data.
861 NULL if being run in non-permament memory mode.
865 InitializeMemoryServices (
866 IN PEI_CORE_INSTANCE
*PrivateData
,
867 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
868 IN PEI_CORE_INSTANCE
*OldCoreData
873 Install the permanent memory is now available.
874 Creates HOB (PHIT and Stack).
876 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
877 @param MemoryBegin Start of memory address.
878 @param MemoryLength Length of memory.
880 @return EFI_SUCCESS Always success.
885 PeiInstallPeiMemory (
886 IN CONST EFI_PEI_SERVICES
**PeiServices
,
887 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
888 IN UINT64 MemoryLength
892 Migrate memory pages allocated in pre-memory phase.
893 Copy memory pages at temporary heap top to permanent heap top.
895 @param[in] Private Pointer to the private data passed in from caller.
896 @param[in] TemporaryRamMigrated Temporary memory has been migrated to permanent memory.
901 IN PEI_CORE_INSTANCE
*Private
,
902 IN BOOLEAN TemporaryRamMigrated
906 Migrate MemoryBaseAddress in memory allocation HOBs
907 from the temporary memory to PEI installed memory.
909 @param[in] PrivateData Pointer to PeiCore's private data structure.
913 ConvertMemoryAllocationHobs (
914 IN PEI_CORE_INSTANCE
*PrivateData
918 The purpose of the service is to publish an interface that allows
919 PEIMs to allocate memory ranges that are managed by the PEI Foundation.
921 Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.
922 After InstallPeiMemory() is called, PEI will allocate pages within the region
923 of memory provided by InstallPeiMemory() service in a best-effort fashion.
924 Location-specific allocations are not managed by the PEI foundation code.
926 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
927 @param MemoryType The type of memory to allocate.
928 @param Pages The number of contiguous 4 KB pages to allocate.
929 @param Memory Pointer to a physical address. On output, the address is set to the base
930 of the page range that was allocated.
932 @retval EFI_SUCCESS The memory range was successfully allocated.
933 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
934 @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,
935 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,
936 EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.
942 IN CONST EFI_PEI_SERVICES
**PeiServices
,
943 IN EFI_MEMORY_TYPE MemoryType
,
945 OUT EFI_PHYSICAL_ADDRESS
*Memory
951 @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
952 @param[in] Memory The base physical address of the pages to be freed.
953 @param[in] Pages The number of contiguous 4 KB pages to free.
955 @retval EFI_SUCCESS The requested pages were freed.
956 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
957 @retval EFI_NOT_FOUND The requested memory pages were not allocated with
964 IN CONST EFI_PEI_SERVICES
**PeiServices
,
965 IN EFI_PHYSICAL_ADDRESS Memory
,
971 Memory allocation service on the temporary memory.
974 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
975 @param Size Amount of memory required
976 @param Buffer Address of pointer to the buffer
978 @retval EFI_SUCCESS The allocation was successful
979 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
980 to allocate the requested size.
986 IN CONST EFI_PEI_SERVICES
**PeiServices
,
993 Routine for load image file.
996 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
997 @param FileHandle Pointer to the FFS file header of the image.
998 @param PeimState The dispatch state of the input PEIM handle.
999 @param EntryPoint Pointer to entry point of specified image file for output.
1000 @param AuthenticationState Pointer to attestation authentication state of image.
1002 @retval EFI_SUCCESS Image is successfully loaded.
1003 @retval EFI_NOT_FOUND Fail to locate necessary PPI
1004 @retval Others Fail to load file.
1009 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1010 IN EFI_PEI_FILE_HANDLE FileHandle
,
1012 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1013 OUT UINT32
*AuthenticationState
1018 Core version of the Status Code reporter
1021 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1022 @param CodeType Type of Status Code.
1023 @param Value Value to output for Status Code.
1024 @param Instance Instance Number of this status code.
1025 @param CallerId ID of the caller of this status code.
1026 @param Data Optional data associated with this status code.
1028 @retval EFI_SUCCESS if status code is successfully reported
1029 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1034 PeiReportStatusCode (
1035 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1036 IN EFI_STATUS_CODE_TYPE CodeType
,
1037 IN EFI_STATUS_CODE_VALUE Value
,
1039 IN CONST EFI_GUID
*CallerId
,
1040 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1045 Core version of the Reset System
1048 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1050 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
1051 @retval EFI_DEVICE_ERROR Did not reset system.
1052 Otherwise, resets the system.
1058 IN CONST EFI_PEI_SERVICES
**PeiServices
1062 Resets the entire platform.
1064 @param[in] ResetType The type of reset to perform.
1065 @param[in] ResetStatus The status code for the reset.
1066 @param[in] DataSize The size, in bytes, of ResetData.
1067 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
1068 the data buffer starts with a Null-terminated string, optionally
1069 followed by additional binary data. The string is a description
1070 that the caller may use to further indicate the reason for the
1071 system reset. ResetData is only valid if ResetStatus is something
1072 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
1073 where a minimum amount of ResetData is always required.
1079 IN EFI_RESET_TYPE ResetType
,
1080 IN EFI_STATUS ResetStatus
,
1082 IN VOID
*ResetData OPTIONAL
1087 Initialize PeiCore Fv List.
1090 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1091 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1096 IN PEI_CORE_INSTANCE
*PrivateData
,
1097 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1101 Process Firmware Volum Information once FvInfoPPI install.
1103 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1104 @param NotifyDescriptor Address of the notification descriptor data structure.
1105 @param Ppi Address of the PPI that was installed.
1107 @retval EFI_SUCCESS if the interface could be successfully installed
1112 FirmwareVolmeInfoPpiNotifyCallback (
1113 IN EFI_PEI_SERVICES
**PeiServices
,
1114 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1120 Given the input VolumeHandle, search for the next matching name file.
1122 @param FileName File name to search.
1123 @param VolumeHandle The current FV to search.
1124 @param FileHandle Pointer to the file matching name in VolumeHandle.
1125 NULL if file not found
1127 @retval EFI_NOT_FOUND No files matching the search criteria were found
1128 @retval EFI_SUCCESS Success to search given file
1133 PeiFfsFindFileByName (
1134 IN CONST EFI_GUID
*FileName
,
1135 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1136 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1140 Returns information about a specific file.
1142 @param FileHandle Handle of the file.
1143 @param FileInfo Upon exit, points to the file's information.
1145 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1146 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1147 @retval EFI_SUCCESS File information returned.
1153 IN EFI_PEI_FILE_HANDLE FileHandle
,
1154 OUT EFI_FV_FILE_INFO
*FileInfo
1158 Returns information about a specific file.
1160 @param FileHandle Handle of the file.
1161 @param FileInfo Upon exit, points to the file's information.
1163 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1164 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1165 @retval EFI_SUCCESS File information returned.
1170 PeiFfsGetFileInfo2 (
1171 IN EFI_PEI_FILE_HANDLE FileHandle
,
1172 OUT EFI_FV_FILE_INFO2
*FileInfo
1176 Returns information about the specified volume.
1178 @param VolumeHandle Handle of the volume.
1179 @param VolumeInfo Upon exit, points to the volume's information.
1181 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1182 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1183 @retval EFI_SUCCESS Volume information returned.
1187 PeiFfsGetVolumeInfo (
1188 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1189 OUT EFI_FV_INFO
*VolumeInfo
1193 This routine enable a PEIM to register itself to shadow when PEI Foundation
1194 discovery permanent memory.
1196 @param FileHandle File handle of a PEIM.
1198 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1199 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1200 @retval EFI_SUCCESS Successfully to register itself.
1205 PeiRegisterForShadow (
1206 IN EFI_PEI_FILE_HANDLE FileHandle
1210 Initialize image service that install PeiLoadFilePpi.
1212 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1213 @param OldCoreData Pointer to Old PeiCore's private data.
1214 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1215 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1216 to permanent memory.
1220 InitializeImageServices (
1221 IN PEI_CORE_INSTANCE
*PrivateData
,
1222 IN PEI_CORE_INSTANCE
*OldCoreData
1226 The wrapper function of PeiLoadImageLoadImage().
1228 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1229 @param FileHandle Pointer to the FFS file header of the image.
1230 @param ImageAddressArg Pointer to PE/TE image.
1231 @param ImageSizeArg Size of PE/TE image.
1232 @param EntryPoint Pointer to entry point of specified image file for output.
1233 @param AuthenticationState Pointer to attestation authentication state of image.
1235 @return Status of PeiLoadImageLoadImage().
1240 PeiLoadImageLoadImageWrapper (
1241 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1242 IN EFI_PEI_FILE_HANDLE FileHandle
,
1243 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1244 OUT UINT64
*ImageSizeArg
, OPTIONAL
1245 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1246 OUT UINT32
*AuthenticationState
1251 Provide a callback for when the security PPI is installed.
1253 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1254 @param NotifyDescriptor The descriptor for the notification event.
1255 @param Ppi Pointer to the PPI in question.
1257 @return Always success
1262 SecurityPpiNotifyCallback (
1263 IN EFI_PEI_SERVICES
**PeiServices
,
1264 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1269 Get Fv image(s) from the FV type file, then install FV INFO(2) ppi, Build FV(2, 3) hob.
1271 @param PrivateData PeiCore's private data structure
1272 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
1273 @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
1275 @retval EFI_NOT_FOUND FV image can't be found.
1276 @retval EFI_SUCCESS Successfully to process it.
1277 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1278 @retval EFI_SECURITY_VIOLATION Image is illegal
1279 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1284 IN PEI_CORE_INSTANCE
*PrivateData
,
1285 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1286 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1290 Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
1292 This routine also will install FvInfo ppi for FV hob in PI ways.
1294 @param Private Pointer of PEI_CORE_INSTANCE
1295 @param Instance The index of FV want to be searched.
1297 @return Instance of PEI_CORE_FV_HANDLE.
1299 PEI_CORE_FV_HANDLE
*
1300 FindNextCoreFvHandle (
1301 IN PEI_CORE_INSTANCE
*Private
,
1306 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1310 Memory-based read services.
1312 This function is to perform the Memory Access Read service based on installed
1313 instance of the EFI_PEI_CPU_IO_PPI.
1314 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1315 return EFI_NOT_YET_AVAILABLE.
1317 @param PeiServices An indirect pointer to the PEI Services Table
1318 published by the PEI Foundation.
1319 @param This Pointer to local data for the interface.
1320 @param Width The width of the access. Enumerated in bytes.
1321 @param Address The physical address of the access.
1322 @param Count The number of accesses to perform.
1323 @param Buffer A pointer to the buffer of data.
1325 @retval EFI_SUCCESS The function completed successfully.
1326 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1331 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1332 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1333 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1340 Memory-based write services.
1342 This function is to perform the Memory Access Write service based on installed
1343 instance of the EFI_PEI_CPU_IO_PPI.
1344 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1345 return EFI_NOT_YET_AVAILABLE.
1347 @param PeiServices An indirect pointer to the PEI Services Table
1348 published by the PEI Foundation.
1349 @param This Pointer to local data for the interface.
1350 @param Width The width of the access. Enumerated in bytes.
1351 @param Address The physical address of the access.
1352 @param Count The number of accesses to perform.
1353 @param Buffer A pointer to the buffer of data.
1355 @retval EFI_SUCCESS The function completed successfully.
1356 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1360 PeiDefaultMemWrite (
1361 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1362 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1363 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1370 IO-based read services.
1372 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1373 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1374 return EFI_NOT_YET_AVAILABLE.
1376 @param PeiServices An indirect pointer to the PEI Services Table
1377 published by the PEI Foundation.
1378 @param This Pointer to local data for the interface.
1379 @param Width The width of the access. Enumerated in bytes.
1380 @param Address The physical address of the access.
1381 @param Count The number of accesses to perform.
1382 @param Buffer A pointer to the buffer of data.
1384 @retval EFI_SUCCESS The function completed successfully.
1385 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1390 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1391 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1392 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1399 IO-based write services.
1401 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1402 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1403 return EFI_NOT_YET_AVAILABLE.
1405 @param PeiServices An indirect pointer to the PEI Services Table
1406 published by the PEI Foundation.
1407 @param This Pointer to local data for the interface.
1408 @param Width The width of the access. Enumerated in bytes.
1409 @param Address The physical address of the access.
1410 @param Count The number of accesses to perform.
1411 @param Buffer A pointer to the buffer of data.
1413 @retval EFI_SUCCESS The function completed successfully.
1414 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1419 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1420 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1421 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1428 8-bit I/O read operations.
1430 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1433 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1434 @param This Pointer to local data for the interface.
1435 @param Address The physical address of the access.
1437 @return An 8-bit value returned from the I/O space.
1442 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1443 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1448 Reads an 16-bit I/O port.
1450 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1453 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1454 @param This Pointer to local data for the interface.
1455 @param Address The physical address of the access.
1457 @return A 16-bit value returned from the I/O space.
1461 PeiDefaultIoRead16 (
1462 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1463 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1468 Reads an 32-bit I/O port.
1470 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1473 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1474 @param This Pointer to local data for the interface.
1475 @param Address The physical address of the access.
1477 @return A 32-bit value returned from the I/O space.
1481 PeiDefaultIoRead32 (
1482 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1483 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1488 Reads an 64-bit I/O port.
1490 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1493 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1494 @param This Pointer to local data for the interface.
1495 @param Address The physical address of the access.
1497 @return A 64-bit value returned from the I/O space.
1501 PeiDefaultIoRead64 (
1502 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1503 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1508 8-bit I/O write operations.
1510 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1511 @param This Pointer to local data for the interface.
1512 @param Address The physical address of the access.
1513 @param Data The data to write.
1517 PeiDefaultIoWrite8 (
1518 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1519 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1525 16-bit I/O write operations.
1527 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1528 @param This Pointer to local data for the interface.
1529 @param Address The physical address of the access.
1530 @param Data The data to write.
1534 PeiDefaultIoWrite16 (
1535 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1536 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1542 32-bit I/O write operations.
1544 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1545 @param This Pointer to local data for the interface.
1546 @param Address The physical address of the access.
1547 @param Data The data to write.
1551 PeiDefaultIoWrite32 (
1552 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1553 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1559 64-bit I/O write operations.
1561 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1562 @param This Pointer to local data for the interface.
1563 @param Address The physical address of the access.
1564 @param Data The data to write.
1568 PeiDefaultIoWrite64 (
1569 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1570 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1576 8-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 8-bit value returned from the memory space.
1590 PeiDefaultMemRead8 (
1591 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1592 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1597 16-bit memory read operations.
1599 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1602 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1603 @param This Pointer to local data for the interface.
1604 @param Address The physical address of the access.
1606 @return An 16-bit value returned from the memory space.
1611 PeiDefaultMemRead16 (
1612 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1613 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1618 32-bit memory read operations.
1620 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1623 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1624 @param This Pointer to local data for the interface.
1625 @param Address The physical address of the access.
1627 @return An 32-bit value returned from the memory space.
1632 PeiDefaultMemRead32 (
1633 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1634 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1639 64-bit memory read operations.
1641 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1644 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1645 @param This Pointer to local data for the interface.
1646 @param Address The physical address of the access.
1648 @return An 64-bit value returned from the memory space.
1653 PeiDefaultMemRead64 (
1654 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1655 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1660 8-bit memory write operations.
1662 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1663 @param This Pointer to local data for the interface.
1664 @param Address The physical address of the access.
1665 @param Data The data to write.
1670 PeiDefaultMemWrite8 (
1671 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1672 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1678 16-bit memory write operations.
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 Address The physical address of the access.
1683 @param Data The data to write.
1688 PeiDefaultMemWrite16 (
1689 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1690 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1696 32-bit memory write operations.
1698 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1699 @param This Pointer to local data for the interface.
1700 @param Address The physical address of the access.
1701 @param Data The data to write.
1706 PeiDefaultMemWrite32 (
1707 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1708 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1714 64-bit memory write operations.
1716 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1717 @param This Pointer to local data for the interface.
1718 @param Address The physical address of the access.
1719 @param Data The data to write.
1724 PeiDefaultMemWrite64 (
1725 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1726 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1731 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1734 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1738 Reads from a given location in the PCI configuration space.
1740 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1741 return EFI_NOT_YET_AVAILABLE.
1743 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1744 @param This Pointer to local data for the interface.
1745 @param Width The width of the access. Enumerated in bytes.
1746 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1747 @param Address The physical address of the access. The format of
1748 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1749 @param Buffer A pointer to the buffer of data.
1751 @retval EFI_SUCCESS The function completed successfully.
1752 @retval EFI_INVALID_PARAMETER The invalid access width.
1753 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1758 PeiDefaultPciCfg2Read (
1759 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1760 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1761 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1767 Write to a given location in the PCI configuration space.
1769 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1770 return EFI_NOT_YET_AVAILABLE.
1772 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1773 @param This Pointer to local data for the interface.
1774 @param Width The width of the access. Enumerated in bytes.
1775 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1776 @param Address The physical address of the access. The format of
1777 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1778 @param Buffer A pointer to the buffer of data.
1780 @retval EFI_SUCCESS The function completed successfully.
1781 @retval EFI_INVALID_PARAMETER The invalid access width.
1782 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1786 PeiDefaultPciCfg2Write (
1787 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1788 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1789 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1795 This function performs a read-modify-write operation on the contents from a given
1796 location in the PCI configuration space.
1798 @param PeiServices An indirect pointer to the PEI Services Table
1799 published by the PEI Foundation.
1800 @param This Pointer to local data for the interface.
1801 @param Width The width of the access. Enumerated in bytes. Type
1802 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
1803 @param Address The physical address of the access.
1804 @param SetBits Points to value to bitwise-OR with the read configuration value.
1805 The size of the value is determined by Width.
1806 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
1807 The size of the value is determined by Width.
1809 @retval EFI_SUCCESS The function completed successfully.
1810 @retval EFI_INVALID_PARAMETER The invalid access width.
1811 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1815 PeiDefaultPciCfg2Modify (
1816 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1817 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1818 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1824 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
1827 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
1828 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
1829 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
1832 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1836 IN PEI_CORE_INSTANCE
*PrivateData