3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Definition of Pei Core Structures and Services
28 #include <Ppi/DxeIpl.h>
29 #include <Ppi/MemoryDiscovered.h>
30 #include <Ppi/StatusCode.h>
31 #include <Ppi/Reset.h>
32 #include <Ppi/FirmwareVolume.h>
33 #include <Ppi/FirmwareVolumeInfo.h>
34 #include <Ppi/Decompress.h>
35 #include <Ppi/GuidedSectionExtraction.h>
36 #include <Ppi/LoadFile.h>
37 #include <Ppi/Security2.h>
38 #include <Ppi/TemporaryRamSupport.h>
39 #include <Library/DebugLib.h>
40 #include <Library/PeiCoreEntryPoint.h>
41 #include <Library/BaseLib.h>
42 #include <Library/HobLib.h>
43 #include <Library/PerformanceLib.h>
44 #include <Library/PeiServicesLib.h>
45 #include <Library/ReportStatusCodeLib.h>
46 #include <Library/PeCoffLib.h>
47 #include <Library/PeCoffGetEntryPointLib.h>
48 #include <Library/BaseMemoryLib.h>
49 #include <Library/CacheMaintenanceLib.h>
50 #include <Library/TimerLib.h>
51 #include <Library/PcdLib.h>
52 #include <IndustryStandard/PeImage.h>
53 #include <Library/PeiServicesTablePointerLib.h>
54 #include <Library/MemoryAllocationLib.h>
55 #include <Library/PeiPiLib.h>
56 #include <Guid/FirmwareFileSystem2.h>
57 #include <Guid/AprioriFileName.h>
59 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
62 // Pei Core private data structures
65 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
66 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
68 } PEI_PPI_LIST_POINTERS
;
70 #define MAX_PPI_DESCRIPTORS 64
76 INTN LastDispatchedInstall
;
77 INTN LastDispatchedNotify
;
78 PEI_PPI_LIST_POINTERS PpiListPtrs
[MAX_PPI_DESCRIPTORS
];
83 // PEI_CORE_FV_HANDE.PeimState
84 // Do not change these values as there is code doing math to change states.
85 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
87 #define PEIM_STATE_NOT_DISPATCHED 0x00
88 #define PEIM_STATE_DISPATCHED 0x01
89 #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02
90 #define PEIM_STATE_DONE 0x03
93 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
94 UINT8 PeimState
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
95 EFI_PEI_FILE_HANDLE FvFileHandles
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
99 #define CACHE_SETION_MAX_NUMBER 0x10
101 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
102 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
103 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
104 UINTN AllSectionCount
;
106 } CACHE_SECTION_DATA
;
109 // Pei Core private data structure instance
112 #define PEI_CORE_HANDLE_SIGNATURE EFI_SIGNATURE_32('P','e','i','C')
116 EFI_PEI_SERVICES
*PS
; // Point to ServiceTableShadow
117 PEI_PPI_DATABASE PpiData
;
119 PEI_CORE_FV_HANDLE Fv
[FixedPcdGet32 (PcdPeiCoreMaxFvSupported
)];
120 EFI_PEI_FILE_HANDLE CurrentFvFileHandles
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
122 UINTN CurrentPeimFvCount
;
123 UINTN CurrentPeimCount
;
124 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
126 EFI_PEI_FV_HANDLE AllFv
[FixedPcdGet32 (PcdPeiCoreMaxFvSupported
)];
127 EFI_PEI_HOB_POINTERS HobList
;
128 BOOLEAN SwitchStackSignal
;
129 BOOLEAN PeiMemoryInstalled
;
130 EFI_PHYSICAL_ADDRESS StackBase
;
132 VOID
*BottomOfCarHeap
;
135 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
136 EFI_PEI_SERVICES ServiceTableShadow
;
137 UINTN SizeOfTemporaryMemory
;
138 UINTN SizeOfCacheAsRam
;
139 VOID
*MaxTopOfCarHeap
;
140 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
141 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
142 UINT64 PhysicalMemoryLength
;
143 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
144 VOID
* ShadowedPeiCore
;
145 CACHE_SECTION_DATA CacheSection
;
149 // Pei Core Instance Data Macros
152 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
153 CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)
156 // BUGBUG: Where does this go really?
160 (EFIAPI
*PEI_CORE_ENTRY_POINT
)(
161 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
162 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
163 IN PEI_CORE_INSTANCE
*OldCoreData
167 // Union of temporarily used function pointers (to save stack space)
170 PEI_CORE_ENTRY_POINT PeiCore
;
171 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
172 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
173 EFI_DXE_IPL_PPI
*DxeIpl
;
174 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
175 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
177 } PEI_CORE_TEMP_POINTERS
;
182 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
183 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
185 } PEI_CORE_PARAMETERS
;
193 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
194 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpList
,
201 The entry routine to Pei Core, invoked by PeiMain during transition
202 from SEC to PEI. After switching stack in the PEI core, it will restart
203 with the old core data.
207 PeiStartupDescriptor - Information and services provided by SEC phase.
208 OldCoreData - Pointer to old core data that is used to initialize the
213 This function never returns
214 EFI_NOT_FOUND - Never reach
220 // Dispatcher support functions
224 PeimDispatchReadiness (
225 IN EFI_PEI_SERVICES
**PeiServices
,
226 IN VOID
*DependencyExpression
232 This is the POSTFIX version of the dependency evaluator. When a
233 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
234 the evaluation stack. When that entry is poped from the evaluation
235 stack, the PPI is checked if it is installed. This method allows
236 some time savings as not all PPIs must be checked for certain
237 operation types (AND, OR).
241 PeiServices - Calling context.
243 DependencyExpression - Pointer to a dependency expression. The Grammar adheres to
244 the BNF described above and is stored in postfix notation.
248 Status = EFI_SUCCESS if it is a well-formed Grammar
249 EFI_INVALID_PARAMETER if the dependency expression overflows
251 EFI_INVALID_PARAMETER if the dependency expression underflows
253 EFI_INVALID_PARAMETER if the dependency expression is not a
261 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
262 IN PEI_CORE_INSTANCE
*PrivateData
269 Conduct PEIM dispatch.
273 PeiStartupDescriptor - Pointer to IN EFI_PEI_STARTUP_DESCRIPTOR
274 PrivateData - Pointer to the private data passed in from caller
275 DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data.
279 EFI_SUCCESS - Successfully dispatched PEIM.
280 EFI_NOT_FOUND - The dispatch failed.
287 InitializeDispatcherData (
288 IN PEI_CORE_INSTANCE
*PrivateData
,
289 IN PEI_CORE_INSTANCE
*OldCoreData
,
290 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
296 Initialize the Dispatcher's data members
300 PeiServices - The PEI core services table.
301 OldCoreData - Pointer to old core data (before switching stack).
302 NULL if being run in non-permament memory mode.
303 PeiStartupDescriptor - Information and services provided by SEC phase.
316 IN EFI_PEI_SERVICES
**PeiServices
,
317 IN EFI_FIRMWARE_VOLUME_HEADER
*FwVolHeader
,
318 IN OUT EFI_FFS_FILE_HEADER
**PeimFileHeader
323 Given the input file pointer, search for the next matching file in the
324 FFS volume. The search starts from FileHeader inside
325 the Firmware Volume defined by FwVolHeader.
328 PeiServices - Pointer to the PEI Core Services Table.
330 FwVolHeader - Pointer to the FV header of the volume to search.
331 This parameter must point to a valid FFS volume.
333 PeimFileHeader - Pointer to the current file from which to begin searching.
334 This pointer will be updated upon return to reflect the file found.
337 EFI_NOT_FOUND - No files matching the search criteria were found
345 IN UINT8 CurrentPeim
,
346 IN UINT32 DispatchedPeimBitMap
352 This routine checks to see if a particular PEIM has been dispatched during
353 the PEI core dispatch.
356 CurrentPeim - The PEIM/FV in the bit array to check.
357 DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
360 TRUE if PEIM already dispatched
368 IN EFI_PEI_SERVICES
**PeiServices
,
369 IN UINT8 CurrentPeim
,
370 OUT UINT32
*DispatchedPeimBitMap
376 This routine sets a PEIM as having been dispatched once its entry
377 point has been invoked.
381 PeiServices - The PEI core services table.
382 CurrentPeim - The PEIM/FV in the bit array to check.
383 DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
393 IN PEI_CORE_INSTANCE
*Private
,
394 IN EFI_PEI_FILE_HANDLE FileHandle
,
401 This routine parses the Dependency Expression, if available, and
402 decides if the module can be executed.
405 PeiServices - The PEI Service Table
406 CurrentPeimAddress - Address of the PEIM Firmware File under investigation
409 TRUE - Can be dispatched
410 FALSE - Cannot be dispatched
416 // PPI support functions
419 InitializePpiServices (
420 IN PEI_CORE_INSTANCE
*PrivateData
,
421 IN PEI_CORE_INSTANCE
*OldCoreData
427 Initialize PPI services.
431 PeiServices - The PEI core services table.
432 OldCoreData - Pointer to the PEI Core data.
433 NULL if being run in non-permament memory mode.
443 IN CONST EFI_PEI_SERVICES
**PeiServices
,
444 IN UINTN OldCheckingBottom
,
445 IN UINTN OldCheckingTop
,
446 IN EFI_HOB_HANDOFF_INFO_TABLE
*NewHandOffHob
452 Migrate the Hob list from the CAR stack to PEI installed memory.
456 PeiServices - The PEI core services table.
457 OldCheckingBottom - The old checking bottom.
458 OldCheckingTop - The old checking top.
459 NewHandOffHob - The new handoff HOB list.
469 IN CONST EFI_PEI_SERVICES
**PeiServices
,
470 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
476 Install PPI services.
480 PeiServices - Pointer to the PEI Service Table
481 PpiList - Pointer to a list of PEI PPI Descriptors.
485 EFI_SUCCESS - if all PPIs in PpiList are successfully installed.
486 EFI_INVALID_PARAMETER - if PpiList is NULL pointer
487 EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid
488 EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI
496 IN CONST EFI_PEI_SERVICES
**PeiServices
,
497 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
498 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
504 Re-Install PPI services.
508 PeiServices - Pointer to the PEI Service Table
509 OldPpi - Pointer to the old PEI PPI Descriptors.
510 NewPpi - Pointer to the new PEI PPI Descriptors.
514 EFI_SUCCESS - if the operation was successful
515 EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL
516 EFI_INVALID_PARAMETER - if NewPpi is not valid
517 EFI_NOT_FOUND - if the PPI was not in the database
525 IN CONST EFI_PEI_SERVICES
**PeiServices
,
526 IN CONST EFI_GUID
*Guid
,
528 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
535 Locate a given named PPI.
539 PeiServices - Pointer to the PEI Service Table
540 Guid - Pointer to GUID of the PPI.
541 Instance - Instance Number to discover.
542 PpiDescriptor - Pointer to reference the found descriptor. If not NULL,
543 returns a pointer to the descriptor (includes flags, etc)
544 Ppi - Pointer to reference the found PPI
548 Status - EFI_SUCCESS if the PPI is in the database
549 EFI_NOT_FOUND if the PPI is not in the database
556 IN CONST EFI_PEI_SERVICES
**PeiServices
,
557 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
563 Install a notification for a given PPI.
567 PeiServices - Pointer to the PEI Service Table
568 NotifyList - Pointer to list of Descriptors to notify upon.
572 Status - EFI_SUCCESS if successful
573 EFI_OUT_OF_RESOURCES if no space in the database
574 EFI_INVALID_PARAMETER if not a good decriptor
581 IN PEI_CORE_INSTANCE
*PrivateData
587 Process the Notify List at dispatch level.
591 PeiServices - Pointer to the PEI Service Table
600 IN PEI_CORE_INSTANCE
*PrivateData
,
602 IN INTN InstallStartIndex
,
603 IN INTN InstallStopIndex
,
604 IN INTN NotifyStartIndex
,
605 IN INTN NotifyStopIndex
611 Dispatch notifications.
615 PeiServices - Pointer to the PEI Service Table
616 NotifyType - Type of notify to fire.
617 InstallStartIndex - Install Beginning index.
618 InstallStopIndex - Install Ending index.
619 NotifyStartIndex - Notify Beginning index.
620 NotifyStopIndex - Notify Ending index.
628 // Boot mode support functions
633 IN CONST EFI_PEI_SERVICES
**PeiServices
,
634 IN OUT EFI_BOOT_MODE
*BootMode
640 This service enables PEIMs to ascertain the present value of the boot mode.
644 PeiServices - The PEI core services table.
645 BootMode - A pointer to contain the value of the boot mode.
649 EFI_SUCCESS - The boot mode was returned successfully.
650 EFI_INVALID_PARAMETER - BootMode is NULL.
658 IN CONST EFI_PEI_SERVICES
**PeiServices
,
659 IN EFI_BOOT_MODE BootMode
665 This service enables PEIMs to update the boot mode variable.
669 PeiServices - The PEI core services table.
670 BootMode - The value of the boot mode to set.
674 EFI_SUCCESS - The value was successfully updated
680 // Security support functions
683 InitializeSecurityServices (
684 IN EFI_PEI_SERVICES
**PeiServices
,
685 IN PEI_CORE_INSTANCE
*OldCoreData
691 Initialize the security services.
695 PeiServices - The PEI core services table.
696 OldCoreData - Pointer to the old core data.
697 NULL if being run in non-permament memory mode.
707 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
713 Provide a callout to the OEM FV verification service.
717 CurrentFvAddress - Pointer to the FV under investigation.
729 IN PEI_CORE_INSTANCE
*PrivateData
,
730 IN EFI_PEI_FV_HANDLE VolumeHandle
,
731 IN EFI_PEI_FILE_HANDLE FileHandle
737 Provide a callout to the security verification service.
741 PeiServices - The PEI core services table.
742 CurrentPeimAddress - Pointer to the Firmware File under investigation.
746 EFI_SUCCESS - Image is OK
747 EFI_SECURITY_VIOLATION - Image is illegal
756 IN CONST EFI_PEI_SERVICES
**PeiServices
,
757 IN OUT VOID
**HobList
763 Gets the pointer to the HOB List.
767 PeiServices - The PEI core services table.
768 HobList - Pointer to the HOB List.
772 EFI_SUCCESS - Get the pointer of HOB List
773 EFI_NOT_AVAILABLE_YET - the HOB List is not yet published
774 EFI_INVALID_PARAMETER - HobList is NULL (in debug mode)
782 IN CONST EFI_PEI_SERVICES
**PeiServices
,
791 Add a new HOB to the HOB List.
795 PeiServices - The PEI core services table.
796 Type - Type of the new HOB.
797 Length - Length of the new HOB to allocate.
798 Hob - Pointer to the new HOB.
803 - EFI_INVALID_PARAMETER if Hob is NULL
804 - EFI_NOT_AVAILABLE_YET if HobList is still not available.
805 - EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
811 PeiCoreBuildHobHandoffInfoTable (
812 IN EFI_BOOT_MODE BootMode
,
813 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
814 IN UINT64 MemoryLength
820 Builds a Handoff Information Table HOB
824 BootMode - Current Bootmode
825 MemoryBegin - Start Memory Address.
826 MemoryLength - Length of Memory.
837 // FFS Fw Volume support functions
842 IN CONST EFI_PEI_SERVICES
**PeiServices
,
844 IN EFI_PEI_FV_HANDLE FwVolHeader
,
845 IN OUT EFI_PEI_FILE_HANDLE
*FileHeader
850 Given the input file pointer, search for the next matching file in the
851 FFS volume as defined by SearchType. The search starts from FileHeader inside
852 the Firmware Volume defined by FwVolHeader.
855 PeiServices - Pointer to the PEI Core Services Table.
857 SearchType - Filter to find only files of this type.
858 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
860 FwVolHeader - Pointer to the FV header of the volume to search.
861 This parameter must point to a valid FFS volume.
863 FileHeader - Pointer to the current file from which to begin searching.
864 This pointer will be updated upon return to reflect the file found.
867 EFI_NOT_FOUND - No files matching the search criteria were found
875 PeiFfsFindSectionData (
876 IN CONST EFI_PEI_SERVICES
**PeiServices
,
877 IN EFI_SECTION_TYPE SectionType
,
878 IN EFI_PEI_FILE_HANDLE FfsFileHeader
,
879 IN OUT VOID
**SectionData
884 Given the input file pointer, search for the next matching section in the
888 PeiServices - Pointer to the PEI Core Services Table.
889 SearchType - Filter to find only sections of this type.
890 FfsFileHeader - Pointer to the current file to search.
891 SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
892 - NULL if section not found
895 EFI_NOT_FOUND - No files matching the search criteria were found
903 PeiFvFindNextVolume (
904 IN CONST EFI_PEI_SERVICES
**PeiServices
,
906 IN OUT EFI_PEI_FV_HANDLE
*FwVolHeader
912 Return the BFV location
914 BugBug -- Move this to the location of this code to where the
915 other FV and FFS support code lives.
916 Also, update to use FindFV for instances #'s >= 1.
920 PeiServices - The PEI core services table.
921 Instance - Instance of FV to find
922 FwVolHeader - Pointer to contain the data to return
925 Pointer to the Firmware Volume instance requested
927 EFI_INVALID_PARAMETER - FwVolHeader is NULL
929 EFI_SUCCESS - Firmware volume instance successfully found.
935 // Memory support functions
938 InitializeMemoryServices (
939 IN PEI_CORE_INSTANCE
*PrivateData
,
940 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
941 IN PEI_CORE_INSTANCE
*OldCoreData
947 Initialize the memory services.
951 PeiServices - The PEI core services table.
952 PeiStartupDescriptor - Information and services provided by SEC phase.
953 OldCoreData - Pointer to the PEI Core data.
954 NULL if being run in non-permament memory mode.
965 PeiInstallPeiMemory (
966 IN CONST EFI_PEI_SERVICES
**PeiServices
,
967 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
968 IN UINT64 MemoryLength
974 Install the permanent memory is now available.
975 Creates HOB (PHIT and Stack).
979 PeiServices - The PEI core services table.
980 MemoryBegin - Start of memory address.
981 MemoryLength - Length of memory.
993 IN CONST EFI_PEI_SERVICES
**PeiServices
,
994 IN EFI_MEMORY_TYPE MemoryType
,
996 OUT EFI_PHYSICAL_ADDRESS
*Memory
1000 Routine Description:
1002 Memory allocation service on permanent memory,
1003 not usable prior to the memory installation.
1007 PeiServices - The PEI core services table.
1008 Type - Type of allocation.
1009 MemoryType - Type of memory to allocate.
1010 Pages - Number of pages to allocate.
1011 Memory - Pointer of memory allocated.
1015 Status - EFI_SUCCESS The allocation was successful
1016 EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
1017 EFI_NOT_AVAILABLE_YET Called with permanent memory not available
1018 EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
1019 to allocate the number of pages.
1027 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1033 Routine Description:
1035 Memory allocation service on the CAR.
1039 PeiServices - The PEI core services table.
1041 Size - Amount of memory required
1043 Buffer - Address of pointer to the buffer
1047 Status - EFI_SUCCESS The allocation was successful
1048 EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1049 to allocate the requested size.
1056 IN EFI_PEI_SERVICES
**PeiServices
,
1057 IN EFI_PEI_FILE_HANDLE FileHandle
,
1058 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1059 OUT UINT32
*AuthenticationState
1063 Routine Description:
1065 Get entry point of a Peim file.
1069 PeiServices - Calling context.
1071 PeimFileHeader - Peim file's header.
1073 EntryPoint - Entry point of that Peim file.
1085 PeiReportStatusCode (
1086 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1087 IN EFI_STATUS_CODE_TYPE CodeType
,
1088 IN EFI_STATUS_CODE_VALUE Value
,
1090 IN CONST EFI_GUID
*CallerId
,
1091 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1095 Routine Description:
1097 Core version of the Status Code reporter
1101 PeiServices - The PEI core services table.
1103 CodeType - Type of Status Code.
1105 Value - Value to output for Status Code.
1107 Instance - Instance Number of this status code.
1109 CallerId - ID of the caller of this status code.
1111 Data - Optional data associated with this status code.
1115 Status - EFI_SUCCESS if status code is successfully reported
1116 - EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1125 IN CONST EFI_PEI_SERVICES
**PeiServices
1129 Routine Description:
1131 Core version of the Reset System
1135 PeiServices - The PEI core services table.
1139 Status - EFI_NOT_AVAILABLE_YET. PPI not available yet.
1140 - EFI_DEVICE_ERROR. Did not reset system.
1142 Otherwise, resets the system.
1149 IN PEI_CORE_INSTANCE
*PrivateData
,
1150 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1154 Routine Description:
1156 Initialize PeiCore Fv List.
1159 PrivateData - Pointer to PEI_CORE_INSTANCE.
1160 SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1170 FirmwareVolmeInfoPpiNotifyCallback (
1171 IN EFI_PEI_SERVICES
**PeiServices
,
1172 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1177 Routine Description:
1179 Process Firmware Volum Information once FvInfoPPI install.
1183 PeiServices - General purpose services available to every PEIM.
1187 Status - EFI_SUCCESS if the interface could be successfully
1196 PeiFfsFindFileByName (
1197 IN CONST EFI_GUID
*FileName
,
1198 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1199 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1203 Routine Description:
1205 Given the input VolumeHandle, search for the next matching name file.
1209 FileName - File name to search.
1210 VolumeHandle - The current FV to search.
1211 FileHandle - Pointer to the file matching name in VolumeHandle.
1212 - NULL if file not found
1223 IN EFI_PEI_FILE_HANDLE FileHandle
,
1224 OUT EFI_FV_FILE_INFO
*FileInfo
1228 Routine Description:
1230 Collect information of given file.
1233 FileHandle - The handle to file.
1234 FileInfo - Pointer to the file information.
1244 PeiFfsGetVolumeInfo (
1245 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1246 OUT EFI_FV_INFO
*VolumeInfo
1250 Routine Description:
1252 Collect information of given Fv Volume.
1255 VolumeHandle - The handle to Fv Volume.
1256 VolumeInfo - The pointer to volume information.
1267 PeiRegisterForShadow (
1268 IN EFI_PEI_FILE_HANDLE FileHandle
1272 Routine Description:
1274 This routine enable a PEIM to register itself to shadow when PEI Foundation
1275 discovery permanent memory.
1278 FileHandle - File handle of a PEIM.
1281 EFI_NOT_FOUND - The file handle doesn't point to PEIM itself.
1282 EFI_ALREADY_STARTED - Indicate that the PEIM has been registered itself.
1283 EFI_SUCCESS - Successfully to register itself.
1290 This routine enable a PEIM to register itself to shadow when PEI Foundation
1291 discovery permanent memory.
1293 @param FileHandle File handle of a PEIM.
1295 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1296 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1297 @retval EFI_SUCCESS Successfully to register itself.
1302 PeiRegisterForShadow (
1303 IN EFI_PEI_FILE_HANDLE FileHandle
1309 IN CONST EFI_PEI_FV_HANDLE FvHandle
,
1310 IN CONST EFI_GUID
*FileName
, OPTIONAL
1311 IN EFI_FV_FILETYPE SearchType
,
1312 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
,
1313 IN OUT EFI_PEI_FV_HANDLE
*AprioriFile OPTIONAL
1317 Routine Description:
1318 Given the input file pointer, search for the next matching file in the
1319 FFS volume as defined by SearchType. The search starts from FileHeader inside
1320 the Firmware Volume defined by FwVolHeader.
1323 PeiServices - Pointer to the PEI Core Services Table.
1324 SearchType - Filter to find only files of this type.
1325 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
1326 FwVolHeader - Pointer to the FV header of the volume to search.
1327 This parameter must point to a valid FFS volume.
1328 FileHeader - Pointer to the current file from which to begin searching.
1329 This pointer will be updated upon return to reflect the file found.
1330 Flag - Indicator for if this is for PEI Dispath search
1333 EFI_NOT_FOUND - No files matching the search criteria were found
1340 InitializeImageServices (
1341 IN PEI_CORE_INSTANCE
*PrivateData
,
1342 IN PEI_CORE_INSTANCE
*OldCoreData
1346 Routine Description:
1348 Install Pei Load File PPI.
1352 PrivateData - Pointer to PEI_CORE_INSTANCE.
1353 OldCoreData - Pointer to PEI_CORE_INSTANCE.
1363 Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
1365 @param PeiServices Pointer to the PEI Core Services Table.
1366 @param FileHandle File handle of a Fv type file.
1367 @param AuthenticationState Pointer to attestation authentication state of image.
1370 @retval EFI_NOT_FOUND FV image can't be found.
1371 @retval EFI_SUCCESS Successfully to process it.
1376 IN EFI_PEI_SERVICES
**PeiServices
,
1377 IN EFI_PEI_FILE_HANDLE FvFileHandle
,
1378 OUT UINT32
*AuthenticationState