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>
49 /// It is an FFS type extension used for PeiFindFileEx. It indicates current
50 /// FFS searching is for all PEIMs can be dispatched by PeiCore.
52 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
55 /// Pei Core private data structures
58 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
59 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
61 } PEI_PPI_LIST_POINTERS
;
64 /// Number of PEI_PPI_LIST_POINTERS to grow by each time we run out of room
66 #define PPI_GROWTH_STEP 64
67 #define CALLBACK_NOTIFY_GROWTH_STEP 32
68 #define DISPATCH_NOTIFY_GROWTH_STEP 8
73 UINTN LastDispatchedCount
;
75 /// MaxCount number of entries.
77 PEI_PPI_LIST_POINTERS
*PpiPtrs
;
84 /// MaxCount number of entries.
86 PEI_PPI_LIST_POINTERS
*NotifyPtrs
;
87 } PEI_CALLBACK_NOTIFY_LIST
;
92 UINTN LastDispatchedCount
;
94 /// MaxCount number of entries.
96 PEI_PPI_LIST_POINTERS
*NotifyPtrs
;
97 } PEI_DISPATCH_NOTIFY_LIST
;
100 /// PPI database structure which contains three links:
101 /// PpiList, CallbackNotifyList and DispatchNotifyList.
107 PEI_PPI_LIST PpiList
;
109 /// Notify List at dispatch level.
111 PEI_CALLBACK_NOTIFY_LIST CallbackNotifyList
;
113 /// Notify List at callback level.
115 PEI_DISPATCH_NOTIFY_LIST DispatchNotifyList
;
119 // PEI_CORE_FV_HANDLE.PeimState
120 // Do not change these values as there is code doing math to change states.
121 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
123 #define PEIM_STATE_NOT_DISPATCHED 0x00
124 #define PEIM_STATE_DISPATCHED 0x01
125 #define PEIM_STATE_REGISTER_FOR_SHADOW 0x02
126 #define PEIM_STATE_DONE 0x03
129 // Number of FV instances to grow by each time we run out of room
131 #define FV_GROWTH_STEP 8
134 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
135 EFI_PEI_FIRMWARE_VOLUME_PPI
*FvPpi
;
136 EFI_PEI_FV_HANDLE FvHandle
;
139 // Pointer to the buffer with the PeimCount number of Entries.
143 // Pointer to the buffer with the PeimCount number of Entries.
145 EFI_PEI_FILE_HANDLE
*FvFileHandles
;
147 UINT32 AuthenticationStatus
;
148 } PEI_CORE_FV_HANDLE
;
154 UINT32 AuthenticationStatus
;
155 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor
;
156 } PEI_CORE_UNKNOW_FORMAT_FV_INFO
;
158 #define CACHE_SETION_MAX_NUMBER 0x10
160 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
161 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
162 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
163 UINT32 AuthenticationStatus
[CACHE_SETION_MAX_NUMBER
];
164 UINTN AllSectionCount
;
166 } CACHE_SECTION_DATA
;
168 #define HOLE_MAX_NUMBER 0x3
170 EFI_PHYSICAL_ADDRESS Base
;
173 BOOLEAN OffsetPositive
;
177 /// Forward declaration for PEI_CORE_INSTANCE
179 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
;
342 The entry routine to Pei Core, invoked by PeiMain during transition
343 from SEC to PEI. After switching stack in the PEI core, it will restart
344 with the old core data.
347 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
348 and location of temporary RAM, the stack location and the BFV location.
349 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
350 An empty PPI list consists of a single descriptor with the end-tag
351 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
352 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
353 that both the PEI Foundation and any modules can leverage the associated service
354 calls and/or code in these early PPIs
355 @param Data Pointer to old core data that is used to initialize the
362 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
363 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
368 // Dispatcher support functions
373 This is the POSTFIX version of the dependency evaluator. When a
374 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
375 the evaluation stack. When that entry is popped from the evaluation
376 stack, the PPI is checked if it is installed. This method allows
377 some time savings as not all PPIs must be checked for certain
378 operation types (AND, OR).
381 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
382 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
383 the BNF described above and is stored in postfix notation.
385 @retval TRUE if it is a well-formed Grammar
386 @retval FALSE if the dependency expression overflows the evaluation stack
387 if the dependency expression underflows the evaluation stack
388 if the dependency expression is not a well-formed Grammar.
392 PeimDispatchReadiness (
393 IN EFI_PEI_SERVICES
**PeiServices
,
394 IN VOID
*DependencyExpression
398 Migrate a PEIM from temporary RAM to permanent memory.
400 @param PeimFileHandle Pointer to the FFS file header of the image.
401 @param MigratedFileHandle Pointer to the FFS file header of the migrated image.
403 @retval EFI_SUCCESS Sucessfully migrated the PEIM to permanent memory.
409 IN EFI_PEI_FILE_HANDLE FileHandle
,
410 IN EFI_PEI_FILE_HANDLE MigratedFileHandle
414 Migrate FVs out of temporary RAM before the cache is flushed.
416 @param Private PeiCore's private data structure
417 @param SecCoreData Points to a data structure containing information about the PEI core's operating
418 environment, such as the size and location of temporary RAM, the stack location and
421 @retval EFI_SUCCESS Succesfully migrated installed FVs from temporary RAM to permanent memory.
422 @retval EFI_OUT_OF_RESOURCES Insufficient memory exists to allocate needed pages.
428 IN PEI_CORE_INSTANCE
*Private
,
429 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
433 Conduct PEIM dispatch.
435 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
436 @param PrivateData Pointer to the private data passed in from caller
441 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
442 IN PEI_CORE_INSTANCE
*PrivateData
446 Initialize the Dispatcher's data members
448 @param PrivateData PeiCore's private data structure
449 @param OldCoreData Old data from SecCore
450 NULL if being run in non-permanent memory mode.
451 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
452 and location of temporary RAM, the stack location and the BFV location.
456 InitializeDispatcherData (
457 IN PEI_CORE_INSTANCE
*PrivateData
,
458 IN PEI_CORE_INSTANCE
*OldCoreData
,
459 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
463 This routine parses the Dependency Expression, if available, and
464 decides if the module can be executed.
467 @param Private PeiCore's private data structure
468 @param FileHandle PEIM's file handle
469 @param PeimCount The index of last dispatched PEIM.
471 @retval TRUE Can be dispatched
472 @retval FALSE Cannot be dispatched
477 IN PEI_CORE_INSTANCE
*Private
,
478 IN EFI_PEI_FILE_HANDLE FileHandle
,
483 // PPI support functions
487 Initialize PPI services.
489 @param PrivateData Pointer to the PEI Core data.
490 @param OldCoreData Pointer to old PEI Core data.
491 NULL if being run in non-permanent memory mode.
495 InitializePpiServices (
496 IN PEI_CORE_INSTANCE
*PrivateData
,
497 IN PEI_CORE_INSTANCE
*OldCoreData
502 Migrate the Hob list from the temporary memory to PEI installed memory.
504 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
505 and location of temporary RAM, the stack location and the BFV location.
506 @param PrivateData Pointer to PeiCore's private data structure.
511 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
512 IN PEI_CORE_INSTANCE
*PrivateData
517 Migrate Notify Pointers inside an FV from temporary memory to permanent memory.
519 @param PrivateData Pointer to PeiCore's private data structure.
520 @param OrgFvHandle Address of FV Handle in temporary memory.
521 @param FvHandle Address of FV Handle in permanent memory.
522 @param FvSize Size of the FV.
526 ConvertPpiPointersFv (
527 IN PEI_CORE_INSTANCE
*PrivateData
,
528 IN UINTN OrgFvHandle
,
535 Migrate PPI Pointers of PEI_CORE from temporary memory to permanent memory.
537 @param PrivateData Pointer to PeiCore's private data structure.
538 @param CoreFvHandle Address of PEI_CORE FV Handle in temporary memory.
542 ConvertPeiCorePpiPointers (
543 IN PEI_CORE_INSTANCE
*PrivateData
,
544 PEI_CORE_FV_HANDLE CoreFvHandle
549 Dumps the PPI lists to debug output.
551 @param PrivateData Points to PeiCore's private instance data.
556 IN PEI_CORE_INSTANCE
*PrivateData
561 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
563 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
564 @param PpiList Pointer to PPI array that want to be installed.
566 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
567 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
568 if any PPI in PpiList is not valid
569 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
575 IN CONST EFI_PEI_SERVICES
**PeiServices
,
576 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
581 Re-Install PPI services.
583 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
584 @param OldPpi Pointer to the old PEI PPI Descriptors.
585 @param NewPpi Pointer to the new PEI PPI Descriptors.
587 @retval EFI_SUCCESS if the operation was successful
588 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
589 if NewPpi is not valid
590 @retval EFI_NOT_FOUND if the PPI was not in the database
596 IN CONST EFI_PEI_SERVICES
**PeiServices
,
597 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
598 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
603 Locate a given named PPI.
606 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
607 @param Guid Pointer to GUID of the PPI.
608 @param Instance Instance Number to discover.
609 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
610 returns a pointer to the descriptor (includes flags, etc)
611 @param Ppi Pointer to reference the found PPI
613 @retval EFI_SUCCESS if the PPI is in the database
614 @retval EFI_NOT_FOUND if the PPI is not in the database
620 IN CONST EFI_PEI_SERVICES
**PeiServices
,
621 IN CONST EFI_GUID
*Guid
,
623 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
629 Install a notification for a given PPI.
632 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
633 @param NotifyList Pointer to list of Descriptors to notify upon.
635 @retval EFI_SUCCESS if successful
636 @retval EFI_OUT_OF_RESOURCES if no space in the database
637 @retval EFI_INVALID_PARAMETER if not a good descriptor
643 IN CONST EFI_PEI_SERVICES
**PeiServices
,
644 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
649 Process the Notify List at dispatch level.
651 @param PrivateData PeiCore's private data structure.
655 ProcessDispatchNotifyList (
656 IN PEI_CORE_INSTANCE
*PrivateData
661 Process notifications.
663 @param PrivateData PeiCore's private data structure
664 @param NotifyType Type of notify to fire.
665 @param InstallStartIndex Install Beginning index.
666 @param InstallStopIndex Install Ending index.
667 @param NotifyStartIndex Notify Beginning index.
668 @param NotifyStopIndex Notify Ending index.
673 IN PEI_CORE_INSTANCE
*PrivateData
,
675 IN INTN InstallStartIndex
,
676 IN INTN InstallStopIndex
,
677 IN INTN NotifyStartIndex
,
678 IN INTN NotifyStopIndex
682 Process PpiList from SEC phase.
684 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
685 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
686 These PPI's will be installed and/or immediately signaled if they are notification type.
690 ProcessPpiListFromSec (
691 IN CONST EFI_PEI_SERVICES
**PeiServices
,
692 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
696 // Boot mode support functions
699 This service enables PEIMs to ascertain the present value of the boot mode.
701 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
702 @param BootMode A pointer to contain the value of the boot mode.
704 @retval EFI_SUCCESS The boot mode was returned successfully.
705 @retval EFI_INVALID_PARAMETER BootMode is NULL.
711 IN CONST EFI_PEI_SERVICES
**PeiServices
,
712 IN OUT EFI_BOOT_MODE
*BootMode
716 This service enables PEIMs to update the boot mode variable.
719 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
720 @param BootMode The value of the boot mode to set.
722 @return EFI_SUCCESS The value was successfully updated
728 IN CONST EFI_PEI_SERVICES
**PeiServices
,
729 IN EFI_BOOT_MODE BootMode
733 // Security support functions
737 Initialize the security services.
739 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
740 @param OldCoreData Pointer to the old core data.
741 NULL if being run in non-permanent memory mode.
745 InitializeSecurityServices (
746 IN EFI_PEI_SERVICES
**PeiServices
,
747 IN PEI_CORE_INSTANCE
*OldCoreData
751 Verify a Firmware volume.
753 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
755 @retval EFI_SUCCESS Firmware Volume is legal
756 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
761 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
765 Provide a callout to the security verification service.
767 @param PrivateData PeiCore's private data structure
768 @param VolumeHandle Handle of FV
769 @param FileHandle Handle of PEIM's FFS
770 @param AuthenticationStatus Authentication status
772 @retval EFI_SUCCESS Image is OK
773 @retval EFI_SECURITY_VIOLATION Image is illegal
774 @retval EFI_NOT_FOUND If security PPI is not installed.
778 IN PEI_CORE_INSTANCE
*PrivateData
,
779 IN EFI_PEI_FV_HANDLE VolumeHandle
,
780 IN EFI_PEI_FILE_HANDLE FileHandle
,
781 IN UINT32 AuthenticationStatus
786 Gets the pointer to the HOB List.
789 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
790 @param HobList Pointer to the HOB List.
792 @retval EFI_SUCCESS Get the pointer of HOB List
793 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
794 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
800 IN CONST EFI_PEI_SERVICES
**PeiServices
,
801 IN OUT VOID
**HobList
805 Add a new HOB to the HOB List.
807 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
808 @param Type Type of the new HOB.
809 @param Length Length of the new HOB to allocate.
810 @param Hob Pointer to the new HOB.
812 @return EFI_SUCCESS Success to create HOB.
813 @retval EFI_INVALID_PARAMETER if Hob is NULL
814 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
815 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
821 IN CONST EFI_PEI_SERVICES
**PeiServices
,
829 Builds a Handoff Information Table HOB
831 @param BootMode - Current Bootmode
832 @param MemoryBegin - Start Memory Address.
833 @param MemoryLength - Length of Memory.
835 @return EFI_SUCCESS Always success to initialize HOB.
839 PeiCoreBuildHobHandoffInfoTable (
840 IN EFI_BOOT_MODE BootMode
,
841 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
842 IN UINT64 MemoryLength
846 Install SEC HOB data to the HOB List.
848 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
849 @param SecHobList Pointer to SEC HOB List.
851 @return EFI_SUCCESS Success to install SEC HOB data.
852 @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.
856 PeiInstallSecHobData (
857 IN CONST EFI_PEI_SERVICES
**PeiServices
,
858 IN EFI_HOB_GENERIC_HEADER
*SecHobList
863 // FFS Fw Volume support functions
866 Searches for the next matching file in the firmware volume.
868 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
869 @param SearchType Filter to find only files of this type.
870 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
871 @param FvHandle Handle of firmware volume in which to search.
872 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
873 at the beginning of the firmware volume. On exit, points the file handle of the next file
874 in the volume or NULL if there are no more files.
876 @retval EFI_NOT_FOUND The file was not found.
877 @retval EFI_NOT_FOUND The header checksum was not zero.
878 @retval EFI_SUCCESS The file was found.
884 IN CONST EFI_PEI_SERVICES
**PeiServices
,
886 IN EFI_PEI_FV_HANDLE FvHandle
,
887 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
891 Go through the file to search SectionType section.
892 Search within encapsulation sections (compression and GUIDed) recursively,
893 until the match section is found.
895 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
896 @param SectionType Filter to find only section of this type.
897 @param SectionInstance Pointer to the filter to find the specific instance of section.
898 @param Section From where to search.
899 @param SectionSize The file size to search.
900 @param OutputBuffer A pointer to the discovered section, if successful.
901 NULL if section not found.
902 @param AuthenticationStatus Updated upon return to point to the authentication status for this section.
903 @param IsFfs3Fv Indicates the FV format.
905 @return EFI_NOT_FOUND The match section is not found.
906 @return EFI_SUCCESS The match section is found.
911 IN CONST EFI_PEI_SERVICES
**PeiServices
,
912 IN EFI_SECTION_TYPE SectionType
,
913 IN OUT UINTN
*SectionInstance
,
914 IN EFI_COMMON_SECTION_HEADER
*Section
,
915 IN UINTN SectionSize
,
916 OUT VOID
**OutputBuffer
,
917 OUT UINT32
*AuthenticationStatus
,
922 Searches for the next matching section within the specified file.
924 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
925 @param SectionType Filter to find only sections of this type.
926 @param FileHandle Pointer to the current file to search.
927 @param SectionData A pointer to the discovered section, if successful.
928 NULL if section not found
930 @retval EFI_NOT_FOUND The section was not found.
931 @retval EFI_SUCCESS The section was found.
936 PeiFfsFindSectionData (
937 IN CONST EFI_PEI_SERVICES
**PeiServices
,
938 IN EFI_SECTION_TYPE SectionType
,
939 IN EFI_PEI_FILE_HANDLE FileHandle
,
940 OUT VOID
**SectionData
944 Searches for the next matching section within the specified file.
946 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
947 @param SectionType The value of the section type to find.
948 @param SectionInstance Section instance to find.
949 @param FileHandle Handle of the firmware file to search.
950 @param SectionData A pointer to the discovered section, if successful.
951 @param AuthenticationStatus A pointer to the authentication status for this section.
953 @retval EFI_SUCCESS The section was found.
954 @retval EFI_NOT_FOUND The section was not found.
959 PeiFfsFindSectionData3 (
960 IN CONST EFI_PEI_SERVICES
**PeiServices
,
961 IN EFI_SECTION_TYPE SectionType
,
962 IN UINTN SectionInstance
,
963 IN EFI_PEI_FILE_HANDLE FileHandle
,
964 OUT VOID
**SectionData
,
965 OUT UINT32
*AuthenticationStatus
969 Search the firmware volumes by index
971 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
972 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
974 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
976 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
977 @retval EFI_NOT_FOUND The volume was not found.
978 @retval EFI_SUCCESS The volume was found.
983 PeiFfsFindNextVolume (
984 IN CONST EFI_PEI_SERVICES
**PeiServices
,
986 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
990 // Memory support functions
994 Initialize the memory services.
996 @param PrivateData PeiCore's private data structure
997 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
998 and location of temporary RAM, the stack location and the BFV location.
999 @param OldCoreData Pointer to the PEI Core data.
1000 NULL if being run in non-permanent memory mode.
1004 InitializeMemoryServices (
1005 IN PEI_CORE_INSTANCE
*PrivateData
,
1006 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
1007 IN PEI_CORE_INSTANCE
*OldCoreData
1012 Install the permanent memory is now available.
1013 Creates HOB (PHIT and Stack).
1015 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1016 @param MemoryBegin Start of memory address.
1017 @param MemoryLength Length of memory.
1019 @return EFI_SUCCESS Always success.
1024 PeiInstallPeiMemory (
1025 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1026 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
1027 IN UINT64 MemoryLength
1031 Migrate memory pages allocated in pre-memory phase.
1032 Copy memory pages at temporary heap top to permanent heap top.
1034 @param[in] Private Pointer to the private data passed in from caller.
1035 @param[in] TemporaryRamMigrated Temporary memory has been migrated to permanent memory.
1039 MigrateMemoryPages (
1040 IN PEI_CORE_INSTANCE
*Private
,
1041 IN BOOLEAN TemporaryRamMigrated
1045 Removes any FV HOBs whose base address is not in PEI installed memory.
1047 @param[in] Private Pointer to PeiCore's private data structure.
1051 RemoveFvHobsInTemporaryMemory (
1052 IN PEI_CORE_INSTANCE
*Private
1056 Migrate the base address in firmware volume allocation HOBs
1057 from temporary memory to PEI installed memory.
1059 @param[in] PrivateData Pointer to PeiCore's private data structure.
1060 @param[in] OrgFvHandle Address of FV Handle in temporary memory.
1061 @param[in] FvHandle Address of FV Handle in permanent memory.
1066 IN PEI_CORE_INSTANCE
*PrivateData
,
1067 IN UINTN OrgFvHandle
,
1072 Migrate MemoryBaseAddress in memory allocation HOBs
1073 from the temporary memory to PEI installed memory.
1075 @param[in] PrivateData Pointer to PeiCore's private data structure.
1079 ConvertMemoryAllocationHobs (
1080 IN PEI_CORE_INSTANCE
*PrivateData
1084 The purpose of the service is to publish an interface that allows
1085 PEIMs to allocate memory ranges that are managed by the PEI Foundation.
1087 Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.
1088 After InstallPeiMemory() is called, PEI will allocate pages within the region
1089 of memory provided by InstallPeiMemory() service in a best-effort fashion.
1090 Location-specific allocations are not managed by the PEI foundation code.
1092 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1093 @param MemoryType The type of memory to allocate.
1094 @param Pages The number of contiguous 4 KB pages to allocate.
1095 @param Memory Pointer to a physical address. On output, the address is set to the base
1096 of the page range that was allocated.
1098 @retval EFI_SUCCESS The memory range was successfully allocated.
1099 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
1100 @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,
1101 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,
1102 EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.
1108 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1109 IN EFI_MEMORY_TYPE MemoryType
,
1111 OUT EFI_PHYSICAL_ADDRESS
*Memory
1117 @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1118 @param[in] Memory The base physical address of the pages to be freed.
1119 @param[in] Pages The number of contiguous 4 KB pages to free.
1121 @retval EFI_SUCCESS The requested pages were freed.
1122 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
1123 @retval EFI_NOT_FOUND The requested memory pages were not allocated with
1130 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1131 IN EFI_PHYSICAL_ADDRESS Memory
,
1137 Memory allocation service on the temporary memory.
1140 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1141 @param Size Amount of memory required
1142 @param Buffer Address of pointer to the buffer
1144 @retval EFI_SUCCESS The allocation was successful
1145 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1146 to allocate the requested size.
1152 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1159 Routine for load image file.
1162 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1163 @param FileHandle Pointer to the FFS file header of the image.
1164 @param PeimState The dispatch state of the input PEIM handle.
1165 @param EntryPoint Pointer to entry point of specified image file for output.
1166 @param AuthenticationState Pointer to attestation authentication state of image.
1168 @retval EFI_SUCCESS Image is successfully loaded.
1169 @retval EFI_NOT_FOUND Fail to locate necessary PPI
1170 @retval Others Fail to load file.
1175 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1176 IN EFI_PEI_FILE_HANDLE FileHandle
,
1178 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1179 OUT UINT32
*AuthenticationState
1184 Core version of the Status Code reporter
1187 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1188 @param CodeType Type of Status Code.
1189 @param Value Value to output for Status Code.
1190 @param Instance Instance Number of this status code.
1191 @param CallerId ID of the caller of this status code.
1192 @param Data Optional data associated with this status code.
1194 @retval EFI_SUCCESS if status code is successfully reported
1195 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1200 PeiReportStatusCode (
1201 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1202 IN EFI_STATUS_CODE_TYPE CodeType
,
1203 IN EFI_STATUS_CODE_VALUE Value
,
1205 IN CONST EFI_GUID
*CallerId
,
1206 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1211 Core version of the Reset System
1214 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1216 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
1217 @retval EFI_DEVICE_ERROR Did not reset system.
1218 Otherwise, resets the system.
1224 IN CONST EFI_PEI_SERVICES
**PeiServices
1228 Resets the entire platform.
1230 @param[in] ResetType The type of reset to perform.
1231 @param[in] ResetStatus The status code for the reset.
1232 @param[in] DataSize The size, in bytes, of ResetData.
1233 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
1234 the data buffer starts with a Null-terminated string, optionally
1235 followed by additional binary data. The string is a description
1236 that the caller may use to further indicate the reason for the
1243 IN EFI_RESET_TYPE ResetType
,
1244 IN EFI_STATUS ResetStatus
,
1246 IN VOID
*ResetData OPTIONAL
1251 Initialize PeiCore FV List.
1254 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1255 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1260 IN PEI_CORE_INSTANCE
*PrivateData
,
1261 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1265 Process Firmware Volume Information once FvInfoPPI install.
1267 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1268 @param NotifyDescriptor Address of the notification descriptor data structure.
1269 @param Ppi Address of the PPI that was installed.
1271 @retval EFI_SUCCESS if the interface could be successfully installed
1276 FirmwareVolumeInfoPpiNotifyCallback (
1277 IN EFI_PEI_SERVICES
**PeiServices
,
1278 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1284 Given the input VolumeHandle, search for the next matching name file.
1286 @param FileName File name to search.
1287 @param VolumeHandle The current FV to search.
1288 @param FileHandle Pointer to the file matching name in VolumeHandle.
1289 NULL if file not found
1291 @retval EFI_NOT_FOUND No files matching the search criteria were found
1292 @retval EFI_SUCCESS Success to search given file
1297 PeiFfsFindFileByName (
1298 IN CONST EFI_GUID
*FileName
,
1299 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1300 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1304 Returns information about a specific file.
1306 @param FileHandle Handle of the file.
1307 @param FileInfo Upon exit, points to the file's information.
1309 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1310 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1311 @retval EFI_SUCCESS File information returned.
1317 IN EFI_PEI_FILE_HANDLE FileHandle
,
1318 OUT EFI_FV_FILE_INFO
*FileInfo
1322 Returns information about a specific file.
1324 @param FileHandle Handle of the file.
1325 @param FileInfo Upon exit, points to the file's information.
1327 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1328 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1329 @retval EFI_SUCCESS File information returned.
1334 PeiFfsGetFileInfo2 (
1335 IN EFI_PEI_FILE_HANDLE FileHandle
,
1336 OUT EFI_FV_FILE_INFO2
*FileInfo
1340 Returns information about the specified volume.
1342 @param VolumeHandle Handle of the volume.
1343 @param VolumeInfo Upon exit, points to the volume's information.
1345 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1346 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1347 @retval EFI_SUCCESS Volume information returned.
1351 PeiFfsGetVolumeInfo (
1352 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1353 OUT EFI_FV_INFO
*VolumeInfo
1357 This routine enables a PEIM to register itself for shadow when the PEI Foundation
1358 discovers permanent memory.
1360 @param FileHandle File handle of a PEIM.
1362 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1363 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1364 @retval EFI_SUCCESS Successfully to register itself.
1369 PeiRegisterForShadow (
1370 IN EFI_PEI_FILE_HANDLE FileHandle
1374 Initialize image service that install PeiLoadFilePpi.
1376 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1377 @param OldCoreData Pointer to Old PeiCore's private data.
1378 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1379 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1380 to permanent memory.
1384 InitializeImageServices (
1385 IN PEI_CORE_INSTANCE
*PrivateData
,
1386 IN PEI_CORE_INSTANCE
*OldCoreData
1390 Loads and relocates a PE/COFF image in place.
1392 @param Pe32Data The base address of the PE/COFF file that is to be loaded and relocated
1393 @param ImageAddress The base address of the relocated PE/COFF image
1395 @retval EFI_SUCCESS The file was loaded and relocated
1396 @retval Others The file not be loaded and error occurred.
1400 LoadAndRelocatePeCoffImageInPlace (
1402 IN VOID
*ImageAddress
1406 Find the PE32 Data for an FFS file.
1408 @param FileHandle Pointer to the FFS file header of the image.
1409 @param Pe32Data Pointer to a (VOID *) PE32 Data pointer.
1411 @retval EFI_SUCCESS Image is successfully loaded.
1412 @retval EFI_NOT_FOUND Fail to locate PE32 Data.
1417 IN EFI_PEI_FILE_HANDLE FileHandle
,
1422 The wrapper function of PeiLoadImageLoadImage().
1424 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1425 @param FileHandle Pointer to the FFS file header of the image.
1426 @param ImageAddressArg Pointer to PE/TE image.
1427 @param ImageSizeArg Size of PE/TE image.
1428 @param EntryPoint Pointer to entry point of specified image file for output.
1429 @param AuthenticationState Pointer to attestation authentication state of image.
1431 @return Status of PeiLoadImageLoadImage().
1436 PeiLoadImageLoadImageWrapper (
1437 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1438 IN EFI_PEI_FILE_HANDLE FileHandle
,
1439 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1440 OUT UINT64
*ImageSizeArg
, OPTIONAL
1441 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1442 OUT UINT32
*AuthenticationState
1447 Provide a callback for when the security PPI is installed.
1449 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1450 @param NotifyDescriptor The descriptor for the notification event.
1451 @param Ppi Pointer to the PPI in question.
1453 @return Always success
1458 SecurityPpiNotifyCallback (
1459 IN EFI_PEI_SERVICES
**PeiServices
,
1460 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1465 Get FV image(s) from the FV type file, then install FV INFO(2) PPI, Build FV(2, 3) HOB.
1467 @param PrivateData PeiCore's private data structure
1468 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent FV image that contain this FV image.
1469 @param ParentFvFileHandle File handle of a FV type file that contain this FV image.
1471 @retval EFI_NOT_FOUND FV image can't be found.
1472 @retval EFI_SUCCESS Successfully to process it.
1473 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1474 @retval EFI_SECURITY_VIOLATION Image is illegal
1475 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1480 IN PEI_CORE_INSTANCE
*PrivateData
,
1481 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1482 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1486 Gets a PEI_CORE_FV_HANDLE instance for the next volume according to the given index.
1488 This routine also will install an instance of the FvInfo PPI for the FV HOB
1489 as defined in the PI specification.
1491 @param Private Pointer of PEI_CORE_INSTANCE
1492 @param Instance Index of the FV to search
1494 @return Instance of PEI_CORE_FV_HANDLE.
1496 PEI_CORE_FV_HANDLE
*
1497 FindNextCoreFvHandle (
1498 IN PEI_CORE_INSTANCE
*Private
,
1503 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1507 Memory-based read services.
1509 This function is to perform the Memory Access Read service based on installed
1510 instance of the EFI_PEI_CPU_IO_PPI.
1511 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1512 return EFI_NOT_YET_AVAILABLE.
1514 @param PeiServices An indirect pointer to the PEI Services Table
1515 published by the PEI Foundation.
1516 @param This Pointer to local data for the interface.
1517 @param Width The width of the access. Enumerated in bytes.
1518 @param Address The physical address of the access.
1519 @param Count The number of accesses to perform.
1520 @param Buffer A pointer to the buffer of data.
1522 @retval EFI_SUCCESS The function completed successfully.
1523 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1528 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1529 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1530 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1537 Memory-based write services.
1539 This function is to perform the Memory Access Write service based on installed
1540 instance of the EFI_PEI_CPU_IO_PPI.
1541 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1542 return EFI_NOT_YET_AVAILABLE.
1544 @param PeiServices An indirect pointer to the PEI Services Table
1545 published by the PEI Foundation.
1546 @param This Pointer to local data for the interface.
1547 @param Width The width of the access. Enumerated in bytes.
1548 @param Address The physical address of the access.
1549 @param Count The number of accesses to perform.
1550 @param Buffer A pointer to the buffer of data.
1552 @retval EFI_SUCCESS The function completed successfully.
1553 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1557 PeiDefaultMemWrite (
1558 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1559 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1560 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1567 IO-based read services.
1569 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1570 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1571 return EFI_NOT_YET_AVAILABLE.
1573 @param PeiServices An indirect pointer to the PEI Services Table
1574 published by the PEI Foundation.
1575 @param This Pointer to local data for the interface.
1576 @param Width The width of the access. Enumerated in bytes.
1577 @param Address The physical address of the access.
1578 @param Count The number of accesses to perform.
1579 @param Buffer A pointer to the buffer of data.
1581 @retval EFI_SUCCESS The function completed successfully.
1582 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1587 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1588 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1589 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1596 IO-based write services.
1598 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1599 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1600 return EFI_NOT_YET_AVAILABLE.
1602 @param PeiServices An indirect pointer to the PEI Services Table
1603 published by the PEI Foundation.
1604 @param This Pointer to local data for the interface.
1605 @param Width The width of the access. Enumerated in bytes.
1606 @param Address The physical address of the access.
1607 @param Count The number of accesses to perform.
1608 @param Buffer A pointer to the buffer of data.
1610 @retval EFI_SUCCESS The function completed successfully.
1611 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1616 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1617 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1618 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1625 8-bit I/O read operations.
1627 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1630 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1631 @param This Pointer to local data for the interface.
1632 @param Address The physical address of the access.
1634 @return An 8-bit value returned from the I/O space.
1639 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1640 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1645 Reads an 16-bit I/O port.
1647 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1650 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1651 @param This Pointer to local data for the interface.
1652 @param Address The physical address of the access.
1654 @return A 16-bit value returned from the I/O space.
1658 PeiDefaultIoRead16 (
1659 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1660 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1665 Reads an 32-bit I/O port.
1667 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1670 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1671 @param This Pointer to local data for the interface.
1672 @param Address The physical address of the access.
1674 @return A 32-bit value returned from the I/O space.
1678 PeiDefaultIoRead32 (
1679 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1680 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1685 Reads an 64-bit I/O port.
1687 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1690 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1691 @param This Pointer to local data for the interface.
1692 @param Address The physical address of the access.
1694 @return A 64-bit value returned from the I/O space.
1698 PeiDefaultIoRead64 (
1699 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1700 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1705 8-bit I/O write operations.
1707 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1708 @param This Pointer to local data for the interface.
1709 @param Address The physical address of the access.
1710 @param Data The data to write.
1714 PeiDefaultIoWrite8 (
1715 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1716 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1722 16-bit I/O write operations.
1724 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1725 @param This Pointer to local data for the interface.
1726 @param Address The physical address of the access.
1727 @param Data The data to write.
1731 PeiDefaultIoWrite16 (
1732 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1733 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1739 32-bit I/O write operations.
1741 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1742 @param This Pointer to local data for the interface.
1743 @param Address The physical address of the access.
1744 @param Data The data to write.
1748 PeiDefaultIoWrite32 (
1749 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1750 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1756 64-bit I/O write operations.
1758 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1759 @param This Pointer to local data for the interface.
1760 @param Address The physical address of the access.
1761 @param Data The data to write.
1765 PeiDefaultIoWrite64 (
1766 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1767 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1773 8-bit memory read operations.
1775 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1778 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1779 @param This Pointer to local data for the interface.
1780 @param Address The physical address of the access.
1782 @return An 8-bit value returned from the memory space.
1787 PeiDefaultMemRead8 (
1788 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1789 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1794 16-bit memory read operations.
1796 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1799 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1800 @param This Pointer to local data for the interface.
1801 @param Address The physical address of the access.
1803 @return An 16-bit value returned from the memory space.
1808 PeiDefaultMemRead16 (
1809 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1810 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1815 32-bit memory read operations.
1817 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1820 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1821 @param This Pointer to local data for the interface.
1822 @param Address The physical address of the access.
1824 @return An 32-bit value returned from the memory space.
1829 PeiDefaultMemRead32 (
1830 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1831 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1836 64-bit memory read operations.
1838 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1841 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1842 @param This Pointer to local data for the interface.
1843 @param Address The physical address of the access.
1845 @return An 64-bit value returned from the memory space.
1850 PeiDefaultMemRead64 (
1851 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1852 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1857 8-bit memory write operations.
1859 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1860 @param This Pointer to local data for the interface.
1861 @param Address The physical address of the access.
1862 @param Data The data to write.
1867 PeiDefaultMemWrite8 (
1868 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1869 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1875 16-bit memory write operations.
1877 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1878 @param This Pointer to local data for the interface.
1879 @param Address The physical address of the access.
1880 @param Data The data to write.
1885 PeiDefaultMemWrite16 (
1886 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1887 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1893 32-bit memory write operations.
1895 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1896 @param This Pointer to local data for the interface.
1897 @param Address The physical address of the access.
1898 @param Data The data to write.
1903 PeiDefaultMemWrite32 (
1904 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1905 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1911 64-bit memory write operations.
1913 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1914 @param This Pointer to local data for the interface.
1915 @param Address The physical address of the access.
1916 @param Data The data to write.
1921 PeiDefaultMemWrite64 (
1922 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1923 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1928 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1931 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1935 Reads from a given location in the PCI configuration space.
1937 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1938 return EFI_NOT_YET_AVAILABLE.
1940 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1941 @param This Pointer to local data for the interface.
1942 @param Width The width of the access. Enumerated in bytes.
1943 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1944 @param Address The physical address of the access. The format of
1945 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1946 @param Buffer A pointer to the buffer of data.
1948 @retval EFI_SUCCESS The function completed successfully.
1949 @retval EFI_INVALID_PARAMETER The invalid access width.
1950 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1955 PeiDefaultPciCfg2Read (
1956 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1957 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1958 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1964 Write to a given location in the PCI configuration space.
1966 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1967 return EFI_NOT_YET_AVAILABLE.
1969 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1970 @param This Pointer to local data for the interface.
1971 @param Width The width of the access. Enumerated in bytes.
1972 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1973 @param Address The physical address of the access. The format of
1974 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1975 @param Buffer A pointer to the buffer of data.
1977 @retval EFI_SUCCESS The function completed successfully.
1978 @retval EFI_INVALID_PARAMETER The invalid access width.
1979 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1983 PeiDefaultPciCfg2Write (
1984 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1985 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1986 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1992 This function performs a read-modify-write operation on the contents from a given
1993 location in the PCI configuration space.
1995 @param PeiServices An indirect pointer to the PEI Services Table
1996 published by the PEI Foundation.
1997 @param This Pointer to local data for the interface.
1998 @param Width The width of the access. Enumerated in bytes. Type
1999 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
2000 @param Address The physical address of the access.
2001 @param SetBits Points to value to bitwise-OR with the read configuration value.
2002 The size of the value is determined by Width.
2003 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
2004 The size of the value is determined by Width.
2006 @retval EFI_SUCCESS The function completed successfully.
2007 @retval EFI_INVALID_PARAMETER The invalid access width.
2008 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
2012 PeiDefaultPciCfg2Modify (
2013 IN CONST EFI_PEI_SERVICES
**PeiServices
,
2014 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
2015 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
2021 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
2024 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
2025 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
2026 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
2029 @param PrivateData Pointer to PEI_CORE_INSTANCE.
2033 IN PEI_CORE_INSTANCE
*PrivateData