2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2015, 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 <Library/DebugLib.h>
34 #include <Library/PeiCoreEntryPoint.h>
35 #include <Library/BaseLib.h>
36 #include <Library/HobLib.h>
37 #include <Library/PerformanceLib.h>
38 #include <Library/PeiServicesLib.h>
39 #include <Library/ReportStatusCodeLib.h>
40 #include <Library/PeCoffLib.h>
41 #include <Library/PeCoffGetEntryPointLib.h>
42 #include <Library/BaseMemoryLib.h>
43 #include <Library/CacheMaintenanceLib.h>
44 #include <Library/PcdLib.h>
45 #include <IndustryStandard/PeImage.h>
46 #include <Library/PeiServicesTablePointerLib.h>
47 #include <Library/MemoryAllocationLib.h>
48 #include <Guid/FirmwareFileSystem2.h>
49 #include <Guid/FirmwareFileSystem3.h>
50 #include <Guid/AprioriFileName.h>
53 /// It is an FFS type extension used for PeiFindFileEx. It indicates current
54 /// Ffs searching is for all PEIMs can be dispatched by PeiCore.
56 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
59 /// Pei Core private data structures
62 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
63 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
65 } PEI_PPI_LIST_POINTERS
;
68 /// PPI database structure which contains two link: PpiList and NotifyList. PpiList
69 /// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.
73 /// index of end of PpiList link list.
77 /// index of end of notify link list.
81 /// index of the dispatched notify list.
85 /// index of last installed Ppi description in PpiList link list.
87 INTN LastDispatchedInstall
;
89 /// index of last dispatched notify in Notify link list.
91 INTN LastDispatchedNotify
;
93 /// Ppi database has the PcdPeiCoreMaxPpiSupported number of entries.
95 PEI_PPI_LIST_POINTERS
*PpiListPtrs
;
100 // PEI_CORE_FV_HANDE.PeimState
101 // Do not change these values as there is code doing math to change states.
102 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
104 #define PEIM_STATE_NOT_DISPATCHED 0x00
105 #define PEIM_STATE_DISPATCHED 0x01
106 #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02
107 #define PEIM_STATE_DONE 0x03
110 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
111 EFI_PEI_FIRMWARE_VOLUME_PPI
*FvPpi
;
112 EFI_PEI_FV_HANDLE FvHandle
;
114 // Ponter to the buffer with the PcdPeiCoreMaxPeimPerFv number of Entries.
118 // Ponter to the buffer with the PcdPeiCoreMaxPeimPerFv number of Entries.
120 EFI_PEI_FILE_HANDLE
*FvFileHandles
;
122 UINT32 AuthenticationStatus
;
123 } PEI_CORE_FV_HANDLE
;
129 UINT32 AuthenticationStatus
;
130 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor
;
131 } PEI_CORE_UNKNOW_FORMAT_FV_INFO
;
133 #define CACHE_SETION_MAX_NUMBER 0x10
135 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
136 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
137 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
138 UINT32 AuthenticationStatus
[CACHE_SETION_MAX_NUMBER
];
139 UINTN AllSectionCount
;
141 } CACHE_SECTION_DATA
;
143 #define HOLE_MAX_NUMBER 0x3
145 EFI_PHYSICAL_ADDRESS Base
;
148 BOOLEAN OffsetPositive
;
152 /// Forward declaration for PEI_CORE_INSTANCE
154 typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE
;
158 Function Pointer type for PeiCore function.
159 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
160 and location of temporary RAM, the stack location and the BFV location.
161 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
162 An empty PPI list consists of a single descriptor with the end-tag
163 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
164 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
165 that both the PEI Foundation and any modules can leverage the associated service
166 calls and/or code in these early PPIs
167 @param OldCoreData Pointer to old core data that is used to initialize the
172 (EFIAPI
*PEICORE_FUNCTION_POINTER
)(
173 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
174 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
175 IN PEI_CORE_INSTANCE
*OldCoreData
178 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
181 /// Pei Core private data structure instance
183 struct _PEI_CORE_INSTANCE
{
187 /// Point to ServiceTableShadow
189 EFI_PEI_SERVICES
*Ps
;
190 PEI_PPI_DATABASE PpiData
;
193 /// The count of FVs which contains FFS and could be dispatched by PeiCore.
198 /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.
199 /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.
201 PEI_CORE_FV_HANDLE
*Fv
;
204 /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.
205 /// Each entry is for one FV which could not be dispatched by PeiCore.
207 PEI_CORE_UNKNOW_FORMAT_FV_INFO
*UnknownFvInfo
;
208 UINTN UnknownFvInfoCount
;
211 /// Pointer to the buffer with the PcdPeiCoreMaxPeimPerFv number of entries.
213 EFI_PEI_FILE_HANDLE
*CurrentFvFileHandles
;
215 UINTN CurrentPeimFvCount
;
216 UINTN CurrentPeimCount
;
217 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
218 BOOLEAN PeimNeedingDispatch
;
219 BOOLEAN PeimDispatchOnThisPass
;
220 BOOLEAN PeimDispatcherReenter
;
221 EFI_PEI_HOB_POINTERS HobList
;
222 BOOLEAN SwitchStackSignal
;
223 BOOLEAN PeiMemoryInstalled
;
225 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
226 EFI_PEI_SERVICES ServiceTableShadow
;
227 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
228 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
229 UINT64 PhysicalMemoryLength
;
230 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
232 BOOLEAN HeapOffsetPositive
;
234 BOOLEAN StackOffsetPositive
;
235 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
236 CACHE_SECTION_DATA CacheSection
;
238 // For Loading modules at fixed address feature to cache the top address below which the
239 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
240 // and Ps should not be changed since maybe user could get this top address by using the offet to Ps.
242 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
244 // The field is define for Loading modules at fixed address feature to tracker the PEI code
245 // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page
248 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
250 // This field points to the shadowed image read function
252 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
255 // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv + 1 number of entries.
257 EFI_PEI_FILE_HANDLE
*FileHandles
;
259 // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv number of entries.
264 // Temp Memory Range is not covered by PeiTempMem and Stack.
265 // Those Memory Range will be migrated into phisical memory.
267 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
271 /// Pei Core Instance Data Macros
273 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
274 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
277 /// Union of temporarily used function pointers (to save stack space)
280 PEICORE_FUNCTION_POINTER PeiCore
;
281 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
282 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
283 EFI_DXE_IPL_PPI
*DxeIpl
;
284 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
285 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
287 } PEI_CORE_TEMP_POINTERS
;
290 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
291 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
293 } PEI_CORE_PARAMETERS
;
300 The entry routine to Pei Core, invoked by PeiMain during transition
301 from SEC to PEI. After switching stack in the PEI core, it will restart
302 with the old core data.
305 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
306 and location of temporary RAM, the stack location and the BFV location.
307 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
308 An empty PPI list consists of a single descriptor with the end-tag
309 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
310 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
311 that both the PEI Foundation and any modules can leverage the associated service
312 calls and/or code in these early PPIs
313 @param Data Pointer to old core data that is used to initialize the
320 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
321 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
326 // Dispatcher support functions
331 This is the POSTFIX version of the dependency evaluator. When a
332 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
333 the evaluation stack. When that entry is poped from the evaluation
334 stack, the PPI is checked if it is installed. This method allows
335 some time savings as not all PPIs must be checked for certain
336 operation types (AND, OR).
339 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
340 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
341 the BNF described above and is stored in postfix notation.
343 @retval TRUE if it is a well-formed Grammar
344 @retval FALSE if the dependency expression overflows the evaluation stack
345 if the dependency expression underflows the evaluation stack
346 if the dependency expression is not a well-formed Grammar.
350 PeimDispatchReadiness (
351 IN EFI_PEI_SERVICES
**PeiServices
,
352 IN VOID
*DependencyExpression
356 Conduct PEIM dispatch.
358 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
359 @param PrivateData Pointer to the private data passed in from caller
364 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
365 IN PEI_CORE_INSTANCE
*PrivateData
369 Initialize the Dispatcher's data members
371 @param PrivateData PeiCore's private data structure
372 @param OldCoreData Old data from SecCore
373 NULL if being run in non-permament memory mode.
374 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
375 and location of temporary RAM, the stack location and the BFV location.
379 InitializeDispatcherData (
380 IN PEI_CORE_INSTANCE
*PrivateData
,
381 IN PEI_CORE_INSTANCE
*OldCoreData
,
382 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
386 This routine parses the Dependency Expression, if available, and
387 decides if the module can be executed.
390 @param Private PeiCore's private data structure
391 @param FileHandle PEIM's file handle
392 @param PeimCount The index of last dispatched PEIM.
394 @retval TRUE Can be dispatched
395 @retval FALSE Cannot be dispatched
400 IN PEI_CORE_INSTANCE
*Private
,
401 IN EFI_PEI_FILE_HANDLE FileHandle
,
406 // PPI support functions
410 Initialize PPI services.
412 @param PrivateData Pointer to the PEI Core data.
413 @param OldCoreData Pointer to old PEI Core data.
414 NULL if being run in non-permament memory mode.
418 InitializePpiServices (
419 IN PEI_CORE_INSTANCE
*PrivateData
,
420 IN PEI_CORE_INSTANCE
*OldCoreData
425 Migrate the Hob list from the temporary memory stack to PEI installed memory.
427 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
428 and location of temporary RAM, the stack location and the BFV location.
429 @param PrivateData Pointer to PeiCore's private data structure.
434 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
435 IN PEI_CORE_INSTANCE
*PrivateData
440 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
442 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
443 @param PpiList Pointer to ppi array that want to be installed.
445 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
446 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
447 if any PPI in PpiList is not valid
448 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
454 IN CONST EFI_PEI_SERVICES
**PeiServices
,
455 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
460 Re-Install PPI services.
462 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
463 @param OldPpi Pointer to the old PEI PPI Descriptors.
464 @param NewPpi Pointer to the new PEI PPI Descriptors.
466 @retval EFI_SUCCESS if the operation was successful
467 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
468 if NewPpi is not valid
469 @retval EFI_NOT_FOUND if the PPI was not in the database
475 IN CONST EFI_PEI_SERVICES
**PeiServices
,
476 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
477 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
482 Locate a given named PPI.
485 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
486 @param Guid Pointer to GUID of the PPI.
487 @param Instance Instance Number to discover.
488 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
489 returns a pointer to the descriptor (includes flags, etc)
490 @param Ppi Pointer to reference the found PPI
492 @retval EFI_SUCCESS if the PPI is in the database
493 @retval EFI_NOT_FOUND if the PPI is not in the database
499 IN CONST EFI_PEI_SERVICES
**PeiServices
,
500 IN CONST EFI_GUID
*Guid
,
502 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
508 Install a notification for a given PPI.
511 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
512 @param NotifyList Pointer to list of Descriptors to notify upon.
514 @retval EFI_SUCCESS if successful
515 @retval EFI_OUT_OF_RESOURCES if no space in the database
516 @retval EFI_INVALID_PARAMETER if not a good decriptor
522 IN CONST EFI_PEI_SERVICES
**PeiServices
,
523 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
528 Process the Notify List at dispatch level.
530 @param PrivateData PeiCore's private data structure.
535 IN PEI_CORE_INSTANCE
*PrivateData
540 Dispatch notifications.
542 @param PrivateData PeiCore's private data structure
543 @param NotifyType Type of notify to fire.
544 @param InstallStartIndex Install Beginning index.
545 @param InstallStopIndex Install Ending index.
546 @param NotifyStartIndex Notify Beginning index.
547 @param NotifyStopIndex Notify Ending index.
552 IN PEI_CORE_INSTANCE
*PrivateData
,
554 IN INTN InstallStartIndex
,
555 IN INTN InstallStopIndex
,
556 IN INTN NotifyStartIndex
,
557 IN INTN NotifyStopIndex
561 // Boot mode support functions
564 This service enables PEIMs to ascertain the present value of the boot mode.
566 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
567 @param BootMode A pointer to contain the value of the boot mode.
569 @retval EFI_SUCCESS The boot mode was returned successfully.
570 @retval EFI_INVALID_PARAMETER BootMode is NULL.
576 IN CONST EFI_PEI_SERVICES
**PeiServices
,
577 IN OUT EFI_BOOT_MODE
*BootMode
581 This service enables PEIMs to update the boot mode variable.
584 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
585 @param BootMode The value of the boot mode to set.
587 @return EFI_SUCCESS The value was successfully updated
593 IN CONST EFI_PEI_SERVICES
**PeiServices
,
594 IN EFI_BOOT_MODE BootMode
598 // Security support functions
602 Initialize the security services.
604 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
605 @param OldCoreData Pointer to the old core data.
606 NULL if being run in non-permament memory mode.
610 InitializeSecurityServices (
611 IN EFI_PEI_SERVICES
**PeiServices
,
612 IN PEI_CORE_INSTANCE
*OldCoreData
616 Verify a Firmware volume.
618 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
620 @retval EFI_SUCCESS Firmware Volume is legal
621 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
626 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
630 Provide a callout to the security verification service.
632 @param PrivateData PeiCore's private data structure
633 @param VolumeHandle Handle of FV
634 @param FileHandle Handle of PEIM's ffs
635 @param AuthenticationStatus Authentication status
637 @retval EFI_SUCCESS Image is OK
638 @retval EFI_SECURITY_VIOLATION Image is illegal
639 @retval EFI_NOT_FOUND If security PPI is not installed.
643 IN PEI_CORE_INSTANCE
*PrivateData
,
644 IN EFI_PEI_FV_HANDLE VolumeHandle
,
645 IN EFI_PEI_FILE_HANDLE FileHandle
,
646 IN UINT32 AuthenticationStatus
651 Gets the pointer to the HOB List.
654 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
655 @param HobList Pointer to the HOB List.
657 @retval EFI_SUCCESS Get the pointer of HOB List
658 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
659 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
665 IN CONST EFI_PEI_SERVICES
**PeiServices
,
666 IN OUT VOID
**HobList
670 Add a new HOB to the HOB List.
672 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
673 @param Type Type of the new HOB.
674 @param Length Length of the new HOB to allocate.
675 @param Hob Pointer to the new HOB.
677 @return EFI_SUCCESS Success to create hob.
678 @retval EFI_INVALID_PARAMETER if Hob is NULL
679 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
680 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
686 IN CONST EFI_PEI_SERVICES
**PeiServices
,
694 Builds a Handoff Information Table HOB
696 @param BootMode - Current Bootmode
697 @param MemoryBegin - Start Memory Address.
698 @param MemoryLength - Length of Memory.
700 @return EFI_SUCCESS Always success to initialize HOB.
704 PeiCoreBuildHobHandoffInfoTable (
705 IN EFI_BOOT_MODE BootMode
,
706 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
707 IN UINT64 MemoryLength
712 // FFS Fw Volume support functions
715 Searches for the next matching file in the firmware volume.
717 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
718 @param SearchType Filter to find only files of this type.
719 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
720 @param FvHandle Handle of firmware volume in which to search.
721 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
722 at the beginning of the firmware volume. On exit, points the file handle of the next file
723 in the volume or NULL if there are no more files.
725 @retval EFI_NOT_FOUND The file was not found.
726 @retval EFI_NOT_FOUND The header checksum was not zero.
727 @retval EFI_SUCCESS The file was found.
733 IN CONST EFI_PEI_SERVICES
**PeiServices
,
735 IN EFI_PEI_FV_HANDLE FvHandle
,
736 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
740 Searches for the next matching section within the specified file.
742 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
743 @param SectionType Filter to find only sections of this type.
744 @param FileHandle Pointer to the current file to search.
745 @param SectionData A pointer to the discovered section, if successful.
746 NULL if section not found
748 @retval EFI_NOT_FOUND The section was not found.
749 @retval EFI_SUCCESS The section was found.
754 PeiFfsFindSectionData (
755 IN CONST EFI_PEI_SERVICES
**PeiServices
,
756 IN EFI_SECTION_TYPE SectionType
,
757 IN EFI_PEI_FILE_HANDLE FileHandle
,
758 OUT VOID
**SectionData
762 Searches for the next matching section within the specified file.
764 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
765 @param SectionType The value of the section type to find.
766 @param SectionInstance Section instance to find.
767 @param FileHandle Handle of the firmware file to search.
768 @param SectionData A pointer to the discovered section, if successful.
769 @param AuthenticationStatus A pointer to the authentication status for this section.
771 @retval EFI_SUCCESS The section was found.
772 @retval EFI_NOT_FOUND The section was not found.
777 PeiFfsFindSectionData3 (
778 IN CONST EFI_PEI_SERVICES
**PeiServices
,
779 IN EFI_SECTION_TYPE SectionType
,
780 IN UINTN SectionInstance
,
781 IN EFI_PEI_FILE_HANDLE FileHandle
,
782 OUT VOID
**SectionData
,
783 OUT UINT32
*AuthenticationStatus
787 Search the firmware volumes by index
789 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
790 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
792 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
794 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
795 @retval EFI_NOT_FOUND The volume was not found.
796 @retval EFI_SUCCESS The volume was found.
801 PeiFfsFindNextVolume (
802 IN CONST EFI_PEI_SERVICES
**PeiServices
,
804 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
808 // Memory support functions
812 Initialize the memory services.
814 @param PrivateData PeiCore's private data structure
815 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
816 and location of temporary RAM, the stack location and the BFV location.
817 @param OldCoreData Pointer to the PEI Core data.
818 NULL if being run in non-permament memory mode.
822 InitializeMemoryServices (
823 IN PEI_CORE_INSTANCE
*PrivateData
,
824 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
825 IN PEI_CORE_INSTANCE
*OldCoreData
830 Install the permanent memory is now available.
831 Creates HOB (PHIT and Stack).
833 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
834 @param MemoryBegin Start of memory address.
835 @param MemoryLength Length of memory.
837 @return EFI_SUCCESS Always success.
842 PeiInstallPeiMemory (
843 IN CONST EFI_PEI_SERVICES
**PeiServices
,
844 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
845 IN UINT64 MemoryLength
850 Memory allocation service on permanent memory,
851 not usable prior to the memory installation.
854 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
855 @param MemoryType Type of memory to allocate.
856 @param Pages Number of pages to allocate.
857 @param Memory Pointer of memory allocated.
859 @retval EFI_SUCCESS The allocation was successful
860 @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
861 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available
862 @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
863 to allocate the number of pages.
869 IN CONST EFI_PEI_SERVICES
**PeiServices
,
870 IN EFI_MEMORY_TYPE MemoryType
,
872 OUT EFI_PHYSICAL_ADDRESS
*Memory
877 Memory allocation service on the temporary memory.
880 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
881 @param Size Amount of memory required
882 @param Buffer Address of pointer to the buffer
884 @retval EFI_SUCCESS The allocation was successful
885 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
886 to allocate the requested size.
892 IN CONST EFI_PEI_SERVICES
**PeiServices
,
899 Routine for load image file.
902 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
903 @param FileHandle Pointer to the FFS file header of the image.
904 @param PeimState The dispatch state of the input PEIM handle.
905 @param EntryPoint Pointer to entry point of specified image file for output.
906 @param AuthenticationState Pointer to attestation authentication state of image.
908 @retval EFI_SUCCESS Image is successfully loaded.
909 @retval EFI_NOT_FOUND Fail to locate necessary PPI
910 @retval Others Fail to load file.
915 IN CONST EFI_PEI_SERVICES
**PeiServices
,
916 IN EFI_PEI_FILE_HANDLE FileHandle
,
918 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
919 OUT UINT32
*AuthenticationState
924 Core version of the Status Code reporter
927 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
928 @param CodeType Type of Status Code.
929 @param Value Value to output for Status Code.
930 @param Instance Instance Number of this status code.
931 @param CallerId ID of the caller of this status code.
932 @param Data Optional data associated with this status code.
934 @retval EFI_SUCCESS if status code is successfully reported
935 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
940 PeiReportStatusCode (
941 IN CONST EFI_PEI_SERVICES
**PeiServices
,
942 IN EFI_STATUS_CODE_TYPE CodeType
,
943 IN EFI_STATUS_CODE_VALUE Value
,
945 IN CONST EFI_GUID
*CallerId
,
946 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
951 Core version of the Reset System
954 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
956 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
957 @retval EFI_DEVICE_ERROR Did not reset system.
958 Otherwise, resets the system.
964 IN CONST EFI_PEI_SERVICES
**PeiServices
968 Resets the entire platform.
970 @param[in] ResetType The type of reset to perform.
971 @param[in] ResetStatus The status code for the reset.
972 @param[in] DataSize The size, in bytes, of WatchdogData.
973 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
974 the data buffer starts with a Null-terminated string, optionally
975 followed by additional binary data. The string is a description
976 that the caller may use to further indicate the reason for the
977 system reset. ResetData is only valid if ResetStatus is something
978 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
979 where a minimum amount of ResetData is always required.
985 IN EFI_RESET_TYPE ResetType
,
986 IN EFI_STATUS ResetStatus
,
988 IN VOID
*ResetData OPTIONAL
993 Initialize PeiCore Fv List.
996 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
997 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1002 IN PEI_CORE_INSTANCE
*PrivateData
,
1003 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1007 Process Firmware Volum Information once FvInfoPPI install.
1009 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1010 @param NotifyDescriptor Address of the notification descriptor data structure.
1011 @param Ppi Address of the PPI that was installed.
1013 @retval EFI_SUCCESS if the interface could be successfully installed
1018 FirmwareVolmeInfoPpiNotifyCallback (
1019 IN EFI_PEI_SERVICES
**PeiServices
,
1020 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1026 Given the input VolumeHandle, search for the next matching name file.
1028 @param FileName File name to search.
1029 @param VolumeHandle The current FV to search.
1030 @param FileHandle Pointer to the file matching name in VolumeHandle.
1031 NULL if file not found
1033 @retval EFI_NOT_FOUND No files matching the search criteria were found
1034 @retval EFI_SUCCESS Success to search given file
1039 PeiFfsFindFileByName (
1040 IN CONST EFI_GUID
*FileName
,
1041 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1042 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1046 Returns information about a specific file.
1048 @param FileHandle Handle of the file.
1049 @param FileInfo Upon exit, points to the file's information.
1051 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1052 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1053 @retval EFI_SUCCESS File information returned.
1059 IN EFI_PEI_FILE_HANDLE FileHandle
,
1060 OUT EFI_FV_FILE_INFO
*FileInfo
1064 Returns information about a specific file.
1066 @param FileHandle Handle of the file.
1067 @param FileInfo Upon exit, points to the file's information.
1069 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1070 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1071 @retval EFI_SUCCESS File information returned.
1076 PeiFfsGetFileInfo2 (
1077 IN EFI_PEI_FILE_HANDLE FileHandle
,
1078 OUT EFI_FV_FILE_INFO2
*FileInfo
1082 Returns information about the specified volume.
1084 @param VolumeHandle Handle of the volume.
1085 @param VolumeInfo Upon exit, points to the volume's information.
1087 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1088 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1089 @retval EFI_SUCCESS Volume information returned.
1093 PeiFfsGetVolumeInfo (
1094 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1095 OUT EFI_FV_INFO
*VolumeInfo
1099 This routine enable a PEIM to register itself to shadow when PEI Foundation
1100 discovery permanent memory.
1102 @param FileHandle File handle of a PEIM.
1104 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1105 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1106 @retval EFI_SUCCESS Successfully to register itself.
1111 PeiRegisterForShadow (
1112 IN EFI_PEI_FILE_HANDLE FileHandle
1116 Initialize image service that install PeiLoadFilePpi.
1118 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1119 @param OldCoreData Pointer to Old PeiCore's private data.
1120 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1121 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1122 to permanent memory.
1126 InitializeImageServices (
1127 IN PEI_CORE_INSTANCE
*PrivateData
,
1128 IN PEI_CORE_INSTANCE
*OldCoreData
1132 The wrapper function of PeiLoadImageLoadImage().
1134 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1135 @param FileHandle Pointer to the FFS file header of the image.
1136 @param ImageAddressArg Pointer to PE/TE image.
1137 @param ImageSizeArg Size of PE/TE image.
1138 @param EntryPoint Pointer to entry point of specified image file for output.
1139 @param AuthenticationState Pointer to attestation authentication state of image.
1141 @return Status of PeiLoadImageLoadImage().
1146 PeiLoadImageLoadImageWrapper (
1147 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1148 IN EFI_PEI_FILE_HANDLE FileHandle
,
1149 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1150 OUT UINT64
*ImageSizeArg
, OPTIONAL
1151 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1152 OUT UINT32
*AuthenticationState
1157 Provide a callback for when the security PPI is installed.
1159 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1160 @param NotifyDescriptor The descriptor for the notification event.
1161 @param Ppi Pointer to the PPI in question.
1163 @return Always success
1168 SecurityPpiNotifyCallback (
1169 IN EFI_PEI_SERVICES
**PeiServices
,
1170 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1175 Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV hob.
1177 @param PrivateData PeiCore's private data structure
1178 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
1179 @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
1181 @retval EFI_NOT_FOUND FV image can't be found.
1182 @retval EFI_SUCCESS Successfully to process it.
1183 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1184 @retval EFI_SECURITY_VIOLATION Image is illegal
1185 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1190 IN PEI_CORE_INSTANCE
*PrivateData
,
1191 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1192 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1196 Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
1198 This routine also will install FvInfo ppi for FV hob in PI ways.
1200 @param Private Pointer of PEI_CORE_INSTANCE
1201 @param Instance The index of FV want to be searched.
1203 @return Instance of PEI_CORE_FV_HANDLE.
1205 PEI_CORE_FV_HANDLE
*
1206 FindNextCoreFvHandle (
1207 IN PEI_CORE_INSTANCE
*Private
,
1212 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1216 Memory-based read services.
1218 This function is to perform the Memory Access Read service based on installed
1219 instance of the EFI_PEI_CPU_IO_PPI.
1220 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1221 return EFI_NOT_YET_AVAILABLE.
1223 @param PeiServices An indirect pointer to the PEI Services Table
1224 published by the PEI Foundation.
1225 @param This Pointer to local data for the interface.
1226 @param Width The width of the access. Enumerated in bytes.
1227 @param Address The physical address of the access.
1228 @param Count The number of accesses to perform.
1229 @param Buffer A pointer to the buffer of data.
1231 @retval EFI_SUCCESS The function completed successfully.
1232 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1237 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1238 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1239 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1246 Memory-based write services.
1248 This function is to perform the Memory Access Write service based on installed
1249 instance of the EFI_PEI_CPU_IO_PPI.
1250 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1251 return EFI_NOT_YET_AVAILABLE.
1253 @param PeiServices An indirect pointer to the PEI Services Table
1254 published by the PEI Foundation.
1255 @param This Pointer to local data for the interface.
1256 @param Width The width of the access. Enumerated in bytes.
1257 @param Address The physical address of the access.
1258 @param Count The number of accesses to perform.
1259 @param Buffer A pointer to the buffer of data.
1261 @retval EFI_SUCCESS The function completed successfully.
1262 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1266 PeiDefaultMemWrite (
1267 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1268 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1269 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1276 IO-based read services.
1278 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1279 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1280 return EFI_NOT_YET_AVAILABLE.
1282 @param PeiServices An indirect pointer to the PEI Services Table
1283 published by the PEI Foundation.
1284 @param This Pointer to local data for the interface.
1285 @param Width The width of the access. Enumerated in bytes.
1286 @param Address The physical address of the access.
1287 @param Count The number of accesses to perform.
1288 @param Buffer A pointer to the buffer of data.
1290 @retval EFI_SUCCESS The function completed successfully.
1291 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1296 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1297 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1298 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1305 IO-based write services.
1307 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1308 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1309 return EFI_NOT_YET_AVAILABLE.
1311 @param PeiServices An indirect pointer to the PEI Services Table
1312 published by the PEI Foundation.
1313 @param This Pointer to local data for the interface.
1314 @param Width The width of the access. Enumerated in bytes.
1315 @param Address The physical address of the access.
1316 @param Count The number of accesses to perform.
1317 @param Buffer A pointer to the buffer of data.
1319 @retval EFI_SUCCESS The function completed successfully.
1320 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1325 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1326 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1327 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1334 8-bit I/O read operations.
1336 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1339 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1340 @param This Pointer to local data for the interface.
1341 @param Address The physical address of the access.
1343 @return An 8-bit value returned from the I/O space.
1348 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1349 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1354 Reads an 16-bit I/O port.
1356 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1359 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1360 @param This Pointer to local data for the interface.
1361 @param Address The physical address of the access.
1363 @return A 16-bit value returned from the I/O space.
1367 PeiDefaultIoRead16 (
1368 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1369 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1374 Reads an 32-bit I/O port.
1376 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1379 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1380 @param This Pointer to local data for the interface.
1381 @param Address The physical address of the access.
1383 @return A 32-bit value returned from the I/O space.
1387 PeiDefaultIoRead32 (
1388 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1389 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1394 Reads an 64-bit I/O port.
1396 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1399 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1400 @param This Pointer to local data for the interface.
1401 @param Address The physical address of the access.
1403 @return A 64-bit value returned from the I/O space.
1407 PeiDefaultIoRead64 (
1408 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1409 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1414 8-bit I/O write operations.
1416 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1417 @param This Pointer to local data for the interface.
1418 @param Address The physical address of the access.
1419 @param Data The data to write.
1423 PeiDefaultIoWrite8 (
1424 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1425 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1431 16-bit I/O write operations.
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.
1436 @param Data The data to write.
1440 PeiDefaultIoWrite16 (
1441 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1442 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1448 32-bit I/O write operations.
1450 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1451 @param This Pointer to local data for the interface.
1452 @param Address The physical address of the access.
1453 @param Data The data to write.
1457 PeiDefaultIoWrite32 (
1458 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1459 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1465 64-bit I/O write operations.
1467 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1468 @param This Pointer to local data for the interface.
1469 @param Address The physical address of the access.
1470 @param Data The data to write.
1474 PeiDefaultIoWrite64 (
1475 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1476 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1482 8-bit memory read operations.
1484 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1487 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1488 @param This Pointer to local data for the interface.
1489 @param Address The physical address of the access.
1491 @return An 8-bit value returned from the memory space.
1496 PeiDefaultMemRead8 (
1497 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1498 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1503 16-bit memory read operations.
1505 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1508 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1509 @param This Pointer to local data for the interface.
1510 @param Address The physical address of the access.
1512 @return An 16-bit value returned from the memory space.
1517 PeiDefaultMemRead16 (
1518 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1519 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1524 32-bit memory read operations.
1526 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1529 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1530 @param This Pointer to local data for the interface.
1531 @param Address The physical address of the access.
1533 @return An 32-bit value returned from the memory space.
1538 PeiDefaultMemRead32 (
1539 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1540 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1545 64-bit memory read operations.
1547 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1550 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1551 @param This Pointer to local data for the interface.
1552 @param Address The physical address of the access.
1554 @return An 64-bit value returned from the memory space.
1559 PeiDefaultMemRead64 (
1560 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1561 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1566 8-bit memory write operations.
1568 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1569 @param This Pointer to local data for the interface.
1570 @param Address The physical address of the access.
1571 @param Data The data to write.
1576 PeiDefaultMemWrite8 (
1577 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1578 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1584 16-bit memory write operations.
1586 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1587 @param This Pointer to local data for the interface.
1588 @param Address The physical address of the access.
1589 @param Data The data to write.
1594 PeiDefaultMemWrite16 (
1595 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1596 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1602 32-bit memory write operations.
1604 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1605 @param This Pointer to local data for the interface.
1606 @param Address The physical address of the access.
1607 @param Data The data to write.
1612 PeiDefaultMemWrite32 (
1613 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1614 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1620 64-bit memory write operations.
1622 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1623 @param This Pointer to local data for the interface.
1624 @param Address The physical address of the access.
1625 @param Data The data to write.
1630 PeiDefaultMemWrite64 (
1631 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1632 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1637 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1640 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1644 Reads from a given location in the PCI configuration space.
1646 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1647 return EFI_NOT_YET_AVAILABLE.
1649 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1650 @param This Pointer to local data for the interface.
1651 @param Width The width of the access. Enumerated in bytes.
1652 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1653 @param Address The physical address of the access. The format of
1654 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1655 @param Buffer A pointer to the buffer of data.
1657 @retval EFI_SUCCESS The function completed successfully.
1658 @retval EFI_INVALID_PARAMETER The invalid access width.
1659 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1664 PeiDefaultPciCfg2Read (
1665 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1666 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1667 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1673 Write to a given location in the PCI configuration space.
1675 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1676 return EFI_NOT_YET_AVAILABLE.
1678 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1679 @param This Pointer to local data for the interface.
1680 @param Width The width of the access. Enumerated in bytes.
1681 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1682 @param Address The physical address of the access. The format of
1683 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1684 @param Buffer A pointer to the buffer of data.
1686 @retval EFI_SUCCESS The function completed successfully.
1687 @retval EFI_INVALID_PARAMETER The invalid access width.
1688 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1692 PeiDefaultPciCfg2Write (
1693 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1694 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1695 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1701 This function performs a read-modify-write operation on the contents from a given
1702 location in the PCI configuration space.
1704 @param PeiServices An indirect pointer to the PEI Services Table
1705 published by the PEI Foundation.
1706 @param This Pointer to local data for the interface.
1707 @param Width The width of the access. Enumerated in bytes. Type
1708 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
1709 @param Address The physical address of the access.
1710 @param SetBits Points to value to bitwise-OR with the read configuration value.
1711 The size of the value is determined by Width.
1712 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
1713 The size of the value is determined by Width.
1715 @retval EFI_SUCCESS The function completed successfully.
1716 @retval EFI_INVALID_PARAMETER The invalid access width.
1717 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1721 PeiDefaultPciCfg2Modify (
1722 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1723 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1724 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1730 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
1733 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
1734 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
1735 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
1738 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1742 IN PEI_CORE_INSTANCE
*PrivateData