2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include <Ppi/DxeIpl.h>
14 #include <Ppi/MemoryDiscovered.h>
15 #include <Ppi/StatusCode.h>
16 #include <Ppi/Reset.h>
17 #include <Ppi/Reset2.h>
18 #include <Ppi/FirmwareVolume.h>
19 #include <Ppi/FirmwareVolumeInfo.h>
20 #include <Ppi/FirmwareVolumeInfo2.h>
21 #include <Ppi/Decompress.h>
22 #include <Ppi/GuidedSectionExtraction.h>
23 #include <Ppi/LoadFile.h>
24 #include <Ppi/Security2.h>
25 #include <Ppi/TemporaryRamSupport.h>
26 #include <Ppi/TemporaryRamDone.h>
27 #include <Ppi/SecHobData.h>
28 #include <Ppi/PeiCoreFvLocation.h>
29 #include <Library/DebugLib.h>
30 #include <Library/PeiCoreEntryPoint.h>
31 #include <Library/BaseLib.h>
32 #include <Library/HobLib.h>
33 #include <Library/PerformanceLib.h>
34 #include <Library/PeiServicesLib.h>
35 #include <Library/ReportStatusCodeLib.h>
36 #include <Library/PeCoffLib.h>
37 #include <Library/PeCoffGetEntryPointLib.h>
38 #include <Library/BaseMemoryLib.h>
39 #include <Library/CacheMaintenanceLib.h>
40 #include <Library/PcdLib.h>
41 #include <IndustryStandard/PeImage.h>
42 #include <Library/PeiServicesTablePointerLib.h>
43 #include <Library/MemoryAllocationLib.h>
44 #include <Guid/FirmwareFileSystem2.h>
45 #include <Guid/FirmwareFileSystem3.h>
46 #include <Guid/AprioriFileName.h>
47 #include <Guid/MigratedFvInfo.h>
50 /// It is an FFS type extension used for PeiFindFileEx. It indicates current
51 /// FFS searching is for all PEIMs can be dispatched by PeiCore.
53 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
56 /// Pei Core private data structures
59 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
60 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
62 } PEI_PPI_LIST_POINTERS
;
65 /// Number of PEI_PPI_LIST_POINTERS to grow by each time we run out of room
67 #define PPI_GROWTH_STEP 64
68 #define CALLBACK_NOTIFY_GROWTH_STEP 32
69 #define DISPATCH_NOTIFY_GROWTH_STEP 8
74 UINTN LastDispatchedCount
;
76 /// MaxCount number of entries.
78 PEI_PPI_LIST_POINTERS
*PpiPtrs
;
85 /// MaxCount number of entries.
87 PEI_PPI_LIST_POINTERS
*NotifyPtrs
;
88 } PEI_CALLBACK_NOTIFY_LIST
;
93 UINTN LastDispatchedCount
;
95 /// MaxCount number of entries.
97 PEI_PPI_LIST_POINTERS
*NotifyPtrs
;
98 } PEI_DISPATCH_NOTIFY_LIST
;
101 /// PPI database structure which contains three links:
102 /// PpiList, CallbackNotifyList and DispatchNotifyList.
108 PEI_PPI_LIST PpiList
;
110 /// Notify List at dispatch level.
112 PEI_CALLBACK_NOTIFY_LIST CallbackNotifyList
;
114 /// Notify List at callback level.
116 PEI_DISPATCH_NOTIFY_LIST DispatchNotifyList
;
120 // PEI_CORE_FV_HANDLE.PeimState
121 // Do not change these values as there is code doing math to change states.
122 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
124 #define PEIM_STATE_NOT_DISPATCHED 0x00
125 #define PEIM_STATE_DISPATCHED 0x01
126 #define PEIM_STATE_REGISTER_FOR_SHADOW 0x02
127 #define PEIM_STATE_DONE 0x03
130 // Number of FV instances to grow by each time we run out of room
132 #define FV_GROWTH_STEP 8
135 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
136 EFI_PEI_FIRMWARE_VOLUME_PPI
*FvPpi
;
137 EFI_PEI_FV_HANDLE FvHandle
;
140 // Pointer to the buffer with the PeimCount number of Entries.
144 // Pointer to the buffer with the PeimCount number of Entries.
146 EFI_PEI_FILE_HANDLE
*FvFileHandles
;
148 UINT32 AuthenticationStatus
;
149 } PEI_CORE_FV_HANDLE
;
155 UINT32 AuthenticationStatus
;
156 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor
;
157 } PEI_CORE_UNKNOW_FORMAT_FV_INFO
;
159 #define CACHE_SETION_MAX_NUMBER 0x10
161 EFI_COMMON_SECTION_HEADER
*Section
[CACHE_SETION_MAX_NUMBER
];
162 VOID
*SectionData
[CACHE_SETION_MAX_NUMBER
];
163 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
164 UINT32 AuthenticationStatus
[CACHE_SETION_MAX_NUMBER
];
165 UINTN AllSectionCount
;
167 } CACHE_SECTION_DATA
;
169 #define HOLE_MAX_NUMBER 0x3
171 EFI_PHYSICAL_ADDRESS Base
;
174 BOOLEAN OffsetPositive
;
178 /// Forward declaration for PEI_CORE_INSTANCE
180 typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE
;
183 Function Pointer type for PeiCore function.
184 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
185 and location of temporary RAM, the stack location and the BFV location.
186 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
187 An empty PPI list consists of a single descriptor with the end-tag
188 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
189 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
190 that both the PEI Foundation and any modules can leverage the associated service
191 calls and/or code in these early PPIs
192 @param OldCoreData Pointer to old core data that is used to initialize the
197 (EFIAPI
*PEICORE_FUNCTION_POINTER
)(
198 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
199 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
200 IN PEI_CORE_INSTANCE
*OldCoreData
204 // Number of files to grow by each time we run out of room
206 #define TEMP_FILE_GROWTH_STEP 32
208 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
211 /// Pei Core private data structure instance
213 struct _PEI_CORE_INSTANCE
{
217 /// Point to ServiceTableShadow
219 EFI_PEI_SERVICES
*Ps
;
220 PEI_PPI_DATABASE PpiData
;
223 /// The count of FVs which contains FFS and could be dispatched by PeiCore.
228 /// The max count of FVs which contains FFS and could be dispatched by PeiCore.
233 /// Pointer to the buffer with the MaxFvCount number of entries.
234 /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.
236 PEI_CORE_FV_HANDLE
*Fv
;
239 /// Pointer to the buffer with the MaxUnknownFvInfoCount number of entries.
240 /// Each entry is for one FV which could not be dispatched by PeiCore.
242 PEI_CORE_UNKNOW_FORMAT_FV_INFO
*UnknownFvInfo
;
243 UINTN MaxUnknownFvInfoCount
;
244 UINTN UnknownFvInfoCount
;
247 /// Pointer to the buffer FvFileHandlers in PEI_CORE_FV_HANDLE specified by CurrentPeimFvCount.
249 EFI_PEI_FILE_HANDLE
*CurrentFvFileHandles
;
251 UINTN CurrentPeimFvCount
;
252 UINTN CurrentPeimCount
;
253 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
254 BOOLEAN PeimNeedingDispatch
;
255 BOOLEAN PeimDispatchOnThisPass
;
256 BOOLEAN PeimDispatcherReenter
;
257 EFI_PEI_HOB_POINTERS HobList
;
258 BOOLEAN SwitchStackSignal
;
259 BOOLEAN PeiMemoryInstalled
;
261 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
262 EFI_PEI_SERVICES ServiceTableShadow
;
263 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
264 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
265 UINT64 PhysicalMemoryLength
;
266 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
268 BOOLEAN HeapOffsetPositive
;
270 BOOLEAN StackOffsetPositive
;
272 // Information for migrating memory pages allocated in pre-memory phase.
274 HOLE_MEMORY_DATA MemoryPages
;
275 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
276 CACHE_SECTION_DATA CacheSection
;
278 // For Loading modules at fixed address feature to cache the top address below which the
279 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
280 // and Ps should not be changed since maybe user could get this top address by using the offset to Ps.
282 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
284 // The field is define for Loading modules at fixed address feature to tracker the PEI code
285 // memory range usage. It is a bit mapped array in which every bit indicates the corresponding memory page
288 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
290 // This field points to the shadowed image read function
292 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
297 // Pointer to the temp buffer with the TempPeimCount number of entries.
299 EFI_PEI_FILE_HANDLE
*TempFileHandles
;
301 // Pointer to the temp buffer with the TempPeimCount number of entries.
303 EFI_GUID
*TempFileGuid
;
306 // Temp Memory Range is not covered by PeiTempMem and Stack.
307 // Those Memory Range will be migrated into physical memory.
309 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
313 /// Pei Core Instance Data Macros
315 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
316 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
319 /// Union of temporarily used function pointers (to save stack space)
322 PEICORE_FUNCTION_POINTER PeiCore
;
323 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
324 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
325 EFI_DXE_IPL_PPI
*DxeIpl
;
326 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
327 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
329 } PEI_CORE_TEMP_POINTERS
;
332 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
333 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
335 } PEI_CORE_PARAMETERS
;
343 The entry routine to Pei Core, invoked by PeiMain during transition
344 from SEC to PEI. After switching stack in the PEI core, it will restart
345 with the old core data.
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.
350 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
351 An empty PPI list consists of a single descriptor with the end-tag
352 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
353 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
354 that both the PEI Foundation and any modules can leverage the associated service
355 calls and/or code in these early PPIs
356 @param Data Pointer to old core data that is used to initialize the
363 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
364 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
369 // Dispatcher support functions
374 This is the POSTFIX version of the dependency evaluator. When a
375 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
376 the evaluation stack. When that entry is popped from the evaluation
377 stack, the PPI is checked if it is installed. This method allows
378 some time savings as not all PPIs must be checked for certain
379 operation types (AND, OR).
382 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
383 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
384 the BNF described above and is stored in postfix notation.
386 @retval TRUE if it is a well-formed Grammar
387 @retval FALSE if the dependency expression overflows the evaluation stack
388 if the dependency expression underflows the evaluation stack
389 if the dependency expression is not a well-formed Grammar.
393 PeimDispatchReadiness (
394 IN EFI_PEI_SERVICES
**PeiServices
,
395 IN VOID
*DependencyExpression
399 Migrate a PEIM from temporary RAM to permanent memory.
401 @param PeimFileHandle Pointer to the FFS file header of the image.
402 @param MigratedFileHandle Pointer to the FFS file header of the migrated image.
404 @retval EFI_SUCCESS Sucessfully migrated the PEIM to permanent memory.
410 IN EFI_PEI_FILE_HANDLE FileHandle
,
411 IN EFI_PEI_FILE_HANDLE MigratedFileHandle
415 Migrate FVs out of temporary RAM before the cache is flushed.
417 @param Private PeiCore's private data structure
418 @param SecCoreData Points to a data structure containing information about the PEI core's operating
419 environment, such as the size and location of temporary RAM, the stack location and
422 @retval EFI_SUCCESS Successfully migrated installed FVs from temporary RAM to permanent memory.
423 @retval EFI_OUT_OF_RESOURCES Insufficient memory exists to allocate needed pages.
429 IN PEI_CORE_INSTANCE
*Private
,
430 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
434 Conduct PEIM dispatch.
436 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
437 @param PrivateData Pointer to the private data passed in from caller
442 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
443 IN PEI_CORE_INSTANCE
*PrivateData
447 Initialize the Dispatcher's data members
449 @param PrivateData PeiCore's private data structure
450 @param OldCoreData Old data from SecCore
451 NULL if being run in non-permanent memory mode.
452 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
453 and location of temporary RAM, the stack location and the BFV location.
457 InitializeDispatcherData (
458 IN PEI_CORE_INSTANCE
*PrivateData
,
459 IN PEI_CORE_INSTANCE
*OldCoreData
,
460 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
464 This routine parses the Dependency Expression, if available, and
465 decides if the module can be executed.
468 @param Private PeiCore's private data structure
469 @param FileHandle PEIM's file handle
470 @param PeimCount The index of last dispatched PEIM.
472 @retval TRUE Can be dispatched
473 @retval FALSE Cannot be dispatched
478 IN PEI_CORE_INSTANCE
*Private
,
479 IN EFI_PEI_FILE_HANDLE FileHandle
,
484 // PPI support functions
489 Initialize PPI services.
491 @param PrivateData Pointer to the PEI Core data.
492 @param OldCoreData Pointer to old PEI Core data.
493 NULL if being run in non-permanent memory mode.
497 InitializePpiServices (
498 IN PEI_CORE_INSTANCE
*PrivateData
,
499 IN PEI_CORE_INSTANCE
*OldCoreData
504 Migrate the Hob list from the temporary memory to PEI installed memory.
506 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
507 and location of temporary RAM, the stack location and the BFV location.
508 @param PrivateData Pointer to PeiCore's private data structure.
513 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
514 IN PEI_CORE_INSTANCE
*PrivateData
519 Migrate Notify Pointers inside an FV from temporary memory to permanent memory.
521 @param PrivateData Pointer to PeiCore's private data structure.
522 @param OrgFvHandle Address of FV Handle in temporary memory.
523 @param FvHandle Address of FV Handle in permanent memory.
524 @param FvSize Size of the FV.
528 ConvertPpiPointersFv (
529 IN PEI_CORE_INSTANCE
*PrivateData
,
530 IN UINTN OrgFvHandle
,
537 Migrate PPI Pointers of PEI_CORE from temporary memory to permanent memory.
539 @param PrivateData Pointer to PeiCore's private data structure.
540 @param CoreFvHandle Address of PEI_CORE FV Handle in temporary memory.
544 ConvertPeiCorePpiPointers (
545 IN PEI_CORE_INSTANCE
*PrivateData
,
546 IN PEI_CORE_FV_HANDLE
*CoreFvHandle
551 Dumps the PPI lists to debug output.
553 @param PrivateData Points to PeiCore's private instance data.
558 IN PEI_CORE_INSTANCE
*PrivateData
563 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
565 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
566 @param PpiList Pointer to PPI array that want to be installed.
568 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
569 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
570 if any PPI in PpiList is not valid
571 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
577 IN CONST EFI_PEI_SERVICES
**PeiServices
,
578 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
583 Re-Install PPI services.
585 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
586 @param OldPpi Pointer to the old PEI PPI Descriptors.
587 @param NewPpi Pointer to the new PEI PPI Descriptors.
589 @retval EFI_SUCCESS if the operation was successful
590 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
591 if NewPpi is not valid
592 @retval EFI_NOT_FOUND if the PPI was not in the database
598 IN CONST EFI_PEI_SERVICES
**PeiServices
,
599 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
600 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
605 Locate a given named PPI.
608 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
609 @param Guid Pointer to GUID of the PPI.
610 @param Instance Instance Number to discover.
611 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
612 returns a pointer to the descriptor (includes flags, etc)
613 @param Ppi Pointer to reference the found PPI
615 @retval EFI_SUCCESS if the PPI is in the database
616 @retval EFI_NOT_FOUND if the PPI is not in the database
622 IN CONST EFI_PEI_SERVICES
**PeiServices
,
623 IN CONST EFI_GUID
*Guid
,
625 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
631 Install a notification for a given PPI.
634 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
635 @param NotifyList Pointer to list of Descriptors to notify upon.
637 @retval EFI_SUCCESS if successful
638 @retval EFI_OUT_OF_RESOURCES if no space in the database
639 @retval EFI_INVALID_PARAMETER if not a good descriptor
645 IN CONST EFI_PEI_SERVICES
**PeiServices
,
646 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
651 Process the Notify List at dispatch level.
653 @param PrivateData PeiCore's private data structure.
657 ProcessDispatchNotifyList (
658 IN PEI_CORE_INSTANCE
*PrivateData
663 Process notifications.
665 @param PrivateData PeiCore's private data structure
666 @param NotifyType Type of notify to fire.
667 @param InstallStartIndex Install Beginning index.
668 @param InstallStopIndex Install Ending index.
669 @param NotifyStartIndex Notify Beginning index.
670 @param NotifyStopIndex Notify Ending index.
675 IN PEI_CORE_INSTANCE
*PrivateData
,
677 IN INTN InstallStartIndex
,
678 IN INTN InstallStopIndex
,
679 IN INTN NotifyStartIndex
,
680 IN INTN NotifyStopIndex
684 Process PpiList from SEC phase.
686 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
687 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
688 These PPI's will be installed and/or immediately signaled if they are notification type.
692 ProcessPpiListFromSec (
693 IN CONST EFI_PEI_SERVICES
**PeiServices
,
694 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
698 // Boot mode support functions
702 This service enables PEIMs to ascertain the present value of the boot mode.
704 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
705 @param BootMode A pointer to contain the value of the boot mode.
707 @retval EFI_SUCCESS The boot mode was returned successfully.
708 @retval EFI_INVALID_PARAMETER BootMode is NULL.
714 IN CONST EFI_PEI_SERVICES
**PeiServices
,
715 IN OUT EFI_BOOT_MODE
*BootMode
719 This service enables PEIMs to update the boot mode variable.
722 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
723 @param BootMode The value of the boot mode to set.
725 @return EFI_SUCCESS The value was successfully updated
731 IN CONST EFI_PEI_SERVICES
**PeiServices
,
732 IN EFI_BOOT_MODE BootMode
736 // Security support functions
741 Initialize the security services.
743 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
744 @param OldCoreData Pointer to the old core data.
745 NULL if being run in non-permanent memory mode.
749 InitializeSecurityServices (
750 IN EFI_PEI_SERVICES
**PeiServices
,
751 IN PEI_CORE_INSTANCE
*OldCoreData
755 Verify a Firmware volume.
757 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
759 @retval EFI_SUCCESS Firmware Volume is legal
760 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
765 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
769 Provide a callout to the security verification service.
771 @param PrivateData PeiCore's private data structure
772 @param VolumeHandle Handle of FV
773 @param FileHandle Handle of PEIM's FFS
774 @param AuthenticationStatus Authentication status
776 @retval EFI_SUCCESS Image is OK
777 @retval EFI_SECURITY_VIOLATION Image is illegal
778 @retval EFI_NOT_FOUND If security PPI is not installed.
782 IN PEI_CORE_INSTANCE
*PrivateData
,
783 IN EFI_PEI_FV_HANDLE VolumeHandle
,
784 IN EFI_PEI_FILE_HANDLE FileHandle
,
785 IN UINT32 AuthenticationStatus
790 Gets the pointer to the HOB List.
793 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
794 @param HobList Pointer to the HOB List.
796 @retval EFI_SUCCESS Get the pointer of HOB List
797 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
798 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
804 IN CONST EFI_PEI_SERVICES
**PeiServices
,
805 IN OUT VOID
**HobList
809 Add a new HOB to the HOB List.
811 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
812 @param Type Type of the new HOB.
813 @param Length Length of the new HOB to allocate.
814 @param Hob Pointer to the new HOB.
816 @return EFI_SUCCESS Success to create HOB.
817 @retval EFI_INVALID_PARAMETER if Hob is NULL
818 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
819 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
825 IN CONST EFI_PEI_SERVICES
**PeiServices
,
833 Builds a Handoff Information Table HOB
835 @param BootMode - Current Bootmode
836 @param MemoryBegin - Start Memory Address.
837 @param MemoryLength - Length of Memory.
839 @return EFI_SUCCESS Always success to initialize HOB.
843 PeiCoreBuildHobHandoffInfoTable (
844 IN EFI_BOOT_MODE BootMode
,
845 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
846 IN UINT64 MemoryLength
850 Install SEC HOB data to the HOB List.
852 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
853 @param SecHobList Pointer to SEC HOB List.
855 @return EFI_SUCCESS Success to install SEC HOB data.
856 @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.
860 PeiInstallSecHobData (
861 IN CONST EFI_PEI_SERVICES
**PeiServices
,
862 IN EFI_HOB_GENERIC_HEADER
*SecHobList
866 // FFS Fw Volume support functions
870 Searches for the next matching file in the firmware volume.
872 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
873 @param SearchType Filter to find only files of this type.
874 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
875 @param FvHandle Handle of firmware volume in which to search.
876 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
877 at the beginning of the firmware volume. On exit, points the file handle of the next file
878 in the volume or NULL if there are no more files.
880 @retval EFI_NOT_FOUND The file was not found.
881 @retval EFI_NOT_FOUND The header checksum was not zero.
882 @retval EFI_SUCCESS The file was found.
888 IN CONST EFI_PEI_SERVICES
**PeiServices
,
890 IN EFI_PEI_FV_HANDLE FvHandle
,
891 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
895 Go through the file to search SectionType section.
896 Search within encapsulation sections (compression and GUIDed) recursively,
897 until the match section is found.
899 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
900 @param SectionType Filter to find only section of this type.
901 @param SectionInstance Pointer to the filter to find the specific instance of section.
902 @param Section From where to search.
903 @param SectionSize The file size to search.
904 @param OutputBuffer A pointer to the discovered section, if successful.
905 NULL if section not found.
906 @param AuthenticationStatus Updated upon return to point to the authentication status for this section.
907 @param IsFfs3Fv Indicates the FV format.
909 @return EFI_NOT_FOUND The match section is not found.
910 @return EFI_SUCCESS The match section is found.
915 IN CONST EFI_PEI_SERVICES
**PeiServices
,
916 IN EFI_SECTION_TYPE SectionType
,
917 IN OUT UINTN
*SectionInstance
,
918 IN EFI_COMMON_SECTION_HEADER
*Section
,
919 IN UINTN SectionSize
,
920 OUT VOID
**OutputBuffer
,
921 OUT UINT32
*AuthenticationStatus
,
926 Searches for the next matching section within the specified file.
928 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
929 @param SectionType Filter to find only sections of this type.
930 @param FileHandle Pointer to the current file to search.
931 @param SectionData A pointer to the discovered section, if successful.
932 NULL if section not found
934 @retval EFI_NOT_FOUND The section was not found.
935 @retval EFI_SUCCESS The section was found.
940 PeiFfsFindSectionData (
941 IN CONST EFI_PEI_SERVICES
**PeiServices
,
942 IN EFI_SECTION_TYPE SectionType
,
943 IN EFI_PEI_FILE_HANDLE FileHandle
,
944 OUT VOID
**SectionData
948 Searches for the next matching section within the specified file.
950 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
951 @param SectionType The value of the section type to find.
952 @param SectionInstance Section instance to find.
953 @param FileHandle Handle of the firmware file to search.
954 @param SectionData A pointer to the discovered section, if successful.
955 @param AuthenticationStatus A pointer to the authentication status for this section.
957 @retval EFI_SUCCESS The section was found.
958 @retval EFI_NOT_FOUND The section was not found.
963 PeiFfsFindSectionData3 (
964 IN CONST EFI_PEI_SERVICES
**PeiServices
,
965 IN EFI_SECTION_TYPE SectionType
,
966 IN UINTN SectionInstance
,
967 IN EFI_PEI_FILE_HANDLE FileHandle
,
968 OUT VOID
**SectionData
,
969 OUT UINT32
*AuthenticationStatus
973 Search the firmware volumes by index
975 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
976 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
978 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
980 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
981 @retval EFI_NOT_FOUND The volume was not found.
982 @retval EFI_SUCCESS The volume was found.
987 PeiFfsFindNextVolume (
988 IN CONST EFI_PEI_SERVICES
**PeiServices
,
990 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
994 // Memory support functions
999 Initialize the memory services.
1001 @param PrivateData PeiCore's private data structure
1002 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
1003 and location of temporary RAM, the stack location and the BFV location.
1004 @param OldCoreData Pointer to the PEI Core data.
1005 NULL if being run in non-permanent memory mode.
1009 InitializeMemoryServices (
1010 IN PEI_CORE_INSTANCE
*PrivateData
,
1011 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
1012 IN PEI_CORE_INSTANCE
*OldCoreData
1017 Install the permanent memory is now available.
1018 Creates HOB (PHIT and Stack).
1020 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1021 @param MemoryBegin Start of memory address.
1022 @param MemoryLength Length of memory.
1024 @return EFI_SUCCESS Always success.
1029 PeiInstallPeiMemory (
1030 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1031 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
1032 IN UINT64 MemoryLength
1036 Migrate memory pages allocated in pre-memory phase.
1037 Copy memory pages at temporary heap top to permanent heap top.
1039 @param[in] Private Pointer to the private data passed in from caller.
1040 @param[in] TemporaryRamMigrated Temporary memory has been migrated to permanent memory.
1044 MigrateMemoryPages (
1045 IN PEI_CORE_INSTANCE
*Private
,
1046 IN BOOLEAN TemporaryRamMigrated
1050 Removes any FV HOBs whose base address is not in PEI installed memory.
1052 @param[in] Private Pointer to PeiCore's private data structure.
1056 RemoveFvHobsInTemporaryMemory (
1057 IN PEI_CORE_INSTANCE
*Private
1061 Migrate the base address in firmware volume allocation HOBs
1062 from temporary memory to PEI installed memory.
1064 @param[in] PrivateData Pointer to PeiCore's private data structure.
1065 @param[in] OrgFvHandle Address of FV Handle in temporary memory.
1066 @param[in] FvHandle Address of FV Handle in permanent memory.
1071 IN PEI_CORE_INSTANCE
*PrivateData
,
1072 IN UINTN OrgFvHandle
,
1077 Migrate MemoryBaseAddress in memory allocation HOBs
1078 from the temporary memory to PEI installed memory.
1080 @param[in] PrivateData Pointer to PeiCore's private data structure.
1084 ConvertMemoryAllocationHobs (
1085 IN PEI_CORE_INSTANCE
*PrivateData
1089 The purpose of the service is to publish an interface that allows
1090 PEIMs to allocate memory ranges that are managed by the PEI Foundation.
1092 Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.
1093 After InstallPeiMemory() is called, PEI will allocate pages within the region
1094 of memory provided by InstallPeiMemory() service in a best-effort fashion.
1095 Location-specific allocations are not managed by the PEI foundation code.
1097 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1098 @param MemoryType The type of memory to allocate.
1099 @param Pages The number of contiguous 4 KB pages to allocate.
1100 @param Memory Pointer to a physical address. On output, the address is set to the base
1101 of the page range that was allocated.
1103 @retval EFI_SUCCESS The memory range was successfully allocated.
1104 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
1105 @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,
1106 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,
1107 EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.
1113 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1114 IN EFI_MEMORY_TYPE MemoryType
,
1116 OUT EFI_PHYSICAL_ADDRESS
*Memory
1122 @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1123 @param[in] Memory The base physical address of the pages to be freed.
1124 @param[in] Pages The number of contiguous 4 KB pages to free.
1126 @retval EFI_SUCCESS The requested pages were freed.
1127 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
1128 @retval EFI_NOT_FOUND The requested memory pages were not allocated with
1135 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1136 IN EFI_PHYSICAL_ADDRESS Memory
,
1142 Memory allocation service on the temporary memory.
1145 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1146 @param Size Amount of memory required
1147 @param Buffer Address of pointer to the buffer
1149 @retval EFI_SUCCESS The allocation was successful
1150 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1151 to allocate the requested size.
1157 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1164 Routine for load image file.
1167 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1168 @param FileHandle Pointer to the FFS file header of the image.
1169 @param PeimState The dispatch state of the input PEIM handle.
1170 @param EntryPoint Pointer to entry point of specified image file for output.
1171 @param AuthenticationState Pointer to attestation authentication state of image.
1173 @retval EFI_SUCCESS Image is successfully loaded.
1174 @retval EFI_NOT_FOUND Fail to locate necessary PPI
1175 @retval Others Fail to load file.
1180 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1181 IN EFI_PEI_FILE_HANDLE FileHandle
,
1183 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1184 OUT UINT32
*AuthenticationState
1189 Core version of the Status Code reporter
1192 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1193 @param CodeType Type of Status Code.
1194 @param Value Value to output for Status Code.
1195 @param Instance Instance Number of this status code.
1196 @param CallerId ID of the caller of this status code.
1197 @param Data Optional data associated with this status code.
1199 @retval EFI_SUCCESS if status code is successfully reported
1200 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1205 PeiReportStatusCode (
1206 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1207 IN EFI_STATUS_CODE_TYPE CodeType
,
1208 IN EFI_STATUS_CODE_VALUE Value
,
1210 IN CONST EFI_GUID
*CallerId
,
1211 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1216 Core version of the Reset System
1219 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1221 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
1222 @retval EFI_DEVICE_ERROR Did not reset system.
1223 Otherwise, resets the system.
1229 IN CONST EFI_PEI_SERVICES
**PeiServices
1233 Resets the entire platform.
1235 @param[in] ResetType The type of reset to perform.
1236 @param[in] ResetStatus The status code for the reset.
1237 @param[in] DataSize The size, in bytes, of ResetData.
1238 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
1239 the data buffer starts with a Null-terminated string, optionally
1240 followed by additional binary data. The string is a description
1241 that the caller may use to further indicate the reason for the
1248 IN EFI_RESET_TYPE ResetType
,
1249 IN EFI_STATUS ResetStatus
,
1251 IN VOID
*ResetData OPTIONAL
1256 Initialize PeiCore FV List.
1259 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1260 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1265 IN PEI_CORE_INSTANCE
*PrivateData
,
1266 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1270 Process Firmware Volume Information once FvInfoPPI install.
1272 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1273 @param NotifyDescriptor Address of the notification descriptor data structure.
1274 @param Ppi Address of the PPI that was installed.
1276 @retval EFI_SUCCESS if the interface could be successfully installed
1281 FirmwareVolumeInfoPpiNotifyCallback (
1282 IN EFI_PEI_SERVICES
**PeiServices
,
1283 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1289 Given the input VolumeHandle, search for the next matching name file.
1291 @param FileName File name to search.
1292 @param VolumeHandle The current FV to search.
1293 @param FileHandle Pointer to the file matching name in VolumeHandle.
1294 NULL if file not found
1296 @retval EFI_NOT_FOUND No files matching the search criteria were found
1297 @retval EFI_SUCCESS Success to search given file
1302 PeiFfsFindFileByName (
1303 IN CONST EFI_GUID
*FileName
,
1304 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1305 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1309 Returns information about a specific file.
1311 @param FileHandle Handle of the file.
1312 @param FileInfo Upon exit, points to the file's information.
1314 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1315 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1316 @retval EFI_SUCCESS File information returned.
1322 IN EFI_PEI_FILE_HANDLE FileHandle
,
1323 OUT EFI_FV_FILE_INFO
*FileInfo
1327 Returns information about a specific file.
1329 @param FileHandle Handle of the file.
1330 @param FileInfo Upon exit, points to the file's information.
1332 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1333 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1334 @retval EFI_SUCCESS File information returned.
1339 PeiFfsGetFileInfo2 (
1340 IN EFI_PEI_FILE_HANDLE FileHandle
,
1341 OUT EFI_FV_FILE_INFO2
*FileInfo
1345 Returns information about the specified volume.
1347 @param VolumeHandle Handle of the volume.
1348 @param VolumeInfo Upon exit, points to the volume's information.
1350 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1351 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1352 @retval EFI_SUCCESS Volume information returned.
1356 PeiFfsGetVolumeInfo (
1357 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1358 OUT EFI_FV_INFO
*VolumeInfo
1362 This routine enables a PEIM to register itself for shadow when the PEI Foundation
1363 discovers permanent memory.
1365 @param FileHandle File handle of a PEIM.
1367 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1368 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1369 @retval EFI_SUCCESS Successfully to register itself.
1374 PeiRegisterForShadow (
1375 IN EFI_PEI_FILE_HANDLE FileHandle
1379 Initialize image service that install PeiLoadFilePpi.
1381 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1382 @param OldCoreData Pointer to Old PeiCore's private data.
1383 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1384 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1385 to permanent memory.
1389 InitializeImageServices (
1390 IN PEI_CORE_INSTANCE
*PrivateData
,
1391 IN PEI_CORE_INSTANCE
*OldCoreData
1395 Loads and relocates a PE/COFF image in place.
1397 @param Pe32Data The base address of the PE/COFF file that is to be loaded and relocated
1398 @param ImageAddress The base address of the relocated PE/COFF image
1400 @retval EFI_SUCCESS The file was loaded and relocated
1401 @retval Others The file not be loaded and error occurred.
1405 LoadAndRelocatePeCoffImageInPlace (
1407 IN VOID
*ImageAddress
1411 Find the PE32 Data for an FFS file.
1413 @param FileHandle Pointer to the FFS file header of the image.
1414 @param Pe32Data Pointer to a (VOID *) PE32 Data pointer.
1416 @retval EFI_SUCCESS Image is successfully loaded.
1417 @retval EFI_NOT_FOUND Fail to locate PE32 Data.
1422 IN EFI_PEI_FILE_HANDLE FileHandle
,
1427 The wrapper function of PeiLoadImageLoadImage().
1429 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1430 @param FileHandle Pointer to the FFS file header of the image.
1431 @param ImageAddressArg Pointer to PE/TE image.
1432 @param ImageSizeArg Size of PE/TE image.
1433 @param EntryPoint Pointer to entry point of specified image file for output.
1434 @param AuthenticationState Pointer to attestation authentication state of image.
1436 @return Status of PeiLoadImageLoadImage().
1441 PeiLoadImageLoadImageWrapper (
1442 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1443 IN EFI_PEI_FILE_HANDLE FileHandle
,
1444 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg OPTIONAL
,
1445 OUT UINT64
*ImageSizeArg OPTIONAL
,
1446 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1447 OUT UINT32
*AuthenticationState
1452 Provide a callback for when the security PPI is installed.
1454 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1455 @param NotifyDescriptor The descriptor for the notification event.
1456 @param Ppi Pointer to the PPI in question.
1458 @return Always success
1463 SecurityPpiNotifyCallback (
1464 IN EFI_PEI_SERVICES
**PeiServices
,
1465 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1470 Get FV image(s) from the FV type file, then install FV INFO(2) PPI, Build FV(2, 3) HOB.
1472 @param PrivateData PeiCore's private data structure
1473 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent FV image that contain this FV image.
1474 @param ParentFvFileHandle File handle of a FV type file that contain this FV image.
1476 @retval EFI_NOT_FOUND FV image can't be found.
1477 @retval EFI_SUCCESS Successfully to process it.
1478 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1479 @retval EFI_SECURITY_VIOLATION Image is illegal
1480 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1485 IN PEI_CORE_INSTANCE
*PrivateData
,
1486 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1487 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1491 Gets a PEI_CORE_FV_HANDLE instance for the next volume according to the given index.
1493 This routine also will install an instance of the FvInfo PPI for the FV HOB
1494 as defined in the PI specification.
1496 @param Private Pointer of PEI_CORE_INSTANCE
1497 @param Instance Index of the FV to search
1499 @return Instance of PEI_CORE_FV_HANDLE.
1501 PEI_CORE_FV_HANDLE
*
1502 FindNextCoreFvHandle (
1503 IN PEI_CORE_INSTANCE
*Private
,
1508 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1512 Memory-based read services.
1514 This function is to perform the Memory Access Read service based on installed
1515 instance of the EFI_PEI_CPU_IO_PPI.
1516 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1517 return EFI_NOT_YET_AVAILABLE.
1519 @param PeiServices An indirect pointer to the PEI Services Table
1520 published by the PEI Foundation.
1521 @param This Pointer to local data for the interface.
1522 @param Width The width of the access. Enumerated in bytes.
1523 @param Address The physical address of the access.
1524 @param Count The number of accesses to perform.
1525 @param Buffer A pointer to the buffer of data.
1527 @retval EFI_SUCCESS The function completed successfully.
1528 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1533 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1534 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1535 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1542 Memory-based write services.
1544 This function is to perform the Memory Access Write service based on installed
1545 instance of the EFI_PEI_CPU_IO_PPI.
1546 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1547 return EFI_NOT_YET_AVAILABLE.
1549 @param PeiServices An indirect pointer to the PEI Services Table
1550 published by the PEI Foundation.
1551 @param This Pointer to local data for the interface.
1552 @param Width The width of the access. Enumerated in bytes.
1553 @param Address The physical address of the access.
1554 @param Count The number of accesses to perform.
1555 @param Buffer A pointer to the buffer of data.
1557 @retval EFI_SUCCESS The function completed successfully.
1558 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1562 PeiDefaultMemWrite (
1563 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1564 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1565 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1572 IO-based read services.
1574 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1575 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1576 return EFI_NOT_YET_AVAILABLE.
1578 @param PeiServices An indirect pointer to the PEI Services Table
1579 published by the PEI Foundation.
1580 @param This Pointer to local data for the interface.
1581 @param Width The width of the access. Enumerated in bytes.
1582 @param Address The physical address of the access.
1583 @param Count The number of accesses to perform.
1584 @param Buffer A pointer to the buffer of data.
1586 @retval EFI_SUCCESS The function completed successfully.
1587 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1592 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1593 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1594 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1601 IO-based write services.
1603 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1604 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1605 return EFI_NOT_YET_AVAILABLE.
1607 @param PeiServices An indirect pointer to the PEI Services Table
1608 published by the PEI Foundation.
1609 @param This Pointer to local data for the interface.
1610 @param Width The width of the access. Enumerated in bytes.
1611 @param Address The physical address of the access.
1612 @param Count The number of accesses to perform.
1613 @param Buffer A pointer to the buffer of data.
1615 @retval EFI_SUCCESS The function completed successfully.
1616 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1621 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1622 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1623 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1630 8-bit I/O read operations.
1632 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1635 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1636 @param This Pointer to local data for the interface.
1637 @param Address The physical address of the access.
1639 @return An 8-bit value returned from the I/O space.
1644 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1645 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1650 Reads an 16-bit I/O port.
1652 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1655 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1656 @param This Pointer to local data for the interface.
1657 @param Address The physical address of the access.
1659 @return A 16-bit value returned from the I/O space.
1663 PeiDefaultIoRead16 (
1664 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1665 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1670 Reads an 32-bit I/O port.
1672 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1675 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1676 @param This Pointer to local data for the interface.
1677 @param Address The physical address of the access.
1679 @return A 32-bit value returned from the I/O space.
1683 PeiDefaultIoRead32 (
1684 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1685 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1690 Reads an 64-bit I/O port.
1692 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1695 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1696 @param This Pointer to local data for the interface.
1697 @param Address The physical address of the access.
1699 @return A 64-bit value returned from the I/O space.
1703 PeiDefaultIoRead64 (
1704 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1705 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1710 8-bit I/O write operations.
1712 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1713 @param This Pointer to local data for the interface.
1714 @param Address The physical address of the access.
1715 @param Data The data to write.
1719 PeiDefaultIoWrite8 (
1720 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1721 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1727 16-bit I/O write operations.
1729 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1730 @param This Pointer to local data for the interface.
1731 @param Address The physical address of the access.
1732 @param Data The data to write.
1736 PeiDefaultIoWrite16 (
1737 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1738 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1744 32-bit I/O write operations.
1746 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1747 @param This Pointer to local data for the interface.
1748 @param Address The physical address of the access.
1749 @param Data The data to write.
1753 PeiDefaultIoWrite32 (
1754 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1755 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1761 64-bit I/O write operations.
1763 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1764 @param This Pointer to local data for the interface.
1765 @param Address The physical address of the access.
1766 @param Data The data to write.
1770 PeiDefaultIoWrite64 (
1771 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1772 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1778 8-bit memory read operations.
1780 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1783 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1784 @param This Pointer to local data for the interface.
1785 @param Address The physical address of the access.
1787 @return An 8-bit value returned from the memory space.
1792 PeiDefaultMemRead8 (
1793 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1794 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1799 16-bit memory read operations.
1801 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1804 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1805 @param This Pointer to local data for the interface.
1806 @param Address The physical address of the access.
1808 @return An 16-bit value returned from the memory space.
1813 PeiDefaultMemRead16 (
1814 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1815 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1820 32-bit memory read operations.
1822 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1825 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1826 @param This Pointer to local data for the interface.
1827 @param Address The physical address of the access.
1829 @return An 32-bit value returned from the memory space.
1834 PeiDefaultMemRead32 (
1835 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1836 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1841 64-bit memory read operations.
1843 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1846 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1847 @param This Pointer to local data for the interface.
1848 @param Address The physical address of the access.
1850 @return An 64-bit value returned from the memory space.
1855 PeiDefaultMemRead64 (
1856 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1857 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1862 8-bit memory write operations.
1864 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1865 @param This Pointer to local data for the interface.
1866 @param Address The physical address of the access.
1867 @param Data The data to write.
1872 PeiDefaultMemWrite8 (
1873 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1874 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1880 16-bit memory write operations.
1882 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1883 @param This Pointer to local data for the interface.
1884 @param Address The physical address of the access.
1885 @param Data The data to write.
1890 PeiDefaultMemWrite16 (
1891 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1892 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1898 32-bit memory write operations.
1900 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1901 @param This Pointer to local data for the interface.
1902 @param Address The physical address of the access.
1903 @param Data The data to write.
1908 PeiDefaultMemWrite32 (
1909 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1910 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1916 64-bit memory write operations.
1918 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1919 @param This Pointer to local data for the interface.
1920 @param Address The physical address of the access.
1921 @param Data The data to write.
1926 PeiDefaultMemWrite64 (
1927 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1928 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1933 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1936 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1940 Reads from a given location in the PCI configuration space.
1942 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1943 return EFI_NOT_YET_AVAILABLE.
1945 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1946 @param This Pointer to local data for the interface.
1947 @param Width The width of the access. Enumerated in bytes.
1948 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1949 @param Address The physical address of the access. The format of
1950 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1951 @param Buffer A pointer to the buffer of data.
1953 @retval EFI_SUCCESS The function completed successfully.
1954 @retval EFI_INVALID_PARAMETER The invalid access width.
1955 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1960 PeiDefaultPciCfg2Read (
1961 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1962 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1963 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1969 Write to a given location in the PCI configuration space.
1971 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1972 return EFI_NOT_YET_AVAILABLE.
1974 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1975 @param This Pointer to local data for the interface.
1976 @param Width The width of the access. Enumerated in bytes.
1977 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1978 @param Address The physical address of the access. The format of
1979 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1980 @param Buffer A pointer to the buffer of data.
1982 @retval EFI_SUCCESS The function completed successfully.
1983 @retval EFI_INVALID_PARAMETER The invalid access width.
1984 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1988 PeiDefaultPciCfg2Write (
1989 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1990 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1991 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1997 This function performs a read-modify-write operation on the contents from a given
1998 location in the PCI configuration space.
2000 @param PeiServices An indirect pointer to the PEI Services Table
2001 published by the PEI Foundation.
2002 @param This Pointer to local data for the interface.
2003 @param Width The width of the access. Enumerated in bytes. Type
2004 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
2005 @param Address The physical address of the access.
2006 @param SetBits Points to value to bitwise-OR with the read configuration value.
2007 The size of the value is determined by Width.
2008 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
2009 The size of the value is determined by Width.
2011 @retval EFI_SUCCESS The function completed successfully.
2012 @retval EFI_INVALID_PARAMETER The invalid access width.
2013 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
2017 PeiDefaultPciCfg2Modify (
2018 IN CONST EFI_PEI_SERVICES
**PeiServices
,
2019 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
2020 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
2026 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
2029 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
2030 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
2031 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
2034 @param PrivateData Pointer to PEI_CORE_INSTANCE.
2038 IN PEI_CORE_INSTANCE
*PrivateData