2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2017, 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 <Library/DebugLib.h>
34 #include <Library/PeiCoreEntryPoint.h>
35 #include <Library/BaseLib.h>
36 #include <Library/HobLib.h>
37 #include <Library/PerformanceLib.h>
38 #include <Library/PeiServicesLib.h>
39 #include <Library/ReportStatusCodeLib.h>
40 #include <Library/PeCoffLib.h>
41 #include <Library/PeCoffGetEntryPointLib.h>
42 #include <Library/BaseMemoryLib.h>
43 #include <Library/CacheMaintenanceLib.h>
44 #include <Library/PcdLib.h>
45 #include <IndustryStandard/PeImage.h>
46 #include <Library/PeiServicesTablePointerLib.h>
47 #include <Library/MemoryAllocationLib.h>
48 #include <Guid/FirmwareFileSystem2.h>
49 #include <Guid/FirmwareFileSystem3.h>
50 #include <Guid/AprioriFileName.h>
53 /// It is an FFS type extension used for PeiFindFileEx. It indicates current
54 /// Ffs searching is for all PEIMs can be dispatched by PeiCore.
56 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
59 /// Pei Core private data structures
62 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
63 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
65 } PEI_PPI_LIST_POINTERS
;
68 /// PPI database structure which contains two link: PpiList and NotifyList. PpiList
69 /// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.
73 /// index of end of PpiList link list.
77 /// index of end of notify link list.
81 /// index of the dispatched notify list.
85 /// index of last installed Ppi description in PpiList link list.
87 INTN LastDispatchedInstall
;
89 /// index of last dispatched notify in Notify link list.
91 INTN LastDispatchedNotify
;
93 /// Ppi database has the PcdPeiCoreMaxPpiSupported number of entries.
95 PEI_PPI_LIST_POINTERS
*PpiListPtrs
;
100 // PEI_CORE_FV_HANDE.PeimState
101 // Do not change these values as there is code doing math to change states.
102 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
104 #define PEIM_STATE_NOT_DISPATCHED 0x00
105 #define PEIM_STATE_DISPATCHED 0x01
106 #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02
107 #define PEIM_STATE_DONE 0x03
110 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
111 EFI_PEI_FIRMWARE_VOLUME_PPI
*FvPpi
;
112 EFI_PEI_FV_HANDLE FvHandle
;
114 // Ponter to the buffer with the PcdPeiCoreMaxPeimPerFv number of Entries.
118 // Ponter to the buffer with the PcdPeiCoreMaxPeimPerFv number of Entries.
120 EFI_PEI_FILE_HANDLE
*FvFileHandles
;
122 UINT32 AuthenticationStatus
;
123 } PEI_CORE_FV_HANDLE
;
129 UINT32 AuthenticationStatus
;
130 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor
;
131 } PEI_CORE_UNKNOW_FORMAT_FV_INFO
;
133 #define CACHE_SETION_MAX_NUMBER 0x10
135 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
136 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
137 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
138 UINT32 AuthenticationStatus
[CACHE_SETION_MAX_NUMBER
];
139 UINTN AllSectionCount
;
141 } CACHE_SECTION_DATA
;
143 #define HOLE_MAX_NUMBER 0x3
145 EFI_PHYSICAL_ADDRESS Base
;
148 BOOLEAN OffsetPositive
;
152 /// Forward declaration for PEI_CORE_INSTANCE
154 typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE
;
158 Function Pointer type for PeiCore function.
159 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
160 and location of temporary RAM, the stack location and the BFV location.
161 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
162 An empty PPI list consists of a single descriptor with the end-tag
163 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
164 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
165 that both the PEI Foundation and any modules can leverage the associated service
166 calls and/or code in these early PPIs
167 @param OldCoreData Pointer to old core data that is used to initialize the
172 (EFIAPI
*PEICORE_FUNCTION_POINTER
)(
173 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
174 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
175 IN PEI_CORE_INSTANCE
*OldCoreData
178 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
181 /// Pei Core private data structure instance
183 struct _PEI_CORE_INSTANCE
{
187 /// Point to ServiceTableShadow
189 EFI_PEI_SERVICES
*Ps
;
190 PEI_PPI_DATABASE PpiData
;
193 /// The count of FVs which contains FFS and could be dispatched by PeiCore.
198 /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.
199 /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.
201 PEI_CORE_FV_HANDLE
*Fv
;
204 /// Pointer to the buffer with the PcdPeiCoreMaxFvSupported number of entries.
205 /// Each entry is for one FV which could not be dispatched by PeiCore.
207 PEI_CORE_UNKNOW_FORMAT_FV_INFO
*UnknownFvInfo
;
208 UINTN UnknownFvInfoCount
;
211 /// Pointer to the buffer with the PcdPeiCoreMaxPeimPerFv number of entries.
213 EFI_PEI_FILE_HANDLE
*CurrentFvFileHandles
;
215 UINTN CurrentPeimFvCount
;
216 UINTN CurrentPeimCount
;
217 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
218 BOOLEAN PeimNeedingDispatch
;
219 BOOLEAN PeimDispatchOnThisPass
;
220 BOOLEAN PeimDispatcherReenter
;
221 EFI_PEI_HOB_POINTERS HobList
;
222 BOOLEAN SwitchStackSignal
;
223 BOOLEAN PeiMemoryInstalled
;
225 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
226 EFI_PEI_SERVICES ServiceTableShadow
;
227 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
228 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
229 UINT64 PhysicalMemoryLength
;
230 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
232 BOOLEAN HeapOffsetPositive
;
234 BOOLEAN StackOffsetPositive
;
235 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
236 CACHE_SECTION_DATA CacheSection
;
238 // For Loading modules at fixed address feature to cache the top address below which the
239 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
240 // and Ps should not be changed since maybe user could get this top address by using the offet to Ps.
242 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
244 // The field is define for Loading modules at fixed address feature to tracker the PEI code
245 // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page
248 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
250 // This field points to the shadowed image read function
252 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
255 // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv + 1 number of entries.
257 EFI_PEI_FILE_HANDLE
*FileHandles
;
259 // Pointer to the temp buffer with the PcdPeiCoreMaxPeimPerFv number of entries.
264 // Temp Memory Range is not covered by PeiTempMem and Stack.
265 // Those Memory Range will be migrated into phisical memory.
267 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
271 /// Pei Core Instance Data Macros
273 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
274 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
277 /// Union of temporarily used function pointers (to save stack space)
280 PEICORE_FUNCTION_POINTER PeiCore
;
281 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
282 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
283 EFI_DXE_IPL_PPI
*DxeIpl
;
284 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
285 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
287 } PEI_CORE_TEMP_POINTERS
;
290 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
291 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
293 } PEI_CORE_PARAMETERS
;
300 The entry routine to Pei Core, invoked by PeiMain during transition
301 from SEC to PEI. After switching stack in the PEI core, it will restart
302 with the old core data.
305 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
306 and location of temporary RAM, the stack location and the BFV location.
307 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
308 An empty PPI list consists of a single descriptor with the end-tag
309 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
310 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
311 that both the PEI Foundation and any modules can leverage the associated service
312 calls and/or code in these early PPIs
313 @param Data Pointer to old core data that is used to initialize the
320 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
321 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
326 // Dispatcher support functions
331 This is the POSTFIX version of the dependency evaluator. When a
332 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
333 the evaluation stack. When that entry is poped from the evaluation
334 stack, the PPI is checked if it is installed. This method allows
335 some time savings as not all PPIs must be checked for certain
336 operation types (AND, OR).
339 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
340 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
341 the BNF described above and is stored in postfix notation.
343 @retval TRUE if it is a well-formed Grammar
344 @retval FALSE if the dependency expression overflows the evaluation stack
345 if the dependency expression underflows the evaluation stack
346 if the dependency expression is not a well-formed Grammar.
350 PeimDispatchReadiness (
351 IN EFI_PEI_SERVICES
**PeiServices
,
352 IN VOID
*DependencyExpression
356 Conduct PEIM dispatch.
358 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
359 @param PrivateData Pointer to the private data passed in from caller
364 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
365 IN PEI_CORE_INSTANCE
*PrivateData
369 Initialize the Dispatcher's data members
371 @param PrivateData PeiCore's private data structure
372 @param OldCoreData Old data from SecCore
373 NULL if being run in non-permament memory mode.
374 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
375 and location of temporary RAM, the stack location and the BFV location.
379 InitializeDispatcherData (
380 IN PEI_CORE_INSTANCE
*PrivateData
,
381 IN PEI_CORE_INSTANCE
*OldCoreData
,
382 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
386 This routine parses the Dependency Expression, if available, and
387 decides if the module can be executed.
390 @param Private PeiCore's private data structure
391 @param FileHandle PEIM's file handle
392 @param PeimCount The index of last dispatched PEIM.
394 @retval TRUE Can be dispatched
395 @retval FALSE Cannot be dispatched
400 IN PEI_CORE_INSTANCE
*Private
,
401 IN EFI_PEI_FILE_HANDLE FileHandle
,
406 // PPI support functions
410 Initialize PPI services.
412 @param PrivateData Pointer to the PEI Core data.
413 @param OldCoreData Pointer to old PEI Core data.
414 NULL if being run in non-permament memory mode.
418 InitializePpiServices (
419 IN PEI_CORE_INSTANCE
*PrivateData
,
420 IN PEI_CORE_INSTANCE
*OldCoreData
425 Migrate the Hob list from the temporary memory stack to PEI installed memory.
427 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
428 and location of temporary RAM, the stack location and the BFV location.
429 @param PrivateData Pointer to PeiCore's private data structure.
434 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
435 IN PEI_CORE_INSTANCE
*PrivateData
440 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
442 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
443 @param PpiList Pointer to ppi array that want to be installed.
445 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
446 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
447 if any PPI in PpiList is not valid
448 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
454 IN CONST EFI_PEI_SERVICES
**PeiServices
,
455 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
460 Re-Install PPI services.
462 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
463 @param OldPpi Pointer to the old PEI PPI Descriptors.
464 @param NewPpi Pointer to the new PEI PPI Descriptors.
466 @retval EFI_SUCCESS if the operation was successful
467 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
468 if NewPpi is not valid
469 @retval EFI_NOT_FOUND if the PPI was not in the database
475 IN CONST EFI_PEI_SERVICES
**PeiServices
,
476 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
477 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
482 Locate a given named PPI.
485 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
486 @param Guid Pointer to GUID of the PPI.
487 @param Instance Instance Number to discover.
488 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
489 returns a pointer to the descriptor (includes flags, etc)
490 @param Ppi Pointer to reference the found PPI
492 @retval EFI_SUCCESS if the PPI is in the database
493 @retval EFI_NOT_FOUND if the PPI is not in the database
499 IN CONST EFI_PEI_SERVICES
**PeiServices
,
500 IN CONST EFI_GUID
*Guid
,
502 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
508 Install a notification for a given PPI.
511 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
512 @param NotifyList Pointer to list of Descriptors to notify upon.
514 @retval EFI_SUCCESS if successful
515 @retval EFI_OUT_OF_RESOURCES if no space in the database
516 @retval EFI_INVALID_PARAMETER if not a good decriptor
522 IN CONST EFI_PEI_SERVICES
**PeiServices
,
523 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
528 Process the Notify List at dispatch level.
530 @param PrivateData PeiCore's private data structure.
535 IN PEI_CORE_INSTANCE
*PrivateData
540 Dispatch notifications.
542 @param PrivateData PeiCore's private data structure
543 @param NotifyType Type of notify to fire.
544 @param InstallStartIndex Install Beginning index.
545 @param InstallStopIndex Install Ending index.
546 @param NotifyStartIndex Notify Beginning index.
547 @param NotifyStopIndex Notify Ending index.
552 IN PEI_CORE_INSTANCE
*PrivateData
,
554 IN INTN InstallStartIndex
,
555 IN INTN InstallStopIndex
,
556 IN INTN NotifyStartIndex
,
557 IN INTN NotifyStopIndex
561 Process PpiList from SEC phase.
563 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
564 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
565 These PPI's will be installed and/or immediately signaled if they are notification type.
569 ProcessPpiListFromSec (
570 IN CONST EFI_PEI_SERVICES
**PeiServices
,
571 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
575 // Boot mode support functions
578 This service enables PEIMs to ascertain the present value of the boot mode.
580 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
581 @param BootMode A pointer to contain the value of the boot mode.
583 @retval EFI_SUCCESS The boot mode was returned successfully.
584 @retval EFI_INVALID_PARAMETER BootMode is NULL.
590 IN CONST EFI_PEI_SERVICES
**PeiServices
,
591 IN OUT EFI_BOOT_MODE
*BootMode
595 This service enables PEIMs to update the boot mode variable.
598 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
599 @param BootMode The value of the boot mode to set.
601 @return EFI_SUCCESS The value was successfully updated
607 IN CONST EFI_PEI_SERVICES
**PeiServices
,
608 IN EFI_BOOT_MODE BootMode
612 // Security support functions
616 Initialize the security services.
618 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
619 @param OldCoreData Pointer to the old core data.
620 NULL if being run in non-permament memory mode.
624 InitializeSecurityServices (
625 IN EFI_PEI_SERVICES
**PeiServices
,
626 IN PEI_CORE_INSTANCE
*OldCoreData
630 Verify a Firmware volume.
632 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
634 @retval EFI_SUCCESS Firmware Volume is legal
635 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
640 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
644 Provide a callout to the security verification service.
646 @param PrivateData PeiCore's private data structure
647 @param VolumeHandle Handle of FV
648 @param FileHandle Handle of PEIM's ffs
649 @param AuthenticationStatus Authentication status
651 @retval EFI_SUCCESS Image is OK
652 @retval EFI_SECURITY_VIOLATION Image is illegal
653 @retval EFI_NOT_FOUND If security PPI is not installed.
657 IN PEI_CORE_INSTANCE
*PrivateData
,
658 IN EFI_PEI_FV_HANDLE VolumeHandle
,
659 IN EFI_PEI_FILE_HANDLE FileHandle
,
660 IN UINT32 AuthenticationStatus
665 Gets the pointer to the HOB List.
668 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
669 @param HobList Pointer to the HOB List.
671 @retval EFI_SUCCESS Get the pointer of HOB List
672 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
673 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
679 IN CONST EFI_PEI_SERVICES
**PeiServices
,
680 IN OUT VOID
**HobList
684 Add a new HOB to the HOB List.
686 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
687 @param Type Type of the new HOB.
688 @param Length Length of the new HOB to allocate.
689 @param Hob Pointer to the new HOB.
691 @return EFI_SUCCESS Success to create hob.
692 @retval EFI_INVALID_PARAMETER if Hob is NULL
693 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
694 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
700 IN CONST EFI_PEI_SERVICES
**PeiServices
,
708 Builds a Handoff Information Table HOB
710 @param BootMode - Current Bootmode
711 @param MemoryBegin - Start Memory Address.
712 @param MemoryLength - Length of Memory.
714 @return EFI_SUCCESS Always success to initialize HOB.
718 PeiCoreBuildHobHandoffInfoTable (
719 IN EFI_BOOT_MODE BootMode
,
720 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
721 IN UINT64 MemoryLength
726 // FFS Fw Volume support functions
729 Searches for the next matching file in the firmware volume.
731 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
732 @param SearchType Filter to find only files of this type.
733 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
734 @param FvHandle Handle of firmware volume in which to search.
735 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
736 at the beginning of the firmware volume. On exit, points the file handle of the next file
737 in the volume or NULL if there are no more files.
739 @retval EFI_NOT_FOUND The file was not found.
740 @retval EFI_NOT_FOUND The header checksum was not zero.
741 @retval EFI_SUCCESS The file was found.
747 IN CONST EFI_PEI_SERVICES
**PeiServices
,
749 IN EFI_PEI_FV_HANDLE FvHandle
,
750 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
754 Searches for the next matching section within the specified file.
756 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
757 @param SectionType Filter to find only sections of this type.
758 @param FileHandle Pointer to the current file to search.
759 @param SectionData A pointer to the discovered section, if successful.
760 NULL if section not found
762 @retval EFI_NOT_FOUND The section was not found.
763 @retval EFI_SUCCESS The section was found.
768 PeiFfsFindSectionData (
769 IN CONST EFI_PEI_SERVICES
**PeiServices
,
770 IN EFI_SECTION_TYPE SectionType
,
771 IN EFI_PEI_FILE_HANDLE FileHandle
,
772 OUT VOID
**SectionData
776 Searches for the next matching section within the specified file.
778 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
779 @param SectionType The value of the section type to find.
780 @param SectionInstance Section instance to find.
781 @param FileHandle Handle of the firmware file to search.
782 @param SectionData A pointer to the discovered section, if successful.
783 @param AuthenticationStatus A pointer to the authentication status for this section.
785 @retval EFI_SUCCESS The section was found.
786 @retval EFI_NOT_FOUND The section was not found.
791 PeiFfsFindSectionData3 (
792 IN CONST EFI_PEI_SERVICES
**PeiServices
,
793 IN EFI_SECTION_TYPE SectionType
,
794 IN UINTN SectionInstance
,
795 IN EFI_PEI_FILE_HANDLE FileHandle
,
796 OUT VOID
**SectionData
,
797 OUT UINT32
*AuthenticationStatus
801 Search the firmware volumes by index
803 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
804 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
806 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
808 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
809 @retval EFI_NOT_FOUND The volume was not found.
810 @retval EFI_SUCCESS The volume was found.
815 PeiFfsFindNextVolume (
816 IN CONST EFI_PEI_SERVICES
**PeiServices
,
818 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
822 // Memory support functions
826 Initialize the memory services.
828 @param PrivateData PeiCore's private data structure
829 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
830 and location of temporary RAM, the stack location and the BFV location.
831 @param OldCoreData Pointer to the PEI Core data.
832 NULL if being run in non-permament memory mode.
836 InitializeMemoryServices (
837 IN PEI_CORE_INSTANCE
*PrivateData
,
838 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
839 IN PEI_CORE_INSTANCE
*OldCoreData
844 Install the permanent memory is now available.
845 Creates HOB (PHIT and Stack).
847 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
848 @param MemoryBegin Start of memory address.
849 @param MemoryLength Length of memory.
851 @return EFI_SUCCESS Always success.
856 PeiInstallPeiMemory (
857 IN CONST EFI_PEI_SERVICES
**PeiServices
,
858 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
859 IN UINT64 MemoryLength
864 Memory allocation service on permanent memory,
865 not usable prior to the memory installation.
868 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
869 @param MemoryType Type of memory to allocate.
870 @param Pages Number of pages to allocate.
871 @param Memory Pointer of memory allocated.
873 @retval EFI_SUCCESS The allocation was successful
874 @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
875 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available
876 @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
877 to allocate the number of pages.
883 IN CONST EFI_PEI_SERVICES
**PeiServices
,
884 IN EFI_MEMORY_TYPE MemoryType
,
886 OUT EFI_PHYSICAL_ADDRESS
*Memory
891 Memory allocation service on the temporary memory.
894 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
895 @param Size Amount of memory required
896 @param Buffer Address of pointer to the buffer
898 @retval EFI_SUCCESS The allocation was successful
899 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
900 to allocate the requested size.
906 IN CONST EFI_PEI_SERVICES
**PeiServices
,
913 Routine for load image file.
916 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
917 @param FileHandle Pointer to the FFS file header of the image.
918 @param PeimState The dispatch state of the input PEIM handle.
919 @param EntryPoint Pointer to entry point of specified image file for output.
920 @param AuthenticationState Pointer to attestation authentication state of image.
922 @retval EFI_SUCCESS Image is successfully loaded.
923 @retval EFI_NOT_FOUND Fail to locate necessary PPI
924 @retval Others Fail to load file.
929 IN CONST EFI_PEI_SERVICES
**PeiServices
,
930 IN EFI_PEI_FILE_HANDLE FileHandle
,
932 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
933 OUT UINT32
*AuthenticationState
938 Core version of the Status Code reporter
941 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
942 @param CodeType Type of Status Code.
943 @param Value Value to output for Status Code.
944 @param Instance Instance Number of this status code.
945 @param CallerId ID of the caller of this status code.
946 @param Data Optional data associated with this status code.
948 @retval EFI_SUCCESS if status code is successfully reported
949 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
954 PeiReportStatusCode (
955 IN CONST EFI_PEI_SERVICES
**PeiServices
,
956 IN EFI_STATUS_CODE_TYPE CodeType
,
957 IN EFI_STATUS_CODE_VALUE Value
,
959 IN CONST EFI_GUID
*CallerId
,
960 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
965 Core version of the Reset System
968 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
970 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
971 @retval EFI_DEVICE_ERROR Did not reset system.
972 Otherwise, resets the system.
978 IN CONST EFI_PEI_SERVICES
**PeiServices
982 Resets the entire platform.
984 @param[in] ResetType The type of reset to perform.
985 @param[in] ResetStatus The status code for the reset.
986 @param[in] DataSize The size, in bytes, of ResetData.
987 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
988 the data buffer starts with a Null-terminated string, optionally
989 followed by additional binary data. The string is a description
990 that the caller may use to further indicate the reason for the
991 system reset. ResetData is only valid if ResetStatus is something
992 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
993 where a minimum amount of ResetData is always required.
999 IN EFI_RESET_TYPE ResetType
,
1000 IN EFI_STATUS ResetStatus
,
1002 IN VOID
*ResetData OPTIONAL
1007 Initialize PeiCore Fv List.
1010 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1011 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1016 IN PEI_CORE_INSTANCE
*PrivateData
,
1017 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1021 Process Firmware Volum Information once FvInfoPPI install.
1023 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1024 @param NotifyDescriptor Address of the notification descriptor data structure.
1025 @param Ppi Address of the PPI that was installed.
1027 @retval EFI_SUCCESS if the interface could be successfully installed
1032 FirmwareVolmeInfoPpiNotifyCallback (
1033 IN EFI_PEI_SERVICES
**PeiServices
,
1034 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1040 Given the input VolumeHandle, search for the next matching name file.
1042 @param FileName File name to search.
1043 @param VolumeHandle The current FV to search.
1044 @param FileHandle Pointer to the file matching name in VolumeHandle.
1045 NULL if file not found
1047 @retval EFI_NOT_FOUND No files matching the search criteria were found
1048 @retval EFI_SUCCESS Success to search given file
1053 PeiFfsFindFileByName (
1054 IN CONST EFI_GUID
*FileName
,
1055 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1056 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1060 Returns information about a specific file.
1062 @param FileHandle Handle of the file.
1063 @param FileInfo Upon exit, points to the file's information.
1065 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1066 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1067 @retval EFI_SUCCESS File information returned.
1073 IN EFI_PEI_FILE_HANDLE FileHandle
,
1074 OUT EFI_FV_FILE_INFO
*FileInfo
1078 Returns information about a specific file.
1080 @param FileHandle Handle of the file.
1081 @param FileInfo Upon exit, points to the file's information.
1083 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1084 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1085 @retval EFI_SUCCESS File information returned.
1090 PeiFfsGetFileInfo2 (
1091 IN EFI_PEI_FILE_HANDLE FileHandle
,
1092 OUT EFI_FV_FILE_INFO2
*FileInfo
1096 Returns information about the specified volume.
1098 @param VolumeHandle Handle of the volume.
1099 @param VolumeInfo Upon exit, points to the volume's information.
1101 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1102 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1103 @retval EFI_SUCCESS Volume information returned.
1107 PeiFfsGetVolumeInfo (
1108 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1109 OUT EFI_FV_INFO
*VolumeInfo
1113 This routine enable a PEIM to register itself to shadow when PEI Foundation
1114 discovery permanent memory.
1116 @param FileHandle File handle of a PEIM.
1118 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1119 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1120 @retval EFI_SUCCESS Successfully to register itself.
1125 PeiRegisterForShadow (
1126 IN EFI_PEI_FILE_HANDLE FileHandle
1130 Initialize image service that install PeiLoadFilePpi.
1132 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1133 @param OldCoreData Pointer to Old PeiCore's private data.
1134 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1135 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1136 to permanent memory.
1140 InitializeImageServices (
1141 IN PEI_CORE_INSTANCE
*PrivateData
,
1142 IN PEI_CORE_INSTANCE
*OldCoreData
1146 The wrapper function of PeiLoadImageLoadImage().
1148 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1149 @param FileHandle Pointer to the FFS file header of the image.
1150 @param ImageAddressArg Pointer to PE/TE image.
1151 @param ImageSizeArg Size of PE/TE image.
1152 @param EntryPoint Pointer to entry point of specified image file for output.
1153 @param AuthenticationState Pointer to attestation authentication state of image.
1155 @return Status of PeiLoadImageLoadImage().
1160 PeiLoadImageLoadImageWrapper (
1161 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1162 IN EFI_PEI_FILE_HANDLE FileHandle
,
1163 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1164 OUT UINT64
*ImageSizeArg
, OPTIONAL
1165 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1166 OUT UINT32
*AuthenticationState
1171 Provide a callback for when the security PPI is installed.
1173 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1174 @param NotifyDescriptor The descriptor for the notification event.
1175 @param Ppi Pointer to the PPI in question.
1177 @return Always success
1182 SecurityPpiNotifyCallback (
1183 IN EFI_PEI_SERVICES
**PeiServices
,
1184 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1189 Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV hob.
1191 @param PrivateData PeiCore's private data structure
1192 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
1193 @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
1195 @retval EFI_NOT_FOUND FV image can't be found.
1196 @retval EFI_SUCCESS Successfully to process it.
1197 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1198 @retval EFI_SECURITY_VIOLATION Image is illegal
1199 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1204 IN PEI_CORE_INSTANCE
*PrivateData
,
1205 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1206 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1210 Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
1212 This routine also will install FvInfo ppi for FV hob in PI ways.
1214 @param Private Pointer of PEI_CORE_INSTANCE
1215 @param Instance The index of FV want to be searched.
1217 @return Instance of PEI_CORE_FV_HANDLE.
1219 PEI_CORE_FV_HANDLE
*
1220 FindNextCoreFvHandle (
1221 IN PEI_CORE_INSTANCE
*Private
,
1226 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1230 Memory-based read services.
1232 This function is to perform the Memory Access Read service based on installed
1233 instance of the EFI_PEI_CPU_IO_PPI.
1234 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1235 return EFI_NOT_YET_AVAILABLE.
1237 @param PeiServices An indirect pointer to the PEI Services Table
1238 published by the PEI Foundation.
1239 @param This Pointer to local data for the interface.
1240 @param Width The width of the access. Enumerated in bytes.
1241 @param Address The physical address of the access.
1242 @param Count The number of accesses to perform.
1243 @param Buffer A pointer to the buffer of data.
1245 @retval EFI_SUCCESS The function completed successfully.
1246 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1251 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1252 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1253 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1260 Memory-based write services.
1262 This function is to perform the Memory Access Write service based on installed
1263 instance of the EFI_PEI_CPU_IO_PPI.
1264 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1265 return EFI_NOT_YET_AVAILABLE.
1267 @param PeiServices An indirect pointer to the PEI Services Table
1268 published by the PEI Foundation.
1269 @param This Pointer to local data for the interface.
1270 @param Width The width of the access. Enumerated in bytes.
1271 @param Address The physical address of the access.
1272 @param Count The number of accesses to perform.
1273 @param Buffer A pointer to the buffer of data.
1275 @retval EFI_SUCCESS The function completed successfully.
1276 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1280 PeiDefaultMemWrite (
1281 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1282 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1283 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1290 IO-based read services.
1292 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1293 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1294 return EFI_NOT_YET_AVAILABLE.
1296 @param PeiServices An indirect pointer to the PEI Services Table
1297 published by the PEI Foundation.
1298 @param This Pointer to local data for the interface.
1299 @param Width The width of the access. Enumerated in bytes.
1300 @param Address The physical address of the access.
1301 @param Count The number of accesses to perform.
1302 @param Buffer A pointer to the buffer of data.
1304 @retval EFI_SUCCESS The function completed successfully.
1305 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1310 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1311 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1312 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1319 IO-based write services.
1321 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1322 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1323 return EFI_NOT_YET_AVAILABLE.
1325 @param PeiServices An indirect pointer to the PEI Services Table
1326 published by the PEI Foundation.
1327 @param This Pointer to local data for the interface.
1328 @param Width The width of the access. Enumerated in bytes.
1329 @param Address The physical address of the access.
1330 @param Count The number of accesses to perform.
1331 @param Buffer A pointer to the buffer of data.
1333 @retval EFI_SUCCESS The function completed successfully.
1334 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1339 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1340 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1341 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1348 8-bit I/O read operations.
1350 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1353 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1354 @param This Pointer to local data for the interface.
1355 @param Address The physical address of the access.
1357 @return An 8-bit value returned from the I/O space.
1362 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1363 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1368 Reads an 16-bit I/O port.
1370 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1373 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1374 @param This Pointer to local data for the interface.
1375 @param Address The physical address of the access.
1377 @return A 16-bit value returned from the I/O space.
1381 PeiDefaultIoRead16 (
1382 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1383 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1388 Reads an 32-bit I/O port.
1390 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1393 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1394 @param This Pointer to local data for the interface.
1395 @param Address The physical address of the access.
1397 @return A 32-bit value returned from the I/O space.
1401 PeiDefaultIoRead32 (
1402 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1403 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1408 Reads an 64-bit I/O port.
1410 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1413 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1414 @param This Pointer to local data for the interface.
1415 @param Address The physical address of the access.
1417 @return A 64-bit value returned from the I/O space.
1421 PeiDefaultIoRead64 (
1422 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1423 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1428 8-bit I/O write operations.
1430 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1431 @param This Pointer to local data for the interface.
1432 @param Address The physical address of the access.
1433 @param Data The data to write.
1437 PeiDefaultIoWrite8 (
1438 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1439 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1445 16-bit I/O write operations.
1447 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1448 @param This Pointer to local data for the interface.
1449 @param Address The physical address of the access.
1450 @param Data The data to write.
1454 PeiDefaultIoWrite16 (
1455 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1456 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1462 32-bit I/O write operations.
1464 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1465 @param This Pointer to local data for the interface.
1466 @param Address The physical address of the access.
1467 @param Data The data to write.
1471 PeiDefaultIoWrite32 (
1472 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1473 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1479 64-bit I/O write operations.
1481 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1482 @param This Pointer to local data for the interface.
1483 @param Address The physical address of the access.
1484 @param Data The data to write.
1488 PeiDefaultIoWrite64 (
1489 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1490 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1496 8-bit memory read operations.
1498 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1501 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1502 @param This Pointer to local data for the interface.
1503 @param Address The physical address of the access.
1505 @return An 8-bit value returned from the memory space.
1510 PeiDefaultMemRead8 (
1511 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1512 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1517 16-bit memory read operations.
1519 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1522 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1523 @param This Pointer to local data for the interface.
1524 @param Address The physical address of the access.
1526 @return An 16-bit value returned from the memory space.
1531 PeiDefaultMemRead16 (
1532 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1533 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1538 32-bit memory read operations.
1540 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1543 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1544 @param This Pointer to local data for the interface.
1545 @param Address The physical address of the access.
1547 @return An 32-bit value returned from the memory space.
1552 PeiDefaultMemRead32 (
1553 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1554 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1559 64-bit memory read operations.
1561 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1564 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1565 @param This Pointer to local data for the interface.
1566 @param Address The physical address of the access.
1568 @return An 64-bit value returned from the memory space.
1573 PeiDefaultMemRead64 (
1574 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1575 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1580 8-bit memory write operations.
1582 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1583 @param This Pointer to local data for the interface.
1584 @param Address The physical address of the access.
1585 @param Data The data to write.
1590 PeiDefaultMemWrite8 (
1591 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1592 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1598 16-bit memory write operations.
1600 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1601 @param This Pointer to local data for the interface.
1602 @param Address The physical address of the access.
1603 @param Data The data to write.
1608 PeiDefaultMemWrite16 (
1609 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1610 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1616 32-bit memory write operations.
1618 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1619 @param This Pointer to local data for the interface.
1620 @param Address The physical address of the access.
1621 @param Data The data to write.
1626 PeiDefaultMemWrite32 (
1627 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1628 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1634 64-bit memory write operations.
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.
1639 @param Data The data to write.
1644 PeiDefaultMemWrite64 (
1645 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1646 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1651 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1654 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1658 Reads from a given location in the PCI configuration space.
1660 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1661 return EFI_NOT_YET_AVAILABLE.
1663 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1664 @param This Pointer to local data for the interface.
1665 @param Width The width of the access. Enumerated in bytes.
1666 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1667 @param Address The physical address of the access. The format of
1668 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1669 @param Buffer A pointer to the buffer of data.
1671 @retval EFI_SUCCESS The function completed successfully.
1672 @retval EFI_INVALID_PARAMETER The invalid access width.
1673 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1678 PeiDefaultPciCfg2Read (
1679 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1680 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1681 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1687 Write to a given location in the PCI configuration space.
1689 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1690 return EFI_NOT_YET_AVAILABLE.
1692 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1693 @param This Pointer to local data for the interface.
1694 @param Width The width of the access. Enumerated in bytes.
1695 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1696 @param Address The physical address of the access. The format of
1697 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1698 @param Buffer A pointer to the buffer of data.
1700 @retval EFI_SUCCESS The function completed successfully.
1701 @retval EFI_INVALID_PARAMETER The invalid access width.
1702 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1706 PeiDefaultPciCfg2Write (
1707 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1708 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1709 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1715 This function performs a read-modify-write operation on the contents from a given
1716 location in the PCI configuration space.
1718 @param PeiServices An indirect pointer to the PEI Services Table
1719 published by the PEI Foundation.
1720 @param This Pointer to local data for the interface.
1721 @param Width The width of the access. Enumerated in bytes. Type
1722 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
1723 @param Address The physical address of the access.
1724 @param SetBits Points to value to bitwise-OR with the read configuration value.
1725 The size of the value is determined by Width.
1726 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
1727 The size of the value is determined by Width.
1729 @retval EFI_SUCCESS The function completed successfully.
1730 @retval EFI_INVALID_PARAMETER The invalid access width.
1731 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1735 PeiDefaultPciCfg2Modify (
1736 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1737 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1738 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1744 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
1747 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
1748 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
1749 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
1752 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1756 IN PEI_CORE_INSTANCE
*PrivateData