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 <Library/DebugLib.h>
39 #include <Library/PeiCoreEntryPoint.h>
40 #include <Library/BaseLib.h>
41 #include <Library/HobLib.h>
42 #include <Library/PerformanceLib.h>
43 #include <Library/PeiServicesLib.h>
44 #include <Library/ReportStatusCodeLib.h>
45 #include <Library/PeCoffLib.h>
46 #include <Library/PeCoffGetEntryPointLib.h>
47 #include <Library/BaseMemoryLib.h>
48 #include <Library/CacheMaintenanceLib.h>
49 #include <Library/TimerLib.h>
50 #include <Library/PcdLib.h>
51 #include <IndustryStandard/PeImage.h>
52 #include <Library/PeiServicesTablePointerLib.h>
53 #include <Library/MemoryAllocationLib.h>
54 #include <Library/PeiPiLib.h>
55 #include <Guid/FirmwareFileSystem2.h>
56 #include <Guid/AprioriFileName.h>
58 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
61 // Pei Core private data structures
64 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
65 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
67 } PEI_PPI_LIST_POINTERS
;
69 #define PEI_STACK_SIZE 0x20000
71 #define MAX_PPI_DESCRIPTORS 64
77 INTN LastDispatchedInstall
;
78 INTN LastDispatchedNotify
;
79 PEI_PPI_LIST_POINTERS PpiListPtrs
[MAX_PPI_DESCRIPTORS
];
84 // PEI_CORE_FV_HANDE.PeimState
85 // Do not change these values as there is code doing math to change states.
86 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
88 #define PEIM_STATE_NOT_DISPATCHED 0x00
89 #define PEIM_STATE_DISPATCHED 0x01
90 #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02
91 #define PEIM_STATE_DONE 0x03
94 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
95 UINT8 PeimState
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
96 EFI_PEI_FILE_HANDLE FvFileHandles
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
100 #define CACHE_SETION_MAX_NUMBER 0x10
102 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
103 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
104 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
105 UINTN AllSectionCount
;
107 } CACHE_SECTION_DATA
;
110 // Pei Core private data structure instance
113 #define PEI_CORE_HANDLE_SIGNATURE EFI_SIGNATURE_32('P','e','i','C')
117 EFI_PEI_SERVICES
*PS
; // Point to ServiceTableShadow
118 PEI_PPI_DATABASE PpiData
;
120 PEI_CORE_FV_HANDLE Fv
[FixedPcdGet32 (PcdPeiCoreMaxFvSupported
)];
121 EFI_PEI_FILE_HANDLE CurrentFvFileHandles
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
123 UINTN CurrentPeimFvCount
;
124 UINTN CurrentPeimCount
;
125 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
127 EFI_PEI_FV_HANDLE AllFv
[FixedPcdGet32 (PcdPeiCoreMaxFvSupported
)];
128 EFI_PEI_HOB_POINTERS HobList
;
129 BOOLEAN SwitchStackSignal
;
130 BOOLEAN PeiMemoryInstalled
;
131 EFI_PHYSICAL_ADDRESS StackBase
;
133 VOID
*BottomOfCarHeap
;
136 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
137 EFI_PEI_SERVICES ServiceTableShadow
;
138 UINTN SizeOfCacheAsRam
;
139 VOID
*MaxTopOfCarHeap
;
140 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
141 CACHE_SECTION_DATA CacheSection
;
145 // Pei Core Instance Data Macros
148 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
149 CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)
152 // BUGBUG: Where does this go really?
156 (EFIAPI
*PEI_CORE_ENTRY_POINT
)(
157 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
158 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
159 IN PEI_CORE_INSTANCE
*OldCoreData
163 // Union of temporarily used function pointers (to save stack space)
166 PEI_CORE_ENTRY_POINT PeiCore
;
167 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
168 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
169 EFI_DXE_IPL_PPI
*DxeIpl
;
170 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
171 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
173 } PEI_CORE_TEMP_POINTERS
;
178 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
179 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
181 } PEI_CORE_PARAMETERS
;
189 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
190 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpList
,
197 The entry routine to Pei Core, invoked by PeiMain during transition
198 from SEC to PEI. After switching stack in the PEI core, it will restart
199 with the old core data.
203 PeiStartupDescriptor - Information and services provided by SEC phase.
204 OldCoreData - Pointer to old core data that is used to initialize the
209 This function never returns
210 EFI_NOT_FOUND - Never reach
216 // Dispatcher support functions
220 PeimDispatchReadiness (
221 IN EFI_PEI_SERVICES
**PeiServices
,
222 IN VOID
*DependencyExpression
228 This is the POSTFIX version of the dependency evaluator. When a
229 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
230 the evaluation stack. When that entry is poped from the evaluation
231 stack, the PPI is checked if it is installed. This method allows
232 some time savings as not all PPIs must be checked for certain
233 operation types (AND, OR).
237 PeiServices - Calling context.
239 DependencyExpression - Pointer to a dependency expression. The Grammar adheres to
240 the BNF described above and is stored in postfix notation.
244 Status = EFI_SUCCESS if it is a well-formed Grammar
245 EFI_INVALID_PARAMETER if the dependency expression overflows
247 EFI_INVALID_PARAMETER if the dependency expression underflows
249 EFI_INVALID_PARAMETER if the dependency expression is not a
257 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
258 IN PEI_CORE_INSTANCE
*PrivateData
265 Conduct PEIM dispatch.
269 PeiStartupDescriptor - Pointer to IN EFI_PEI_STARTUP_DESCRIPTOR
270 PrivateData - Pointer to the private data passed in from caller
271 DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data.
275 EFI_SUCCESS - Successfully dispatched PEIM.
276 EFI_NOT_FOUND - The dispatch failed.
283 InitializeDispatcherData (
284 IN PEI_CORE_INSTANCE
*PrivateData
,
285 IN PEI_CORE_INSTANCE
*OldCoreData
,
286 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
292 Initialize the Dispatcher's data members
296 PeiServices - The PEI core services table.
297 OldCoreData - Pointer to old core data (before switching stack).
298 NULL if being run in non-permament memory mode.
299 PeiStartupDescriptor - Information and services provided by SEC phase.
312 IN UINT8 CurrentPeim
,
313 IN UINT32 DispatchedPeimBitMap
319 This routine checks to see if a particular PEIM has been dispatched during
320 the PEI core dispatch.
323 CurrentPeim - The PEIM/FV in the bit array to check.
324 DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
327 TRUE if PEIM already dispatched
335 IN EFI_PEI_SERVICES
**PeiServices
,
336 IN UINT8 CurrentPeim
,
337 OUT UINT32
*DispatchedPeimBitMap
343 This routine sets a PEIM as having been dispatched once its entry
344 point has been invoked.
348 PeiServices - The PEI core services table.
349 CurrentPeim - The PEIM/FV in the bit array to check.
350 DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
360 IN PEI_CORE_INSTANCE
*Private
,
361 IN EFI_PEI_FILE_HANDLE FileHandle
,
368 This routine parses the Dependency Expression, if available, and
369 decides if the module can be executed.
372 PeiServices - The PEI Service Table
373 CurrentPeimAddress - Address of the PEIM Firmware File under investigation
376 TRUE - Can be dispatched
377 FALSE - Cannot be dispatched
382 #if defined (MDE_CPU_IPF)
384 // In Ipf we should make special changes for the PHIT pointers to support
385 // recovery boot in cache mode.
387 #define SWITCH_TO_CACHE_MODE(CoreData) SwitchToCacheMode(CoreData)
388 #define CACHE_MODE_ADDRESS_MASK 0x7FFFFFFFFFFFFFFFULL
391 IN PEI_CORE_INSTANCE
*CoreData
397 Switch the PHIT pointers to cache mode after InstallPeiMemory in CAR.
401 CoreData - The PEI core Private Data
410 #define SWITCH_TO_CACHE_MODE(CoreData)
415 // PPI support functions
418 InitializePpiServices (
419 IN PEI_CORE_INSTANCE
*PrivateData
,
420 IN PEI_CORE_INSTANCE
*OldCoreData
426 Initialize PPI services.
430 PeiServices - The PEI core services table.
431 OldCoreData - Pointer to the PEI Core data.
432 NULL if being run in non-permament memory mode.
442 IN CONST EFI_PEI_SERVICES
**PeiServices
,
443 IN EFI_HOB_HANDOFF_INFO_TABLE
*OldHandOffHob
,
444 IN EFI_HOB_HANDOFF_INFO_TABLE
*NewHandOffHob
450 Migrate the Hob list from the CAR stack to PEI installed memory.
454 PeiServices - The PEI core services table.
455 OldHandOffHob - The old handoff HOB list.
456 NewHandOffHob - The new handoff HOB list.
466 IN CONST EFI_PEI_SERVICES
**PeiServices
,
467 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
473 Install PPI services.
477 PeiServices - Pointer to the PEI Service Table
478 PpiList - Pointer to a list of PEI PPI Descriptors.
482 EFI_SUCCESS - if all PPIs in PpiList are successfully installed.
483 EFI_INVALID_PARAMETER - if PpiList is NULL pointer
484 EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid
485 EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI
493 IN CONST EFI_PEI_SERVICES
**PeiServices
,
494 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
495 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
501 Re-Install PPI services.
505 PeiServices - Pointer to the PEI Service Table
506 OldPpi - Pointer to the old PEI PPI Descriptors.
507 NewPpi - Pointer to the new PEI PPI Descriptors.
511 EFI_SUCCESS - if the operation was successful
512 EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL
513 EFI_INVALID_PARAMETER - if NewPpi is not valid
514 EFI_NOT_FOUND - if the PPI was not in the database
522 IN CONST EFI_PEI_SERVICES
**PeiServices
,
523 IN CONST EFI_GUID
*Guid
,
525 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
532 Locate a given named PPI.
536 PeiServices - Pointer to the PEI Service Table
537 Guid - Pointer to GUID of the PPI.
538 Instance - Instance Number to discover.
539 PpiDescriptor - Pointer to reference the found descriptor. If not NULL,
540 returns a pointer to the descriptor (includes flags, etc)
541 Ppi - Pointer to reference the found PPI
545 Status - EFI_SUCCESS if the PPI is in the database
546 EFI_NOT_FOUND if the PPI is not in the database
553 IN CONST EFI_PEI_SERVICES
**PeiServices
,
554 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
560 Install a notification for a given PPI.
564 PeiServices - Pointer to the PEI Service Table
565 NotifyList - Pointer to list of Descriptors to notify upon.
569 Status - EFI_SUCCESS if successful
570 EFI_OUT_OF_RESOURCES if no space in the database
571 EFI_INVALID_PARAMETER if not a good decriptor
578 IN PEI_CORE_INSTANCE
*PrivateData
584 Process the Notify List at dispatch level.
588 PeiServices - Pointer to the PEI Service Table
597 IN PEI_CORE_INSTANCE
*PrivateData
,
599 IN INTN InstallStartIndex
,
600 IN INTN InstallStopIndex
,
601 IN INTN NotifyStartIndex
,
602 IN INTN NotifyStopIndex
608 Dispatch notifications.
612 PeiServices - Pointer to the PEI Service Table
613 NotifyType - Type of notify to fire.
614 InstallStartIndex - Install Beginning index.
615 InstallStopIndex - Install Ending index.
616 NotifyStartIndex - Notify Beginning index.
617 NotifyStopIndex - Notify Ending index.
625 // Boot mode support functions
630 IN CONST EFI_PEI_SERVICES
**PeiServices
,
631 IN OUT EFI_BOOT_MODE
*BootMode
637 This service enables PEIMs to ascertain the present value of the boot mode.
641 PeiServices - The PEI core services table.
642 BootMode - A pointer to contain the value of the boot mode.
646 EFI_SUCCESS - The boot mode was returned successfully.
647 EFI_INVALID_PARAMETER - BootMode is NULL.
655 IN CONST EFI_PEI_SERVICES
**PeiServices
,
656 IN EFI_BOOT_MODE BootMode
662 This service enables PEIMs to update the boot mode variable.
666 PeiServices - The PEI core services table.
667 BootMode - The value of the boot mode to set.
671 EFI_SUCCESS - The value was successfully updated
677 // Security support functions
680 InitializeSecurityServices (
681 IN EFI_PEI_SERVICES
**PeiServices
,
682 IN PEI_CORE_INSTANCE
*OldCoreData
688 Initialize the security services.
692 PeiServices - The PEI core services table.
693 OldCoreData - Pointer to the old core data.
694 NULL if being run in non-permament memory mode.
704 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
710 Provide a callout to the OEM FV verification service.
714 CurrentFvAddress - Pointer to the FV under investigation.
726 IN PEI_CORE_INSTANCE
*PrivateData
,
727 IN EFI_PEI_FV_HANDLE VolumeHandle
,
728 IN EFI_PEI_FILE_HANDLE FileHandle
734 Provide a callout to the security verification service.
738 PeiServices - The PEI core services table.
739 CurrentPeimAddress - Pointer to the Firmware File under investigation.
743 EFI_SUCCESS - Image is OK
744 EFI_SECURITY_VIOLATION - Image is illegal
753 IN CONST EFI_PEI_SERVICES
**PeiServices
,
754 IN OUT VOID
**HobList
760 Gets the pointer to the HOB List.
764 PeiServices - The PEI core services table.
765 HobList - Pointer to the HOB List.
769 EFI_SUCCESS - Get the pointer of HOB List
770 EFI_NOT_AVAILABLE_YET - the HOB List is not yet published
771 EFI_INVALID_PARAMETER - HobList is NULL (in debug mode)
779 IN CONST EFI_PEI_SERVICES
**PeiServices
,
788 Add a new HOB to the HOB List.
792 PeiServices - The PEI core services table.
793 Type - Type of the new HOB.
794 Length - Length of the new HOB to allocate.
795 Hob - Pointer to the new HOB.
800 - EFI_INVALID_PARAMETER if Hob is NULL
801 - EFI_NOT_AVAILABLE_YET if HobList is still not available.
802 - EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
808 PeiCoreBuildHobHandoffInfoTable (
809 IN EFI_BOOT_MODE BootMode
,
810 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
811 IN UINT64 MemoryLength
817 Builds a Handoff Information Table HOB
821 BootMode - Current Bootmode
822 MemoryBegin - Start Memory Address.
823 MemoryLength - Length of Memory.
834 // FFS Fw Volume support functions
839 IN CONST EFI_PEI_SERVICES
**PeiServices
,
841 IN EFI_PEI_FV_HANDLE FwVolHeader
,
842 IN OUT EFI_PEI_FILE_HANDLE
*FileHeader
847 Given the input file pointer, search for the next matching file in the
848 FFS volume as defined by SearchType. The search starts from FileHeader inside
849 the Firmware Volume defined by FwVolHeader.
852 PeiServices - Pointer to the PEI Core Services Table.
854 SearchType - Filter to find only files of this type.
855 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
857 FwVolHeader - Pointer to the FV header of the volume to search.
858 This parameter must point to a valid FFS volume.
860 FileHeader - Pointer to the current file from which to begin searching.
861 This pointer will be updated upon return to reflect the file found.
864 EFI_NOT_FOUND - No files matching the search criteria were found
872 PeiFfsFindSectionData (
873 IN CONST EFI_PEI_SERVICES
**PeiServices
,
874 IN EFI_SECTION_TYPE SectionType
,
875 IN EFI_PEI_FILE_HANDLE FfsFileHeader
,
876 IN OUT VOID
**SectionData
881 Given the input file pointer, search for the next matching section in the
885 PeiServices - Pointer to the PEI Core Services Table.
886 SearchType - Filter to find only sections of this type.
887 FfsFileHeader - Pointer to the current file to search.
888 SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
889 - NULL if section not found
892 EFI_NOT_FOUND - No files matching the search criteria were found
900 PeiFvFindNextVolume (
901 IN CONST EFI_PEI_SERVICES
**PeiServices
,
903 IN OUT EFI_PEI_FV_HANDLE
*FwVolHeader
909 Return the BFV location
911 BugBug -- Move this to the location of this code to where the
912 other FV and FFS support code lives.
913 Also, update to use FindFV for instances #'s >= 1.
917 PeiServices - The PEI core services table.
918 Instance - Instance of FV to find
919 FwVolHeader - Pointer to contain the data to return
922 Pointer to the Firmware Volume instance requested
924 EFI_INVALID_PARAMETER - FwVolHeader is NULL
926 EFI_SUCCESS - Firmware volume instance successfully found.
932 // Memory support functions
935 InitializeMemoryServices (
936 IN PEI_CORE_INSTANCE
*PrivateData
,
937 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
938 IN PEI_CORE_INSTANCE
*OldCoreData
944 Initialize the memory services.
948 PeiServices - The PEI core services table.
949 PeiStartupDescriptor - Information and services provided by SEC phase.
950 OldCoreData - Pointer to the PEI Core data.
951 NULL if being run in non-permament memory mode.
962 PeiInstallPeiMemory (
963 IN CONST EFI_PEI_SERVICES
**PeiServices
,
964 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
965 IN UINT64 MemoryLength
971 Install the permanent memory is now available.
972 Creates HOB (PHIT and Stack).
976 PeiServices - The PEI core services table.
977 MemoryBegin - Start of memory address.
978 MemoryLength - Length of memory.
990 IN CONST EFI_PEI_SERVICES
**PeiServices
,
991 IN EFI_MEMORY_TYPE MemoryType
,
993 OUT EFI_PHYSICAL_ADDRESS
*Memory
999 Memory allocation service on permanent memory,
1000 not usable prior to the memory installation.
1004 PeiServices - The PEI core services table.
1005 Type - Type of allocation.
1006 MemoryType - Type of memory to allocate.
1007 Pages - Number of pages to allocate.
1008 Memory - Pointer of memory allocated.
1012 Status - EFI_SUCCESS The allocation was successful
1013 EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
1014 EFI_NOT_AVAILABLE_YET Called with permanent memory not available
1015 EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
1016 to allocate the number of pages.
1024 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1030 Routine Description:
1032 Memory allocation service on the CAR.
1036 PeiServices - The PEI core services table.
1038 Size - Amount of memory required
1040 Buffer - Address of pointer to the buffer
1044 Status - EFI_SUCCESS The allocation was successful
1045 EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1046 to allocate the requested size.
1053 IN EFI_PEI_SERVICES
**PeiServices
,
1054 IN EFI_PEI_FILE_HANDLE FileHandle
,
1055 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1056 OUT UINT32
*AuthenticationState
1060 Routine Description:
1062 Get entry point of a Peim file.
1066 PeiServices - Calling context.
1068 PeimFileHeader - Peim file's header.
1070 EntryPoint - Entry point of that Peim file.
1082 PeiReportStatusCode (
1083 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1084 IN EFI_STATUS_CODE_TYPE CodeType
,
1085 IN EFI_STATUS_CODE_VALUE Value
,
1087 IN CONST EFI_GUID
*CallerId
,
1088 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1092 Routine Description:
1094 Core version of the Status Code reporter
1098 PeiServices - The PEI core services table.
1100 CodeType - Type of Status Code.
1102 Value - Value to output for Status Code.
1104 Instance - Instance Number of this status code.
1106 CallerId - ID of the caller of this status code.
1108 Data - Optional data associated with this status code.
1112 Status - EFI_SUCCESS if status code is successfully reported
1113 - EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1122 IN CONST EFI_PEI_SERVICES
**PeiServices
1126 Routine Description:
1128 Core version of the Reset System
1132 PeiServices - The PEI core services table.
1136 Status - EFI_NOT_AVAILABLE_YET. PPI not available yet.
1137 - EFI_DEVICE_ERROR. Did not reset system.
1139 Otherwise, resets the system.
1146 IN PEI_CORE_INSTANCE
*PrivateData
,
1147 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1151 Routine Description:
1153 Initialize PeiCore Fv List.
1156 PrivateData - Pointer to PEI_CORE_INSTANCE.
1157 SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1167 FirmwareVolmeInfoPpiNotifyCallback (
1168 IN EFI_PEI_SERVICES
**PeiServices
,
1169 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1174 Routine Description:
1176 Process Firmware Volum Information once FvInfoPPI install.
1180 PeiServices - General purpose services available to every PEIM.
1184 Status - EFI_SUCCESS if the interface could be successfully
1193 PeiFfsFindFileByName (
1194 IN CONST EFI_GUID
*FileName
,
1195 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1196 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1200 Routine Description:
1202 Given the input VolumeHandle, search for the next matching name file.
1206 FileName - File name to search.
1207 VolumeHandle - The current FV to search.
1208 FileHandle - Pointer to the file matching name in VolumeHandle.
1209 - NULL if file not found
1220 IN EFI_PEI_FILE_HANDLE FileHandle
,
1221 OUT EFI_FV_FILE_INFO
*FileInfo
1225 Routine Description:
1227 Collect information of given file.
1230 FileHandle - The handle to file.
1231 FileInfo - Pointer to the file information.
1241 PeiFfsGetVolumeInfo (
1242 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1243 OUT EFI_FV_INFO
*VolumeInfo
1247 Routine Description:
1249 Collect information of given Fv Volume.
1252 VolumeHandle - The handle to Fv Volume.
1253 VolumeInfo - The pointer to volume information.
1264 PeiRegisterForShadow (
1265 IN EFI_PEI_FILE_HANDLE FileHandle
1269 Routine Description:
1271 This routine enable a PEIM to register itself to shadow when PEI Foundation
1272 discovery permanent memory.
1275 FileHandle - File handle of a PEIM.
1278 EFI_NOT_FOUND - The file handle doesn't point to PEIM itself.
1279 EFI_ALREADY_STARTED - Indicate that the PEIM has been registered itself.
1280 EFI_SUCCESS - Successfully to register itself.
1287 This routine enable a PEIM to register itself to shadow when PEI Foundation
1288 discovery permanent memory.
1290 @param FileHandle File handle of a PEIM.
1292 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1293 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1294 @retval EFI_SUCCESS Successfully to register itself.
1299 PeiRegisterForShadow (
1300 IN EFI_PEI_FILE_HANDLE FileHandle
1305 Transfers control to a function starting with a new stack.
1307 Transfers control to the function specified by EntryPoint using the new stack
1308 specified by NewStack and passing in the parameters specified by Context1 and
1309 Context2. Context1 and Context2 are optional and may be NULL. The function
1310 EntryPoint must never return.
1312 If EntryPoint is NULL, then ASSERT().
1313 If NewStack is NULL, then ASSERT().
1315 @param EntryPoint A pointer to function to call with the new stack.
1316 @param Context1 A pointer to the context to pass into the EntryPoint
1318 @param Context2 A pointer to the context to pass into the EntryPoint
1320 @param NewStack A pointer to the new stack to use for the EntryPoint
1322 @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
1323 Reserved on other architectures.
1329 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
1330 IN VOID
*Context1
, OPTIONAL
1331 IN VOID
*Context2
, OPTIONAL
1338 IN CONST EFI_PEI_FV_HANDLE FvHandle
,
1339 IN CONST EFI_GUID
*FileName
, OPTIONAL
1340 IN EFI_FV_FILETYPE SearchType
,
1341 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
,
1342 IN OUT EFI_PEI_FV_HANDLE
*AprioriFile OPTIONAL
1346 Routine Description:
1347 Given the input file pointer, search for the next matching file in the
1348 FFS volume as defined by SearchType. The search starts from FileHeader inside
1349 the Firmware Volume defined by FwVolHeader.
1352 PeiServices - Pointer to the PEI Core Services Table.
1353 SearchType - Filter to find only files of this type.
1354 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
1355 FwVolHeader - Pointer to the FV header of the volume to search.
1356 This parameter must point to a valid FFS volume.
1357 FileHeader - Pointer to the current file from which to begin searching.
1358 This pointer will be updated upon return to reflect the file found.
1359 Flag - Indicator for if this is for PEI Dispath search
1362 EFI_NOT_FOUND - No files matching the search criteria were found
1369 InitializeImageServices (
1370 IN PEI_CORE_INSTANCE
*PrivateData
,
1371 IN PEI_CORE_INSTANCE
*OldCoreData
1375 Routine Description:
1377 Install Pei Load File PPI.
1381 PrivateData - Pointer to PEI_CORE_INSTANCE.
1382 OldCoreData - Pointer to PEI_CORE_INSTANCE.
1392 Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
1394 @param PeiServices Pointer to the PEI Core Services Table.
1395 @param FileHandle File handle of a Fv type file.
1396 @param AuthenticationState Pointer to attestation authentication state of image.
1399 @retval EFI_NOT_FOUND FV image can't be found.
1400 @retval EFI_SUCCESS Successfully to process it.
1405 IN EFI_PEI_SERVICES
**PeiServices
,
1406 IN EFI_PEI_FILE_HANDLE FvFileHandle
,
1407 OUT UINT32
*AuthenticationState