2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2013, 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/FirmwareVolume.h>
24 #include <Ppi/FirmwareVolumeInfo.h>
25 #include <Ppi/FirmwareVolumeInfo2.h>
26 #include <Ppi/Decompress.h>
27 #include <Ppi/GuidedSectionExtraction.h>
28 #include <Ppi/LoadFile.h>
29 #include <Ppi/Security2.h>
30 #include <Ppi/TemporaryRamSupport.h>
31 #include <Ppi/TemporaryRamDone.h>
32 #include <Library/DebugLib.h>
33 #include <Library/PeiCoreEntryPoint.h>
34 #include <Library/BaseLib.h>
35 #include <Library/HobLib.h>
36 #include <Library/PerformanceLib.h>
37 #include <Library/PeiServicesLib.h>
38 #include <Library/ReportStatusCodeLib.h>
39 #include <Library/PeCoffLib.h>
40 #include <Library/PeCoffGetEntryPointLib.h>
41 #include <Library/BaseMemoryLib.h>
42 #include <Library/CacheMaintenanceLib.h>
43 #include <Library/PcdLib.h>
44 #include <IndustryStandard/PeImage.h>
45 #include <Library/PeiServicesTablePointerLib.h>
46 #include <Library/MemoryAllocationLib.h>
47 #include <Guid/FirmwareFileSystem2.h>
48 #include <Guid/FirmwareFileSystem3.h>
49 #include <Guid/AprioriFileName.h>
52 /// It is an FFS type extension used for PeiFindFileEx. It indicates current
53 /// Ffs searching is for all PEIMs can be dispatched by PeiCore.
55 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
58 /// Pei Core private data structures
61 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
62 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
64 } PEI_PPI_LIST_POINTERS
;
67 /// PPI database structure which contains two link: PpiList and NotifyList. PpiList
68 /// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.
72 /// index of end of PpiList link list.
76 /// index of end of notify link list.
80 /// index of the dispatched notify list.
84 /// index of last installed Ppi description in PpiList link list.
86 INTN LastDispatchedInstall
;
88 /// index of last dispatched notify in Notify link list.
90 INTN LastDispatchedNotify
;
94 PEI_PPI_LIST_POINTERS PpiListPtrs
[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported
)];
99 // PEI_CORE_FV_HANDE.PeimState
100 // Do not change these values as there is code doing math to change states.
101 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
103 #define PEIM_STATE_NOT_DISPATCHED 0x00
104 #define PEIM_STATE_DISPATCHED 0x01
105 #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02
106 #define PEIM_STATE_DONE 0x03
109 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
110 EFI_PEI_FIRMWARE_VOLUME_PPI
*FvPpi
;
111 EFI_PEI_FV_HANDLE FvHandle
;
112 UINT8 PeimState
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
113 EFI_PEI_FILE_HANDLE FvFileHandles
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
115 UINT32 AuthenticationStatus
;
116 } PEI_CORE_FV_HANDLE
;
122 UINT32 AuthenticationStatus
;
123 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor
;
124 } PEI_CORE_UNKNOW_FORMAT_FV_INFO
;
126 #define CACHE_SETION_MAX_NUMBER 0x10
128 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
129 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
130 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
131 UINT32 AuthenticationStatus
[CACHE_SETION_MAX_NUMBER
];
132 UINTN AllSectionCount
;
134 } CACHE_SECTION_DATA
;
136 #define HOLE_MAX_NUMBER 0x3
138 EFI_PHYSICAL_ADDRESS Base
;
141 BOOLEAN OffsetPositive
;
145 /// Forward declaration for PEI_CORE_INSTANCE
147 typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE
;
151 Function Pointer type for PeiCore function.
152 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
153 and location of temporary RAM, the stack location and the BFV location.
154 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
155 An empty PPI list consists of a single descriptor with the end-tag
156 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
157 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
158 that both the PEI Foundation and any modules can leverage the associated service
159 calls and/or code in these early PPIs
160 @param OldCoreData Pointer to old core data that is used to initialize the
165 (EFIAPI
*PEICORE_FUNCTION_POINTER
)(
166 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
167 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
168 IN PEI_CORE_INSTANCE
*OldCoreData
171 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
174 /// Pei Core private data structure instance
176 struct _PEI_CORE_INSTANCE
{
180 /// Point to ServiceTableShadow
182 EFI_PEI_SERVICES
*Ps
;
183 PEI_PPI_DATABASE PpiData
;
186 /// The count of FVs which contains FFS and could be dispatched by PeiCore.
191 /// The instance arrary for FVs which contains FFS and could be dispatched by PeiCore.
193 PEI_CORE_FV_HANDLE Fv
[FixedPcdGet32 (PcdPeiCoreMaxFvSupported
)];
194 PEI_CORE_UNKNOW_FORMAT_FV_INFO UnknownFvInfo
[FixedPcdGet32 (PcdPeiCoreMaxFvSupported
)];
195 UINTN UnknownFvInfoCount
;
197 EFI_PEI_FILE_HANDLE CurrentFvFileHandles
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
199 UINTN CurrentPeimFvCount
;
200 UINTN CurrentPeimCount
;
201 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
202 BOOLEAN PeimNeedingDispatch
;
203 BOOLEAN PeimDispatchOnThisPass
;
204 BOOLEAN PeimDispatcherReenter
;
205 EFI_PEI_HOB_POINTERS HobList
;
206 BOOLEAN SwitchStackSignal
;
207 BOOLEAN PeiMemoryInstalled
;
209 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
210 EFI_PEI_SERVICES ServiceTableShadow
;
211 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
212 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
213 UINT64 PhysicalMemoryLength
;
214 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
216 BOOLEAN HeapOffsetPositive
;
218 BOOLEAN StackOffsetPositive
;
219 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
220 CACHE_SECTION_DATA CacheSection
;
222 // For Loading modules at fixed address feature to cache the top address below which the
223 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
224 // and Ps should not be changed since maybe user could get this top address by using the offet to Ps.
226 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
228 // The field is define for Loading modules at fixed address feature to tracker the PEI code
229 // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page
232 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
234 // This field points to the shadowed image read function
236 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
238 // Temp Memory Range is not covered by PeiTempMem and Stack.
239 // Those Memory Range will be migrated into phisical memory.
241 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
245 /// Pei Core Instance Data Macros
247 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
248 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
251 /// Union of temporarily used function pointers (to save stack space)
254 PEICORE_FUNCTION_POINTER PeiCore
;
255 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
256 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
257 EFI_DXE_IPL_PPI
*DxeIpl
;
258 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
259 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
261 } PEI_CORE_TEMP_POINTERS
;
264 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
265 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
267 } PEI_CORE_PARAMETERS
;
274 The entry routine to Pei Core, invoked by PeiMain during transition
275 from SEC to PEI. After switching stack in the PEI core, it will restart
276 with the old core data.
279 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
280 and location of temporary RAM, the stack location and the BFV location.
281 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
282 An empty PPI list consists of a single descriptor with the end-tag
283 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
284 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
285 that both the PEI Foundation and any modules can leverage the associated service
286 calls and/or code in these early PPIs
287 @param Data Pointer to old core data that is used to initialize the
294 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
295 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
300 // Dispatcher support functions
305 This is the POSTFIX version of the dependency evaluator. When a
306 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
307 the evaluation stack. When that entry is poped from the evaluation
308 stack, the PPI is checked if it is installed. This method allows
309 some time savings as not all PPIs must be checked for certain
310 operation types (AND, OR).
313 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
314 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
315 the BNF described above and is stored in postfix notation.
317 @retval TRUE if it is a well-formed Grammar
318 @retval FALSE if the dependency expression overflows the evaluation stack
319 if the dependency expression underflows the evaluation stack
320 if the dependency expression is not a well-formed Grammar.
324 PeimDispatchReadiness (
325 IN EFI_PEI_SERVICES
**PeiServices
,
326 IN VOID
*DependencyExpression
330 Conduct PEIM dispatch.
332 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
333 @param PrivateData Pointer to the private data passed in from caller
338 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
339 IN PEI_CORE_INSTANCE
*PrivateData
343 Initialize the Dispatcher's data members
345 @param PrivateData PeiCore's private data structure
346 @param OldCoreData Old data from SecCore
347 NULL if being run in non-permament memory mode.
348 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
349 and location of temporary RAM, the stack location and the BFV location.
353 InitializeDispatcherData (
354 IN PEI_CORE_INSTANCE
*PrivateData
,
355 IN PEI_CORE_INSTANCE
*OldCoreData
,
356 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
360 This routine parses the Dependency Expression, if available, and
361 decides if the module can be executed.
364 @param Private PeiCore's private data structure
365 @param FileHandle PEIM's file handle
366 @param PeimCount The index of last dispatched PEIM.
368 @retval TRUE Can be dispatched
369 @retval FALSE Cannot be dispatched
374 IN PEI_CORE_INSTANCE
*Private
,
375 IN EFI_PEI_FILE_HANDLE FileHandle
,
380 // PPI support functions
384 Initialize PPI services.
386 @param PrivateData Pointer to the PEI Core data.
387 @param OldCoreData Pointer to old PEI Core data.
388 NULL if being run in non-permament memory mode.
392 InitializePpiServices (
393 IN PEI_CORE_INSTANCE
*PrivateData
,
394 IN PEI_CORE_INSTANCE
*OldCoreData
399 Migrate the Hob list from the temporary memory stack to PEI installed memory.
401 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
402 and location of temporary RAM, the stack location and the BFV location.
403 @param PrivateData Pointer to PeiCore's private data structure.
408 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
409 IN PEI_CORE_INSTANCE
*PrivateData
414 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
416 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
417 @param PpiList Pointer to ppi array that want to be installed.
419 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
420 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
421 if any PPI in PpiList is not valid
422 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
428 IN CONST EFI_PEI_SERVICES
**PeiServices
,
429 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
434 Re-Install PPI services.
436 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
437 @param OldPpi Pointer to the old PEI PPI Descriptors.
438 @param NewPpi Pointer to the new PEI PPI Descriptors.
440 @retval EFI_SUCCESS if the operation was successful
441 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
442 if NewPpi is not valid
443 @retval EFI_NOT_FOUND if the PPI was not in the database
449 IN CONST EFI_PEI_SERVICES
**PeiServices
,
450 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
451 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
456 Locate a given named PPI.
459 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
460 @param Guid Pointer to GUID of the PPI.
461 @param Instance Instance Number to discover.
462 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
463 returns a pointer to the descriptor (includes flags, etc)
464 @param Ppi Pointer to reference the found PPI
466 @retval EFI_SUCCESS if the PPI is in the database
467 @retval EFI_NOT_FOUND if the PPI is not in the database
473 IN CONST EFI_PEI_SERVICES
**PeiServices
,
474 IN CONST EFI_GUID
*Guid
,
476 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
482 Install a notification for a given PPI.
485 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
486 @param NotifyList Pointer to list of Descriptors to notify upon.
488 @retval EFI_SUCCESS if successful
489 @retval EFI_OUT_OF_RESOURCES if no space in the database
490 @retval EFI_INVALID_PARAMETER if not a good decriptor
496 IN CONST EFI_PEI_SERVICES
**PeiServices
,
497 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
502 Process the Notify List at dispatch level.
504 @param PrivateData PeiCore's private data structure.
509 IN PEI_CORE_INSTANCE
*PrivateData
514 Dispatch notifications.
516 @param PrivateData PeiCore's private data structure
517 @param NotifyType Type of notify to fire.
518 @param InstallStartIndex Install Beginning index.
519 @param InstallStopIndex Install Ending index.
520 @param NotifyStartIndex Notify Beginning index.
521 @param NotifyStopIndex Notify Ending index.
526 IN PEI_CORE_INSTANCE
*PrivateData
,
528 IN INTN InstallStartIndex
,
529 IN INTN InstallStopIndex
,
530 IN INTN NotifyStartIndex
,
531 IN INTN NotifyStopIndex
535 // Boot mode support functions
538 This service enables PEIMs to ascertain the present value of the boot mode.
540 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
541 @param BootMode A pointer to contain the value of the boot mode.
543 @retval EFI_SUCCESS The boot mode was returned successfully.
544 @retval EFI_INVALID_PARAMETER BootMode is NULL.
550 IN CONST EFI_PEI_SERVICES
**PeiServices
,
551 IN OUT EFI_BOOT_MODE
*BootMode
555 This service enables PEIMs to update the boot mode variable.
558 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
559 @param BootMode The value of the boot mode to set.
561 @return EFI_SUCCESS The value was successfully updated
567 IN CONST EFI_PEI_SERVICES
**PeiServices
,
568 IN EFI_BOOT_MODE BootMode
572 // Security support functions
576 Initialize the security services.
578 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
579 @param OldCoreData Pointer to the old core data.
580 NULL if being run in non-permament memory mode.
584 InitializeSecurityServices (
585 IN EFI_PEI_SERVICES
**PeiServices
,
586 IN PEI_CORE_INSTANCE
*OldCoreData
590 Verify a Firmware volume.
592 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
594 @retval EFI_SUCCESS Firmware Volume is legal
595 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
600 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
604 Provide a callout to the security verification service.
606 @param PrivateData PeiCore's private data structure
607 @param VolumeHandle Handle of FV
608 @param FileHandle Handle of PEIM's ffs
609 @param AuthenticationStatus Authentication status
611 @retval EFI_SUCCESS Image is OK
612 @retval EFI_SECURITY_VIOLATION Image is illegal
613 @retval EFI_NOT_FOUND If security PPI is not installed.
617 IN PEI_CORE_INSTANCE
*PrivateData
,
618 IN EFI_PEI_FV_HANDLE VolumeHandle
,
619 IN EFI_PEI_FILE_HANDLE FileHandle
,
620 IN UINT32 AuthenticationStatus
625 Gets the pointer to the HOB List.
628 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
629 @param HobList Pointer to the HOB List.
631 @retval EFI_SUCCESS Get the pointer of HOB List
632 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
633 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
639 IN CONST EFI_PEI_SERVICES
**PeiServices
,
640 IN OUT VOID
**HobList
644 Add a new HOB to the HOB List.
646 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
647 @param Type Type of the new HOB.
648 @param Length Length of the new HOB to allocate.
649 @param Hob Pointer to the new HOB.
651 @return EFI_SUCCESS Success to create hob.
652 @retval EFI_INVALID_PARAMETER if Hob is NULL
653 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
654 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
660 IN CONST EFI_PEI_SERVICES
**PeiServices
,
668 Builds a Handoff Information Table HOB
670 @param BootMode - Current Bootmode
671 @param MemoryBegin - Start Memory Address.
672 @param MemoryLength - Length of Memory.
674 @return EFI_SUCCESS Always success to initialize HOB.
678 PeiCoreBuildHobHandoffInfoTable (
679 IN EFI_BOOT_MODE BootMode
,
680 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
681 IN UINT64 MemoryLength
686 // FFS Fw Volume support functions
689 Searches for the next matching file in the firmware volume.
691 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
692 @param SearchType Filter to find only files of this type.
693 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
694 @param FvHandle Handle of firmware volume in which to search.
695 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
696 at the beginning of the firmware volume. On exit, points the file handle of the next file
697 in the volume or NULL if there are no more files.
699 @retval EFI_NOT_FOUND The file was not found.
700 @retval EFI_NOT_FOUND The header checksum was not zero.
701 @retval EFI_SUCCESS The file was found.
707 IN CONST EFI_PEI_SERVICES
**PeiServices
,
709 IN EFI_PEI_FV_HANDLE FvHandle
,
710 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
714 Searches for the next matching section within the specified file.
716 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
717 @param SectionType Filter to find only sections of this type.
718 @param FileHandle Pointer to the current file to search.
719 @param SectionData A pointer to the discovered section, if successful.
720 NULL if section not found
722 @retval EFI_NOT_FOUND The section was not found.
723 @retval EFI_SUCCESS The section was found.
728 PeiFfsFindSectionData (
729 IN CONST EFI_PEI_SERVICES
**PeiServices
,
730 IN EFI_SECTION_TYPE SectionType
,
731 IN EFI_PEI_FILE_HANDLE FileHandle
,
732 OUT VOID
**SectionData
736 Searches for the next matching section within the specified file.
738 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
739 @param SectionType The value of the section type to find.
740 @param SectionInstance Section instance to find.
741 @param FileHandle Handle of the firmware file to search.
742 @param SectionData A pointer to the discovered section, if successful.
743 @param AuthenticationStatus A pointer to the authentication status for this section.
745 @retval EFI_SUCCESS The section was found.
746 @retval EFI_NOT_FOUND The section was not found.
751 PeiFfsFindSectionData3 (
752 IN CONST EFI_PEI_SERVICES
**PeiServices
,
753 IN EFI_SECTION_TYPE SectionType
,
754 IN UINTN SectionInstance
,
755 IN EFI_PEI_FILE_HANDLE FileHandle
,
756 OUT VOID
**SectionData
,
757 OUT UINT32
*AuthenticationStatus
761 Search the firmware volumes by index
763 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
764 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
766 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
768 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
769 @retval EFI_NOT_FOUND The volume was not found.
770 @retval EFI_SUCCESS The volume was found.
775 PeiFfsFindNextVolume (
776 IN CONST EFI_PEI_SERVICES
**PeiServices
,
778 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
782 // Memory support functions
786 Initialize the memory services.
788 @param PrivateData PeiCore's private data structure
789 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
790 and location of temporary RAM, the stack location and the BFV location.
791 @param OldCoreData Pointer to the PEI Core data.
792 NULL if being run in non-permament memory mode.
796 InitializeMemoryServices (
797 IN PEI_CORE_INSTANCE
*PrivateData
,
798 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
799 IN PEI_CORE_INSTANCE
*OldCoreData
804 Install the permanent memory is now available.
805 Creates HOB (PHIT and Stack).
807 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
808 @param MemoryBegin Start of memory address.
809 @param MemoryLength Length of memory.
811 @return EFI_SUCCESS Always success.
816 PeiInstallPeiMemory (
817 IN CONST EFI_PEI_SERVICES
**PeiServices
,
818 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
819 IN UINT64 MemoryLength
824 Memory allocation service on permanent memory,
825 not usable prior to the memory installation.
828 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
829 @param MemoryType Type of memory to allocate.
830 @param Pages Number of pages to allocate.
831 @param Memory Pointer of memory allocated.
833 @retval EFI_SUCCESS The allocation was successful
834 @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
835 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available
836 @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
837 to allocate the number of pages.
843 IN CONST EFI_PEI_SERVICES
**PeiServices
,
844 IN EFI_MEMORY_TYPE MemoryType
,
846 OUT EFI_PHYSICAL_ADDRESS
*Memory
851 Memory allocation service on the temporary memory.
854 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
855 @param Size Amount of memory required
856 @param Buffer Address of pointer to the buffer
858 @retval EFI_SUCCESS The allocation was successful
859 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
860 to allocate the requested size.
866 IN CONST EFI_PEI_SERVICES
**PeiServices
,
873 Routine for load image file.
876 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
877 @param FileHandle Pointer to the FFS file header of the image.
878 @param PeimState The dispatch state of the input PEIM handle.
879 @param EntryPoint Pointer to entry point of specified image file for output.
880 @param AuthenticationState Pointer to attestation authentication state of image.
882 @retval EFI_SUCCESS Image is successfully loaded.
883 @retval EFI_NOT_FOUND Fail to locate necessary PPI
884 @retval Others Fail to load file.
889 IN CONST EFI_PEI_SERVICES
**PeiServices
,
890 IN EFI_PEI_FILE_HANDLE FileHandle
,
892 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
893 OUT UINT32
*AuthenticationState
898 Core version of the Status Code reporter
901 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
902 @param CodeType Type of Status Code.
903 @param Value Value to output for Status Code.
904 @param Instance Instance Number of this status code.
905 @param CallerId ID of the caller of this status code.
906 @param Data Optional data associated with this status code.
908 @retval EFI_SUCCESS if status code is successfully reported
909 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
914 PeiReportStatusCode (
915 IN CONST EFI_PEI_SERVICES
**PeiServices
,
916 IN EFI_STATUS_CODE_TYPE CodeType
,
917 IN EFI_STATUS_CODE_VALUE Value
,
919 IN CONST EFI_GUID
*CallerId
,
920 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
925 Core version of the Reset System
928 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
930 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
931 @retval EFI_DEVICE_ERROR Did not reset system.
932 Otherwise, resets the system.
938 IN CONST EFI_PEI_SERVICES
**PeiServices
943 Initialize PeiCore Fv List.
946 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
947 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
952 IN PEI_CORE_INSTANCE
*PrivateData
,
953 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
957 Process Firmware Volum Information once FvInfoPPI install.
959 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
960 @param NotifyDescriptor Address of the notification descriptor data structure.
961 @param Ppi Address of the PPI that was installed.
963 @retval EFI_SUCCESS if the interface could be successfully installed
968 FirmwareVolmeInfoPpiNotifyCallback (
969 IN EFI_PEI_SERVICES
**PeiServices
,
970 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
976 Given the input VolumeHandle, search for the next matching name file.
978 @param FileName File name to search.
979 @param VolumeHandle The current FV to search.
980 @param FileHandle Pointer to the file matching name in VolumeHandle.
981 NULL if file not found
983 @retval EFI_NOT_FOUND No files matching the search criteria were found
984 @retval EFI_SUCCESS Success to search given file
989 PeiFfsFindFileByName (
990 IN CONST EFI_GUID
*FileName
,
991 IN EFI_PEI_FV_HANDLE VolumeHandle
,
992 OUT EFI_PEI_FILE_HANDLE
*FileHandle
996 Returns information about a specific file.
998 @param FileHandle Handle of the file.
999 @param FileInfo Upon exit, points to the file's information.
1001 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1002 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1003 @retval EFI_SUCCESS File information returned.
1009 IN EFI_PEI_FILE_HANDLE FileHandle
,
1010 OUT EFI_FV_FILE_INFO
*FileInfo
1014 Returns information about a specific file.
1016 @param FileHandle Handle of the file.
1017 @param FileInfo Upon exit, points to the file's information.
1019 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1020 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1021 @retval EFI_SUCCESS File information returned.
1026 PeiFfsGetFileInfo2 (
1027 IN EFI_PEI_FILE_HANDLE FileHandle
,
1028 OUT EFI_FV_FILE_INFO2
*FileInfo
1032 Returns information about the specified volume.
1034 @param VolumeHandle Handle of the volume.
1035 @param VolumeInfo Upon exit, points to the volume's information.
1037 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1038 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1039 @retval EFI_SUCCESS Volume information returned.
1043 PeiFfsGetVolumeInfo (
1044 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1045 OUT EFI_FV_INFO
*VolumeInfo
1049 This routine enable a PEIM to register itself to shadow when PEI Foundation
1050 discovery permanent memory.
1052 @param FileHandle File handle of a PEIM.
1054 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1055 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1056 @retval EFI_SUCCESS Successfully to register itself.
1061 PeiRegisterForShadow (
1062 IN EFI_PEI_FILE_HANDLE FileHandle
1066 Initialize image service that install PeiLoadFilePpi.
1068 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1069 @param OldCoreData Pointer to Old PeiCore's private data.
1070 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1071 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1072 to permenent memory.
1076 InitializeImageServices (
1077 IN PEI_CORE_INSTANCE
*PrivateData
,
1078 IN PEI_CORE_INSTANCE
*OldCoreData
1082 The wrapper function of PeiLoadImageLoadImage().
1084 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1085 @param FileHandle Pointer to the FFS file header of the image.
1086 @param ImageAddressArg Pointer to PE/TE image.
1087 @param ImageSizeArg Size of PE/TE image.
1088 @param EntryPoint Pointer to entry point of specified image file for output.
1089 @param AuthenticationState Pointer to attestation authentication state of image.
1091 @return Status of PeiLoadImageLoadImage().
1096 PeiLoadImageLoadImageWrapper (
1097 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1098 IN EFI_PEI_FILE_HANDLE FileHandle
,
1099 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1100 OUT UINT64
*ImageSizeArg
, OPTIONAL
1101 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1102 OUT UINT32
*AuthenticationState
1107 Provide a callback for when the security PPI is installed.
1109 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1110 @param NotifyDescriptor The descriptor for the notification event.
1111 @param Ppi Pointer to the PPI in question.
1113 @return Always success
1118 SecurityPpiNotifyCallback (
1119 IN EFI_PEI_SERVICES
**PeiServices
,
1120 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1125 Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV hob.
1127 @param PrivateData PeiCore's private data structure
1128 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
1129 @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
1131 @retval EFI_NOT_FOUND FV image can't be found.
1132 @retval EFI_SUCCESS Successfully to process it.
1133 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1134 @retval EFI_SECURITY_VIOLATION Image is illegal
1135 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1140 IN PEI_CORE_INSTANCE
*PrivateData
,
1141 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1142 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1146 Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
1148 This routine also will install FvInfo ppi for FV hob in PI ways.
1150 @param Private Pointer of PEI_CORE_INSTANCE
1151 @param Instance The index of FV want to be searched.
1153 @return Instance of PEI_CORE_FV_HANDLE.
1155 PEI_CORE_FV_HANDLE
*
1156 FindNextCoreFvHandle (
1157 IN PEI_CORE_INSTANCE
*Private
,
1162 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1166 Memory-based read services.
1168 This function is to perform the Memory Access Read service based on installed
1169 instance of the EFI_PEI_CPU_IO_PPI.
1170 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1171 return EFI_NOT_YET_AVAILABLE.
1173 @param PeiServices An indirect pointer to the PEI Services Table
1174 published by the PEI Foundation.
1175 @param This Pointer to local data for the interface.
1176 @param Width The width of the access. Enumerated in bytes.
1177 @param Address The physical address of the access.
1178 @param Count The number of accesses to perform.
1179 @param Buffer A pointer to the buffer of data.
1181 @retval EFI_SUCCESS The function completed successfully.
1182 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1187 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1188 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1189 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1196 Memory-based write services.
1198 This function is to perform the Memory Access Write service based on installed
1199 instance of the EFI_PEI_CPU_IO_PPI.
1200 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1201 return EFI_NOT_YET_AVAILABLE.
1203 @param PeiServices An indirect pointer to the PEI Services Table
1204 published by the PEI Foundation.
1205 @param This Pointer to local data for the interface.
1206 @param Width The width of the access. Enumerated in bytes.
1207 @param Address The physical address of the access.
1208 @param Count The number of accesses to perform.
1209 @param Buffer A pointer to the buffer of data.
1211 @retval EFI_SUCCESS The function completed successfully.
1212 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1216 PeiDefaultMemWrite (
1217 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1218 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1219 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1226 IO-based read services.
1228 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1229 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1230 return EFI_NOT_YET_AVAILABLE.
1232 @param PeiServices An indirect pointer to the PEI Services Table
1233 published by the PEI Foundation.
1234 @param This Pointer to local data for the interface.
1235 @param Width The width of the access. Enumerated in bytes.
1236 @param Address The physical address of the access.
1237 @param Count The number of accesses to perform.
1238 @param Buffer A pointer to the buffer of data.
1240 @retval EFI_SUCCESS The function completed successfully.
1241 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1246 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1247 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1248 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1255 IO-based write services.
1257 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1258 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1259 return EFI_NOT_YET_AVAILABLE.
1261 @param PeiServices An indirect pointer to the PEI Services Table
1262 published by the PEI Foundation.
1263 @param This Pointer to local data for the interface.
1264 @param Width The width of the access. Enumerated in bytes.
1265 @param Address The physical address of the access.
1266 @param Count The number of accesses to perform.
1267 @param Buffer A pointer to the buffer of data.
1269 @retval EFI_SUCCESS The function completed successfully.
1270 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1275 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1276 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1277 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1284 8-bit I/O read operations.
1286 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1289 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1290 @param This Pointer to local data for the interface.
1291 @param Address The physical address of the access.
1293 @return An 8-bit value returned from the I/O space.
1298 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1299 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1304 Reads an 16-bit I/O port.
1306 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1309 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1310 @param This Pointer to local data for the interface.
1311 @param Address The physical address of the access.
1313 @return A 16-bit value returned from the I/O space.
1317 PeiDefaultIoRead16 (
1318 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1319 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1324 Reads an 32-bit I/O port.
1326 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1329 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1330 @param This Pointer to local data for the interface.
1331 @param Address The physical address of the access.
1333 @return A 32-bit value returned from the I/O space.
1337 PeiDefaultIoRead32 (
1338 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1339 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1344 Reads an 64-bit I/O port.
1346 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1349 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1350 @param This Pointer to local data for the interface.
1351 @param Address The physical address of the access.
1353 @return A 64-bit value returned from the I/O space.
1357 PeiDefaultIoRead64 (
1358 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1359 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1364 8-bit I/O write operations.
1366 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1367 @param This Pointer to local data for the interface.
1368 @param Address The physical address of the access.
1369 @param Data The data to write.
1373 PeiDefaultIoWrite8 (
1374 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1375 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1381 16-bit I/O write operations.
1383 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1384 @param This Pointer to local data for the interface.
1385 @param Address The physical address of the access.
1386 @param Data The data to write.
1390 PeiDefaultIoWrite16 (
1391 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1392 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1398 32-bit I/O write operations.
1400 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1401 @param This Pointer to local data for the interface.
1402 @param Address The physical address of the access.
1403 @param Data The data to write.
1407 PeiDefaultIoWrite32 (
1408 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1409 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1415 64-bit I/O write operations.
1417 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1418 @param This Pointer to local data for the interface.
1419 @param Address The physical address of the access.
1420 @param Data The data to write.
1424 PeiDefaultIoWrite64 (
1425 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1426 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1432 8-bit memory read operations.
1434 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1437 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1438 @param This Pointer to local data for the interface.
1439 @param Address The physical address of the access.
1441 @return An 8-bit value returned from the memory space.
1446 PeiDefaultMemRead8 (
1447 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1448 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1453 16-bit memory read operations.
1455 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1458 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1459 @param This Pointer to local data for the interface.
1460 @param Address The physical address of the access.
1462 @return An 16-bit value returned from the memory space.
1467 PeiDefaultMemRead16 (
1468 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1469 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1474 32-bit memory read operations.
1476 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1479 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1480 @param This Pointer to local data for the interface.
1481 @param Address The physical address of the access.
1483 @return An 32-bit value returned from the memory space.
1488 PeiDefaultMemRead32 (
1489 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1490 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1495 64-bit memory read operations.
1497 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1500 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1501 @param This Pointer to local data for the interface.
1502 @param Address The physical address of the access.
1504 @return An 64-bit value returned from the memory space.
1509 PeiDefaultMemRead64 (
1510 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1511 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1516 8-bit memory write operations.
1518 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1519 @param This Pointer to local data for the interface.
1520 @param Address The physical address of the access.
1521 @param Data The data to write.
1526 PeiDefaultMemWrite8 (
1527 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1528 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1534 16-bit memory write operations.
1536 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1537 @param This Pointer to local data for the interface.
1538 @param Address The physical address of the access.
1539 @param Data The data to write.
1544 PeiDefaultMemWrite16 (
1545 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1546 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1552 32-bit memory write operations.
1554 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1555 @param This Pointer to local data for the interface.
1556 @param Address The physical address of the access.
1557 @param Data The data to write.
1562 PeiDefaultMemWrite32 (
1563 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1564 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1570 64-bit memory write operations.
1572 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1573 @param This Pointer to local data for the interface.
1574 @param Address The physical address of the access.
1575 @param Data The data to write.
1580 PeiDefaultMemWrite64 (
1581 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1582 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1587 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1590 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1594 Reads from a given location in the PCI configuration space.
1596 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1597 return EFI_NOT_YET_AVAILABLE.
1599 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1600 @param This Pointer to local data for the interface.
1601 @param Width The width of the access. Enumerated in bytes.
1602 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1603 @param Address The physical address of the access. The format of
1604 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1605 @param Buffer A pointer to the buffer of data.
1607 @retval EFI_SUCCESS The function completed successfully.
1608 @retval EFI_INVALID_PARAMETER The invalid access width.
1609 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1614 PeiDefaultPciCfg2Read (
1615 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1616 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1617 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1623 Write to a given location in the PCI configuration space.
1625 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1626 return EFI_NOT_YET_AVAILABLE.
1628 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1629 @param This Pointer to local data for the interface.
1630 @param Width The width of the access. Enumerated in bytes.
1631 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1632 @param Address The physical address of the access. The format of
1633 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1634 @param Buffer A pointer to the buffer of data.
1636 @retval EFI_SUCCESS The function completed successfully.
1637 @retval EFI_INVALID_PARAMETER The invalid access width.
1638 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1642 PeiDefaultPciCfg2Write (
1643 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1644 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1645 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1651 This function performs a read-modify-write operation on the contents from a given
1652 location in the PCI configuration space.
1654 @param PeiServices An indirect pointer to the PEI Services Table
1655 published by the PEI Foundation.
1656 @param This Pointer to local data for the interface.
1657 @param Width The width of the access. Enumerated in bytes. Type
1658 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
1659 @param Address The physical address of the access.
1660 @param SetBits Points to value to bitwise-OR with the read configuration value.
1661 The size of the value is determined by Width.
1662 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
1663 The size of the value is determined by Width.
1665 @retval EFI_SUCCESS The function completed successfully.
1666 @retval EFI_INVALID_PARAMETER The invalid access width.
1667 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1671 PeiDefaultPciCfg2Modify (
1672 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1673 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1674 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1680 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
1683 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
1684 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
1685 PrivateData->Fv[] array should be fixed up to be pointed to the one in permenant
1688 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1692 IN PEI_CORE_INSTANCE
*PrivateData