2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2007, 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 <Library/PeiPiLib.h>
47 #include <Guid/FirmwareFileSystem2.h>
48 #include <Guid/AprioriFileName.h>
50 #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
53 /// Pei Core private data structures
56 EFI_PEI_PPI_DESCRIPTOR
*Ppi
;
57 EFI_PEI_NOTIFY_DESCRIPTOR
*Notify
;
59 } PEI_PPI_LIST_POINTERS
;
62 /// PPI database structure which contains two link: PpiList and NotifyList. PpiList
63 /// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.
67 /// index of end of PpiList link list.
71 /// index of end of notify link list.
75 /// index of the dispatched notify list.
79 /// index of last installed Ppi description in PpiList link list.
81 INTN LastDispatchedInstall
;
83 /// index of last dispatched notify in Notify link list.
85 INTN LastDispatchedNotify
;
89 PEI_PPI_LIST_POINTERS PpiListPtrs
[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported
)];
94 // PEI_CORE_FV_HANDE.PeimState
95 // Do not change these values as there is code doing math to change states.
96 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
98 #define PEIM_STATE_NOT_DISPATCHED 0x00
99 #define PEIM_STATE_DISPATCHED 0x01
100 #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02
101 #define PEIM_STATE_DONE 0x03
104 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
105 UINT8 PeimState
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
106 EFI_PEI_FILE_HANDLE FvFileHandles
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
108 } PEI_CORE_FV_HANDLE
;
110 #define CACHE_SETION_MAX_NUMBER 0x10
112 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
113 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
114 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
115 UINTN AllSectionCount
;
117 } CACHE_SECTION_DATA
;
120 #define PEI_CORE_HANDLE_SIGNATURE EFI_SIGNATURE_32('P','e','i','C')
123 /// Pei Core private data structure instance
127 EFI_PEI_SERVICES
*PS
; // Point to ServiceTableShadow
128 PEI_PPI_DATABASE PpiData
;
130 PEI_CORE_FV_HANDLE Fv
[FixedPcdGet32 (PcdPeiCoreMaxFvSupported
)];
131 EFI_PEI_FILE_HANDLE CurrentFvFileHandles
[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv
)];
133 UINTN CurrentPeimFvCount
;
134 UINTN CurrentPeimCount
;
135 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
137 EFI_PEI_FV_HANDLE AllFv
[FixedPcdGet32 (PcdPeiCoreMaxFvSupported
)];
138 EFI_PEI_HOB_POINTERS HobList
;
139 BOOLEAN SwitchStackSignal
;
140 BOOLEAN PeiMemoryInstalled
;
141 EFI_PHYSICAL_ADDRESS StackBase
;
143 VOID
*BottomOfCarHeap
;
146 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
147 EFI_PEI_SERVICES ServiceTableShadow
;
148 UINTN SizeOfTemporaryMemory
;
149 UINTN SizeOfCacheAsRam
;
150 VOID
*MaxTopOfCarHeap
;
151 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
152 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
153 UINT64 PhysicalMemoryLength
;
154 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
155 VOID
* ShadowedPeiCore
;
156 CACHE_SECTION_DATA CacheSection
;
160 /// Pei Core Instance Data Macros
162 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
163 CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)
167 (EFIAPI
*PEI_CORE_ENTRY_POINT
)(
168 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
169 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
170 IN PEI_CORE_INSTANCE
*OldCoreData
174 /// Union of temporarily used function pointers (to save stack space)
177 PEI_CORE_ENTRY_POINT PeiCore
;
178 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
179 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
180 EFI_DXE_IPL_PPI
*DxeIpl
;
181 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
182 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
184 } PEI_CORE_TEMP_POINTERS
;
189 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
190 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
192 } PEI_CORE_PARAMETERS
;
199 The entry routine to Pei Core, invoked by PeiMain during transition
200 from SEC to PEI. After switching stack in the PEI core, it will restart
201 with the old core data.
204 @param SecCoreData Points to a data structure containing information about the PEI core's operating
205 environment, such as the size and location of temporary RAM, the stack location and
207 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
208 An empty PPI list consists of a single descriptor with the end-tag
209 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
210 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
211 that both the PEI Foundation and any modules can leverage the associated service
212 calls and/or code in these early PPIs
213 @param Data Pointer to old core data that is used to initialize the
216 @retval EFI_NOT_FOUND Never reach
222 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
223 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpList
,
229 // Dispatcher support functions
234 This is the POSTFIX version of the dependency evaluator. When a
235 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
236 the evaluation stack. When that entry is poped from the evaluation
237 stack, the PPI is checked if it is installed. This method allows
238 some time savings as not all PPIs must be checked for certain
239 operation types (AND, OR).
242 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
243 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
244 the BNF described above and is stored in postfix notation.
246 @retval TRUE if it is a well-formed Grammar
247 @retval FALSE if the dependency expression overflows the evaluation stack
248 if the dependency expression underflows the evaluation stack
249 if the dependency expression is not a well-formed Grammar.
253 PeimDispatchReadiness (
254 IN EFI_PEI_SERVICES
**PeiServices
,
255 IN VOID
*DependencyExpression
260 Conduct PEIM dispatch.
262 @param SecCoreData Points to a data structure containing information about the PEI core's operating
263 environment, such as the size and location of temporary RAM, the stack location and
265 @param PrivateData Pointer to the private data passed in from caller
267 @retval EFI_SUCCESS Successfully dispatched PEIM.
268 @retval EFI_NOT_FOUND The dispatch failed.
273 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
274 IN PEI_CORE_INSTANCE
*PrivateData
279 Initialize the Dispatcher's data members
281 @param PrivateData PeiCore's private data structure
282 @param OldCoreData Old data from SecCore
283 NULL if being run in non-permament memory mode.
284 @param SecCoreData Points to a data structure containing information about the PEI core's operating
285 environment, such as the size and location of temporary RAM, the stack location and
290 InitializeDispatcherData (
291 IN PEI_CORE_INSTANCE
*PrivateData
,
292 IN PEI_CORE_INSTANCE
*OldCoreData
,
293 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
298 This routine parses the Dependency Expression, if available, and
299 decides if the module can be executed.
302 @param Private PeiCore's private data structure
303 @param FileHandle PEIM's file handle
304 @param PeimCount Peim count in all dispatched PEIMs.
306 @retval TRUE Can be dispatched
307 @retval FALSE Cannot be dispatched
312 IN PEI_CORE_INSTANCE
*Private
,
313 IN EFI_PEI_FILE_HANDLE FileHandle
,
319 // PPI support functions
323 Initialize PPI services.
325 @param PrivateData Pointer to the PEI Core data.
326 @param OldCoreData Pointer to old PEI Core data.
327 NULL if being run in non-permament memory mode.
331 InitializePpiServices (
332 IN PEI_CORE_INSTANCE
*PrivateData
,
333 IN PEI_CORE_INSTANCE
*OldCoreData
339 Migrate the Hob list from the CAR stack to PEI installed memory.
341 @param PeiServices The PEI core services table.
342 @param OldCheckingBottom The old checking bottom.
343 @param OldCheckingTop The old checking top.
344 @param Fixup The address difference between
345 the new Hob list and old Hob list.
350 IN PEI_CORE_INSTANCE
*PrivateData
,
351 IN UINTN OldCheckingBottom
,
352 IN UINTN OldCheckingTop
,
359 Install PPI services.
361 @param PeiServices - Pointer to the PEI Service Table
362 @param PpiList - Pointer to a list of PEI PPI Descriptors.
364 @retval EFI_SUCCESS - if all PPIs in PpiList are successfully installed.
365 @retval EFI_INVALID_PARAMETER - if PpiList is NULL pointer
366 @retval EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid
367 @retval EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI
373 IN CONST EFI_PEI_SERVICES
**PeiServices
,
374 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
380 Re-Install PPI services.
382 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
383 @param OldPpi Pointer to the old PEI PPI Descriptors.
384 @param NewPpi Pointer to the new PEI PPI Descriptors.
386 @retval EFI_SUCCESS if the operation was successful
387 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
388 @retval EFI_INVALID_PARAMETER if NewPpi is not valid
389 @retval EFI_NOT_FOUND if the PPI was not in the database
395 IN CONST EFI_PEI_SERVICES
**PeiServices
,
396 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
397 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
403 Locate a given named PPI.
406 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
407 @param Guid Pointer to GUID of the PPI.
408 @param Instance Instance Number to discover.
409 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
410 returns a pointer to the descriptor (includes flags, etc)
411 @param Ppi Pointer to reference the found PPI
413 @retval EFI_SUCCESS if the PPI is in the database
414 @retval EFI_NOT_FOUND if the PPI is not in the database
420 IN CONST EFI_PEI_SERVICES
**PeiServices
,
421 IN CONST EFI_GUID
*Guid
,
423 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
430 Install a notification for a given PPI.
433 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
434 @param NotifyList Pointer to list of Descriptors to notify upon.
436 @retval EFI_SUCCESS if successful
437 @retval EFI_OUT_OF_RESOURCES if no space in the database
438 @retval EFI_INVALID_PARAMETER if not a good decriptor
444 IN CONST EFI_PEI_SERVICES
**PeiServices
,
445 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
451 Process the Notify List at dispatch level.
453 @param PrivateData PeiCore's private data structure.
458 IN PEI_CORE_INSTANCE
*PrivateData
464 Dispatch notifications.
466 @param PrivateData PeiCore's private data structure
467 @param NotifyType Type of notify to fire.
468 @param InstallStartIndex Install Beginning index.
469 @param InstallStopIndex Install Ending index.
470 @param NotifyStartIndex Notify Beginning index.
471 @param NotifyStopIndex Notify Ending index.
476 IN PEI_CORE_INSTANCE
*PrivateData
,
478 IN INTN InstallStartIndex
,
479 IN INTN InstallStopIndex
,
480 IN INTN NotifyStartIndex
,
481 IN INTN NotifyStopIndex
486 // Boot mode support functions
489 This service enables PEIMs to ascertain the present value of the boot mode.
491 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
492 @param BootMode A pointer to contain the value of the boot mode.
494 @retval EFI_SUCCESS The boot mode was returned successfully.
495 @retval EFI_INVALID_PARAMETER BootMode is NULL.
501 IN CONST EFI_PEI_SERVICES
**PeiServices
,
502 IN OUT EFI_BOOT_MODE
*BootMode
507 This service enables PEIMs to update the boot mode variable.
510 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
511 @param BootMode The value of the boot mode to set.
513 @return EFI_SUCCESS The value was successfully updated
519 IN CONST EFI_PEI_SERVICES
**PeiServices
,
520 IN EFI_BOOT_MODE BootMode
525 // Security support functions
529 Initialize the security services.
531 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
532 @param OldCoreData Pointer to the old core data.
533 NULL if being run in non-permament memory mode.
537 InitializeSecurityServices (
538 IN EFI_PEI_SERVICES
**PeiServices
,
539 IN PEI_CORE_INSTANCE
*OldCoreData
544 Verify a Firmware volume
546 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
548 @retval EFI_SUCCESS Firmware Volume is legal
549 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
554 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
560 Provide a callout to the security verification service.
563 @param PrivateData PeiCore's private data structure
564 @param VolumeHandle Handle of FV
565 @param FileHandle Handle of PEIM's ffs
567 @retval EFI_SUCCESS Image is OK
568 @retval EFI_SECURITY_VIOLATION Image is illegal
573 IN PEI_CORE_INSTANCE
*PrivateData
,
574 IN EFI_PEI_FV_HANDLE VolumeHandle
,
575 IN EFI_PEI_FILE_HANDLE FileHandle
581 Gets the pointer to the HOB List.
584 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
585 @param HobList Pointer to the HOB List.
587 @retval EFI_SUCCESS Get the pointer of HOB List
588 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
589 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
595 IN CONST EFI_PEI_SERVICES
**PeiServices
,
596 IN OUT VOID
**HobList
601 Add a new HOB to the HOB List.
603 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
604 @param Type Type of the new HOB.
605 @param Length Length of the new HOB to allocate.
606 @param Hob Pointer to the new HOB.
608 @return EFI_SUCCESS Success to create hob.
609 @retval EFI_INVALID_PARAMETER if Hob is NULL
610 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
611 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
617 IN CONST EFI_PEI_SERVICES
**PeiServices
,
626 Builds a Handoff Information Table HOB
628 @param BootMode - Current Bootmode
629 @param MemoryBegin - Start Memory Address.
630 @param MemoryLength - Length of Memory.
632 @return EFI_SUCCESS Always success to initialize HOB.
636 PeiCoreBuildHobHandoffInfoTable (
637 IN EFI_BOOT_MODE BootMode
,
638 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
639 IN UINT64 MemoryLength
645 // FFS Fw Volume support functions
648 Given the input file pointer, search for the next matching file in the
649 FFS volume as defined by SearchType. The search starts from FileHeader inside
650 the Firmware Volume defined by FwVolHeader.
653 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
654 @param SearchType Filter to find only files of this type.
655 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
656 @param VolumeHandle Pointer to the FV header of the volume to search.
657 @param FileHandle Pointer to the current file from which to begin searching.
658 This pointer will be updated upon return to reflect the file found.
659 @retval EFI_NOT_FOUND No files matching the search criteria were found
660 @retval EFI_SUCCESS Success to find next file in given volume
666 IN CONST EFI_PEI_SERVICES
**PeiServices
,
668 IN EFI_PEI_FV_HANDLE FwVolHeader
,
669 IN OUT EFI_PEI_FILE_HANDLE
*FileHeader
674 Given the input file pointer, search for the next matching section in the
678 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
679 @param SectionType Filter to find only sections of this type.
680 @param FileHandle Pointer to the current file to search.
681 @param SectionData Pointer to the Section matching SectionType in FfsFileHeader.
682 NULL if section not found
684 @retval EFI_NOT_FOUND No files matching the search criteria were found
685 @retval EFI_SUCCESS Success to find section data in given file
690 PeiFfsFindSectionData (
691 IN CONST EFI_PEI_SERVICES
**PeiServices
,
692 IN EFI_SECTION_TYPE SectionType
,
693 IN EFI_PEI_FILE_HANDLE FfsFileHeader
,
694 IN OUT VOID
**SectionData
699 search the firmware volumes by index
701 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
702 @param Instance Instance of FV to find
703 @param VolumeHandle Pointer to found Volume.
705 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL
706 @retval EFI_SUCCESS Firmware volume instance successfully found.
711 PeiFvFindNextVolume (
712 IN CONST EFI_PEI_SERVICES
**PeiServices
,
714 IN OUT EFI_PEI_FV_HANDLE
*FwVolHeader
719 // Memory support functions
723 Initialize the memory services.
726 @param PrivateData PeiCore's private data structure
727 @param SecCoreData Points to a data structure containing information about the PEI core's operating
728 environment, such as the size and location of temporary RAM, the stack location and
730 @param OldCoreData Pointer to the PEI Core data.
731 NULL if being run in non-permament memory mode.
735 InitializeMemoryServices (
736 IN PEI_CORE_INSTANCE
*PrivateData
,
737 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
738 IN PEI_CORE_INSTANCE
*OldCoreData
744 Install the permanent memory is now available.
745 Creates HOB (PHIT and Stack).
747 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
748 @param MemoryBegin Start of memory address.
749 @param MemoryLength Length of memory.
751 @return EFI_SUCCESS Always success.
756 PeiInstallPeiMemory (
757 IN CONST EFI_PEI_SERVICES
**PeiServices
,
758 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
759 IN UINT64 MemoryLength
765 Memory allocation service on permanent memory,
766 not usable prior to the memory installation.
769 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
770 @param MemoryType Type of memory to allocate.
771 @param Pages Number of pages to allocate.
772 @param Memory Pointer of memory allocated.
774 @retval EFI_SUCCESS The allocation was successful
775 @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
776 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available
777 @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
778 to allocate the number of pages.
784 IN CONST EFI_PEI_SERVICES
**PeiServices
,
785 IN EFI_MEMORY_TYPE MemoryType
,
787 OUT EFI_PHYSICAL_ADDRESS
*Memory
793 Memory allocation service on the CAR.
796 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
797 @param Size Amount of memory required
798 @param Buffer Address of pointer to the buffer
800 @retval EFI_SUCCESS The allocation was successful
801 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
802 to allocate the requested size.
808 IN CONST EFI_PEI_SERVICES
**PeiServices
,
816 Routine for load image file.
819 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
820 @param FileHandle Pointer to the FFS file header of the image.
821 @param EntryPoint Pointer to entry point of specified image file for output.
822 @param AuthenticationState Pointer to attestation authentication state of image.
824 @retval EFI_SUCCESS Image is successfully loaded.
825 @retval EFI_NOT_FOUND Fail to locate necessary PPI
826 @retval Others Fail to load file.
831 IN EFI_PEI_SERVICES
**PeiServices
,
832 IN EFI_PEI_FILE_HANDLE FileHandle
,
833 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
834 OUT UINT32
*AuthenticationState
840 Core version of the Status Code reporter
843 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
844 @param CodeType Type of Status Code.
845 @param Value Value to output for Status Code.
846 @param Instance Instance Number of this status code.
847 @param CallerId ID of the caller of this status code.
848 @param Data Optional data associated with this status code.
850 @retval EFI_SUCCESS if status code is successfully reported
851 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
856 PeiReportStatusCode (
857 IN CONST EFI_PEI_SERVICES
**PeiServices
,
858 IN EFI_STATUS_CODE_TYPE CodeType
,
859 IN EFI_STATUS_CODE_VALUE Value
,
861 IN CONST EFI_GUID
*CallerId
,
862 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
868 Core version of the Reset System
871 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
873 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
874 @retval EFI_DEVICE_ERROR Did not reset system.
875 Otherwise, resets the system.
881 IN CONST EFI_PEI_SERVICES
**PeiServices
887 Initialize PeiCore Fv List.
890 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
891 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
896 IN PEI_CORE_INSTANCE
*PrivateData
,
897 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
902 Process Firmware Volum Information once FvInfoPPI install.
904 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
905 @param NotifyDescriptor Address of the notification descriptor data structure.
906 @param Ppi Address of the PPI that was installed.
908 @retval EFI_SUCCESS if the interface could be successfully installed
913 FirmwareVolmeInfoPpiNotifyCallback (
914 IN EFI_PEI_SERVICES
**PeiServices
,
915 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
922 Given the input VolumeHandle, search for the next matching name file.
925 @param FileName File name to search.
926 @param VolumeHandle The current FV to search.
927 @param FileHandle Pointer to the file matching name in VolumeHandle.
928 NULL if file not found
935 PeiFfsFindFileByName (
936 IN CONST EFI_GUID
*FileName
,
937 IN EFI_PEI_FV_HANDLE VolumeHandle
,
938 OUT EFI_PEI_FILE_HANDLE
*FileHandle
944 Returns information about a specific file.
947 @param FileHandle The handle to file.
948 @param FileInfo Pointer to the file information.
950 @retval EFI_INVALID_PARAMETER Invalid FileHandle or FileInfo.
951 @retval EFI_SUCCESS Success to collect file info.
957 IN EFI_PEI_FILE_HANDLE FileHandle
,
958 OUT EFI_FV_FILE_INFO
*FileInfo
964 Collect information of given Fv Volume.
966 @param VolumeHandle The handle to Fv Volume.
967 @param VolumeInfo The pointer to volume information.
969 @retval EFI_INVALID_PARAMETER VolumeInfo is NULL
970 @retval EFI_SUCCESS Success to collect fv info.
974 PeiFfsGetVolumeInfo (
975 IN EFI_PEI_FV_HANDLE VolumeHandle
,
976 OUT EFI_FV_INFO
*VolumeInfo
981 This routine enable a PEIM to register itself to shadow when PEI Foundation
982 discovery permanent memory.
984 @param FileHandle File handle of a PEIM.
986 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
987 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
988 @retval EFI_SUCCESS Successfully to register itself.
993 PeiRegisterForShadow (
994 IN EFI_PEI_FILE_HANDLE FileHandle
999 Given the input file pointer, search for the next matching file in the
1000 FFS volume as defined by SearchType. The search starts from FileHeader inside
1001 the Firmware Volume defined by FwVolHeader.
1004 @param FvHandle Pointer to the FV header of the volume to search
1005 @param FileName File name
1006 @param SearchType Filter to find only files of this type.
1007 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
1008 @param FileHandle This parameter must point to a valid FFS volume.
1009 @param AprioriFile Pointer to AprioriFile image in this FV if has
1011 @return EFI_NOT_FOUND No files matching the search criteria were found
1012 @retval EFI_SUCCESS Success to search given file
1017 IN CONST EFI_PEI_FV_HANDLE FvHandle
,
1018 IN CONST EFI_GUID
*FileName
, OPTIONAL
1019 IN EFI_FV_FILETYPE SearchType
,
1020 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
,
1021 IN OUT EFI_PEI_FV_HANDLE
*AprioriFile OPTIONAL
1027 Install Pei Load File PPI.
1030 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1031 @param OldCoreData Pointer to PEI_CORE_INSTANCE.
1035 InitializeImageServices (
1036 IN PEI_CORE_INSTANCE
*PrivateData
,
1037 IN PEI_CORE_INSTANCE
*OldCoreData
1042 Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
1044 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1045 @param FileHandle File handle of a Fv type file.
1046 @param AuthenticationState Pointer to attestation authentication state of image.
1049 @retval EFI_NOT_FOUND FV image can't be found.
1050 @retval EFI_SUCCESS Successfully to process it.
1055 IN EFI_PEI_SERVICES
**PeiServices
,
1056 IN EFI_PEI_FILE_HANDLE FvFileHandle
,
1057 OUT UINT32
*AuthenticationState