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
;
184 Function Pointer type for PeiCore function.
185 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
186 and location of temporary RAM, the stack location and the BFV location.
187 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
188 An empty PPI list consists of a single descriptor with the end-tag
189 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
190 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
191 that both the PEI Foundation and any modules can leverage the associated service
192 calls and/or code in these early PPIs
193 @param OldCoreData Pointer to old core data that is used to initialize the
198 (EFIAPI
*PEICORE_FUNCTION_POINTER
)(
199 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
200 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
201 IN PEI_CORE_INSTANCE
*OldCoreData
205 // Number of files to grow by each time we run out of room
207 #define TEMP_FILE_GROWTH_STEP 32
209 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
212 /// Pei Core private data structure instance
214 struct _PEI_CORE_INSTANCE
{
218 /// Point to ServiceTableShadow
220 EFI_PEI_SERVICES
*Ps
;
221 PEI_PPI_DATABASE PpiData
;
224 /// The count of FVs which contains FFS and could be dispatched by PeiCore.
229 /// The max count of FVs which contains FFS and could be dispatched by PeiCore.
234 /// Pointer to the buffer with the MaxFvCount number of entries.
235 /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.
237 PEI_CORE_FV_HANDLE
*Fv
;
240 /// Pointer to the buffer with the MaxUnknownFvInfoCount number of entries.
241 /// Each entry is for one FV which could not be dispatched by PeiCore.
243 PEI_CORE_UNKNOW_FORMAT_FV_INFO
*UnknownFvInfo
;
244 UINTN MaxUnknownFvInfoCount
;
245 UINTN UnknownFvInfoCount
;
248 /// Pointer to the buffer FvFileHandlers in PEI_CORE_FV_HANDLE specified by CurrentPeimFvCount.
250 EFI_PEI_FILE_HANDLE
*CurrentFvFileHandles
;
252 UINTN CurrentPeimFvCount
;
253 UINTN CurrentPeimCount
;
254 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
255 BOOLEAN PeimNeedingDispatch
;
256 BOOLEAN PeimDispatchOnThisPass
;
257 BOOLEAN PeimDispatcherReenter
;
258 EFI_PEI_HOB_POINTERS HobList
;
259 BOOLEAN SwitchStackSignal
;
260 BOOLEAN PeiMemoryInstalled
;
262 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
263 EFI_PEI_SERVICES ServiceTableShadow
;
264 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
265 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
266 UINT64 PhysicalMemoryLength
;
267 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
269 BOOLEAN HeapOffsetPositive
;
271 BOOLEAN StackOffsetPositive
;
273 // Information for migrating memory pages allocated in pre-memory phase.
275 HOLE_MEMORY_DATA MemoryPages
;
276 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
277 CACHE_SECTION_DATA CacheSection
;
279 // For Loading modules at fixed address feature to cache the top address below which the
280 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
281 // and Ps should not be changed since maybe user could get this top address by using the offset to Ps.
283 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
285 // The field is define for Loading modules at fixed address feature to tracker the PEI code
286 // memory range usage. It is a bit mapped array in which every bit indicates the corresponding memory page
289 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
291 // This field points to the shadowed image read function
293 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
298 // Pointer to the temp buffer with the TempPeimCount number of entries.
300 EFI_PEI_FILE_HANDLE
*TempFileHandles
;
302 // Pointer to the temp buffer with the TempPeimCount number of entries.
304 EFI_GUID
*TempFileGuid
;
307 // Temp Memory Range is not covered by PeiTempMem and Stack.
308 // Those Memory Range will be migrated into physical memory.
310 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
314 /// Pei Core Instance Data Macros
316 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
317 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
320 /// Union of temporarily used function pointers (to save stack space)
323 PEICORE_FUNCTION_POINTER PeiCore
;
324 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
325 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
326 EFI_DXE_IPL_PPI
*DxeIpl
;
327 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
328 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
330 } PEI_CORE_TEMP_POINTERS
;
333 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
334 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
336 } 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 Succesfully 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
488 Initialize PPI services.
490 @param PrivateData Pointer to the PEI Core data.
491 @param OldCoreData Pointer to old PEI Core data.
492 NULL if being run in non-permanent memory mode.
496 InitializePpiServices (
497 IN PEI_CORE_INSTANCE
*PrivateData
,
498 IN PEI_CORE_INSTANCE
*OldCoreData
503 Migrate the Hob list from the temporary memory to PEI installed memory.
505 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
506 and location of temporary RAM, the stack location and the BFV location.
507 @param PrivateData Pointer to PeiCore's private data structure.
512 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
513 IN PEI_CORE_INSTANCE
*PrivateData
518 Migrate Notify Pointers inside an FV from temporary memory to permanent memory.
520 @param PrivateData Pointer to PeiCore's private data structure.
521 @param OrgFvHandle Address of FV Handle in temporary memory.
522 @param FvHandle Address of FV Handle in permanent memory.
523 @param FvSize Size of the FV.
527 ConvertPpiPointersFv (
528 IN PEI_CORE_INSTANCE
*PrivateData
,
529 IN UINTN OrgFvHandle
,
536 Migrate PPI Pointers of PEI_CORE from temporary memory to permanent memory.
538 @param PrivateData Pointer to PeiCore's private data structure.
539 @param CoreFvHandle Address of PEI_CORE FV Handle in temporary memory.
543 ConvertPeiCorePpiPointers (
544 IN PEI_CORE_INSTANCE
*PrivateData
,
545 PEI_CORE_FV_HANDLE CoreFvHandle
550 Dumps the PPI lists to debug output.
552 @param PrivateData Points to PeiCore's private instance data.
557 IN PEI_CORE_INSTANCE
*PrivateData
562 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
564 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
565 @param PpiList Pointer to PPI array that want to be installed.
567 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
568 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
569 if any PPI in PpiList is not valid
570 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
576 IN CONST EFI_PEI_SERVICES
**PeiServices
,
577 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
582 Re-Install PPI services.
584 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
585 @param OldPpi Pointer to the old PEI PPI Descriptors.
586 @param NewPpi Pointer to the new PEI PPI Descriptors.
588 @retval EFI_SUCCESS if the operation was successful
589 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
590 if NewPpi is not valid
591 @retval EFI_NOT_FOUND if the PPI was not in the database
597 IN CONST EFI_PEI_SERVICES
**PeiServices
,
598 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
599 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
604 Locate a given named PPI.
607 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
608 @param Guid Pointer to GUID of the PPI.
609 @param Instance Instance Number to discover.
610 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
611 returns a pointer to the descriptor (includes flags, etc)
612 @param Ppi Pointer to reference the found PPI
614 @retval EFI_SUCCESS if the PPI is in the database
615 @retval EFI_NOT_FOUND if the PPI is not in the database
621 IN CONST EFI_PEI_SERVICES
**PeiServices
,
622 IN CONST EFI_GUID
*Guid
,
624 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
630 Install a notification for a given PPI.
633 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
634 @param NotifyList Pointer to list of Descriptors to notify upon.
636 @retval EFI_SUCCESS if successful
637 @retval EFI_OUT_OF_RESOURCES if no space in the database
638 @retval EFI_INVALID_PARAMETER if not a good descriptor
644 IN CONST EFI_PEI_SERVICES
**PeiServices
,
645 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
650 Process the Notify List at dispatch level.
652 @param PrivateData PeiCore's private data structure.
656 ProcessDispatchNotifyList (
657 IN PEI_CORE_INSTANCE
*PrivateData
662 Process notifications.
664 @param PrivateData PeiCore's private data structure
665 @param NotifyType Type of notify to fire.
666 @param InstallStartIndex Install Beginning index.
667 @param InstallStopIndex Install Ending index.
668 @param NotifyStartIndex Notify Beginning index.
669 @param NotifyStopIndex Notify Ending index.
674 IN PEI_CORE_INSTANCE
*PrivateData
,
676 IN INTN InstallStartIndex
,
677 IN INTN InstallStopIndex
,
678 IN INTN NotifyStartIndex
,
679 IN INTN NotifyStopIndex
683 Process PpiList from SEC phase.
685 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
686 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
687 These PPI's will be installed and/or immediately signaled if they are notification type.
691 ProcessPpiListFromSec (
692 IN CONST EFI_PEI_SERVICES
**PeiServices
,
693 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
697 // Boot mode support functions
700 This service enables PEIMs to ascertain the present value of the boot mode.
702 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
703 @param BootMode A pointer to contain the value of the boot mode.
705 @retval EFI_SUCCESS The boot mode was returned successfully.
706 @retval EFI_INVALID_PARAMETER BootMode is NULL.
712 IN CONST EFI_PEI_SERVICES
**PeiServices
,
713 IN OUT EFI_BOOT_MODE
*BootMode
717 This service enables PEIMs to update the boot mode variable.
720 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
721 @param BootMode The value of the boot mode to set.
723 @return EFI_SUCCESS The value was successfully updated
729 IN CONST EFI_PEI_SERVICES
**PeiServices
,
730 IN EFI_BOOT_MODE BootMode
734 // Security support functions
738 Initialize the security services.
740 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
741 @param OldCoreData Pointer to the old core data.
742 NULL if being run in non-permanent memory mode.
746 InitializeSecurityServices (
747 IN EFI_PEI_SERVICES
**PeiServices
,
748 IN PEI_CORE_INSTANCE
*OldCoreData
752 Verify a Firmware volume.
754 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
756 @retval EFI_SUCCESS Firmware Volume is legal
757 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
762 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
766 Provide a callout to the security verification service.
768 @param PrivateData PeiCore's private data structure
769 @param VolumeHandle Handle of FV
770 @param FileHandle Handle of PEIM's FFS
771 @param AuthenticationStatus Authentication status
773 @retval EFI_SUCCESS Image is OK
774 @retval EFI_SECURITY_VIOLATION Image is illegal
775 @retval EFI_NOT_FOUND If security PPI is not installed.
779 IN PEI_CORE_INSTANCE
*PrivateData
,
780 IN EFI_PEI_FV_HANDLE VolumeHandle
,
781 IN EFI_PEI_FILE_HANDLE FileHandle
,
782 IN UINT32 AuthenticationStatus
787 Gets the pointer to the HOB List.
790 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
791 @param HobList Pointer to the HOB List.
793 @retval EFI_SUCCESS Get the pointer of HOB List
794 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
795 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
801 IN CONST EFI_PEI_SERVICES
**PeiServices
,
802 IN OUT VOID
**HobList
806 Add a new HOB to the HOB List.
808 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
809 @param Type Type of the new HOB.
810 @param Length Length of the new HOB to allocate.
811 @param Hob Pointer to the new HOB.
813 @return EFI_SUCCESS Success to create HOB.
814 @retval EFI_INVALID_PARAMETER if Hob is NULL
815 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
816 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
822 IN CONST EFI_PEI_SERVICES
**PeiServices
,
830 Builds a Handoff Information Table HOB
832 @param BootMode - Current Bootmode
833 @param MemoryBegin - Start Memory Address.
834 @param MemoryLength - Length of Memory.
836 @return EFI_SUCCESS Always success to initialize HOB.
840 PeiCoreBuildHobHandoffInfoTable (
841 IN EFI_BOOT_MODE BootMode
,
842 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
843 IN UINT64 MemoryLength
847 Install SEC HOB data to the HOB List.
849 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
850 @param SecHobList Pointer to SEC HOB List.
852 @return EFI_SUCCESS Success to install SEC HOB data.
853 @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.
857 PeiInstallSecHobData (
858 IN CONST EFI_PEI_SERVICES
**PeiServices
,
859 IN EFI_HOB_GENERIC_HEADER
*SecHobList
864 // FFS Fw Volume support functions
867 Searches for the next matching file in the firmware volume.
869 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
870 @param SearchType Filter to find only files of this type.
871 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
872 @param FvHandle Handle of firmware volume in which to search.
873 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
874 at the beginning of the firmware volume. On exit, points the file handle of the next file
875 in the volume or NULL if there are no more files.
877 @retval EFI_NOT_FOUND The file was not found.
878 @retval EFI_NOT_FOUND The header checksum was not zero.
879 @retval EFI_SUCCESS The file was found.
885 IN CONST EFI_PEI_SERVICES
**PeiServices
,
887 IN EFI_PEI_FV_HANDLE FvHandle
,
888 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
892 Go through the file to search SectionType section.
893 Search within encapsulation sections (compression and GUIDed) recursively,
894 until the match section is found.
896 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
897 @param SectionType Filter to find only section of this type.
898 @param SectionInstance Pointer to the filter to find the specific instance of section.
899 @param Section From where to search.
900 @param SectionSize The file size to search.
901 @param OutputBuffer A pointer to the discovered section, if successful.
902 NULL if section not found.
903 @param AuthenticationStatus Updated upon return to point to the authentication status for this section.
904 @param IsFfs3Fv Indicates the FV format.
906 @return EFI_NOT_FOUND The match section is not found.
907 @return EFI_SUCCESS The match section is found.
912 IN CONST EFI_PEI_SERVICES
**PeiServices
,
913 IN EFI_SECTION_TYPE SectionType
,
914 IN OUT UINTN
*SectionInstance
,
915 IN EFI_COMMON_SECTION_HEADER
*Section
,
916 IN UINTN SectionSize
,
917 OUT VOID
**OutputBuffer
,
918 OUT UINT32
*AuthenticationStatus
,
923 Searches for the next matching section within the specified file.
925 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
926 @param SectionType Filter to find only sections of this type.
927 @param FileHandle Pointer to the current file to search.
928 @param SectionData A pointer to the discovered section, if successful.
929 NULL if section not found
931 @retval EFI_NOT_FOUND The section was not found.
932 @retval EFI_SUCCESS The section was found.
937 PeiFfsFindSectionData (
938 IN CONST EFI_PEI_SERVICES
**PeiServices
,
939 IN EFI_SECTION_TYPE SectionType
,
940 IN EFI_PEI_FILE_HANDLE FileHandle
,
941 OUT VOID
**SectionData
945 Searches for the next matching section within the specified file.
947 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
948 @param SectionType The value of the section type to find.
949 @param SectionInstance Section instance to find.
950 @param FileHandle Handle of the firmware file to search.
951 @param SectionData A pointer to the discovered section, if successful.
952 @param AuthenticationStatus A pointer to the authentication status for this section.
954 @retval EFI_SUCCESS The section was found.
955 @retval EFI_NOT_FOUND The section was not found.
960 PeiFfsFindSectionData3 (
961 IN CONST EFI_PEI_SERVICES
**PeiServices
,
962 IN EFI_SECTION_TYPE SectionType
,
963 IN UINTN SectionInstance
,
964 IN EFI_PEI_FILE_HANDLE FileHandle
,
965 OUT VOID
**SectionData
,
966 OUT UINT32
*AuthenticationStatus
970 Search the firmware volumes by index
972 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
973 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
975 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
977 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
978 @retval EFI_NOT_FOUND The volume was not found.
979 @retval EFI_SUCCESS The volume was found.
984 PeiFfsFindNextVolume (
985 IN CONST EFI_PEI_SERVICES
**PeiServices
,
987 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
991 // Memory support functions
995 Initialize the memory services.
997 @param PrivateData PeiCore's private data structure
998 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
999 and location of temporary RAM, the stack location and the BFV location.
1000 @param OldCoreData Pointer to the PEI Core data.
1001 NULL if being run in non-permanent memory mode.
1005 InitializeMemoryServices (
1006 IN PEI_CORE_INSTANCE
*PrivateData
,
1007 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
1008 IN PEI_CORE_INSTANCE
*OldCoreData
1013 Install the permanent memory is now available.
1014 Creates HOB (PHIT and Stack).
1016 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1017 @param MemoryBegin Start of memory address.
1018 @param MemoryLength Length of memory.
1020 @return EFI_SUCCESS Always success.
1025 PeiInstallPeiMemory (
1026 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1027 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
1028 IN UINT64 MemoryLength
1032 Migrate memory pages allocated in pre-memory phase.
1033 Copy memory pages at temporary heap top to permanent heap top.
1035 @param[in] Private Pointer to the private data passed in from caller.
1036 @param[in] TemporaryRamMigrated Temporary memory has been migrated to permanent memory.
1040 MigrateMemoryPages (
1041 IN PEI_CORE_INSTANCE
*Private
,
1042 IN BOOLEAN TemporaryRamMigrated
1046 Removes any FV HOBs whose base address is not in PEI installed memory.
1048 @param[in] Private Pointer to PeiCore's private data structure.
1052 RemoveFvHobsInTemporaryMemory (
1053 IN PEI_CORE_INSTANCE
*Private
1057 Migrate the base address in firmware volume allocation HOBs
1058 from temporary memory to PEI installed memory.
1060 @param[in] PrivateData Pointer to PeiCore's private data structure.
1061 @param[in] OrgFvHandle Address of FV Handle in temporary memory.
1062 @param[in] FvHandle Address of FV Handle in permanent memory.
1067 IN PEI_CORE_INSTANCE
*PrivateData
,
1068 IN UINTN OrgFvHandle
,
1073 Migrate MemoryBaseAddress in memory allocation HOBs
1074 from the temporary memory to PEI installed memory.
1076 @param[in] PrivateData Pointer to PeiCore's private data structure.
1080 ConvertMemoryAllocationHobs (
1081 IN PEI_CORE_INSTANCE
*PrivateData
1085 The purpose of the service is to publish an interface that allows
1086 PEIMs to allocate memory ranges that are managed by the PEI Foundation.
1088 Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.
1089 After InstallPeiMemory() is called, PEI will allocate pages within the region
1090 of memory provided by InstallPeiMemory() service in a best-effort fashion.
1091 Location-specific allocations are not managed by the PEI foundation code.
1093 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1094 @param MemoryType The type of memory to allocate.
1095 @param Pages The number of contiguous 4 KB pages to allocate.
1096 @param Memory Pointer to a physical address. On output, the address is set to the base
1097 of the page range that was allocated.
1099 @retval EFI_SUCCESS The memory range was successfully allocated.
1100 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
1101 @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,
1102 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,
1103 EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.
1109 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1110 IN EFI_MEMORY_TYPE MemoryType
,
1112 OUT EFI_PHYSICAL_ADDRESS
*Memory
1118 @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1119 @param[in] Memory The base physical address of the pages to be freed.
1120 @param[in] Pages The number of contiguous 4 KB pages to free.
1122 @retval EFI_SUCCESS The requested pages were freed.
1123 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
1124 @retval EFI_NOT_FOUND The requested memory pages were not allocated with
1131 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1132 IN EFI_PHYSICAL_ADDRESS Memory
,
1138 Memory allocation service on the temporary memory.
1141 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1142 @param Size Amount of memory required
1143 @param Buffer Address of pointer to the buffer
1145 @retval EFI_SUCCESS The allocation was successful
1146 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1147 to allocate the requested size.
1153 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1160 Routine for load image file.
1163 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1164 @param FileHandle Pointer to the FFS file header of the image.
1165 @param PeimState The dispatch state of the input PEIM handle.
1166 @param EntryPoint Pointer to entry point of specified image file for output.
1167 @param AuthenticationState Pointer to attestation authentication state of image.
1169 @retval EFI_SUCCESS Image is successfully loaded.
1170 @retval EFI_NOT_FOUND Fail to locate necessary PPI
1171 @retval Others Fail to load file.
1176 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1177 IN EFI_PEI_FILE_HANDLE FileHandle
,
1179 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1180 OUT UINT32
*AuthenticationState
1185 Core version of the Status Code reporter
1188 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1189 @param CodeType Type of Status Code.
1190 @param Value Value to output for Status Code.
1191 @param Instance Instance Number of this status code.
1192 @param CallerId ID of the caller of this status code.
1193 @param Data Optional data associated with this status code.
1195 @retval EFI_SUCCESS if status code is successfully reported
1196 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1201 PeiReportStatusCode (
1202 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1203 IN EFI_STATUS_CODE_TYPE CodeType
,
1204 IN EFI_STATUS_CODE_VALUE Value
,
1206 IN CONST EFI_GUID
*CallerId
,
1207 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1212 Core version of the Reset System
1215 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1217 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
1218 @retval EFI_DEVICE_ERROR Did not reset system.
1219 Otherwise, resets the system.
1225 IN CONST EFI_PEI_SERVICES
**PeiServices
1229 Resets the entire platform.
1231 @param[in] ResetType The type of reset to perform.
1232 @param[in] ResetStatus The status code for the reset.
1233 @param[in] DataSize The size, in bytes, of ResetData.
1234 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
1235 the data buffer starts with a Null-terminated string, optionally
1236 followed by additional binary data. The string is a description
1237 that the caller may use to further indicate the reason for the
1244 IN EFI_RESET_TYPE ResetType
,
1245 IN EFI_STATUS ResetStatus
,
1247 IN VOID
*ResetData OPTIONAL
1252 Initialize PeiCore FV List.
1255 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1256 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1261 IN PEI_CORE_INSTANCE
*PrivateData
,
1262 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1266 Process Firmware Volume Information once FvInfoPPI install.
1268 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1269 @param NotifyDescriptor Address of the notification descriptor data structure.
1270 @param Ppi Address of the PPI that was installed.
1272 @retval EFI_SUCCESS if the interface could be successfully installed
1277 FirmwareVolumeInfoPpiNotifyCallback (
1278 IN EFI_PEI_SERVICES
**PeiServices
,
1279 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1285 Given the input VolumeHandle, search for the next matching name file.
1287 @param FileName File name to search.
1288 @param VolumeHandle The current FV to search.
1289 @param FileHandle Pointer to the file matching name in VolumeHandle.
1290 NULL if file not found
1292 @retval EFI_NOT_FOUND No files matching the search criteria were found
1293 @retval EFI_SUCCESS Success to search given file
1298 PeiFfsFindFileByName (
1299 IN CONST EFI_GUID
*FileName
,
1300 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1301 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1305 Returns information about a specific file.
1307 @param FileHandle Handle of the file.
1308 @param FileInfo Upon exit, points to the file's information.
1310 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1311 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1312 @retval EFI_SUCCESS File information returned.
1318 IN EFI_PEI_FILE_HANDLE FileHandle
,
1319 OUT EFI_FV_FILE_INFO
*FileInfo
1323 Returns information about a specific file.
1325 @param FileHandle Handle of the file.
1326 @param FileInfo Upon exit, points to the file's information.
1328 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1329 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1330 @retval EFI_SUCCESS File information returned.
1335 PeiFfsGetFileInfo2 (
1336 IN EFI_PEI_FILE_HANDLE FileHandle
,
1337 OUT EFI_FV_FILE_INFO2
*FileInfo
1341 Returns information about the specified volume.
1343 @param VolumeHandle Handle of the volume.
1344 @param VolumeInfo Upon exit, points to the volume's information.
1346 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1347 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1348 @retval EFI_SUCCESS Volume information returned.
1352 PeiFfsGetVolumeInfo (
1353 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1354 OUT EFI_FV_INFO
*VolumeInfo
1358 This routine enables a PEIM to register itself for shadow when the PEI Foundation
1359 discovers permanent memory.
1361 @param FileHandle File handle of a PEIM.
1363 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1364 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1365 @retval EFI_SUCCESS Successfully to register itself.
1370 PeiRegisterForShadow (
1371 IN EFI_PEI_FILE_HANDLE FileHandle
1375 Initialize image service that install PeiLoadFilePpi.
1377 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1378 @param OldCoreData Pointer to Old PeiCore's private data.
1379 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1380 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1381 to permanent memory.
1385 InitializeImageServices (
1386 IN PEI_CORE_INSTANCE
*PrivateData
,
1387 IN PEI_CORE_INSTANCE
*OldCoreData
1391 Loads and relocates a PE/COFF image in place.
1393 @param Pe32Data The base address of the PE/COFF file that is to be loaded and relocated
1394 @param ImageAddress The base address of the relocated PE/COFF image
1396 @retval EFI_SUCCESS The file was loaded and relocated
1397 @retval Others The file not be loaded and error occurred.
1401 LoadAndRelocatePeCoffImageInPlace (
1403 IN VOID
*ImageAddress
1407 Find the PE32 Data for an FFS file.
1409 @param FileHandle Pointer to the FFS file header of the image.
1410 @param Pe32Data Pointer to a (VOID *) PE32 Data pointer.
1412 @retval EFI_SUCCESS Image is successfully loaded.
1413 @retval EFI_NOT_FOUND Fail to locate PE32 Data.
1418 IN EFI_PEI_FILE_HANDLE FileHandle
,
1423 The wrapper function of PeiLoadImageLoadImage().
1425 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1426 @param FileHandle Pointer to the FFS file header of the image.
1427 @param ImageAddressArg Pointer to PE/TE image.
1428 @param ImageSizeArg Size of PE/TE image.
1429 @param EntryPoint Pointer to entry point of specified image file for output.
1430 @param AuthenticationState Pointer to attestation authentication state of image.
1432 @return Status of PeiLoadImageLoadImage().
1437 PeiLoadImageLoadImageWrapper (
1438 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1439 IN EFI_PEI_FILE_HANDLE FileHandle
,
1440 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1441 OUT UINT64
*ImageSizeArg
, OPTIONAL
1442 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1443 OUT UINT32
*AuthenticationState
1448 Provide a callback for when the security PPI is installed.
1450 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1451 @param NotifyDescriptor The descriptor for the notification event.
1452 @param Ppi Pointer to the PPI in question.
1454 @return Always success
1459 SecurityPpiNotifyCallback (
1460 IN EFI_PEI_SERVICES
**PeiServices
,
1461 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1466 Get FV image(s) from the FV type file, then install FV INFO(2) PPI, Build FV(2, 3) HOB.
1468 @param PrivateData PeiCore's private data structure
1469 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent FV image that contain this FV image.
1470 @param ParentFvFileHandle File handle of a FV type file that contain this FV image.
1472 @retval EFI_NOT_FOUND FV image can't be found.
1473 @retval EFI_SUCCESS Successfully to process it.
1474 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1475 @retval EFI_SECURITY_VIOLATION Image is illegal
1476 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1481 IN PEI_CORE_INSTANCE
*PrivateData
,
1482 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1483 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1487 Gets a PEI_CORE_FV_HANDLE instance for the next volume according to the given index.
1489 This routine also will install an instance of the FvInfo PPI for the FV HOB
1490 as defined in the PI specification.
1492 @param Private Pointer of PEI_CORE_INSTANCE
1493 @param Instance Index of the FV to search
1495 @return Instance of PEI_CORE_FV_HANDLE.
1497 PEI_CORE_FV_HANDLE
*
1498 FindNextCoreFvHandle (
1499 IN PEI_CORE_INSTANCE
*Private
,
1504 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1508 Memory-based read services.
1510 This function is to perform the Memory Access Read service based on installed
1511 instance of the EFI_PEI_CPU_IO_PPI.
1512 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1513 return EFI_NOT_YET_AVAILABLE.
1515 @param PeiServices An indirect pointer to the PEI Services Table
1516 published by the PEI Foundation.
1517 @param This Pointer to local data for the interface.
1518 @param Width The width of the access. Enumerated in bytes.
1519 @param Address The physical address of the access.
1520 @param Count The number of accesses to perform.
1521 @param Buffer A pointer to the buffer of data.
1523 @retval EFI_SUCCESS The function completed successfully.
1524 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1529 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1530 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1531 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1538 Memory-based write services.
1540 This function is to perform the Memory Access Write service based on installed
1541 instance of the EFI_PEI_CPU_IO_PPI.
1542 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1543 return EFI_NOT_YET_AVAILABLE.
1545 @param PeiServices An indirect pointer to the PEI Services Table
1546 published by the PEI Foundation.
1547 @param This Pointer to local data for the interface.
1548 @param Width The width of the access. Enumerated in bytes.
1549 @param Address The physical address of the access.
1550 @param Count The number of accesses to perform.
1551 @param Buffer A pointer to the buffer of data.
1553 @retval EFI_SUCCESS The function completed successfully.
1554 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1558 PeiDefaultMemWrite (
1559 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1560 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1561 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1568 IO-based read services.
1570 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1571 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1572 return EFI_NOT_YET_AVAILABLE.
1574 @param PeiServices An indirect pointer to the PEI Services Table
1575 published by the PEI Foundation.
1576 @param This Pointer to local data for the interface.
1577 @param Width The width of the access. Enumerated in bytes.
1578 @param Address The physical address of the access.
1579 @param Count The number of accesses to perform.
1580 @param Buffer A pointer to the buffer of data.
1582 @retval EFI_SUCCESS The function completed successfully.
1583 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1588 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1589 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1590 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1597 IO-based write services.
1599 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1600 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1601 return EFI_NOT_YET_AVAILABLE.
1603 @param PeiServices An indirect pointer to the PEI Services Table
1604 published by the PEI Foundation.
1605 @param This Pointer to local data for the interface.
1606 @param Width The width of the access. Enumerated in bytes.
1607 @param Address The physical address of the access.
1608 @param Count The number of accesses to perform.
1609 @param Buffer A pointer to the buffer of data.
1611 @retval EFI_SUCCESS The function completed successfully.
1612 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1617 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1618 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1619 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1626 8-bit I/O read operations.
1628 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1631 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1632 @param This Pointer to local data for the interface.
1633 @param Address The physical address of the access.
1635 @return An 8-bit value returned from the I/O space.
1640 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1641 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1646 Reads an 16-bit I/O port.
1648 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1651 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1652 @param This Pointer to local data for the interface.
1653 @param Address The physical address of the access.
1655 @return A 16-bit value returned from the I/O space.
1659 PeiDefaultIoRead16 (
1660 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1661 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1666 Reads an 32-bit I/O port.
1668 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1671 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1672 @param This Pointer to local data for the interface.
1673 @param Address The physical address of the access.
1675 @return A 32-bit value returned from the I/O space.
1679 PeiDefaultIoRead32 (
1680 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1681 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1686 Reads an 64-bit I/O port.
1688 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1691 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1692 @param This Pointer to local data for the interface.
1693 @param Address The physical address of the access.
1695 @return A 64-bit value returned from the I/O space.
1699 PeiDefaultIoRead64 (
1700 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1701 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1706 8-bit I/O write operations.
1708 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1709 @param This Pointer to local data for the interface.
1710 @param Address The physical address of the access.
1711 @param Data The data to write.
1715 PeiDefaultIoWrite8 (
1716 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1717 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1723 16-bit I/O write operations.
1725 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1726 @param This Pointer to local data for the interface.
1727 @param Address The physical address of the access.
1728 @param Data The data to write.
1732 PeiDefaultIoWrite16 (
1733 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1734 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1740 32-bit I/O write operations.
1742 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1743 @param This Pointer to local data for the interface.
1744 @param Address The physical address of the access.
1745 @param Data The data to write.
1749 PeiDefaultIoWrite32 (
1750 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1751 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1757 64-bit I/O write operations.
1759 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1760 @param This Pointer to local data for the interface.
1761 @param Address The physical address of the access.
1762 @param Data The data to write.
1766 PeiDefaultIoWrite64 (
1767 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1768 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1774 8-bit memory read operations.
1776 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1779 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1780 @param This Pointer to local data for the interface.
1781 @param Address The physical address of the access.
1783 @return An 8-bit value returned from the memory space.
1788 PeiDefaultMemRead8 (
1789 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1790 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1795 16-bit memory read operations.
1797 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1800 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1801 @param This Pointer to local data for the interface.
1802 @param Address The physical address of the access.
1804 @return An 16-bit value returned from the memory space.
1809 PeiDefaultMemRead16 (
1810 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1811 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1816 32-bit memory read operations.
1818 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1821 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1822 @param This Pointer to local data for the interface.
1823 @param Address The physical address of the access.
1825 @return An 32-bit value returned from the memory space.
1830 PeiDefaultMemRead32 (
1831 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1832 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1837 64-bit memory read operations.
1839 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1842 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1843 @param This Pointer to local data for the interface.
1844 @param Address The physical address of the access.
1846 @return An 64-bit value returned from the memory space.
1851 PeiDefaultMemRead64 (
1852 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1853 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1858 8-bit memory write operations.
1860 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1861 @param This Pointer to local data for the interface.
1862 @param Address The physical address of the access.
1863 @param Data The data to write.
1868 PeiDefaultMemWrite8 (
1869 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1870 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1876 16-bit memory write operations.
1878 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1879 @param This Pointer to local data for the interface.
1880 @param Address The physical address of the access.
1881 @param Data The data to write.
1886 PeiDefaultMemWrite16 (
1887 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1888 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1894 32-bit memory write operations.
1896 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1897 @param This Pointer to local data for the interface.
1898 @param Address The physical address of the access.
1899 @param Data The data to write.
1904 PeiDefaultMemWrite32 (
1905 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1906 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1912 64-bit memory write operations.
1914 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1915 @param This Pointer to local data for the interface.
1916 @param Address The physical address of the access.
1917 @param Data The data to write.
1922 PeiDefaultMemWrite64 (
1923 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1924 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1929 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1932 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1936 Reads from a given location in the PCI configuration space.
1938 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1939 return EFI_NOT_YET_AVAILABLE.
1941 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1942 @param This Pointer to local data for the interface.
1943 @param Width The width of the access. Enumerated in bytes.
1944 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1945 @param Address The physical address of the access. The format of
1946 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1947 @param Buffer A pointer to the buffer of data.
1949 @retval EFI_SUCCESS The function completed successfully.
1950 @retval EFI_INVALID_PARAMETER The invalid access width.
1951 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1956 PeiDefaultPciCfg2Read (
1957 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1958 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1959 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1965 Write to a given location in the PCI configuration space.
1967 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1968 return EFI_NOT_YET_AVAILABLE.
1970 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1971 @param This Pointer to local data for the interface.
1972 @param Width The width of the access. Enumerated in bytes.
1973 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1974 @param Address The physical address of the access. The format of
1975 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1976 @param Buffer A pointer to the buffer of data.
1978 @retval EFI_SUCCESS The function completed successfully.
1979 @retval EFI_INVALID_PARAMETER The invalid access width.
1980 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1984 PeiDefaultPciCfg2Write (
1985 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1986 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1987 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1993 This function performs a read-modify-write operation on the contents from a given
1994 location in the PCI configuration space.
1996 @param PeiServices An indirect pointer to the PEI Services Table
1997 published by the PEI Foundation.
1998 @param This Pointer to local data for the interface.
1999 @param Width The width of the access. Enumerated in bytes. Type
2000 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
2001 @param Address The physical address of the access.
2002 @param SetBits Points to value to bitwise-OR with the read configuration value.
2003 The size of the value is determined by Width.
2004 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
2005 The size of the value is determined by Width.
2007 @retval EFI_SUCCESS The function completed successfully.
2008 @retval EFI_INVALID_PARAMETER The invalid access width.
2009 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
2013 PeiDefaultPciCfg2Modify (
2014 IN CONST EFI_PEI_SERVICES
**PeiServices
,
2015 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
2016 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
2022 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
2025 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
2026 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
2027 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
2030 @param PrivateData Pointer to PEI_CORE_INSTANCE.
2034 IN PEI_CORE_INSTANCE
*PrivateData