2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <Ppi/DxeIpl.h>
20 #include <Ppi/MemoryDiscovered.h>
21 #include <Ppi/StatusCode.h>
22 #include <Ppi/Reset.h>
23 #include <Ppi/Reset2.h>
24 #include <Ppi/FirmwareVolume.h>
25 #include <Ppi/FirmwareVolumeInfo.h>
26 #include <Ppi/FirmwareVolumeInfo2.h>
27 #include <Ppi/Decompress.h>
28 #include <Ppi/GuidedSectionExtraction.h>
29 #include <Ppi/LoadFile.h>
30 #include <Ppi/Security2.h>
31 #include <Ppi/TemporaryRamSupport.h>
32 #include <Ppi/TemporaryRamDone.h>
33 #include <Ppi/SecHobData.h>
34 #include <Library/DebugLib.h>
35 #include <Library/PeiCoreEntryPoint.h>
36 #include <Library/BaseLib.h>
37 #include <Library/HobLib.h>
38 #include <Library/PerformanceLib.h>
39 #include <Library/PeiServicesLib.h>
40 #include <Library/ReportStatusCodeLib.h>
41 #include <Library/PeCoffLib.h>
42 #include <Library/PeCoffGetEntryPointLib.h>
43 #include <Library/BaseMemoryLib.h>
44 #include <Library/CacheMaintenanceLib.h>
45 #include <Library/PcdLib.h>
46 #include <IndustryStandard/PeImage.h>
47 #include <Library/PeiServicesTablePointerLib.h>
48 #include <Library/MemoryAllocationLib.h>
49 #include <Guid/FirmwareFileSystem2.h>
50 #include <Guid/FirmwareFileSystem3.h>
51 #include <Guid/AprioriFileName.h>
54 /// It is an FFS type extension used for PeiFindFileEx. It indicates current
55 /// Ffs searching is for all PEIMs can be dispatched by PeiCore.
57 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
60 /// Pei Core private data structures
63 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
64 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
66 } PEI_PPI_LIST_POINTERS
;
69 /// Number of PEI_PPI_LIST_POINTERS to grow by each time we run out of room
71 #define PPI_GROWTH_STEP 64
72 #define CALLBACK_NOTIFY_GROWTH_STEP 32
73 #define DISPATCH_NOTIFY_GROWTH_STEP 8
78 UINTN LastDispatchedCount
;
80 /// MaxCount number of entries.
82 PEI_PPI_LIST_POINTERS
*PpiPtrs
;
89 /// MaxCount number of entries.
91 PEI_PPI_LIST_POINTERS
*NotifyPtrs
;
92 } PEI_CALLBACK_NOTIFY_LIST
;
97 UINTN LastDispatchedCount
;
99 /// MaxCount number of entries.
101 PEI_PPI_LIST_POINTERS
*NotifyPtrs
;
102 } PEI_DISPATCH_NOTIFY_LIST
;
105 /// PPI database structure which contains three links:
106 /// PpiList, CallbackNotifyList and DispatchNotifyList.
112 PEI_PPI_LIST PpiList
;
114 /// Notify List at dispatch level.
116 PEI_CALLBACK_NOTIFY_LIST CallbackNotifyList
;
118 /// Notify List at callback level.
120 PEI_DISPATCH_NOTIFY_LIST DispatchNotifyList
;
124 // PEI_CORE_FV_HANDE.PeimState
125 // Do not change these values as there is code doing math to change states.
126 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
128 #define PEIM_STATE_NOT_DISPATCHED 0x00
129 #define PEIM_STATE_DISPATCHED 0x01
130 #define PEIM_STATE_REGISTER_FOR_SHADOW 0x02
131 #define PEIM_STATE_DONE 0x03
134 // Number of FV instances to grow by each time we run out of room
136 #define FV_GROWTH_STEP 8
139 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
140 EFI_PEI_FIRMWARE_VOLUME_PPI
*FvPpi
;
141 EFI_PEI_FV_HANDLE FvHandle
;
144 // Ponter to the buffer with the PeimCount number of Entries.
148 // Ponter to the buffer with the PeimCount number of Entries.
150 EFI_PEI_FILE_HANDLE
*FvFileHandles
;
152 UINT32 AuthenticationStatus
;
153 } PEI_CORE_FV_HANDLE
;
159 UINT32 AuthenticationStatus
;
160 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor
;
161 } PEI_CORE_UNKNOW_FORMAT_FV_INFO
;
163 #define CACHE_SETION_MAX_NUMBER 0x10
165 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
166 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
167 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
168 UINT32 AuthenticationStatus
[CACHE_SETION_MAX_NUMBER
];
169 UINTN AllSectionCount
;
171 } CACHE_SECTION_DATA
;
173 #define HOLE_MAX_NUMBER 0x3
175 EFI_PHYSICAL_ADDRESS Base
;
178 BOOLEAN OffsetPositive
;
182 /// Forward declaration for PEI_CORE_INSTANCE
184 typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE
;
188 Function Pointer type for PeiCore function.
189 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
190 and location of temporary RAM, the stack location and the BFV location.
191 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
192 An empty PPI list consists of a single descriptor with the end-tag
193 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
194 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
195 that both the PEI Foundation and any modules can leverage the associated service
196 calls and/or code in these early PPIs
197 @param OldCoreData Pointer to old core data that is used to initialize the
202 (EFIAPI
*PEICORE_FUNCTION_POINTER
)(
203 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
204 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
205 IN PEI_CORE_INSTANCE
*OldCoreData
209 // Number of files to grow by each time we run out of room
211 #define TEMP_FILE_GROWTH_STEP 32
213 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
216 /// Pei Core private data structure instance
218 struct _PEI_CORE_INSTANCE
{
222 /// Point to ServiceTableShadow
224 EFI_PEI_SERVICES
*Ps
;
225 PEI_PPI_DATABASE PpiData
;
228 /// The count of FVs which contains FFS and could be dispatched by PeiCore.
233 /// The max count of FVs which contains FFS and could be dispatched by PeiCore.
238 /// Pointer to the buffer with the MaxFvCount number of entries.
239 /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.
241 PEI_CORE_FV_HANDLE
*Fv
;
244 /// Pointer to the buffer with the MaxUnknownFvInfoCount number of entries.
245 /// Each entry is for one FV which could not be dispatched by PeiCore.
247 PEI_CORE_UNKNOW_FORMAT_FV_INFO
*UnknownFvInfo
;
248 UINTN MaxUnknownFvInfoCount
;
249 UINTN UnknownFvInfoCount
;
252 /// Pointer to the buffer FvFileHandlers in PEI_CORE_FV_HANDLE specified by CurrentPeimFvCount.
254 EFI_PEI_FILE_HANDLE
*CurrentFvFileHandles
;
256 UINTN CurrentPeimFvCount
;
257 UINTN CurrentPeimCount
;
258 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
259 BOOLEAN PeimNeedingDispatch
;
260 BOOLEAN PeimDispatchOnThisPass
;
261 BOOLEAN PeimDispatcherReenter
;
262 EFI_PEI_HOB_POINTERS HobList
;
263 BOOLEAN SwitchStackSignal
;
264 BOOLEAN PeiMemoryInstalled
;
266 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
267 EFI_PEI_SERVICES ServiceTableShadow
;
268 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
269 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
270 UINT64 PhysicalMemoryLength
;
271 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
273 BOOLEAN HeapOffsetPositive
;
275 BOOLEAN StackOffsetPositive
;
277 // Information for migrating memory pages allocated in pre-memory phase.
279 HOLE_MEMORY_DATA MemoryPages
;
280 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
281 CACHE_SECTION_DATA CacheSection
;
283 // For Loading modules at fixed address feature to cache the top address below which the
284 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
285 // and Ps should not be changed since maybe user could get this top address by using the offet to Ps.
287 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
289 // The field is define for Loading modules at fixed address feature to tracker the PEI code
290 // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page
293 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
295 // This field points to the shadowed image read function
297 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
302 // Pointer to the temp buffer with the TempPeimCount number of entries.
304 EFI_PEI_FILE_HANDLE
*TempFileHandles
;
306 // Pointer to the temp buffer with the TempPeimCount number of entries.
308 EFI_GUID
*TempFileGuid
;
311 // Temp Memory Range is not covered by PeiTempMem and Stack.
312 // Those Memory Range will be migrated into physical memory.
314 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
318 /// Pei Core Instance Data Macros
320 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
321 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
324 /// Union of temporarily used function pointers (to save stack space)
327 PEICORE_FUNCTION_POINTER PeiCore
;
328 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
329 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
330 EFI_DXE_IPL_PPI
*DxeIpl
;
331 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
332 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
334 } PEI_CORE_TEMP_POINTERS
;
337 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
338 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
340 } PEI_CORE_PARAMETERS
;
347 The entry routine to Pei Core, invoked by PeiMain during transition
348 from SEC to PEI. After switching stack in the PEI core, it will restart
349 with the old core data.
352 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
353 and location of temporary RAM, the stack location and the BFV location.
354 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
355 An empty PPI list consists of a single descriptor with the end-tag
356 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
357 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
358 that both the PEI Foundation and any modules can leverage the associated service
359 calls and/or code in these early PPIs
360 @param Data Pointer to old core data that is used to initialize the
367 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
368 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
373 // Dispatcher support functions
378 This is the POSTFIX version of the dependency evaluator. When a
379 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
380 the evaluation stack. When that entry is poped from the evaluation
381 stack, the PPI is checked if it is installed. This method allows
382 some time savings as not all PPIs must be checked for certain
383 operation types (AND, OR).
386 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
387 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
388 the BNF described above and is stored in postfix notation.
390 @retval TRUE if it is a well-formed Grammar
391 @retval FALSE if the dependency expression overflows the evaluation stack
392 if the dependency expression underflows the evaluation stack
393 if the dependency expression is not a well-formed Grammar.
397 PeimDispatchReadiness (
398 IN EFI_PEI_SERVICES
**PeiServices
,
399 IN VOID
*DependencyExpression
403 Conduct PEIM dispatch.
405 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
406 @param PrivateData Pointer to the private data passed in from caller
411 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
412 IN PEI_CORE_INSTANCE
*PrivateData
416 Initialize the Dispatcher's data members
418 @param PrivateData PeiCore's private data structure
419 @param OldCoreData Old data from SecCore
420 NULL if being run in non-permament memory mode.
421 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
422 and location of temporary RAM, the stack location and the BFV location.
426 InitializeDispatcherData (
427 IN PEI_CORE_INSTANCE
*PrivateData
,
428 IN PEI_CORE_INSTANCE
*OldCoreData
,
429 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
433 This routine parses the Dependency Expression, if available, and
434 decides if the module can be executed.
437 @param Private PeiCore's private data structure
438 @param FileHandle PEIM's file handle
439 @param PeimCount The index of last dispatched PEIM.
441 @retval TRUE Can be dispatched
442 @retval FALSE Cannot be dispatched
447 IN PEI_CORE_INSTANCE
*Private
,
448 IN EFI_PEI_FILE_HANDLE FileHandle
,
453 // PPI support functions
457 Initialize PPI services.
459 @param PrivateData Pointer to the PEI Core data.
460 @param OldCoreData Pointer to old PEI Core data.
461 NULL if being run in non-permament memory mode.
465 InitializePpiServices (
466 IN PEI_CORE_INSTANCE
*PrivateData
,
467 IN PEI_CORE_INSTANCE
*OldCoreData
472 Migrate the Hob list from the temporary memory to PEI installed memory.
474 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
475 and location of temporary RAM, the stack location and the BFV location.
476 @param PrivateData Pointer to PeiCore's private data structure.
481 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
482 IN PEI_CORE_INSTANCE
*PrivateData
487 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
489 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
490 @param PpiList Pointer to ppi array that want to be installed.
492 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
493 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
494 if any PPI in PpiList is not valid
495 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
501 IN CONST EFI_PEI_SERVICES
**PeiServices
,
502 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
507 Re-Install PPI services.
509 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
510 @param OldPpi Pointer to the old PEI PPI Descriptors.
511 @param NewPpi Pointer to the new PEI PPI Descriptors.
513 @retval EFI_SUCCESS if the operation was successful
514 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
515 if NewPpi is not valid
516 @retval EFI_NOT_FOUND if the PPI was not in the database
522 IN CONST EFI_PEI_SERVICES
**PeiServices
,
523 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
524 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
529 Locate a given named PPI.
532 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
533 @param Guid Pointer to GUID of the PPI.
534 @param Instance Instance Number to discover.
535 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
536 returns a pointer to the descriptor (includes flags, etc)
537 @param Ppi Pointer to reference the found PPI
539 @retval EFI_SUCCESS if the PPI is in the database
540 @retval EFI_NOT_FOUND if the PPI is not in the database
546 IN CONST EFI_PEI_SERVICES
**PeiServices
,
547 IN CONST EFI_GUID
*Guid
,
549 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
555 Install a notification for a given PPI.
558 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
559 @param NotifyList Pointer to list of Descriptors to notify upon.
561 @retval EFI_SUCCESS if successful
562 @retval EFI_OUT_OF_RESOURCES if no space in the database
563 @retval EFI_INVALID_PARAMETER if not a good decriptor
569 IN CONST EFI_PEI_SERVICES
**PeiServices
,
570 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
575 Process the Notify List at dispatch level.
577 @param PrivateData PeiCore's private data structure.
581 ProcessDispatchNotifyList (
582 IN PEI_CORE_INSTANCE
*PrivateData
587 Process notifications.
589 @param PrivateData PeiCore's private data structure
590 @param NotifyType Type of notify to fire.
591 @param InstallStartIndex Install Beginning index.
592 @param InstallStopIndex Install Ending index.
593 @param NotifyStartIndex Notify Beginning index.
594 @param NotifyStopIndex Notify Ending index.
599 IN PEI_CORE_INSTANCE
*PrivateData
,
601 IN INTN InstallStartIndex
,
602 IN INTN InstallStopIndex
,
603 IN INTN NotifyStartIndex
,
604 IN INTN NotifyStopIndex
608 Process PpiList from SEC phase.
610 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
611 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
612 These PPI's will be installed and/or immediately signaled if they are notification type.
616 ProcessPpiListFromSec (
617 IN CONST EFI_PEI_SERVICES
**PeiServices
,
618 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
622 // Boot mode support functions
625 This service enables PEIMs to ascertain the present value of the boot mode.
627 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
628 @param BootMode A pointer to contain the value of the boot mode.
630 @retval EFI_SUCCESS The boot mode was returned successfully.
631 @retval EFI_INVALID_PARAMETER BootMode is NULL.
637 IN CONST EFI_PEI_SERVICES
**PeiServices
,
638 IN OUT EFI_BOOT_MODE
*BootMode
642 This service enables PEIMs to update the boot mode variable.
645 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
646 @param BootMode The value of the boot mode to set.
648 @return EFI_SUCCESS The value was successfully updated
654 IN CONST EFI_PEI_SERVICES
**PeiServices
,
655 IN EFI_BOOT_MODE BootMode
659 // Security support functions
663 Initialize the security services.
665 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
666 @param OldCoreData Pointer to the old core data.
667 NULL if being run in non-permament memory mode.
671 InitializeSecurityServices (
672 IN EFI_PEI_SERVICES
**PeiServices
,
673 IN PEI_CORE_INSTANCE
*OldCoreData
677 Verify a Firmware volume.
679 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
681 @retval EFI_SUCCESS Firmware Volume is legal
682 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
687 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
691 Provide a callout to the security verification service.
693 @param PrivateData PeiCore's private data structure
694 @param VolumeHandle Handle of FV
695 @param FileHandle Handle of PEIM's ffs
696 @param AuthenticationStatus Authentication status
698 @retval EFI_SUCCESS Image is OK
699 @retval EFI_SECURITY_VIOLATION Image is illegal
700 @retval EFI_NOT_FOUND If security PPI is not installed.
704 IN PEI_CORE_INSTANCE
*PrivateData
,
705 IN EFI_PEI_FV_HANDLE VolumeHandle
,
706 IN EFI_PEI_FILE_HANDLE FileHandle
,
707 IN UINT32 AuthenticationStatus
712 Gets the pointer to the HOB List.
715 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
716 @param HobList Pointer to the HOB List.
718 @retval EFI_SUCCESS Get the pointer of HOB List
719 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
720 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
726 IN CONST EFI_PEI_SERVICES
**PeiServices
,
727 IN OUT VOID
**HobList
731 Add a new HOB to the HOB List.
733 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
734 @param Type Type of the new HOB.
735 @param Length Length of the new HOB to allocate.
736 @param Hob Pointer to the new HOB.
738 @return EFI_SUCCESS Success to create hob.
739 @retval EFI_INVALID_PARAMETER if Hob is NULL
740 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
741 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
747 IN CONST EFI_PEI_SERVICES
**PeiServices
,
755 Builds a Handoff Information Table HOB
757 @param BootMode - Current Bootmode
758 @param MemoryBegin - Start Memory Address.
759 @param MemoryLength - Length of Memory.
761 @return EFI_SUCCESS Always success to initialize HOB.
765 PeiCoreBuildHobHandoffInfoTable (
766 IN EFI_BOOT_MODE BootMode
,
767 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
768 IN UINT64 MemoryLength
772 Install SEC HOB data to the HOB List.
774 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
775 @param SecHobList Pointer to SEC HOB List.
777 @return EFI_SUCCESS Success to install SEC HOB data.
778 @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.
782 PeiInstallSecHobData (
783 IN CONST EFI_PEI_SERVICES
**PeiServices
,
784 IN EFI_HOB_GENERIC_HEADER
*SecHobList
789 // FFS Fw Volume support functions
792 Searches for the next matching file in the firmware volume.
794 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
795 @param SearchType Filter to find only files of this type.
796 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
797 @param FvHandle Handle of firmware volume in which to search.
798 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
799 at the beginning of the firmware volume. On exit, points the file handle of the next file
800 in the volume or NULL if there are no more files.
802 @retval EFI_NOT_FOUND The file was not found.
803 @retval EFI_NOT_FOUND The header checksum was not zero.
804 @retval EFI_SUCCESS The file was found.
810 IN CONST EFI_PEI_SERVICES
**PeiServices
,
812 IN EFI_PEI_FV_HANDLE FvHandle
,
813 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
817 Searches for the next matching section within the specified file.
819 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
820 @param SectionType Filter to find only sections of this type.
821 @param FileHandle Pointer to the current file to search.
822 @param SectionData A pointer to the discovered section, if successful.
823 NULL if section not found
825 @retval EFI_NOT_FOUND The section was not found.
826 @retval EFI_SUCCESS The section was found.
831 PeiFfsFindSectionData (
832 IN CONST EFI_PEI_SERVICES
**PeiServices
,
833 IN EFI_SECTION_TYPE SectionType
,
834 IN EFI_PEI_FILE_HANDLE FileHandle
,
835 OUT VOID
**SectionData
839 Searches for the next matching section within the specified file.
841 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
842 @param SectionType The value of the section type to find.
843 @param SectionInstance Section instance to find.
844 @param FileHandle Handle of the firmware file to search.
845 @param SectionData A pointer to the discovered section, if successful.
846 @param AuthenticationStatus A pointer to the authentication status for this section.
848 @retval EFI_SUCCESS The section was found.
849 @retval EFI_NOT_FOUND The section was not found.
854 PeiFfsFindSectionData3 (
855 IN CONST EFI_PEI_SERVICES
**PeiServices
,
856 IN EFI_SECTION_TYPE SectionType
,
857 IN UINTN SectionInstance
,
858 IN EFI_PEI_FILE_HANDLE FileHandle
,
859 OUT VOID
**SectionData
,
860 OUT UINT32
*AuthenticationStatus
864 Search the firmware volumes by index
866 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
867 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
869 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
871 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
872 @retval EFI_NOT_FOUND The volume was not found.
873 @retval EFI_SUCCESS The volume was found.
878 PeiFfsFindNextVolume (
879 IN CONST EFI_PEI_SERVICES
**PeiServices
,
881 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
885 // Memory support functions
889 Initialize the memory services.
891 @param PrivateData PeiCore's private data structure
892 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
893 and location of temporary RAM, the stack location and the BFV location.
894 @param OldCoreData Pointer to the PEI Core data.
895 NULL if being run in non-permament memory mode.
899 InitializeMemoryServices (
900 IN PEI_CORE_INSTANCE
*PrivateData
,
901 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
902 IN PEI_CORE_INSTANCE
*OldCoreData
907 Install the permanent memory is now available.
908 Creates HOB (PHIT and Stack).
910 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
911 @param MemoryBegin Start of memory address.
912 @param MemoryLength Length of memory.
914 @return EFI_SUCCESS Always success.
919 PeiInstallPeiMemory (
920 IN CONST EFI_PEI_SERVICES
**PeiServices
,
921 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
922 IN UINT64 MemoryLength
926 Migrate memory pages allocated in pre-memory phase.
927 Copy memory pages at temporary heap top to permanent heap top.
929 @param[in] Private Pointer to the private data passed in from caller.
930 @param[in] TemporaryRamMigrated Temporary memory has been migrated to permanent memory.
935 IN PEI_CORE_INSTANCE
*Private
,
936 IN BOOLEAN TemporaryRamMigrated
940 Migrate MemoryBaseAddress in memory allocation HOBs
941 from the temporary memory to PEI installed memory.
943 @param[in] PrivateData Pointer to PeiCore's private data structure.
947 ConvertMemoryAllocationHobs (
948 IN PEI_CORE_INSTANCE
*PrivateData
952 The purpose of the service is to publish an interface that allows
953 PEIMs to allocate memory ranges that are managed by the PEI Foundation.
955 Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.
956 After InstallPeiMemory() is called, PEI will allocate pages within the region
957 of memory provided by InstallPeiMemory() service in a best-effort fashion.
958 Location-specific allocations are not managed by the PEI foundation code.
960 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
961 @param MemoryType The type of memory to allocate.
962 @param Pages The number of contiguous 4 KB pages to allocate.
963 @param Memory Pointer to a physical address. On output, the address is set to the base
964 of the page range that was allocated.
966 @retval EFI_SUCCESS The memory range was successfully allocated.
967 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
968 @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,
969 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,
970 EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.
976 IN CONST EFI_PEI_SERVICES
**PeiServices
,
977 IN EFI_MEMORY_TYPE MemoryType
,
979 OUT EFI_PHYSICAL_ADDRESS
*Memory
985 @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
986 @param[in] Memory The base physical address of the pages to be freed.
987 @param[in] Pages The number of contiguous 4 KB pages to free.
989 @retval EFI_SUCCESS The requested pages were freed.
990 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
991 @retval EFI_NOT_FOUND The requested memory pages were not allocated with
998 IN CONST EFI_PEI_SERVICES
**PeiServices
,
999 IN EFI_PHYSICAL_ADDRESS Memory
,
1005 Memory allocation service on the temporary memory.
1008 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1009 @param Size Amount of memory required
1010 @param Buffer Address of pointer to the buffer
1012 @retval EFI_SUCCESS The allocation was successful
1013 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1014 to allocate the requested size.
1020 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1027 Routine for load image file.
1030 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1031 @param FileHandle Pointer to the FFS file header of the image.
1032 @param PeimState The dispatch state of the input PEIM handle.
1033 @param EntryPoint Pointer to entry point of specified image file for output.
1034 @param AuthenticationState Pointer to attestation authentication state of image.
1036 @retval EFI_SUCCESS Image is successfully loaded.
1037 @retval EFI_NOT_FOUND Fail to locate necessary PPI
1038 @retval Others Fail to load file.
1043 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1044 IN EFI_PEI_FILE_HANDLE FileHandle
,
1046 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1047 OUT UINT32
*AuthenticationState
1052 Core version of the Status Code reporter
1055 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1056 @param CodeType Type of Status Code.
1057 @param Value Value to output for Status Code.
1058 @param Instance Instance Number of this status code.
1059 @param CallerId ID of the caller of this status code.
1060 @param Data Optional data associated with this status code.
1062 @retval EFI_SUCCESS if status code is successfully reported
1063 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1068 PeiReportStatusCode (
1069 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1070 IN EFI_STATUS_CODE_TYPE CodeType
,
1071 IN EFI_STATUS_CODE_VALUE Value
,
1073 IN CONST EFI_GUID
*CallerId
,
1074 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1079 Core version of the Reset System
1082 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1084 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
1085 @retval EFI_DEVICE_ERROR Did not reset system.
1086 Otherwise, resets the system.
1092 IN CONST EFI_PEI_SERVICES
**PeiServices
1096 Resets the entire platform.
1098 @param[in] ResetType The type of reset to perform.
1099 @param[in] ResetStatus The status code for the reset.
1100 @param[in] DataSize The size, in bytes, of ResetData.
1101 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
1102 the data buffer starts with a Null-terminated string, optionally
1103 followed by additional binary data. The string is a description
1104 that the caller may use to further indicate the reason for the
1105 system reset. ResetData is only valid if ResetStatus is something
1106 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
1107 where a minimum amount of ResetData is always required.
1113 IN EFI_RESET_TYPE ResetType
,
1114 IN EFI_STATUS ResetStatus
,
1116 IN VOID
*ResetData OPTIONAL
1121 Initialize PeiCore Fv List.
1124 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1125 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1130 IN PEI_CORE_INSTANCE
*PrivateData
,
1131 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1135 Process Firmware Volum Information once FvInfoPPI install.
1137 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1138 @param NotifyDescriptor Address of the notification descriptor data structure.
1139 @param Ppi Address of the PPI that was installed.
1141 @retval EFI_SUCCESS if the interface could be successfully installed
1146 FirmwareVolmeInfoPpiNotifyCallback (
1147 IN EFI_PEI_SERVICES
**PeiServices
,
1148 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1154 Given the input VolumeHandle, search for the next matching name file.
1156 @param FileName File name to search.
1157 @param VolumeHandle The current FV to search.
1158 @param FileHandle Pointer to the file matching name in VolumeHandle.
1159 NULL if file not found
1161 @retval EFI_NOT_FOUND No files matching the search criteria were found
1162 @retval EFI_SUCCESS Success to search given file
1167 PeiFfsFindFileByName (
1168 IN CONST EFI_GUID
*FileName
,
1169 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1170 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1174 Returns information about a specific file.
1176 @param FileHandle Handle of the file.
1177 @param FileInfo Upon exit, points to the file's information.
1179 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1180 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1181 @retval EFI_SUCCESS File information returned.
1187 IN EFI_PEI_FILE_HANDLE FileHandle
,
1188 OUT EFI_FV_FILE_INFO
*FileInfo
1192 Returns information about a specific file.
1194 @param FileHandle Handle of the file.
1195 @param FileInfo Upon exit, points to the file's information.
1197 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1198 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1199 @retval EFI_SUCCESS File information returned.
1204 PeiFfsGetFileInfo2 (
1205 IN EFI_PEI_FILE_HANDLE FileHandle
,
1206 OUT EFI_FV_FILE_INFO2
*FileInfo
1210 Returns information about the specified volume.
1212 @param VolumeHandle Handle of the volume.
1213 @param VolumeInfo Upon exit, points to the volume's information.
1215 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1216 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1217 @retval EFI_SUCCESS Volume information returned.
1221 PeiFfsGetVolumeInfo (
1222 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1223 OUT EFI_FV_INFO
*VolumeInfo
1227 This routine enable a PEIM to register itself to shadow when PEI Foundation
1228 discovery permanent memory.
1230 @param FileHandle File handle of a PEIM.
1232 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1233 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1234 @retval EFI_SUCCESS Successfully to register itself.
1239 PeiRegisterForShadow (
1240 IN EFI_PEI_FILE_HANDLE FileHandle
1244 Initialize image service that install PeiLoadFilePpi.
1246 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1247 @param OldCoreData Pointer to Old PeiCore's private data.
1248 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1249 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1250 to permanent memory.
1254 InitializeImageServices (
1255 IN PEI_CORE_INSTANCE
*PrivateData
,
1256 IN PEI_CORE_INSTANCE
*OldCoreData
1260 The wrapper function of PeiLoadImageLoadImage().
1262 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1263 @param FileHandle Pointer to the FFS file header of the image.
1264 @param ImageAddressArg Pointer to PE/TE image.
1265 @param ImageSizeArg Size of PE/TE image.
1266 @param EntryPoint Pointer to entry point of specified image file for output.
1267 @param AuthenticationState Pointer to attestation authentication state of image.
1269 @return Status of PeiLoadImageLoadImage().
1274 PeiLoadImageLoadImageWrapper (
1275 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1276 IN EFI_PEI_FILE_HANDLE FileHandle
,
1277 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1278 OUT UINT64
*ImageSizeArg
, OPTIONAL
1279 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1280 OUT UINT32
*AuthenticationState
1285 Provide a callback for when the security PPI is installed.
1287 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1288 @param NotifyDescriptor The descriptor for the notification event.
1289 @param Ppi Pointer to the PPI in question.
1291 @return Always success
1296 SecurityPpiNotifyCallback (
1297 IN EFI_PEI_SERVICES
**PeiServices
,
1298 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1303 Get Fv image(s) from the FV type file, then install FV INFO(2) ppi, Build FV(2, 3) hob.
1305 @param PrivateData PeiCore's private data structure
1306 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
1307 @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
1309 @retval EFI_NOT_FOUND FV image can't be found.
1310 @retval EFI_SUCCESS Successfully to process it.
1311 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1312 @retval EFI_SECURITY_VIOLATION Image is illegal
1313 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1318 IN PEI_CORE_INSTANCE
*PrivateData
,
1319 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1320 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1324 Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
1326 This routine also will install FvInfo ppi for FV hob in PI ways.
1328 @param Private Pointer of PEI_CORE_INSTANCE
1329 @param Instance The index of FV want to be searched.
1331 @return Instance of PEI_CORE_FV_HANDLE.
1333 PEI_CORE_FV_HANDLE
*
1334 FindNextCoreFvHandle (
1335 IN PEI_CORE_INSTANCE
*Private
,
1340 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1344 Memory-based read services.
1346 This function is to perform the Memory Access Read service based on installed
1347 instance of the EFI_PEI_CPU_IO_PPI.
1348 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1349 return EFI_NOT_YET_AVAILABLE.
1351 @param PeiServices An indirect pointer to the PEI Services Table
1352 published by the PEI Foundation.
1353 @param This Pointer to local data for the interface.
1354 @param Width The width of the access. Enumerated in bytes.
1355 @param Address The physical address of the access.
1356 @param Count The number of accesses to perform.
1357 @param Buffer A pointer to the buffer of data.
1359 @retval EFI_SUCCESS The function completed successfully.
1360 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1365 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1366 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1367 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1374 Memory-based write services.
1376 This function is to perform the Memory Access Write service based on installed
1377 instance of the EFI_PEI_CPU_IO_PPI.
1378 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1379 return EFI_NOT_YET_AVAILABLE.
1381 @param PeiServices An indirect pointer to the PEI Services Table
1382 published by the PEI Foundation.
1383 @param This Pointer to local data for the interface.
1384 @param Width The width of the access. Enumerated in bytes.
1385 @param Address The physical address of the access.
1386 @param Count The number of accesses to perform.
1387 @param Buffer A pointer to the buffer of data.
1389 @retval EFI_SUCCESS The function completed successfully.
1390 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1394 PeiDefaultMemWrite (
1395 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1396 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1397 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1404 IO-based read services.
1406 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1407 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1408 return EFI_NOT_YET_AVAILABLE.
1410 @param PeiServices An indirect pointer to the PEI Services Table
1411 published by the PEI Foundation.
1412 @param This Pointer to local data for the interface.
1413 @param Width The width of the access. Enumerated in bytes.
1414 @param Address The physical address of the access.
1415 @param Count The number of accesses to perform.
1416 @param Buffer A pointer to the buffer of data.
1418 @retval EFI_SUCCESS The function completed successfully.
1419 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1424 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1425 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1426 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1433 IO-based write services.
1435 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1436 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1437 return EFI_NOT_YET_AVAILABLE.
1439 @param PeiServices An indirect pointer to the PEI Services Table
1440 published by the PEI Foundation.
1441 @param This Pointer to local data for the interface.
1442 @param Width The width of the access. Enumerated in bytes.
1443 @param Address The physical address of the access.
1444 @param Count The number of accesses to perform.
1445 @param Buffer A pointer to the buffer of data.
1447 @retval EFI_SUCCESS The function completed successfully.
1448 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1453 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1454 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1455 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1462 8-bit I/O read operations.
1464 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1467 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1468 @param This Pointer to local data for the interface.
1469 @param Address The physical address of the access.
1471 @return An 8-bit value returned from the I/O space.
1476 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1477 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1482 Reads an 16-bit I/O port.
1484 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1487 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1488 @param This Pointer to local data for the interface.
1489 @param Address The physical address of the access.
1491 @return A 16-bit value returned from the I/O space.
1495 PeiDefaultIoRead16 (
1496 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1497 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1502 Reads an 32-bit I/O port.
1504 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1507 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1508 @param This Pointer to local data for the interface.
1509 @param Address The physical address of the access.
1511 @return A 32-bit value returned from the I/O space.
1515 PeiDefaultIoRead32 (
1516 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1517 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1522 Reads an 64-bit I/O port.
1524 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1527 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1528 @param This Pointer to local data for the interface.
1529 @param Address The physical address of the access.
1531 @return A 64-bit value returned from the I/O space.
1535 PeiDefaultIoRead64 (
1536 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1537 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1542 8-bit I/O write operations.
1544 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1545 @param This Pointer to local data for the interface.
1546 @param Address The physical address of the access.
1547 @param Data The data to write.
1551 PeiDefaultIoWrite8 (
1552 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1553 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1559 16-bit I/O write operations.
1561 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1562 @param This Pointer to local data for the interface.
1563 @param Address The physical address of the access.
1564 @param Data The data to write.
1568 PeiDefaultIoWrite16 (
1569 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1570 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1576 32-bit I/O write operations.
1578 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1579 @param This Pointer to local data for the interface.
1580 @param Address The physical address of the access.
1581 @param Data The data to write.
1585 PeiDefaultIoWrite32 (
1586 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1587 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1593 64-bit I/O write operations.
1595 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1596 @param This Pointer to local data for the interface.
1597 @param Address The physical address of the access.
1598 @param Data The data to write.
1602 PeiDefaultIoWrite64 (
1603 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1604 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1610 8-bit memory read operations.
1612 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1615 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1616 @param This Pointer to local data for the interface.
1617 @param Address The physical address of the access.
1619 @return An 8-bit value returned from the memory space.
1624 PeiDefaultMemRead8 (
1625 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1626 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1631 16-bit memory read operations.
1633 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1636 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1637 @param This Pointer to local data for the interface.
1638 @param Address The physical address of the access.
1640 @return An 16-bit value returned from the memory space.
1645 PeiDefaultMemRead16 (
1646 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1647 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1652 32-bit memory read operations.
1654 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1657 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1658 @param This Pointer to local data for the interface.
1659 @param Address The physical address of the access.
1661 @return An 32-bit value returned from the memory space.
1666 PeiDefaultMemRead32 (
1667 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1668 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1673 64-bit memory read operations.
1675 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1678 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1679 @param This Pointer to local data for the interface.
1680 @param Address The physical address of the access.
1682 @return An 64-bit value returned from the memory space.
1687 PeiDefaultMemRead64 (
1688 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1689 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1694 8-bit memory write operations.
1696 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1697 @param This Pointer to local data for the interface.
1698 @param Address The physical address of the access.
1699 @param Data The data to write.
1704 PeiDefaultMemWrite8 (
1705 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1706 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1712 16-bit memory write operations.
1714 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1715 @param This Pointer to local data for the interface.
1716 @param Address The physical address of the access.
1717 @param Data The data to write.
1722 PeiDefaultMemWrite16 (
1723 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1724 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1730 32-bit memory write operations.
1732 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1733 @param This Pointer to local data for the interface.
1734 @param Address The physical address of the access.
1735 @param Data The data to write.
1740 PeiDefaultMemWrite32 (
1741 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1742 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1748 64-bit memory write operations.
1750 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1751 @param This Pointer to local data for the interface.
1752 @param Address The physical address of the access.
1753 @param Data The data to write.
1758 PeiDefaultMemWrite64 (
1759 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1760 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1765 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1768 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1772 Reads from a given location in the PCI configuration space.
1774 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1775 return EFI_NOT_YET_AVAILABLE.
1777 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1778 @param This Pointer to local data for the interface.
1779 @param Width The width of the access. Enumerated in bytes.
1780 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1781 @param Address The physical address of the access. The format of
1782 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1783 @param Buffer A pointer to the buffer of data.
1785 @retval EFI_SUCCESS The function completed successfully.
1786 @retval EFI_INVALID_PARAMETER The invalid access width.
1787 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1792 PeiDefaultPciCfg2Read (
1793 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1794 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1795 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1801 Write to a given location in the PCI configuration space.
1803 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1804 return EFI_NOT_YET_AVAILABLE.
1806 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1807 @param This Pointer to local data for the interface.
1808 @param Width The width of the access. Enumerated in bytes.
1809 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1810 @param Address The physical address of the access. The format of
1811 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1812 @param Buffer A pointer to the buffer of data.
1814 @retval EFI_SUCCESS The function completed successfully.
1815 @retval EFI_INVALID_PARAMETER The invalid access width.
1816 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1820 PeiDefaultPciCfg2Write (
1821 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1822 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1823 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1829 This function performs a read-modify-write operation on the contents from a given
1830 location in the PCI configuration space.
1832 @param PeiServices An indirect pointer to the PEI Services Table
1833 published by the PEI Foundation.
1834 @param This Pointer to local data for the interface.
1835 @param Width The width of the access. Enumerated in bytes. Type
1836 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
1837 @param Address The physical address of the access.
1838 @param SetBits Points to value to bitwise-OR with the read configuration value.
1839 The size of the value is determined by Width.
1840 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
1841 The size of the value is determined by Width.
1843 @retval EFI_SUCCESS The function completed successfully.
1844 @retval EFI_INVALID_PARAMETER The invalid access width.
1845 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1849 PeiDefaultPciCfg2Modify (
1850 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1851 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1852 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1858 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
1861 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
1862 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
1863 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
1866 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1870 IN PEI_CORE_INSTANCE
*PrivateData