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 <FrameworkPei.h>
29 #include <Guid/StatusCodeDataTypeId.h>
30 #include <Ppi/DxeIpl.h>
31 #include <Ppi/MemoryDiscovered.h>
32 #include <Ppi/StatusCode.h>
33 #include <Ppi/Reset.h>
34 #include <Ppi/FirmwareVolume.h>
35 #include <Ppi/FirmwareVolumeInfo.h>
36 #include <Ppi/Decompress.h>
37 #include <Ppi/GuidedSectionExtraction.h>
38 #include <Ppi/LoadFile.h>
39 #include <Ppi/Security2.h>
40 #include <Library/DebugLib.h>
41 #include <Library/PeiCoreEntryPoint.h>
42 #include <Library/BaseLib.h>
43 #include <Library/HobLib.h>
44 #include <Library/PerformanceLib.h>
45 #include <Library/PeiServicesLib.h>
46 #include <Library/ReportStatusCodeLib.h>
47 #include <Library/PeCoffGetEntryPointLib.h>
48 #include <Library/BaseMemoryLib.h>
49 #include <Library/CacheMaintenanceLib.h>
50 #include <Library/TimerLib.h>
51 #include <Library/PeCoffLoaderLib.h>
52 #include <IndustryStandard/PeImage.h>
53 #include <Library/PeiServicesTablePointerLib.h>
54 #include <Library/MemoryAllocationLib.h>
55 #include <Guid/FirmwareFileSystem2.h>
56 #include <Guid/AprioriFileName.h>
57 #include <Guid/PeiPeCoffLoader.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 PEI_STACK_SIZE 0x20000
72 #define MAX_PPI_DESCRIPTORS 64
78 INTN LastDispatchedInstall
;
79 INTN LastDispatchedNotify
;
80 PEI_PPI_LIST_POINTERS PpiListPtrs
[MAX_PPI_DESCRIPTORS
];
84 #define PEI_CORE_MAX_FV_SUPPORTED 4
85 #define PEI_CORE_MAX_PEIM_PER_FV 32
88 // PEI_CORE_FV_HANDE.PeimState
89 // Do not change these values as there is code doing math to change states.
90 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
92 #define PEIM_STATE_NOT_DISPATCHED 0x00
93 #define PEIM_STATE_DISPATCHED 0x01
94 #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02
95 #define PEIM_STATE_DONE 0x03
98 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
99 UINT8 PeimState
[PEI_CORE_MAX_PEIM_PER_FV
];
100 EFI_PEI_FILE_HANDLE FvFileHandles
[PEI_CORE_MAX_PEIM_PER_FV
];
102 } PEI_CORE_FV_HANDLE
;
105 // Pei Core private data structure instance
108 #define PEI_CORE_HANDLE_SIGNATURE EFI_SIGNATURE_32('P','e','i','C')
112 EFI_PEI_SERVICES
*PS
; // Point to ServiceTableShadow
113 PEI_PPI_DATABASE PpiData
;
115 PEI_CORE_FV_HANDLE Fv
[PEI_CORE_MAX_FV_SUPPORTED
];
116 EFI_PEI_FILE_HANDLE CurrentFvFileHandles
[PEI_CORE_MAX_PEIM_PER_FV
];
118 UINTN CurrentPeimFvCount
;
119 UINTN CurrentPeimCount
;
120 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
122 EFI_PEI_FV_HANDLE AllFv
[PEI_CORE_MAX_FV_SUPPORTED
];
123 EFI_PEI_HOB_POINTERS HobList
;
124 BOOLEAN SwitchStackSignal
;
125 BOOLEAN PeiMemoryInstalled
;
126 EFI_PHYSICAL_ADDRESS StackBase
;
128 VOID
*BottomOfCarHeap
;
131 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
132 EFI_PEI_SERVICES ServiceTableShadow
;
133 UINTN SizeOfCacheAsRam
;
134 VOID
*MaxTopOfCarHeap
;
135 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
136 EFI_PEI_PE_COFF_LOADER_PROTOCOL
*PeCoffLoader
;
140 // Pei Core Instance Data Macros
143 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
144 CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)
147 // BUGBUG: Where does this go really?
151 (EFIAPI
*PEI_CORE_ENTRY_POINT
)(
152 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
153 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
154 IN PEI_CORE_INSTANCE
*OldCoreData
158 // Union of temporarily used function pointers (to save stack space)
161 PEI_CORE_ENTRY_POINT PeiCore
;
162 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
163 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
164 EFI_DXE_IPL_PPI
*DxeIpl
;
165 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
166 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
168 } PEI_CORE_TEMP_POINTERS
;
173 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
174 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
176 } PEI_CORE_PARAMETERS
;
184 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
185 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpList
,
192 The entry routine to Pei Core, invoked by PeiMain during transition
193 from SEC to PEI. After switching stack in the PEI core, it will restart
194 with the old core data.
198 PeiStartupDescriptor - Information and services provided by SEC phase.
199 OldCoreData - Pointer to old core data that is used to initialize the
204 This function never returns
205 EFI_NOT_FOUND - Never reach
211 // Dispatcher support functions
215 PeimDispatchReadiness (
216 IN EFI_PEI_SERVICES
**PeiServices
,
217 IN VOID
*DependencyExpression
223 This is the POSTFIX version of the dependency evaluator. When a
224 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
225 the evaluation stack. When that entry is poped from the evaluation
226 stack, the PPI is checked if it is installed. This method allows
227 some time savings as not all PPIs must be checked for certain
228 operation types (AND, OR).
232 PeiServices - Calling context.
234 DependencyExpression - Pointer to a dependency expression. The Grammar adheres to
235 the BNF described above and is stored in postfix notation.
236 Runnable - is True if the driver can be scheduled and False if the driver
237 cannot be scheduled. This is the value that the schedulers
238 should use for deciding the state of the driver.
242 Status = EFI_SUCCESS if it is a well-formed Grammar
243 EFI_INVALID_PARAMETER if the dependency expression overflows
245 EFI_INVALID_PARAMETER if the dependency expression underflows
247 EFI_INVALID_PARAMETER if the dependency expression is not a
255 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
256 IN PEI_CORE_INSTANCE
*PrivateData
263 Conduct PEIM dispatch.
267 PeiStartupDescriptor - Pointer to IN EFI_PEI_STARTUP_DESCRIPTOR
268 PrivateData - Pointer to the private data passed in from caller
269 DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data.
273 EFI_SUCCESS - Successfully dispatched PEIM.
274 EFI_NOT_FOUND - The dispatch failed.
281 InitializeDispatcherData (
282 IN PEI_CORE_INSTANCE
*PrivateData
,
283 IN PEI_CORE_INSTANCE
*OldCoreData
,
284 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
290 Initialize the Dispatcher's data members
294 PeiServices - The PEI core services table.
295 OldCoreData - Pointer to old core data (before switching stack).
296 NULL if being run in non-permament memory mode.
297 PeiStartupDescriptor - Information and services provided by SEC phase.
310 IN EFI_PEI_SERVICES
**PeiServices
,
311 IN EFI_FIRMWARE_VOLUME_HEADER
*FwVolHeader
,
312 IN OUT EFI_FFS_FILE_HEADER
**PeimFileHeader
317 Given the input file pointer, search for the next matching file in the
318 FFS volume. The search starts from FileHeader inside
319 the Firmware Volume defined by FwVolHeader.
322 PeiServices - Pointer to the PEI Core Services Table.
324 FwVolHeader - Pointer to the FV header of the volume to search.
325 This parameter must point to a valid FFS volume.
327 PeimFileHeader - Pointer to the current file from which to begin searching.
328 This pointer will be updated upon return to reflect the file found.
331 EFI_NOT_FOUND - No files matching the search criteria were found
339 IN UINT8 CurrentPeim
,
340 IN UINT32 DispatchedPeimBitMap
346 This routine checks to see if a particular PEIM has been dispatched during
347 the PEI core dispatch.
350 CurrentPeim - The PEIM/FV in the bit array to check.
351 DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
354 TRUE if PEIM already dispatched
362 IN EFI_PEI_SERVICES
**PeiServices
,
363 IN UINT8 CurrentPeim
,
364 OUT UINT32
*DispatchedPeimBitMap
370 This routine sets a PEIM as having been dispatched once its entry
371 point has been invoked.
375 PeiServices - The PEI core services table.
376 CurrentPeim - The PEIM/FV in the bit array to check.
377 DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
387 IN PEI_CORE_INSTANCE
*Private
,
388 IN EFI_PEI_FILE_HANDLE FileHandle
,
395 This routine parses the Dependency Expression, if available, and
396 decides if the module can be executed.
399 PeiServices - The PEI Service Table
400 CurrentPeimAddress - Address of the PEIM Firmware File under investigation
403 TRUE - Can be dispatched
404 FALSE - Cannot be dispatched
409 #if defined (MDE_CPU_IPF)
411 // In Ipf we should make special changes for the PHIT pointers to support
412 // recovery boot in cache mode.
414 #define SWITCH_TO_CACHE_MODE(CoreData) SwitchToCacheMode(CoreData)
415 #define CACHE_MODE_ADDRESS_MASK 0x7FFFFFFFFFFFFFFFULL
418 IN PEI_CORE_INSTANCE
*CoreData
424 Switch the PHIT pointers to cache mode after InstallPeiMemory in CAR.
428 CoreData - The PEI core Private Data
437 #define SWITCH_TO_CACHE_MODE(CoreData)
442 // PPI support functions
445 InitializePpiServices (
446 IN PEI_CORE_INSTANCE
*PrivateData
,
447 IN PEI_CORE_INSTANCE
*OldCoreData
453 Initialize PPI services.
457 PeiServices - The PEI core services table.
458 OldCoreData - Pointer to the PEI Core data.
459 NULL if being run in non-permament memory mode.
469 IN CONST EFI_PEI_SERVICES
**PeiServices
,
470 IN EFI_HOB_HANDOFF_INFO_TABLE
*OldHandOffHob
,
471 IN EFI_HOB_HANDOFF_INFO_TABLE
*NewHandOffHob
477 Migrate the Hob list from the CAR stack to PEI installed memory.
481 PeiServices - The PEI core services table.
482 OldHandOffHob - The old handoff HOB list.
483 NewHandOffHob - The new handoff HOB list.
493 IN CONST EFI_PEI_SERVICES
**PeiServices
,
494 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
500 Install PPI services.
504 PeiServices - Pointer to the PEI Service Table
505 PpiList - Pointer to a list of PEI PPI Descriptors.
509 EFI_SUCCESS - if all PPIs in PpiList are successfully installed.
510 EFI_INVALID_PARAMETER - if PpiList is NULL pointer
511 EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid
512 EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI
520 IN CONST EFI_PEI_SERVICES
**PeiServices
,
521 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
522 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
528 Re-Install PPI services.
532 PeiServices - Pointer to the PEI Service Table
533 OldPpi - Pointer to the old PEI PPI Descriptors.
534 NewPpi - Pointer to the new PEI PPI Descriptors.
538 EFI_SUCCESS - if the operation was successful
539 EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL
540 EFI_INVALID_PARAMETER - if NewPpi is not valid
541 EFI_NOT_FOUND - if the PPI was not in the database
549 IN CONST EFI_PEI_SERVICES
**PeiServices
,
550 IN CONST EFI_GUID
*Guid
,
552 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
559 Locate a given named PPI.
563 PeiServices - Pointer to the PEI Service Table
564 Guid - Pointer to GUID of the PPI.
565 Instance - Instance Number to discover.
566 PpiDescriptor - Pointer to reference the found descriptor. If not NULL,
567 returns a pointer to the descriptor (includes flags, etc)
568 Ppi - Pointer to reference the found PPI
572 Status - EFI_SUCCESS if the PPI is in the database
573 EFI_NOT_FOUND if the PPI is not in the database
580 IN CONST EFI_PEI_SERVICES
**PeiServices
,
581 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
587 Install a notification for a given PPI.
591 PeiServices - Pointer to the PEI Service Table
592 NotifyList - Pointer to list of Descriptors to notify upon.
596 Status - EFI_SUCCESS if successful
597 EFI_OUT_OF_RESOURCES if no space in the database
598 EFI_INVALID_PARAMETER if not a good decriptor
605 IN PEI_CORE_INSTANCE
*PrivateData
611 Process the Notify List at dispatch level.
615 PeiServices - Pointer to the PEI Service Table
624 IN PEI_CORE_INSTANCE
*PrivateData
,
626 IN INTN InstallStartIndex
,
627 IN INTN InstallStopIndex
,
628 IN INTN NotifyStartIndex
,
629 IN INTN NotifyStopIndex
635 Dispatch notifications.
639 PeiServices - Pointer to the PEI Service Table
640 NotifyType - Type of notify to fire.
641 InstallStartIndex - Install Beginning index.
642 InstallStopIndex - Install Ending index.
643 NotifyStartIndex - Notify Beginning index.
644 NotifyStopIndex - Notify Ending index.
652 // Boot mode support functions
657 IN CONST EFI_PEI_SERVICES
**PeiServices
,
658 IN OUT EFI_BOOT_MODE
*BootMode
664 This service enables PEIMs to ascertain the present value of the boot mode.
668 PeiServices - The PEI core services table.
669 BootMode - A pointer to contain the value of the boot mode.
673 EFI_SUCCESS - The boot mode was returned successfully.
674 EFI_INVALID_PARAMETER - BootMode is NULL.
682 IN CONST EFI_PEI_SERVICES
**PeiServices
,
683 IN EFI_BOOT_MODE BootMode
689 This service enables PEIMs to update the boot mode variable.
693 PeiServices - The PEI core services table.
694 BootMode - The value of the boot mode to set.
698 EFI_SUCCESS - The value was successfully updated
704 // Security support functions
707 InitializeSecurityServices (
708 IN EFI_PEI_SERVICES
**PeiServices
,
709 IN PEI_CORE_INSTANCE
*OldCoreData
715 Initialize the security services.
719 PeiServices - The PEI core services table.
720 OldCoreData - Pointer to the old core data.
721 NULL if being run in non-permament memory mode.
731 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
737 Provide a callout to the OEM FV verification service.
741 CurrentFvAddress - Pointer to the FV under investigation.
753 IN PEI_CORE_INSTANCE
*PrivateData
,
754 IN EFI_PEI_FV_HANDLE VolumeHandle
,
755 IN EFI_PEI_FILE_HANDLE FileHandle
761 Provide a callout to the security verification service.
765 PeiServices - The PEI core services table.
766 CurrentPeimAddress - Pointer to the Firmware File under investigation.
770 EFI_SUCCESS - Image is OK
771 EFI_SECURITY_VIOLATION - Image is illegal
780 IN CONST EFI_PEI_SERVICES
**PeiServices
,
781 IN OUT VOID
**HobList
787 Gets the pointer to the HOB List.
791 PeiServices - The PEI core services table.
792 HobList - Pointer to the HOB List.
796 EFI_SUCCESS - Get the pointer of HOB List
797 EFI_NOT_AVAILABLE_YET - the HOB List is not yet published
798 EFI_INVALID_PARAMETER - HobList is NULL (in debug mode)
806 IN CONST EFI_PEI_SERVICES
**PeiServices
,
815 Add a new HOB to the HOB List.
819 PeiServices - The PEI core services table.
820 Type - Type of the new HOB.
821 Length - Length of the new HOB to allocate.
822 Hob - Pointer to the new HOB.
827 - EFI_INVALID_PARAMETER if Hob is NULL
828 - EFI_NOT_AVAILABLE_YET if HobList is still not available.
829 - EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
835 PeiCoreBuildHobHandoffInfoTable (
836 IN EFI_BOOT_MODE BootMode
,
837 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
838 IN UINT64 MemoryLength
844 Builds a Handoff Information Table HOB
848 BootMode - Current Bootmode
849 MemoryBegin - Start Memory Address.
850 MemoryLength - Length of Memory.
861 // FFS Fw Volume support functions
866 IN CONST EFI_PEI_SERVICES
**PeiServices
,
868 IN EFI_PEI_FV_HANDLE FwVolHeader
,
869 IN OUT EFI_PEI_FILE_HANDLE
*FileHeader
874 Given the input file pointer, search for the next matching file in the
875 FFS volume as defined by SearchType. The search starts from FileHeader inside
876 the Firmware Volume defined by FwVolHeader.
879 PeiServices - Pointer to the PEI Core Services Table.
881 SearchType - Filter to find only files of this type.
882 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
884 FwVolHeader - Pointer to the FV header of the volume to search.
885 This parameter must point to a valid FFS volume.
887 FileHeader - Pointer to the current file from which to begin searching.
888 This pointer will be updated upon return to reflect the file found.
891 EFI_NOT_FOUND - No files matching the search criteria were found
899 PeiFfsFindSectionData (
900 IN CONST EFI_PEI_SERVICES
**PeiServices
,
901 IN EFI_SECTION_TYPE SectionType
,
902 IN EFI_PEI_FILE_HANDLE FfsFileHeader
,
903 IN OUT VOID
**SectionData
908 Given the input file pointer, search for the next matching section in the
912 PeiServices - Pointer to the PEI Core Services Table.
913 SearchType - Filter to find only sections of this type.
914 FfsFileHeader - Pointer to the current file to search.
915 SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
916 - NULL if section not found
919 EFI_NOT_FOUND - No files matching the search criteria were found
927 PeiFvFindNextVolume (
928 IN CONST EFI_PEI_SERVICES
**PeiServices
,
930 IN OUT EFI_PEI_FV_HANDLE
*FwVolHeader
936 Return the BFV location
938 BugBug -- Move this to the location of this code to where the
939 other FV and FFS support code lives.
940 Also, update to use FindFV for instances #'s >= 1.
944 PeiServices - The PEI core services table.
945 Instance - Instance of FV to find
946 FwVolHeader - Pointer to contain the data to return
949 Pointer to the Firmware Volume instance requested
951 EFI_INVALID_PARAMETER - FwVolHeader is NULL
953 EFI_SUCCESS - Firmware volume instance successfully found.
959 // Memory support functions
962 InitializeMemoryServices (
963 IN PEI_CORE_INSTANCE
*PrivateData
,
964 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
965 IN PEI_CORE_INSTANCE
*OldCoreData
971 Initialize the memory services.
975 PeiServices - The PEI core services table.
976 PeiStartupDescriptor - Information and services provided by SEC phase.
977 OldCoreData - Pointer to the PEI Core data.
978 NULL if being run in non-permament memory mode.
989 PeiInstallPeiMemory (
990 IN CONST EFI_PEI_SERVICES
**PeiServices
,
991 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
992 IN UINT64 MemoryLength
998 Install the permanent memory is now available.
999 Creates HOB (PHIT and Stack).
1003 PeiServices - The PEI core services table.
1004 MemoryBegin - Start of memory address.
1005 MemoryLength - Length of memory.
1009 Status - EFI_SUCCESS
1017 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1018 IN EFI_MEMORY_TYPE MemoryType
,
1020 OUT EFI_PHYSICAL_ADDRESS
*Memory
1024 Routine Description:
1026 Memory allocation service on permanent memory,
1027 not usable prior to the memory installation.
1031 PeiServices - The PEI core services table.
1032 Type - Type of allocation.
1033 MemoryType - Type of memory to allocate.
1034 Pages - Number of pages to allocate.
1035 Memory - Pointer of memory allocated.
1039 Status - EFI_SUCCESS The allocation was successful
1040 EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
1041 EFI_NOT_AVAILABLE_YET Called with permanent memory not available
1042 EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
1043 to allocate the number of pages.
1051 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1057 Routine Description:
1059 Memory allocation service on the CAR.
1063 PeiServices - The PEI core services table.
1065 Size - Amount of memory required
1067 Buffer - Address of pointer to the buffer
1071 Status - EFI_SUCCESS The allocation was successful
1072 EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1073 to allocate the requested size.
1080 IN EFI_PEI_SERVICES
**PeiServices
,
1081 IN EFI_PEI_FILE_HANDLE FileHandle
,
1082 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1083 OUT UINT32
*AuthenticationState
1087 Routine Description:
1089 Get entry point of a Peim file.
1093 PeiServices - Calling context.
1095 PeimFileHeader - Peim file's header.
1097 EntryPoint - Entry point of that Peim file.
1109 PeiReportStatusCode (
1110 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1111 IN EFI_STATUS_CODE_TYPE CodeType
,
1112 IN EFI_STATUS_CODE_VALUE Value
,
1114 IN CONST EFI_GUID
*CallerId
,
1115 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1119 Routine Description:
1121 Core version of the Status Code reporter
1125 PeiServices - The PEI core services table.
1127 CodeType - Type of Status Code.
1129 Value - Value to output for Status Code.
1131 Instance - Instance Number of this status code.
1133 CallerId - ID of the caller of this status code.
1135 Data - Optional data associated with this status code.
1139 Status - EFI_SUCCESS if status code is successfully reported
1140 - EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1149 IN CONST EFI_PEI_SERVICES
**PeiServices
1153 Routine Description:
1155 Core version of the Reset System
1159 PeiServices - The PEI core services table.
1163 Status - EFI_NOT_AVAILABLE_YET. PPI not available yet.
1164 - EFI_DEVICE_ERROR. Did not reset system.
1166 Otherwise, resets the system.
1173 IN PEI_CORE_INSTANCE
*PrivateData
,
1174 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1178 Routine Description:
1180 Initialize PeiCore Fv List.
1183 PrivateData - Pointer to PEI_CORE_INSTANCE.
1184 SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1194 FirmwareVolmeInfoPpiNotifyCallback (
1195 IN EFI_PEI_SERVICES
**PeiServices
,
1196 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1201 Routine Description:
1203 Process Firmware Volum Information once FvInfoPPI install.
1207 PeiServices - General purpose services available to every PEIM.
1211 Status - EFI_SUCCESS if the interface could be successfully
1220 PeiFfsFindFileByName (
1221 IN CONST EFI_GUID
*FileName
,
1222 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1223 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1227 Routine Description:
1229 Given the input VolumeHandle, search for the next matching name file.
1233 FileName - File name to search.
1234 VolumeHandle - The current FV to search.
1235 FileHandle - Pointer to the file matching name in VolumeHandle.
1236 - NULL if file not found
1247 IN EFI_PEI_FILE_HANDLE FileHandle
,
1248 OUT EFI_FV_FILE_INFO
*FileInfo
1252 Routine Description:
1254 Collect information of given file.
1257 FileHandle - The handle to file.
1258 FileInfo - Pointer to the file information.
1268 PeiFfsGetVolumeInfo (
1269 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1270 OUT EFI_FV_INFO
*VolumeInfo
1274 Routine Description:
1276 Collect information of given Fv Volume.
1279 VolumeHandle - The handle to Fv Volume.
1280 VolumeInfo - The pointer to volume information.
1291 PeiRegisterForShadow (
1292 IN EFI_PEI_FILE_HANDLE FileHandle
1296 Routine Description:
1298 This routine enable a PEIM to register itself to shadow when PEI Foundation
1299 discovery permanent memory.
1302 FileHandle - File handle of a PEIM.
1305 EFI_NOT_FOUND - The file handle doesn't point to PEIM itself.
1306 EFI_ALREADY_STARTED - Indicate that the PEIM has been registered itself.
1307 EFI_SUCCESS - Successfully to register itself.
1314 This routine enable a PEIM to register itself to shadow when PEI Foundation
1315 discovery permanent memory.
1317 @param FileHandle File handle of a PEIM.
1319 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1320 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1321 @retval EFI_SUCCESS Successfully to register itself.
1326 PeiRegisterForShadow (
1327 IN EFI_PEI_FILE_HANDLE FileHandle
1332 Transfers control to a function starting with a new stack.
1334 Transfers control to the function specified by EntryPoint using the new stack
1335 specified by NewStack and passing in the parameters specified by Context1 and
1336 Context2. Context1 and Context2 are optional and may be NULL. The function
1337 EntryPoint must never return.
1339 If EntryPoint is NULL, then ASSERT().
1340 If NewStack is NULL, then ASSERT().
1342 @param EntryPoint A pointer to function to call with the new stack.
1343 @param Context1 A pointer to the context to pass into the EntryPoint
1345 @param Context2 A pointer to the context to pass into the EntryPoint
1347 @param NewStack A pointer to the new stack to use for the EntryPoint
1349 @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
1350 Reserved on other architectures.
1356 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
1357 IN VOID
*Context1
, OPTIONAL
1358 IN VOID
*Context2
, OPTIONAL
1365 IN CONST EFI_PEI_FV_HANDLE FvHandle
,
1366 IN CONST EFI_GUID
*FileName
, OPTIONAL
1367 IN EFI_FV_FILETYPE SearchType
,
1368 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
,
1369 IN OUT EFI_PEI_FV_HANDLE
*AprioriFile OPTIONAL
1373 Routine Description:
1374 Given the input file pointer, search for the next matching file in the
1375 FFS volume as defined by SearchType. The search starts from FileHeader inside
1376 the Firmware Volume defined by FwVolHeader.
1379 PeiServices - Pointer to the PEI Core Services Table.
1380 SearchType - Filter to find only files of this type.
1381 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
1382 FwVolHeader - Pointer to the FV header of the volume to search.
1383 This parameter must point to a valid FFS volume.
1384 FileHeader - Pointer to the current file from which to begin searching.
1385 This pointer will be updated upon return to reflect the file found.
1386 Flag - Indicator for if this is for PEI Dispath search
1389 EFI_NOT_FOUND - No files matching the search criteria were found
1396 InitializeImageServices (
1397 IN PEI_CORE_INSTANCE
*PrivateData
,
1398 IN PEI_CORE_INSTANCE
*OldCoreData
1402 Routine Description:
1404 Regitser PeCoffLoader to PeiCore PrivateData. And install
1409 PrivateData - Pointer to PEI_CORE_INSTANCE.
1410 OldCoreData - Pointer to PEI_CORE_INSTANCE.