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
415 #if defined (MDE_CPU_IPF)
417 // In Ipf we should make special changes for the PHIT pointers to support
418 // recovery boot in cache mode.
420 #define SWITCH_TO_CACHE_MODE(CoreData) SwitchToCacheMode(CoreData)
421 #define CACHE_MODE_ADDRESS_MASK 0x7FFFFFFFFFFFFFFFULL
424 IN PEI_CORE_INSTANCE
*CoreData
430 Switch the PHIT pointers to cache mode after InstallPeiMemory in CAR.
434 CoreData - The PEI core Private Data
443 #define SWITCH_TO_CACHE_MODE(CoreData)
448 // PPI support functions
451 InitializePpiServices (
452 IN PEI_CORE_INSTANCE
*PrivateData
,
453 IN PEI_CORE_INSTANCE
*OldCoreData
459 Initialize PPI services.
463 PeiServices - The PEI core services table.
464 OldCoreData - Pointer to the PEI Core data.
465 NULL if being run in non-permament memory mode.
475 IN CONST EFI_PEI_SERVICES
**PeiServices
,
476 IN UINTN OldCheckingBottom
,
477 IN UINTN OldCheckingTop
,
478 IN EFI_HOB_HANDOFF_INFO_TABLE
*NewHandOffHob
484 Migrate the Hob list from the CAR stack to PEI installed memory.
488 PeiServices - The PEI core services table.
489 OldCheckingBottom - The old checking bottom.
490 OldCheckingTop - The old checking top.
491 NewHandOffHob - The new handoff HOB list.
501 IN CONST EFI_PEI_SERVICES
**PeiServices
,
502 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
508 Install PPI services.
512 PeiServices - Pointer to the PEI Service Table
513 PpiList - Pointer to a list of PEI PPI Descriptors.
517 EFI_SUCCESS - if all PPIs in PpiList are successfully installed.
518 EFI_INVALID_PARAMETER - if PpiList is NULL pointer
519 EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid
520 EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI
528 IN CONST EFI_PEI_SERVICES
**PeiServices
,
529 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
530 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
536 Re-Install PPI services.
540 PeiServices - Pointer to the PEI Service Table
541 OldPpi - Pointer to the old PEI PPI Descriptors.
542 NewPpi - Pointer to the new PEI PPI Descriptors.
546 EFI_SUCCESS - if the operation was successful
547 EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL
548 EFI_INVALID_PARAMETER - if NewPpi is not valid
549 EFI_NOT_FOUND - if the PPI was not in the database
557 IN CONST EFI_PEI_SERVICES
**PeiServices
,
558 IN CONST EFI_GUID
*Guid
,
560 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
567 Locate a given named PPI.
571 PeiServices - Pointer to the PEI Service Table
572 Guid - Pointer to GUID of the PPI.
573 Instance - Instance Number to discover.
574 PpiDescriptor - Pointer to reference the found descriptor. If not NULL,
575 returns a pointer to the descriptor (includes flags, etc)
576 Ppi - Pointer to reference the found PPI
580 Status - EFI_SUCCESS if the PPI is in the database
581 EFI_NOT_FOUND if the PPI is not in the database
588 IN CONST EFI_PEI_SERVICES
**PeiServices
,
589 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
595 Install a notification for a given PPI.
599 PeiServices - Pointer to the PEI Service Table
600 NotifyList - Pointer to list of Descriptors to notify upon.
604 Status - EFI_SUCCESS if successful
605 EFI_OUT_OF_RESOURCES if no space in the database
606 EFI_INVALID_PARAMETER if not a good decriptor
613 IN PEI_CORE_INSTANCE
*PrivateData
619 Process the Notify List at dispatch level.
623 PeiServices - Pointer to the PEI Service Table
632 IN PEI_CORE_INSTANCE
*PrivateData
,
634 IN INTN InstallStartIndex
,
635 IN INTN InstallStopIndex
,
636 IN INTN NotifyStartIndex
,
637 IN INTN NotifyStopIndex
643 Dispatch notifications.
647 PeiServices - Pointer to the PEI Service Table
648 NotifyType - Type of notify to fire.
649 InstallStartIndex - Install Beginning index.
650 InstallStopIndex - Install Ending index.
651 NotifyStartIndex - Notify Beginning index.
652 NotifyStopIndex - Notify Ending index.
660 // Boot mode support functions
665 IN CONST EFI_PEI_SERVICES
**PeiServices
,
666 IN OUT EFI_BOOT_MODE
*BootMode
672 This service enables PEIMs to ascertain the present value of the boot mode.
676 PeiServices - The PEI core services table.
677 BootMode - A pointer to contain the value of the boot mode.
681 EFI_SUCCESS - The boot mode was returned successfully.
682 EFI_INVALID_PARAMETER - BootMode is NULL.
690 IN CONST EFI_PEI_SERVICES
**PeiServices
,
691 IN EFI_BOOT_MODE BootMode
697 This service enables PEIMs to update the boot mode variable.
701 PeiServices - The PEI core services table.
702 BootMode - The value of the boot mode to set.
706 EFI_SUCCESS - The value was successfully updated
712 // Security support functions
715 InitializeSecurityServices (
716 IN EFI_PEI_SERVICES
**PeiServices
,
717 IN PEI_CORE_INSTANCE
*OldCoreData
723 Initialize the security services.
727 PeiServices - The PEI core services table.
728 OldCoreData - Pointer to the old core data.
729 NULL if being run in non-permament memory mode.
739 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
745 Provide a callout to the OEM FV verification service.
749 CurrentFvAddress - Pointer to the FV under investigation.
761 IN PEI_CORE_INSTANCE
*PrivateData
,
762 IN EFI_PEI_FV_HANDLE VolumeHandle
,
763 IN EFI_PEI_FILE_HANDLE FileHandle
769 Provide a callout to the security verification service.
773 PeiServices - The PEI core services table.
774 CurrentPeimAddress - Pointer to the Firmware File under investigation.
778 EFI_SUCCESS - Image is OK
779 EFI_SECURITY_VIOLATION - Image is illegal
788 IN CONST EFI_PEI_SERVICES
**PeiServices
,
789 IN OUT VOID
**HobList
795 Gets the pointer to the HOB List.
799 PeiServices - The PEI core services table.
800 HobList - Pointer to the HOB List.
804 EFI_SUCCESS - Get the pointer of HOB List
805 EFI_NOT_AVAILABLE_YET - the HOB List is not yet published
806 EFI_INVALID_PARAMETER - HobList is NULL (in debug mode)
814 IN CONST EFI_PEI_SERVICES
**PeiServices
,
823 Add a new HOB to the HOB List.
827 PeiServices - The PEI core services table.
828 Type - Type of the new HOB.
829 Length - Length of the new HOB to allocate.
830 Hob - Pointer to the new HOB.
835 - EFI_INVALID_PARAMETER if Hob is NULL
836 - EFI_NOT_AVAILABLE_YET if HobList is still not available.
837 - EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
843 PeiCoreBuildHobHandoffInfoTable (
844 IN EFI_BOOT_MODE BootMode
,
845 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
846 IN UINT64 MemoryLength
852 Builds a Handoff Information Table HOB
856 BootMode - Current Bootmode
857 MemoryBegin - Start Memory Address.
858 MemoryLength - Length of Memory.
869 // FFS Fw Volume support functions
874 IN CONST EFI_PEI_SERVICES
**PeiServices
,
876 IN EFI_PEI_FV_HANDLE FwVolHeader
,
877 IN OUT EFI_PEI_FILE_HANDLE
*FileHeader
882 Given the input file pointer, search for the next matching file in the
883 FFS volume as defined by SearchType. The search starts from FileHeader inside
884 the Firmware Volume defined by FwVolHeader.
887 PeiServices - Pointer to the PEI Core Services Table.
889 SearchType - Filter to find only files of this type.
890 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
892 FwVolHeader - Pointer to the FV header of the volume to search.
893 This parameter must point to a valid FFS volume.
895 FileHeader - Pointer to the current file from which to begin searching.
896 This pointer will be updated upon return to reflect the file found.
899 EFI_NOT_FOUND - No files matching the search criteria were found
907 PeiFfsFindSectionData (
908 IN CONST EFI_PEI_SERVICES
**PeiServices
,
909 IN EFI_SECTION_TYPE SectionType
,
910 IN EFI_PEI_FILE_HANDLE FfsFileHeader
,
911 IN OUT VOID
**SectionData
916 Given the input file pointer, search for the next matching section in the
920 PeiServices - Pointer to the PEI Core Services Table.
921 SearchType - Filter to find only sections of this type.
922 FfsFileHeader - Pointer to the current file to search.
923 SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
924 - NULL if section not found
927 EFI_NOT_FOUND - No files matching the search criteria were found
935 PeiFvFindNextVolume (
936 IN CONST EFI_PEI_SERVICES
**PeiServices
,
938 IN OUT EFI_PEI_FV_HANDLE
*FwVolHeader
944 Return the BFV location
946 BugBug -- Move this to the location of this code to where the
947 other FV and FFS support code lives.
948 Also, update to use FindFV for instances #'s >= 1.
952 PeiServices - The PEI core services table.
953 Instance - Instance of FV to find
954 FwVolHeader - Pointer to contain the data to return
957 Pointer to the Firmware Volume instance requested
959 EFI_INVALID_PARAMETER - FwVolHeader is NULL
961 EFI_SUCCESS - Firmware volume instance successfully found.
967 // Memory support functions
970 InitializeMemoryServices (
971 IN PEI_CORE_INSTANCE
*PrivateData
,
972 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
973 IN PEI_CORE_INSTANCE
*OldCoreData
979 Initialize the memory services.
983 PeiServices - The PEI core services table.
984 PeiStartupDescriptor - Information and services provided by SEC phase.
985 OldCoreData - Pointer to the PEI Core data.
986 NULL if being run in non-permament memory mode.
997 PeiInstallPeiMemory (
998 IN CONST EFI_PEI_SERVICES
**PeiServices
,
999 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
1000 IN UINT64 MemoryLength
1004 Routine Description:
1006 Install the permanent memory is now available.
1007 Creates HOB (PHIT and Stack).
1011 PeiServices - The PEI core services table.
1012 MemoryBegin - Start of memory address.
1013 MemoryLength - Length of memory.
1017 Status - EFI_SUCCESS
1025 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1026 IN EFI_MEMORY_TYPE MemoryType
,
1028 OUT EFI_PHYSICAL_ADDRESS
*Memory
1032 Routine Description:
1034 Memory allocation service on permanent memory,
1035 not usable prior to the memory installation.
1039 PeiServices - The PEI core services table.
1040 Type - Type of allocation.
1041 MemoryType - Type of memory to allocate.
1042 Pages - Number of pages to allocate.
1043 Memory - Pointer of memory allocated.
1047 Status - EFI_SUCCESS The allocation was successful
1048 EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
1049 EFI_NOT_AVAILABLE_YET Called with permanent memory not available
1050 EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
1051 to allocate the number of pages.
1059 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1065 Routine Description:
1067 Memory allocation service on the CAR.
1071 PeiServices - The PEI core services table.
1073 Size - Amount of memory required
1075 Buffer - Address of pointer to the buffer
1079 Status - EFI_SUCCESS The allocation was successful
1080 EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1081 to allocate the requested size.
1088 IN EFI_PEI_SERVICES
**PeiServices
,
1089 IN EFI_PEI_FILE_HANDLE FileHandle
,
1090 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1091 OUT UINT32
*AuthenticationState
1095 Routine Description:
1097 Get entry point of a Peim file.
1101 PeiServices - Calling context.
1103 PeimFileHeader - Peim file's header.
1105 EntryPoint - Entry point of that Peim file.
1117 PeiReportStatusCode (
1118 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1119 IN EFI_STATUS_CODE_TYPE CodeType
,
1120 IN EFI_STATUS_CODE_VALUE Value
,
1122 IN CONST EFI_GUID
*CallerId
,
1123 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1127 Routine Description:
1129 Core version of the Status Code reporter
1133 PeiServices - The PEI core services table.
1135 CodeType - Type of Status Code.
1137 Value - Value to output for Status Code.
1139 Instance - Instance Number of this status code.
1141 CallerId - ID of the caller of this status code.
1143 Data - Optional data associated with this status code.
1147 Status - EFI_SUCCESS if status code is successfully reported
1148 - EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1157 IN CONST EFI_PEI_SERVICES
**PeiServices
1161 Routine Description:
1163 Core version of the Reset System
1167 PeiServices - The PEI core services table.
1171 Status - EFI_NOT_AVAILABLE_YET. PPI not available yet.
1172 - EFI_DEVICE_ERROR. Did not reset system.
1174 Otherwise, resets the system.
1181 IN PEI_CORE_INSTANCE
*PrivateData
,
1182 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1186 Routine Description:
1188 Initialize PeiCore Fv List.
1191 PrivateData - Pointer to PEI_CORE_INSTANCE.
1192 SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1202 FirmwareVolmeInfoPpiNotifyCallback (
1203 IN EFI_PEI_SERVICES
**PeiServices
,
1204 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1209 Routine Description:
1211 Process Firmware Volum Information once FvInfoPPI install.
1215 PeiServices - General purpose services available to every PEIM.
1219 Status - EFI_SUCCESS if the interface could be successfully
1228 PeiFfsFindFileByName (
1229 IN CONST EFI_GUID
*FileName
,
1230 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1231 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1235 Routine Description:
1237 Given the input VolumeHandle, search for the next matching name file.
1241 FileName - File name to search.
1242 VolumeHandle - The current FV to search.
1243 FileHandle - Pointer to the file matching name in VolumeHandle.
1244 - NULL if file not found
1255 IN EFI_PEI_FILE_HANDLE FileHandle
,
1256 OUT EFI_FV_FILE_INFO
*FileInfo
1260 Routine Description:
1262 Collect information of given file.
1265 FileHandle - The handle to file.
1266 FileInfo - Pointer to the file information.
1276 PeiFfsGetVolumeInfo (
1277 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1278 OUT EFI_FV_INFO
*VolumeInfo
1282 Routine Description:
1284 Collect information of given Fv Volume.
1287 VolumeHandle - The handle to Fv Volume.
1288 VolumeInfo - The pointer to volume information.
1299 PeiRegisterForShadow (
1300 IN EFI_PEI_FILE_HANDLE FileHandle
1304 Routine Description:
1306 This routine enable a PEIM to register itself to shadow when PEI Foundation
1307 discovery permanent memory.
1310 FileHandle - File handle of a PEIM.
1313 EFI_NOT_FOUND - The file handle doesn't point to PEIM itself.
1314 EFI_ALREADY_STARTED - Indicate that the PEIM has been registered itself.
1315 EFI_SUCCESS - Successfully to register itself.
1322 This routine enable a PEIM to register itself to shadow when PEI Foundation
1323 discovery permanent memory.
1325 @param FileHandle File handle of a PEIM.
1327 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1328 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1329 @retval EFI_SUCCESS Successfully to register itself.
1334 PeiRegisterForShadow (
1335 IN EFI_PEI_FILE_HANDLE FileHandle
1340 Transfers control to a function starting with a new stack.
1342 Transfers control to the function specified by EntryPoint using the new stack
1343 specified by NewStack and passing in the parameters specified by Context1 and
1344 Context2. Context1 and Context2 are optional and may be NULL. The function
1345 EntryPoint must never return.
1347 If EntryPoint is NULL, then ASSERT().
1348 If NewStack is NULL, then ASSERT().
1350 @param EntryPoint A pointer to function to call with the new stack.
1351 @param Context1 A pointer to the context to pass into the EntryPoint
1353 @param Context2 A pointer to the context to pass into the EntryPoint
1355 @param NewStack A pointer to the new stack to use for the EntryPoint
1357 @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
1358 Reserved on other architectures.
1364 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
1365 IN VOID
*Context1
, OPTIONAL
1366 IN VOID
*Context2
, OPTIONAL
1373 IN CONST EFI_PEI_FV_HANDLE FvHandle
,
1374 IN CONST EFI_GUID
*FileName
, OPTIONAL
1375 IN EFI_FV_FILETYPE SearchType
,
1376 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
,
1377 IN OUT EFI_PEI_FV_HANDLE
*AprioriFile OPTIONAL
1381 Routine Description:
1382 Given the input file pointer, search for the next matching file in the
1383 FFS volume as defined by SearchType. The search starts from FileHeader inside
1384 the Firmware Volume defined by FwVolHeader.
1387 PeiServices - Pointer to the PEI Core Services Table.
1388 SearchType - Filter to find only files of this type.
1389 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
1390 FwVolHeader - Pointer to the FV header of the volume to search.
1391 This parameter must point to a valid FFS volume.
1392 FileHeader - Pointer to the current file from which to begin searching.
1393 This pointer will be updated upon return to reflect the file found.
1394 Flag - Indicator for if this is for PEI Dispath search
1397 EFI_NOT_FOUND - No files matching the search criteria were found
1404 InitializeImageServices (
1405 IN PEI_CORE_INSTANCE
*PrivateData
,
1406 IN PEI_CORE_INSTANCE
*OldCoreData
1410 Routine Description:
1412 Install Pei Load File PPI.
1416 PrivateData - Pointer to PEI_CORE_INSTANCE.
1417 OldCoreData - Pointer to PEI_CORE_INSTANCE.
1427 Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
1429 @param PeiServices Pointer to the PEI Core Services Table.
1430 @param FileHandle File handle of a Fv type file.
1431 @param AuthenticationState Pointer to attestation authentication state of image.
1434 @retval EFI_NOT_FOUND FV image can't be found.
1435 @retval EFI_SUCCESS Successfully to process it.
1440 IN EFI_PEI_SERVICES
**PeiServices
,
1441 IN EFI_PEI_FILE_HANDLE FvFileHandle
,
1442 OUT UINT32
*AuthenticationState