2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2008, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <Ppi/DxeIpl.h>
20 #include <Ppi/MemoryDiscovered.h>
21 #include <Ppi/StatusCode.h>
22 #include <Ppi/Reset.h>
23 #include <Ppi/FirmwareVolume.h>
24 #include <Ppi/FirmwareVolumeInfo.h>
25 #include <Ppi/Decompress.h>
26 #include <Ppi/GuidedSectionExtraction.h>
27 #include <Ppi/LoadFile.h>
28 #include <Ppi/Security2.h>
29 #include <Ppi/TemporaryRamSupport.h>
30 #include <Library/DebugLib.h>
31 #include <Library/PeiCoreEntryPoint.h>
32 #include <Library/BaseLib.h>
33 #include <Library/HobLib.h>
34 #include <Library/PerformanceLib.h>
35 #include <Library/PeiServicesLib.h>
36 #include <Library/ReportStatusCodeLib.h>
37 #include <Library/PeCoffLib.h>
38 #include <Library/PeCoffGetEntryPointLib.h>
39 #include <Library/BaseMemoryLib.h>
40 #include <Library/CacheMaintenanceLib.h>
41 #include <Library/TimerLib.h>
42 #include <Library/PcdLib.h>
43 #include <IndustryStandard/PeImage.h>
44 #include <Library/PeiServicesTablePointerLib.h>
45 #include <Library/MemoryAllocationLib.h>
46 #include <Guid/FirmwareFileSystem2.h>
47 #include <Guid/AprioriFileName.h>
50 /// It is an FFS type extension used for PeiFindFileEx. It indicates current
51 /// Ffs searching is for all PEIMs can be dispatched by PeiCore.
53 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
56 /// Pei Core private data structures
59 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
60 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
62 } PEI_PPI_LIST_POINTERS
;
65 /// PPI database structure which contains two link: PpiList and NotifyList. PpiList
66 /// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.
70 /// index of end of PpiList link list.
74 /// index of end of notify link list.
78 /// index of the dispatched notify list.
82 /// index of last installed Ppi description in PpiList link list.
84 INTN LastDispatchedInstall
;
86 /// index of last dispatched notify in Notify link list.
88 INTN LastDispatchedNotify
;
92 PEI_PPI_LIST_POINTERS PpiListPtrs
[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported
)];
97 // PEI_CORE_FV_HANDE.PeimState
98 // Do not change these values as there is code doing math to change states.
99 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
101 #define PEIM_STATE_NOT_DISPATCHED 0x00
102 #define PEIM_STATE_DISPATCHED 0x01
103 #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02
104 #define PEIM_STATE_DONE 0x03
107 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
108 UINT8 PeimState
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
109 EFI_PEI_FILE_HANDLE FvFileHandles
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
111 } PEI_CORE_FV_HANDLE
;
113 #define CACHE_SETION_MAX_NUMBER 0x10
115 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
116 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
117 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
118 UINTN AllSectionCount
;
120 } CACHE_SECTION_DATA
;
123 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
126 /// Pei Core private data structure instance
130 EFI_PEI_SERVICES
*PS
; // Point to ServiceTableShadow
131 PEI_PPI_DATABASE PpiData
;
133 PEI_CORE_FV_HANDLE Fv
[FixedPcdGet32 (PcdPeiCoreMaxFvSupported
)];
134 EFI_PEI_FILE_HANDLE CurrentFvFileHandles
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
136 UINTN CurrentPeimFvCount
;
137 UINTN CurrentPeimCount
;
138 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
139 BOOLEAN PeimNeedingDispatch
;
140 BOOLEAN PeimDispatchOnThisPass
;
141 BOOLEAN PeimDispatcherReenter
;
143 EFI_PEI_FV_HANDLE AllFv
[FixedPcdGet32 (PcdPeiCoreMaxFvSupported
)];
144 EFI_PEI_HOB_POINTERS HobList
;
145 BOOLEAN SwitchStackSignal
;
146 BOOLEAN PeiMemoryInstalled
;
147 EFI_PHYSICAL_ADDRESS StackBase
;
150 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
151 EFI_PEI_SERVICES ServiceTableShadow
;
152 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
153 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
154 UINT64 PhysicalMemoryLength
;
155 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
156 VOID
* ShadowedPeiCore
;
157 CACHE_SECTION_DATA CacheSection
;
161 /// Pei Core Instance Data Macros
163 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
164 CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)
167 Function Pointer type for PeiCore function.
168 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
169 and location of temporary RAM, the stack location and the BFV location.
170 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
171 An empty PPI list consists of a single descriptor with the end-tag
172 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
173 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
174 that both the PEI Foundation and any modules can leverage the associated service
175 calls and/or code in these early PPIs
176 @param OldCoreData Pointer to old core data that is used to initialize the
181 (EFIAPI
*PEICORE_FUNCTION_POINTER
)(
182 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
183 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
184 IN PEI_CORE_INSTANCE
*OldCoreData
188 /// Union of temporarily used function pointers (to save stack space)
191 PEICORE_FUNCTION_POINTER PeiCore
;
192 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
193 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
194 EFI_DXE_IPL_PPI
*DxeIpl
;
195 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
196 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
198 } PEI_CORE_TEMP_POINTERS
;
201 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
202 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
204 } PEI_CORE_PARAMETERS
;
211 The entry routine to Pei Core, invoked by PeiMain during transition
212 from SEC to PEI. After switching stack in the PEI core, it will restart
213 with the old core data.
216 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
217 and location of temporary RAM, the stack location and the BFV location.
218 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
219 An empty PPI list consists of a single descriptor with the end-tag
220 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
221 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
222 that both the PEI Foundation and any modules can leverage the associated service
223 calls and/or code in these early PPIs
224 @param Data Pointer to old core data that is used to initialize the
231 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
232 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
237 // Dispatcher support functions
242 This is the POSTFIX version of the dependency evaluator. When a
243 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
244 the evaluation stack. When that entry is poped from the evaluation
245 stack, the PPI is checked if it is installed. This method allows
246 some time savings as not all PPIs must be checked for certain
247 operation types (AND, OR).
250 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
251 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
252 the BNF described above and is stored in postfix notation.
254 @retval TRUE if it is a well-formed Grammar
255 @retval FALSE if the dependency expression overflows the evaluation stack
256 if the dependency expression underflows the evaluation stack
257 if the dependency expression is not a well-formed Grammar.
261 PeimDispatchReadiness (
262 IN EFI_PEI_SERVICES
**PeiServices
,
263 IN VOID
*DependencyExpression
267 Conduct PEIM dispatch.
269 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
270 @param PrivateData Pointer to the private data passed in from caller
275 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
276 IN PEI_CORE_INSTANCE
*PrivateData
280 Initialize the Dispatcher's data members
282 @param PrivateData PeiCore's private data structure
283 @param OldCoreData Old data from SecCore
284 NULL if being run in non-permament memory mode.
285 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
286 and location of temporary RAM, the stack location and the BFV location.
290 InitializeDispatcherData (
291 IN PEI_CORE_INSTANCE
*PrivateData
,
292 IN PEI_CORE_INSTANCE
*OldCoreData
,
293 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
297 This routine parses the Dependency Expression, if available, and
298 decides if the module can be executed.
301 @param Private PeiCore's private data structure
302 @param FileHandle PEIM's file handle
303 @param PeimCount The index of last dispatched PEIM.
305 @retval TRUE Can be dispatched
306 @retval FALSE Cannot be dispatched
311 IN PEI_CORE_INSTANCE
*Private
,
312 IN EFI_PEI_FILE_HANDLE FileHandle
,
317 // PPI support functions
321 Initialize PPI services.
323 @param PrivateData Pointer to the PEI Core data.
324 @param OldCoreData Pointer to old PEI Core data.
325 NULL if being run in non-permament memory mode.
329 InitializePpiServices (
330 IN PEI_CORE_INSTANCE
*PrivateData
,
331 IN PEI_CORE_INSTANCE
*OldCoreData
336 Migrate the Hob list from the CAR stack to PEI installed memory.
338 @param PrivateData Pointer to PeiCore's private data structure.
339 @param OldCheckingBottom Bottom of temporary memory range. All Ppi in this range
340 will be fixup for PpiData and PpiDescriptor pointer.
341 @param OldCheckingTop Top of temporary memory range. All Ppi in this range
342 will be fixup for PpiData and PpiDescriptor.
343 @param Fixup The address difference between
344 the new Hob list and old Hob list.
349 IN PEI_CORE_INSTANCE
*PrivateData
,
350 IN UINTN OldCheckingBottom
,
351 IN UINTN OldCheckingTop
,
357 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
359 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
360 @param PpiList Pointer to ppi array that want to be installed.
362 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
363 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
364 if any PPI in PpiList is not valid
365 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
371 IN CONST EFI_PEI_SERVICES
**PeiServices
,
372 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
377 Re-Install PPI services.
379 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
380 @param OldPpi Pointer to the old PEI PPI Descriptors.
381 @param NewPpi Pointer to the new PEI PPI Descriptors.
383 @retval EFI_SUCCESS if the operation was successful
384 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
385 if NewPpi is not valid
386 @retval EFI_NOT_FOUND if the PPI was not in the database
392 IN CONST EFI_PEI_SERVICES
**PeiServices
,
393 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
394 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
399 Locate a given named PPI.
402 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
403 @param Guid Pointer to GUID of the PPI.
404 @param Instance Instance Number to discover.
405 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
406 returns a pointer to the descriptor (includes flags, etc)
407 @param Ppi Pointer to reference the found PPI
409 @retval EFI_SUCCESS if the PPI is in the database
410 @retval EFI_NOT_FOUND if the PPI is not in the database
416 IN CONST EFI_PEI_SERVICES
**PeiServices
,
417 IN CONST EFI_GUID
*Guid
,
419 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
425 Install a notification for a given PPI.
428 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
429 @param NotifyList Pointer to list of Descriptors to notify upon.
431 @retval EFI_SUCCESS if successful
432 @retval EFI_OUT_OF_RESOURCES if no space in the database
433 @retval EFI_INVALID_PARAMETER if not a good decriptor
439 IN CONST EFI_PEI_SERVICES
**PeiServices
,
440 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
445 Process the Notify List at dispatch level.
447 @param PrivateData PeiCore's private data structure.
452 IN PEI_CORE_INSTANCE
*PrivateData
457 Dispatch notifications.
459 @param PrivateData PeiCore's private data structure
460 @param NotifyType Type of notify to fire.
461 @param InstallStartIndex Install Beginning index.
462 @param InstallStopIndex Install Ending index.
463 @param NotifyStartIndex Notify Beginning index.
464 @param NotifyStopIndex Notify Ending index.
469 IN PEI_CORE_INSTANCE
*PrivateData
,
471 IN INTN InstallStartIndex
,
472 IN INTN InstallStopIndex
,
473 IN INTN NotifyStartIndex
,
474 IN INTN NotifyStopIndex
478 // Boot mode support functions
481 This service enables PEIMs to ascertain the present value of the boot mode.
483 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
484 @param BootMode A pointer to contain the value of the boot mode.
486 @retval EFI_SUCCESS The boot mode was returned successfully.
487 @retval EFI_INVALID_PARAMETER BootMode is NULL.
493 IN CONST EFI_PEI_SERVICES
**PeiServices
,
494 IN OUT EFI_BOOT_MODE
*BootMode
498 This service enables PEIMs to update the boot mode variable.
501 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
502 @param BootMode The value of the boot mode to set.
504 @return EFI_SUCCESS The value was successfully updated
510 IN CONST EFI_PEI_SERVICES
**PeiServices
,
511 IN EFI_BOOT_MODE BootMode
515 // Security support functions
519 Initialize the security services.
521 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
522 @param OldCoreData Pointer to the old core data.
523 NULL if being run in non-permament memory mode.
527 InitializeSecurityServices (
528 IN EFI_PEI_SERVICES
**PeiServices
,
529 IN PEI_CORE_INSTANCE
*OldCoreData
533 Verify a Firmware volume.
535 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
537 @retval EFI_SUCCESS Firmware Volume is legal
538 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
543 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
548 Provide a callout to the security verification service.
551 @param PrivateData PeiCore's private data structure
552 @param VolumeHandle Handle of FV
553 @param FileHandle Handle of PEIM's ffs
555 @retval EFI_SUCCESS Image is OK
556 @retval EFI_SECURITY_VIOLATION Image is illegal
561 IN PEI_CORE_INSTANCE
*PrivateData
,
562 IN EFI_PEI_FV_HANDLE VolumeHandle
,
563 IN EFI_PEI_FILE_HANDLE FileHandle
568 Gets the pointer to the HOB List.
571 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
572 @param HobList Pointer to the HOB List.
574 @retval EFI_SUCCESS Get the pointer of HOB List
575 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
576 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
582 IN CONST EFI_PEI_SERVICES
**PeiServices
,
583 IN OUT VOID
**HobList
587 Add a new HOB to the HOB List.
589 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
590 @param Type Type of the new HOB.
591 @param Length Length of the new HOB to allocate.
592 @param Hob Pointer to the new HOB.
594 @return EFI_SUCCESS Success to create hob.
595 @retval EFI_INVALID_PARAMETER if Hob is NULL
596 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
597 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
603 IN CONST EFI_PEI_SERVICES
**PeiServices
,
611 Builds a Handoff Information Table HOB
613 @param BootMode - Current Bootmode
614 @param MemoryBegin - Start Memory Address.
615 @param MemoryLength - Length of Memory.
617 @return EFI_SUCCESS Always success to initialize HOB.
621 PeiCoreBuildHobHandoffInfoTable (
622 IN EFI_BOOT_MODE BootMode
,
623 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
624 IN UINT64 MemoryLength
629 // FFS Fw Volume support functions
632 Given the input file pointer, search for the next matching file in the
633 FFS volume as defined by SearchType. The search starts from FileHeader inside
634 the Firmware Volume defined by FwVolHeader.
637 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
638 @param SearchType Filter to find only files of this type.
639 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
640 @param FwVolHeader Pointer to the FV header of the volume to search.
641 @param FileHeader Pointer to the current file from which to begin searching.
642 This pointer will be updated upon return to reflect the file found.
643 @retval EFI_NOT_FOUND No files matching the search criteria were found
644 @retval EFI_SUCCESS Success to find next file in given volume
650 IN CONST EFI_PEI_SERVICES
**PeiServices
,
652 IN EFI_PEI_FV_HANDLE FwVolHeader
,
653 IN OUT EFI_PEI_FILE_HANDLE
*FileHeader
657 Given the input file pointer, search for the next matching section in the
660 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
661 @param SectionType Filter to find only sections of this type.
662 @param FfsFileHeader Pointer to the current file to search.
663 @param SectionData Pointer to the Section matching SectionType in FfsFileHeader.
664 NULL if section not found
666 @retval EFI_NOT_FOUND No files matching the search criteria were found
667 @retval EFI_SUCCESS Success to find section data in given file
672 PeiFfsFindSectionData (
673 IN CONST EFI_PEI_SERVICES
**PeiServices
,
674 IN EFI_SECTION_TYPE SectionType
,
675 IN EFI_PEI_FILE_HANDLE FfsFileHeader
,
676 IN OUT VOID
**SectionData
680 search the firmware volumes by index
682 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
683 @param Instance Instance of FV to find
684 @param FwVolHeader Pointer to found Volume.
686 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL
687 @retval EFI_SUCCESS Firmware volume instance successfully found.
692 PeiFvFindNextVolume (
693 IN CONST EFI_PEI_SERVICES
**PeiServices
,
695 IN OUT EFI_PEI_FV_HANDLE
*FwVolHeader
699 // Memory support functions
703 Initialize the memory services.
705 @param PrivateData PeiCore's private data structure
706 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
707 and location of temporary RAM, the stack location and the BFV location.
708 @param OldCoreData Pointer to the PEI Core data.
709 NULL if being run in non-permament memory mode.
713 InitializeMemoryServices (
714 IN PEI_CORE_INSTANCE
*PrivateData
,
715 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
716 IN PEI_CORE_INSTANCE
*OldCoreData
721 Install the permanent memory is now available.
722 Creates HOB (PHIT and Stack).
724 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
725 @param MemoryBegin Start of memory address.
726 @param MemoryLength Length of memory.
728 @return EFI_SUCCESS Always success.
733 PeiInstallPeiMemory (
734 IN CONST EFI_PEI_SERVICES
**PeiServices
,
735 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
736 IN UINT64 MemoryLength
741 Memory allocation service on permanent memory,
742 not usable prior to the memory installation.
745 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
746 @param MemoryType Type of memory to allocate.
747 @param Pages Number of pages to allocate.
748 @param Memory Pointer of memory allocated.
750 @retval EFI_SUCCESS The allocation was successful
751 @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
752 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available
753 @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
754 to allocate the number of pages.
760 IN CONST EFI_PEI_SERVICES
**PeiServices
,
761 IN EFI_MEMORY_TYPE MemoryType
,
763 OUT EFI_PHYSICAL_ADDRESS
*Memory
768 Memory allocation service on the CAR.
771 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
772 @param Size Amount of memory required
773 @param Buffer Address of pointer to the buffer
775 @retval EFI_SUCCESS The allocation was successful
776 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
777 to allocate the requested size.
783 IN CONST EFI_PEI_SERVICES
**PeiServices
,
790 Routine for load image file.
793 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
794 @param FileHandle Pointer to the FFS file header of the image.
795 @param EntryPoint Pointer to entry point of specified image file for output.
796 @param AuthenticationState Pointer to attestation authentication state of image.
798 @retval EFI_SUCCESS Image is successfully loaded.
799 @retval EFI_NOT_FOUND Fail to locate necessary PPI
800 @retval Others Fail to load file.
805 IN CONST EFI_PEI_SERVICES
**PeiServices
,
806 IN EFI_PEI_FILE_HANDLE FileHandle
,
807 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
808 OUT UINT32
*AuthenticationState
813 Core version of the Status Code reporter
816 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
817 @param CodeType Type of Status Code.
818 @param Value Value to output for Status Code.
819 @param Instance Instance Number of this status code.
820 @param CallerId ID of the caller of this status code.
821 @param Data Optional data associated with this status code.
823 @retval EFI_SUCCESS if status code is successfully reported
824 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
829 PeiReportStatusCode (
830 IN CONST EFI_PEI_SERVICES
**PeiServices
,
831 IN EFI_STATUS_CODE_TYPE CodeType
,
832 IN EFI_STATUS_CODE_VALUE Value
,
834 IN CONST EFI_GUID
*CallerId
,
835 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
840 Core version of the Reset System
843 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
845 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
846 @retval EFI_DEVICE_ERROR Did not reset system.
847 Otherwise, resets the system.
853 IN CONST EFI_PEI_SERVICES
**PeiServices
858 Initialize PeiCore Fv List.
861 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
862 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
867 IN PEI_CORE_INSTANCE
*PrivateData
,
868 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
872 Process Firmware Volum Information once FvInfoPPI install.
874 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
875 @param NotifyDescriptor Address of the notification descriptor data structure.
876 @param Ppi Address of the PPI that was installed.
878 @retval EFI_SUCCESS if the interface could be successfully installed
883 FirmwareVolmeInfoPpiNotifyCallback (
884 IN EFI_PEI_SERVICES
**PeiServices
,
885 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
891 Given the input VolumeHandle, search for the next matching name file.
893 @param FileName File name to search.
894 @param VolumeHandle The current FV to search.
895 @param FileHandle Pointer to the file matching name in VolumeHandle.
896 NULL if file not found
898 @retval EFI_NOT_FOUND No files matching the search criteria were found
899 @retval EFI_SUCCESS Success to search given file
904 PeiFfsFindFileByName (
905 IN CONST EFI_GUID
*FileName
,
906 IN EFI_PEI_FV_HANDLE VolumeHandle
,
907 OUT EFI_PEI_FILE_HANDLE
*FileHandle
912 Returns information about a specific file.
915 @param FileHandle The handle to file.
916 @param FileInfo Pointer to the file information.
918 @retval EFI_INVALID_PARAMETER Invalid FileHandle or FileInfo.
919 @retval EFI_SUCCESS Success to collect file info.
925 IN EFI_PEI_FILE_HANDLE FileHandle
,
926 OUT EFI_FV_FILE_INFO
*FileInfo
931 Collect information of given Fv Volume.
933 @param VolumeHandle The handle to Fv Volume.
934 @param VolumeInfo The pointer to volume information.
936 @retval EFI_INVALID_PARAMETER VolumeInfo is NULL
937 @retval EFI_SUCCESS Success to collect fv info.
941 PeiFfsGetVolumeInfo (
942 IN EFI_PEI_FV_HANDLE VolumeHandle
,
943 OUT EFI_FV_INFO
*VolumeInfo
947 This routine enable a PEIM to register itself to shadow when PEI Foundation
948 discovery permanent memory.
950 @param FileHandle File handle of a PEIM.
952 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
953 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
954 @retval EFI_SUCCESS Successfully to register itself.
959 PeiRegisterForShadow (
960 IN EFI_PEI_FILE_HANDLE FileHandle
964 Given the input file pointer, search for the next matching file in the
965 FFS volume as defined by SearchType. The search starts from FileHeader inside
966 the Firmware Volume defined by FwVolHeader.
969 @param FvHandle Pointer to the FV header of the volume to search
970 @param FileName File name
971 @param SearchType Filter to find only files of this type.
972 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
973 @param FileHandle This parameter must point to a valid FFS volume.
974 @param AprioriFile Pointer to AprioriFile image in this FV if has
976 @return EFI_NOT_FOUND No files matching the search criteria were found
977 @retval EFI_SUCCESS Success to search given file
982 IN CONST EFI_PEI_FV_HANDLE FvHandle
,
983 IN CONST EFI_GUID
*FileName
, OPTIONAL
984 IN EFI_FV_FILETYPE SearchType
,
985 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
,
986 IN OUT EFI_PEI_FV_HANDLE
*AprioriFile OPTIONAL
990 Initialize image service that install PeiLoadFilePpi.
992 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
993 @param OldCoreData Pointer to Old PeiCore's private data.
994 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
995 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1000 InitializeImageServices (
1001 IN PEI_CORE_INSTANCE
*PrivateData
,
1002 IN PEI_CORE_INSTANCE
*OldCoreData
1006 Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
1008 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1009 @param FvFileHandle File handle of a Fv type file.
1010 @param AuthenticationState Pointer to attestation authentication state of image.
1011 If return 0, means pass security checking.
1013 @retval EFI_NOT_FOUND FV image can't be found.
1014 @retval EFI_SUCCESS Successfully to process it.
1019 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1020 IN EFI_PEI_FILE_HANDLE FvFileHandle
,
1021 OUT UINT32
*AuthenticationState
1025 The wrapper function of PeiLoadImageLoadImage().
1027 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1028 @param FileHandle Pointer to the FFS file header of the image.
1029 @param ImageAddressArg Pointer to PE/TE image.
1030 @param ImageSizeArg Size of PE/TE image.
1031 @param EntryPoint Pointer to entry point of specified image file for output.
1032 @param AuthenticationState Pointer to attestation authentication state of image.
1034 @return Status of PeiLoadImageLoadImage().
1039 PeiLoadImageLoadImageWrapper (
1040 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1041 IN EFI_PEI_FILE_HANDLE FileHandle
,
1042 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1043 OUT UINT64
*ImageSizeArg
, OPTIONAL
1044 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1045 OUT UINT32
*AuthenticationState
1050 Provide a callback for when the security PPI is installed.
1052 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1053 @param NotifyDescriptor The descriptor for the notification event.
1054 @param Ppi Pointer to the PPI in question.
1056 @return Always success
1061 SecurityPpiNotifyCallback (
1062 IN EFI_PEI_SERVICES
**PeiServices
,
1063 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,