2 Definition of Pei Core Structures and Services
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5 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/Reset2.h>
24 #include <Ppi/FirmwareVolume.h>
25 #include <Ppi/FirmwareVolumeInfo.h>
26 #include <Ppi/FirmwareVolumeInfo2.h>
27 #include <Ppi/Decompress.h>
28 #include <Ppi/GuidedSectionExtraction.h>
29 #include <Ppi/LoadFile.h>
30 #include <Ppi/Security2.h>
31 #include <Ppi/TemporaryRamSupport.h>
32 #include <Ppi/TemporaryRamDone.h>
33 #include <Ppi/SecHobData.h>
34 #include <Ppi/PeiCoreFvLocation.h>
35 #include <Library/DebugLib.h>
36 #include <Library/PeiCoreEntryPoint.h>
37 #include <Library/BaseLib.h>
38 #include <Library/HobLib.h>
39 #include <Library/PerformanceLib.h>
40 #include <Library/PeiServicesLib.h>
41 #include <Library/ReportStatusCodeLib.h>
42 #include <Library/PeCoffLib.h>
43 #include <Library/PeCoffGetEntryPointLib.h>
44 #include <Library/BaseMemoryLib.h>
45 #include <Library/CacheMaintenanceLib.h>
46 #include <Library/PcdLib.h>
47 #include <IndustryStandard/PeImage.h>
48 #include <Library/PeiServicesTablePointerLib.h>
49 #include <Library/MemoryAllocationLib.h>
50 #include <Guid/FirmwareFileSystem2.h>
51 #include <Guid/FirmwareFileSystem3.h>
52 #include <Guid/AprioriFileName.h>
55 /// It is an FFS type extension used for PeiFindFileEx. It indicates current
56 /// Ffs searching is for all PEIMs can be dispatched by PeiCore.
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
;
70 /// Number of PEI_PPI_LIST_POINTERS to grow by each time we run out of room
72 #define PPI_GROWTH_STEP 64
73 #define CALLBACK_NOTIFY_GROWTH_STEP 32
74 #define DISPATCH_NOTIFY_GROWTH_STEP 8
79 UINTN LastDispatchedCount
;
81 /// MaxCount number of entries.
83 PEI_PPI_LIST_POINTERS
*PpiPtrs
;
90 /// MaxCount number of entries.
92 PEI_PPI_LIST_POINTERS
*NotifyPtrs
;
93 } PEI_CALLBACK_NOTIFY_LIST
;
98 UINTN LastDispatchedCount
;
100 /// MaxCount number of entries.
102 PEI_PPI_LIST_POINTERS
*NotifyPtrs
;
103 } PEI_DISPATCH_NOTIFY_LIST
;
106 /// PPI database structure which contains three links:
107 /// PpiList, CallbackNotifyList and DispatchNotifyList.
113 PEI_PPI_LIST PpiList
;
115 /// Notify List at dispatch level.
117 PEI_CALLBACK_NOTIFY_LIST CallbackNotifyList
;
119 /// Notify List at callback level.
121 PEI_DISPATCH_NOTIFY_LIST DispatchNotifyList
;
125 // PEI_CORE_FV_HANDE.PeimState
126 // Do not change these values as there is code doing math to change states.
127 // Look for Private->Fv[FvCount].PeimState[PeimCount]++;
129 #define PEIM_STATE_NOT_DISPATCHED 0x00
130 #define PEIM_STATE_DISPATCHED 0x01
131 #define PEIM_STATE_REGISTER_FOR_SHADOW 0x02
132 #define PEIM_STATE_DONE 0x03
135 // Number of FV instances to grow by each time we run out of room
137 #define FV_GROWTH_STEP 8
140 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
141 EFI_PEI_FIRMWARE_VOLUME_PPI
*FvPpi
;
142 EFI_PEI_FV_HANDLE FvHandle
;
145 // Ponter to the buffer with the PeimCount number of Entries.
149 // Ponter to the buffer with the PeimCount number of Entries.
151 EFI_PEI_FILE_HANDLE
*FvFileHandles
;
153 UINT32 AuthenticationStatus
;
154 } PEI_CORE_FV_HANDLE
;
160 UINT32 AuthenticationStatus
;
161 EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor
;
162 } PEI_CORE_UNKNOW_FORMAT_FV_INFO
;
164 #define CACHE_SETION_MAX_NUMBER 0x10
166 EFI_COMMON_SECTION_HEADER
* Section
[CACHE_SETION_MAX_NUMBER
];
167 VOID
* SectionData
[CACHE_SETION_MAX_NUMBER
];
168 UINTN SectionSize
[CACHE_SETION_MAX_NUMBER
];
169 UINT32 AuthenticationStatus
[CACHE_SETION_MAX_NUMBER
];
170 UINTN AllSectionCount
;
172 } CACHE_SECTION_DATA
;
174 #define HOLE_MAX_NUMBER 0x3
176 EFI_PHYSICAL_ADDRESS Base
;
179 BOOLEAN OffsetPositive
;
183 /// Forward declaration for PEI_CORE_INSTANCE
185 typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE
;
189 Function Pointer type for PeiCore function.
190 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
191 and location of temporary RAM, the stack location and the BFV location.
192 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
193 An empty PPI list consists of a single descriptor with the end-tag
194 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
195 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
196 that both the PEI Foundation and any modules can leverage the associated service
197 calls and/or code in these early PPIs
198 @param OldCoreData Pointer to old core data that is used to initialize the
203 (EFIAPI
*PEICORE_FUNCTION_POINTER
)(
204 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
205 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
206 IN PEI_CORE_INSTANCE
*OldCoreData
210 // Number of files to grow by each time we run out of room
212 #define TEMP_FILE_GROWTH_STEP 32
214 #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
217 /// Pei Core private data structure instance
219 struct _PEI_CORE_INSTANCE
{
223 /// Point to ServiceTableShadow
225 EFI_PEI_SERVICES
*Ps
;
226 PEI_PPI_DATABASE PpiData
;
229 /// The count of FVs which contains FFS and could be dispatched by PeiCore.
234 /// The max count of FVs which contains FFS and could be dispatched by PeiCore.
239 /// Pointer to the buffer with the MaxFvCount number of entries.
240 /// Each entry is for one FV which contains FFS and could be dispatched by PeiCore.
242 PEI_CORE_FV_HANDLE
*Fv
;
245 /// Pointer to the buffer with the MaxUnknownFvInfoCount number of entries.
246 /// Each entry is for one FV which could not be dispatched by PeiCore.
248 PEI_CORE_UNKNOW_FORMAT_FV_INFO
*UnknownFvInfo
;
249 UINTN MaxUnknownFvInfoCount
;
250 UINTN UnknownFvInfoCount
;
253 /// Pointer to the buffer FvFileHandlers in PEI_CORE_FV_HANDLE specified by CurrentPeimFvCount.
255 EFI_PEI_FILE_HANDLE
*CurrentFvFileHandles
;
257 UINTN CurrentPeimFvCount
;
258 UINTN CurrentPeimCount
;
259 EFI_PEI_FILE_HANDLE CurrentFileHandle
;
260 BOOLEAN PeimNeedingDispatch
;
261 BOOLEAN PeimDispatchOnThisPass
;
262 BOOLEAN PeimDispatcherReenter
;
263 EFI_PEI_HOB_POINTERS HobList
;
264 BOOLEAN SwitchStackSignal
;
265 BOOLEAN PeiMemoryInstalled
;
267 EFI_PEI_SECURITY2_PPI
*PrivateSecurityPpi
;
268 EFI_PEI_SERVICES ServiceTableShadow
;
269 EFI_PEI_PPI_DESCRIPTOR
*XipLoadFile
;
270 EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin
;
271 UINT64 PhysicalMemoryLength
;
272 EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop
;
274 BOOLEAN HeapOffsetPositive
;
276 BOOLEAN StackOffsetPositive
;
278 // Information for migrating memory pages allocated in pre-memory phase.
280 HOLE_MEMORY_DATA MemoryPages
;
281 PEICORE_FUNCTION_POINTER ShadowedPeiCore
;
282 CACHE_SECTION_DATA CacheSection
;
284 // For Loading modules at fixed address feature to cache the top address below which the
285 // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
286 // and Ps should not be changed since maybe user could get this top address by using the offet to Ps.
288 EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress
;
290 // The field is define for Loading modules at fixed address feature to tracker the PEI code
291 // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page
294 UINT64
*PeiCodeMemoryRangeUsageBitMap
;
296 // This field points to the shadowed image read function
298 PE_COFF_LOADER_READ_FILE ShadowedImageRead
;
303 // Pointer to the temp buffer with the TempPeimCount number of entries.
305 EFI_PEI_FILE_HANDLE
*TempFileHandles
;
307 // Pointer to the temp buffer with the TempPeimCount number of entries.
309 EFI_GUID
*TempFileGuid
;
312 // Temp Memory Range is not covered by PeiTempMem and Stack.
313 // Those Memory Range will be migrated into physical memory.
315 HOLE_MEMORY_DATA HoleData
[HOLE_MAX_NUMBER
];
319 /// Pei Core Instance Data Macros
321 #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
322 CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
325 /// Union of temporarily used function pointers (to save stack space)
328 PEICORE_FUNCTION_POINTER PeiCore
;
329 EFI_PEIM_ENTRY_POINT2 PeimEntry
;
330 EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry
;
331 EFI_DXE_IPL_PPI
*DxeIpl
;
332 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
333 EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
;
335 } PEI_CORE_TEMP_POINTERS
;
338 CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
;
339 EFI_PEI_PPI_DESCRIPTOR
*PpiList
;
341 } PEI_CORE_PARAMETERS
;
348 The entry routine to Pei Core, invoked by PeiMain during transition
349 from SEC to PEI. After switching stack in the PEI core, it will restart
350 with the old core data.
353 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
354 and location of temporary RAM, the stack location and the BFV location.
355 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
356 An empty PPI list consists of a single descriptor with the end-tag
357 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
358 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
359 that both the PEI Foundation and any modules can leverage the associated service
360 calls and/or code in these early PPIs
361 @param Data Pointer to old core data that is used to initialize the
368 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
369 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
,
374 // Dispatcher support functions
379 This is the POSTFIX version of the dependency evaluator. When a
380 PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
381 the evaluation stack. When that entry is poped from the evaluation
382 stack, the PPI is checked if it is installed. This method allows
383 some time savings as not all PPIs must be checked for certain
384 operation types (AND, OR).
387 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
388 @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
389 the BNF described above and is stored in postfix notation.
391 @retval TRUE if it is a well-formed Grammar
392 @retval FALSE if the dependency expression overflows the evaluation stack
393 if the dependency expression underflows the evaluation stack
394 if the dependency expression is not a well-formed Grammar.
398 PeimDispatchReadiness (
399 IN EFI_PEI_SERVICES
**PeiServices
,
400 IN VOID
*DependencyExpression
404 Conduct PEIM dispatch.
406 @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
407 @param PrivateData Pointer to the private data passed in from caller
412 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
413 IN PEI_CORE_INSTANCE
*PrivateData
417 Initialize the Dispatcher's data members
419 @param PrivateData PeiCore's private data structure
420 @param OldCoreData Old data from SecCore
421 NULL if being run in non-permament memory mode.
422 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
423 and location of temporary RAM, the stack location and the BFV location.
427 InitializeDispatcherData (
428 IN PEI_CORE_INSTANCE
*PrivateData
,
429 IN PEI_CORE_INSTANCE
*OldCoreData
,
430 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
434 This routine parses the Dependency Expression, if available, and
435 decides if the module can be executed.
438 @param Private PeiCore's private data structure
439 @param FileHandle PEIM's file handle
440 @param PeimCount The index of last dispatched PEIM.
442 @retval TRUE Can be dispatched
443 @retval FALSE Cannot be dispatched
448 IN PEI_CORE_INSTANCE
*Private
,
449 IN EFI_PEI_FILE_HANDLE FileHandle
,
454 // PPI support functions
458 Initialize PPI services.
460 @param PrivateData Pointer to the PEI Core data.
461 @param OldCoreData Pointer to old PEI Core data.
462 NULL if being run in non-permament memory mode.
466 InitializePpiServices (
467 IN PEI_CORE_INSTANCE
*PrivateData
,
468 IN PEI_CORE_INSTANCE
*OldCoreData
473 Migrate the Hob list from the temporary memory to PEI installed memory.
475 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
476 and location of temporary RAM, the stack location and the BFV location.
477 @param PrivateData Pointer to PeiCore's private data structure.
482 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
483 IN PEI_CORE_INSTANCE
*PrivateData
488 Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
490 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
491 @param PpiList Pointer to ppi array that want to be installed.
493 @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
494 @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
495 if any PPI in PpiList is not valid
496 @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
502 IN CONST EFI_PEI_SERVICES
**PeiServices
,
503 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
508 Re-Install PPI services.
510 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
511 @param OldPpi Pointer to the old PEI PPI Descriptors.
512 @param NewPpi Pointer to the new PEI PPI Descriptors.
514 @retval EFI_SUCCESS if the operation was successful
515 @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
516 if NewPpi is not valid
517 @retval EFI_NOT_FOUND if the PPI was not in the database
523 IN CONST EFI_PEI_SERVICES
**PeiServices
,
524 IN CONST EFI_PEI_PPI_DESCRIPTOR
*OldPpi
,
525 IN CONST EFI_PEI_PPI_DESCRIPTOR
*NewPpi
530 Locate a given named PPI.
533 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
534 @param Guid Pointer to GUID of the PPI.
535 @param Instance Instance Number to discover.
536 @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
537 returns a pointer to the descriptor (includes flags, etc)
538 @param Ppi Pointer to reference the found PPI
540 @retval EFI_SUCCESS if the PPI is in the database
541 @retval EFI_NOT_FOUND if the PPI is not in the database
547 IN CONST EFI_PEI_SERVICES
**PeiServices
,
548 IN CONST EFI_GUID
*Guid
,
550 IN OUT EFI_PEI_PPI_DESCRIPTOR
**PpiDescriptor
,
556 Install a notification for a given PPI.
559 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
560 @param NotifyList Pointer to list of Descriptors to notify upon.
562 @retval EFI_SUCCESS if successful
563 @retval EFI_OUT_OF_RESOURCES if no space in the database
564 @retval EFI_INVALID_PARAMETER if not a good decriptor
570 IN CONST EFI_PEI_SERVICES
**PeiServices
,
571 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyList
576 Process the Notify List at dispatch level.
578 @param PrivateData PeiCore's private data structure.
582 ProcessDispatchNotifyList (
583 IN PEI_CORE_INSTANCE
*PrivateData
588 Process notifications.
590 @param PrivateData PeiCore's private data structure
591 @param NotifyType Type of notify to fire.
592 @param InstallStartIndex Install Beginning index.
593 @param InstallStopIndex Install Ending index.
594 @param NotifyStartIndex Notify Beginning index.
595 @param NotifyStopIndex Notify Ending index.
600 IN PEI_CORE_INSTANCE
*PrivateData
,
602 IN INTN InstallStartIndex
,
603 IN INTN InstallStopIndex
,
604 IN INTN NotifyStartIndex
,
605 IN INTN NotifyStopIndex
609 Process PpiList from SEC phase.
611 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
612 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
613 These PPI's will be installed and/or immediately signaled if they are notification type.
617 ProcessPpiListFromSec (
618 IN CONST EFI_PEI_SERVICES
**PeiServices
,
619 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
623 // Boot mode support functions
626 This service enables PEIMs to ascertain the present value of the boot mode.
628 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
629 @param BootMode A pointer to contain the value of the boot mode.
631 @retval EFI_SUCCESS The boot mode was returned successfully.
632 @retval EFI_INVALID_PARAMETER BootMode is NULL.
638 IN CONST EFI_PEI_SERVICES
**PeiServices
,
639 IN OUT EFI_BOOT_MODE
*BootMode
643 This service enables PEIMs to update the boot mode variable.
646 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
647 @param BootMode The value of the boot mode to set.
649 @return EFI_SUCCESS The value was successfully updated
655 IN CONST EFI_PEI_SERVICES
**PeiServices
,
656 IN EFI_BOOT_MODE BootMode
660 // Security support functions
664 Initialize the security services.
666 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
667 @param OldCoreData Pointer to the old core data.
668 NULL if being run in non-permament memory mode.
672 InitializeSecurityServices (
673 IN EFI_PEI_SERVICES
**PeiServices
,
674 IN PEI_CORE_INSTANCE
*OldCoreData
678 Verify a Firmware volume.
680 @param CurrentFvAddress Pointer to the current Firmware Volume under consideration
682 @retval EFI_SUCCESS Firmware Volume is legal
683 @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
688 IN EFI_FIRMWARE_VOLUME_HEADER
*CurrentFvAddress
692 Provide a callout to the security verification service.
694 @param PrivateData PeiCore's private data structure
695 @param VolumeHandle Handle of FV
696 @param FileHandle Handle of PEIM's ffs
697 @param AuthenticationStatus Authentication status
699 @retval EFI_SUCCESS Image is OK
700 @retval EFI_SECURITY_VIOLATION Image is illegal
701 @retval EFI_NOT_FOUND If security PPI is not installed.
705 IN PEI_CORE_INSTANCE
*PrivateData
,
706 IN EFI_PEI_FV_HANDLE VolumeHandle
,
707 IN EFI_PEI_FILE_HANDLE FileHandle
,
708 IN UINT32 AuthenticationStatus
713 Gets the pointer to the HOB List.
716 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
717 @param HobList Pointer to the HOB List.
719 @retval EFI_SUCCESS Get the pointer of HOB List
720 @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
721 @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
727 IN CONST EFI_PEI_SERVICES
**PeiServices
,
728 IN OUT VOID
**HobList
732 Add a new HOB to the HOB List.
734 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
735 @param Type Type of the new HOB.
736 @param Length Length of the new HOB to allocate.
737 @param Hob Pointer to the new HOB.
739 @return EFI_SUCCESS Success to create hob.
740 @retval EFI_INVALID_PARAMETER if Hob is NULL
741 @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
742 @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
748 IN CONST EFI_PEI_SERVICES
**PeiServices
,
756 Builds a Handoff Information Table HOB
758 @param BootMode - Current Bootmode
759 @param MemoryBegin - Start Memory Address.
760 @param MemoryLength - Length of Memory.
762 @return EFI_SUCCESS Always success to initialize HOB.
766 PeiCoreBuildHobHandoffInfoTable (
767 IN EFI_BOOT_MODE BootMode
,
768 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
769 IN UINT64 MemoryLength
773 Install SEC HOB data to the HOB List.
775 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
776 @param SecHobList Pointer to SEC HOB List.
778 @return EFI_SUCCESS Success to install SEC HOB data.
779 @retval EFI_OUT_OF_RESOURCES If there is no more memory to grow the Hoblist.
783 PeiInstallSecHobData (
784 IN CONST EFI_PEI_SERVICES
**PeiServices
,
785 IN EFI_HOB_GENERIC_HEADER
*SecHobList
790 // FFS Fw Volume support functions
793 Searches for the next matching file in the firmware volume.
795 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
796 @param SearchType Filter to find only files of this type.
797 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
798 @param FvHandle Handle of firmware volume in which to search.
799 @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
800 at the beginning of the firmware volume. On exit, points the file handle of the next file
801 in the volume or NULL if there are no more files.
803 @retval EFI_NOT_FOUND The file was not found.
804 @retval EFI_NOT_FOUND The header checksum was not zero.
805 @retval EFI_SUCCESS The file was found.
811 IN CONST EFI_PEI_SERVICES
**PeiServices
,
813 IN EFI_PEI_FV_HANDLE FvHandle
,
814 IN OUT EFI_PEI_FILE_HANDLE
*FileHandle
818 Searches for the next matching section within the specified file.
820 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
821 @param SectionType Filter to find only sections of this type.
822 @param FileHandle Pointer to the current file to search.
823 @param SectionData A pointer to the discovered section, if successful.
824 NULL if section not found
826 @retval EFI_NOT_FOUND The section was not found.
827 @retval EFI_SUCCESS The section was found.
832 PeiFfsFindSectionData (
833 IN CONST EFI_PEI_SERVICES
**PeiServices
,
834 IN EFI_SECTION_TYPE SectionType
,
835 IN EFI_PEI_FILE_HANDLE FileHandle
,
836 OUT VOID
**SectionData
840 Searches for the next matching section within the specified file.
842 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
843 @param SectionType The value of the section type to find.
844 @param SectionInstance Section instance to find.
845 @param FileHandle Handle of the firmware file to search.
846 @param SectionData A pointer to the discovered section, if successful.
847 @param AuthenticationStatus A pointer to the authentication status for this section.
849 @retval EFI_SUCCESS The section was found.
850 @retval EFI_NOT_FOUND The section was not found.
855 PeiFfsFindSectionData3 (
856 IN CONST EFI_PEI_SERVICES
**PeiServices
,
857 IN EFI_SECTION_TYPE SectionType
,
858 IN UINTN SectionInstance
,
859 IN EFI_PEI_FILE_HANDLE FileHandle
,
860 OUT VOID
**SectionData
,
861 OUT UINT32
*AuthenticationStatus
865 Search the firmware volumes by index
867 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
868 @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
870 @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
872 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL
873 @retval EFI_NOT_FOUND The volume was not found.
874 @retval EFI_SUCCESS The volume was found.
879 PeiFfsFindNextVolume (
880 IN CONST EFI_PEI_SERVICES
**PeiServices
,
882 IN OUT EFI_PEI_FV_HANDLE
*VolumeHandle
886 // Memory support functions
890 Initialize the memory services.
892 @param PrivateData PeiCore's private data structure
893 @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
894 and location of temporary RAM, the stack location and the BFV location.
895 @param OldCoreData Pointer to the PEI Core data.
896 NULL if being run in non-permament memory mode.
900 InitializeMemoryServices (
901 IN PEI_CORE_INSTANCE
*PrivateData
,
902 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
903 IN PEI_CORE_INSTANCE
*OldCoreData
908 Install the permanent memory is now available.
909 Creates HOB (PHIT and Stack).
911 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
912 @param MemoryBegin Start of memory address.
913 @param MemoryLength Length of memory.
915 @return EFI_SUCCESS Always success.
920 PeiInstallPeiMemory (
921 IN CONST EFI_PEI_SERVICES
**PeiServices
,
922 IN EFI_PHYSICAL_ADDRESS MemoryBegin
,
923 IN UINT64 MemoryLength
927 Migrate memory pages allocated in pre-memory phase.
928 Copy memory pages at temporary heap top to permanent heap top.
930 @param[in] Private Pointer to the private data passed in from caller.
931 @param[in] TemporaryRamMigrated Temporary memory has been migrated to permanent memory.
936 IN PEI_CORE_INSTANCE
*Private
,
937 IN BOOLEAN TemporaryRamMigrated
941 Migrate MemoryBaseAddress in memory allocation HOBs
942 from the temporary memory to PEI installed memory.
944 @param[in] PrivateData Pointer to PeiCore's private data structure.
948 ConvertMemoryAllocationHobs (
949 IN PEI_CORE_INSTANCE
*PrivateData
953 The purpose of the service is to publish an interface that allows
954 PEIMs to allocate memory ranges that are managed by the PEI Foundation.
956 Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.
957 After InstallPeiMemory() is called, PEI will allocate pages within the region
958 of memory provided by InstallPeiMemory() service in a best-effort fashion.
959 Location-specific allocations are not managed by the PEI foundation code.
961 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
962 @param MemoryType The type of memory to allocate.
963 @param Pages The number of contiguous 4 KB pages to allocate.
964 @param Memory Pointer to a physical address. On output, the address is set to the base
965 of the page range that was allocated.
967 @retval EFI_SUCCESS The memory range was successfully allocated.
968 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
969 @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode,
970 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,
971 EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.
977 IN CONST EFI_PEI_SERVICES
**PeiServices
,
978 IN EFI_MEMORY_TYPE MemoryType
,
980 OUT EFI_PHYSICAL_ADDRESS
*Memory
986 @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
987 @param[in] Memory The base physical address of the pages to be freed.
988 @param[in] Pages The number of contiguous 4 KB pages to free.
990 @retval EFI_SUCCESS The requested pages were freed.
991 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
992 @retval EFI_NOT_FOUND The requested memory pages were not allocated with
999 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1000 IN EFI_PHYSICAL_ADDRESS Memory
,
1006 Memory allocation service on the temporary memory.
1009 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1010 @param Size Amount of memory required
1011 @param Buffer Address of pointer to the buffer
1013 @retval EFI_SUCCESS The allocation was successful
1014 @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
1015 to allocate the requested size.
1021 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1028 Routine for load image file.
1031 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1032 @param FileHandle Pointer to the FFS file header of the image.
1033 @param PeimState The dispatch state of the input PEIM handle.
1034 @param EntryPoint Pointer to entry point of specified image file for output.
1035 @param AuthenticationState Pointer to attestation authentication state of image.
1037 @retval EFI_SUCCESS Image is successfully loaded.
1038 @retval EFI_NOT_FOUND Fail to locate necessary PPI
1039 @retval Others Fail to load file.
1044 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1045 IN EFI_PEI_FILE_HANDLE FileHandle
,
1047 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1048 OUT UINT32
*AuthenticationState
1053 Core version of the Status Code reporter
1056 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1057 @param CodeType Type of Status Code.
1058 @param Value Value to output for Status Code.
1059 @param Instance Instance Number of this status code.
1060 @param CallerId ID of the caller of this status code.
1061 @param Data Optional data associated with this status code.
1063 @retval EFI_SUCCESS if status code is successfully reported
1064 @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
1069 PeiReportStatusCode (
1070 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1071 IN EFI_STATUS_CODE_TYPE CodeType
,
1072 IN EFI_STATUS_CODE_VALUE Value
,
1074 IN CONST EFI_GUID
*CallerId
,
1075 IN CONST EFI_STATUS_CODE_DATA
*Data OPTIONAL
1080 Core version of the Reset System
1083 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1085 @retval EFI_NOT_AVAILABLE_YET PPI not available yet.
1086 @retval EFI_DEVICE_ERROR Did not reset system.
1087 Otherwise, resets the system.
1093 IN CONST EFI_PEI_SERVICES
**PeiServices
1097 Resets the entire platform.
1099 @param[in] ResetType The type of reset to perform.
1100 @param[in] ResetStatus The status code for the reset.
1101 @param[in] DataSize The size, in bytes, of ResetData.
1102 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown
1103 the data buffer starts with a Null-terminated string, optionally
1104 followed by additional binary data. The string is a description
1105 that the caller may use to further indicate the reason for the
1106 system reset. ResetData is only valid if ResetStatus is something
1107 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific
1108 where a minimum amount of ResetData is always required.
1114 IN EFI_RESET_TYPE ResetType
,
1115 IN EFI_STATUS ResetStatus
,
1117 IN VOID
*ResetData OPTIONAL
1122 Initialize PeiCore Fv List.
1125 @param PrivateData - Pointer to PEI_CORE_INSTANCE.
1126 @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
1131 IN PEI_CORE_INSTANCE
*PrivateData
,
1132 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
1136 Process Firmware Volum Information once FvInfoPPI install.
1138 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1139 @param NotifyDescriptor Address of the notification descriptor data structure.
1140 @param Ppi Address of the PPI that was installed.
1142 @retval EFI_SUCCESS if the interface could be successfully installed
1147 FirmwareVolmeInfoPpiNotifyCallback (
1148 IN EFI_PEI_SERVICES
**PeiServices
,
1149 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1155 Given the input VolumeHandle, search for the next matching name file.
1157 @param FileName File name to search.
1158 @param VolumeHandle The current FV to search.
1159 @param FileHandle Pointer to the file matching name in VolumeHandle.
1160 NULL if file not found
1162 @retval EFI_NOT_FOUND No files matching the search criteria were found
1163 @retval EFI_SUCCESS Success to search given file
1168 PeiFfsFindFileByName (
1169 IN CONST EFI_GUID
*FileName
,
1170 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1171 OUT EFI_PEI_FILE_HANDLE
*FileHandle
1175 Returns information about a specific file.
1177 @param FileHandle Handle of the file.
1178 @param FileInfo Upon exit, points to the file's information.
1180 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1181 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1182 @retval EFI_SUCCESS File information returned.
1188 IN EFI_PEI_FILE_HANDLE FileHandle
,
1189 OUT EFI_FV_FILE_INFO
*FileInfo
1193 Returns information about a specific file.
1195 @param FileHandle Handle of the file.
1196 @param FileInfo Upon exit, points to the file's information.
1198 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.
1199 @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
1200 @retval EFI_SUCCESS File information returned.
1205 PeiFfsGetFileInfo2 (
1206 IN EFI_PEI_FILE_HANDLE FileHandle
,
1207 OUT EFI_FV_FILE_INFO2
*FileInfo
1211 Returns information about the specified volume.
1213 @param VolumeHandle Handle of the volume.
1214 @param VolumeInfo Upon exit, points to the volume's information.
1216 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
1217 @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
1218 @retval EFI_SUCCESS Volume information returned.
1222 PeiFfsGetVolumeInfo (
1223 IN EFI_PEI_FV_HANDLE VolumeHandle
,
1224 OUT EFI_FV_INFO
*VolumeInfo
1228 This routine enable a PEIM to register itself to shadow when PEI Foundation
1229 discovery permanent memory.
1231 @param FileHandle File handle of a PEIM.
1233 @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
1234 @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
1235 @retval EFI_SUCCESS Successfully to register itself.
1240 PeiRegisterForShadow (
1241 IN EFI_PEI_FILE_HANDLE FileHandle
1245 Initialize image service that install PeiLoadFilePpi.
1247 @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
1248 @param OldCoreData Pointer to Old PeiCore's private data.
1249 If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
1250 If not NULL, PeiCore is entered at second time, stack/heap has been moved
1251 to permanent memory.
1255 InitializeImageServices (
1256 IN PEI_CORE_INSTANCE
*PrivateData
,
1257 IN PEI_CORE_INSTANCE
*OldCoreData
1261 The wrapper function of PeiLoadImageLoadImage().
1263 @param This Pointer to EFI_PEI_LOAD_FILE_PPI.
1264 @param FileHandle Pointer to the FFS file header of the image.
1265 @param ImageAddressArg Pointer to PE/TE image.
1266 @param ImageSizeArg Size of PE/TE image.
1267 @param EntryPoint Pointer to entry point of specified image file for output.
1268 @param AuthenticationState Pointer to attestation authentication state of image.
1270 @return Status of PeiLoadImageLoadImage().
1275 PeiLoadImageLoadImageWrapper (
1276 IN CONST EFI_PEI_LOAD_FILE_PPI
*This
,
1277 IN EFI_PEI_FILE_HANDLE FileHandle
,
1278 OUT EFI_PHYSICAL_ADDRESS
*ImageAddressArg
, OPTIONAL
1279 OUT UINT64
*ImageSizeArg
, OPTIONAL
1280 OUT EFI_PHYSICAL_ADDRESS
*EntryPoint
,
1281 OUT UINT32
*AuthenticationState
1286 Provide a callback for when the security PPI is installed.
1288 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
1289 @param NotifyDescriptor The descriptor for the notification event.
1290 @param Ppi Pointer to the PPI in question.
1292 @return Always success
1297 SecurityPpiNotifyCallback (
1298 IN EFI_PEI_SERVICES
**PeiServices
,
1299 IN EFI_PEI_NOTIFY_DESCRIPTOR
*NotifyDescriptor
,
1304 Get Fv image(s) from the FV type file, then install FV INFO(2) ppi, Build FV(2, 3) hob.
1306 @param PrivateData PeiCore's private data structure
1307 @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
1308 @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
1310 @retval EFI_NOT_FOUND FV image can't be found.
1311 @retval EFI_SUCCESS Successfully to process it.
1312 @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
1313 @retval EFI_SECURITY_VIOLATION Image is illegal
1314 @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
1319 IN PEI_CORE_INSTANCE
*PrivateData
,
1320 IN PEI_CORE_FV_HANDLE
*ParentFvCoreHandle
,
1321 IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
1325 Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
1327 This routine also will install FvInfo ppi for FV hob in PI ways.
1329 @param Private Pointer of PEI_CORE_INSTANCE
1330 @param Instance The index of FV want to be searched.
1332 @return Instance of PEI_CORE_FV_HANDLE.
1334 PEI_CORE_FV_HANDLE
*
1335 FindNextCoreFvHandle (
1336 IN PEI_CORE_INSTANCE
*Private
,
1341 // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1345 Memory-based read services.
1347 This function is to perform the Memory Access Read service based on installed
1348 instance of the EFI_PEI_CPU_IO_PPI.
1349 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1350 return EFI_NOT_YET_AVAILABLE.
1352 @param PeiServices An indirect pointer to the PEI Services Table
1353 published by the PEI Foundation.
1354 @param This Pointer to local data for the interface.
1355 @param Width The width of the access. Enumerated in bytes.
1356 @param Address The physical address of the access.
1357 @param Count The number of accesses to perform.
1358 @param Buffer A pointer to the buffer of data.
1360 @retval EFI_SUCCESS The function completed successfully.
1361 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1366 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1367 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1368 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1375 Memory-based write services.
1377 This function is to perform the Memory Access Write service based on installed
1378 instance of the EFI_PEI_CPU_IO_PPI.
1379 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1380 return EFI_NOT_YET_AVAILABLE.
1382 @param PeiServices An indirect pointer to the PEI Services Table
1383 published by the PEI Foundation.
1384 @param This Pointer to local data for the interface.
1385 @param Width The width of the access. Enumerated in bytes.
1386 @param Address The physical address of the access.
1387 @param Count The number of accesses to perform.
1388 @param Buffer A pointer to the buffer of data.
1390 @retval EFI_SUCCESS The function completed successfully.
1391 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1395 PeiDefaultMemWrite (
1396 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1397 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1398 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1405 IO-based read services.
1407 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
1408 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1409 return EFI_NOT_YET_AVAILABLE.
1411 @param PeiServices An indirect pointer to the PEI Services Table
1412 published by the PEI Foundation.
1413 @param This Pointer to local data for the interface.
1414 @param Width The width of the access. Enumerated in bytes.
1415 @param Address The physical address of the access.
1416 @param Count The number of accesses to perform.
1417 @param Buffer A pointer to the buffer of data.
1419 @retval EFI_SUCCESS The function completed successfully.
1420 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1425 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1426 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1427 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1434 IO-based write services.
1436 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
1437 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1438 return EFI_NOT_YET_AVAILABLE.
1440 @param PeiServices An indirect pointer to the PEI Services Table
1441 published by the PEI Foundation.
1442 @param This Pointer to local data for the interface.
1443 @param Width The width of the access. Enumerated in bytes.
1444 @param Address The physical address of the access.
1445 @param Count The number of accesses to perform.
1446 @param Buffer A pointer to the buffer of data.
1448 @retval EFI_SUCCESS The function completed successfully.
1449 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
1454 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1455 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1456 IN EFI_PEI_CPU_IO_PPI_WIDTH Width
,
1463 8-bit I/O read operations.
1465 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1468 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1469 @param This Pointer to local data for the interface.
1470 @param Address The physical address of the access.
1472 @return An 8-bit value returned from the I/O space.
1477 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1478 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1483 Reads an 16-bit I/O port.
1485 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1488 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1489 @param This Pointer to local data for the interface.
1490 @param Address The physical address of the access.
1492 @return A 16-bit value returned from the I/O space.
1496 PeiDefaultIoRead16 (
1497 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1498 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1503 Reads an 32-bit I/O port.
1505 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1508 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1509 @param This Pointer to local data for the interface.
1510 @param Address The physical address of the access.
1512 @return A 32-bit value returned from the I/O space.
1516 PeiDefaultIoRead32 (
1517 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1518 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1523 Reads an 64-bit I/O port.
1525 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1528 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1529 @param This Pointer to local data for the interface.
1530 @param Address The physical address of the access.
1532 @return A 64-bit value returned from the I/O space.
1536 PeiDefaultIoRead64 (
1537 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1538 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1543 8-bit I/O write operations.
1545 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1546 @param This Pointer to local data for the interface.
1547 @param Address The physical address of the access.
1548 @param Data The data to write.
1552 PeiDefaultIoWrite8 (
1553 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1554 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1560 16-bit I/O write operations.
1562 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1563 @param This Pointer to local data for the interface.
1564 @param Address The physical address of the access.
1565 @param Data The data to write.
1569 PeiDefaultIoWrite16 (
1570 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1571 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1577 32-bit I/O write operations.
1579 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1580 @param This Pointer to local data for the interface.
1581 @param Address The physical address of the access.
1582 @param Data The data to write.
1586 PeiDefaultIoWrite32 (
1587 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1588 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1594 64-bit I/O write operations.
1596 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1597 @param This Pointer to local data for the interface.
1598 @param Address The physical address of the access.
1599 @param Data The data to write.
1603 PeiDefaultIoWrite64 (
1604 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1605 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1611 8-bit memory read operations.
1613 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1616 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1617 @param This Pointer to local data for the interface.
1618 @param Address The physical address of the access.
1620 @return An 8-bit value returned from the memory space.
1625 PeiDefaultMemRead8 (
1626 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1627 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1632 16-bit memory read operations.
1634 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1637 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1638 @param This Pointer to local data for the interface.
1639 @param Address The physical address of the access.
1641 @return An 16-bit value returned from the memory space.
1646 PeiDefaultMemRead16 (
1647 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1648 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1653 32-bit memory read operations.
1655 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1658 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1659 @param This Pointer to local data for the interface.
1660 @param Address The physical address of the access.
1662 @return An 32-bit value returned from the memory space.
1667 PeiDefaultMemRead32 (
1668 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1669 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1674 64-bit memory read operations.
1676 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
1679 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1680 @param This Pointer to local data for the interface.
1681 @param Address The physical address of the access.
1683 @return An 64-bit value returned from the memory space.
1688 PeiDefaultMemRead64 (
1689 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1690 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1695 8-bit memory write operations.
1697 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1698 @param This Pointer to local data for the interface.
1699 @param Address The physical address of the access.
1700 @param Data The data to write.
1705 PeiDefaultMemWrite8 (
1706 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1707 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1713 16-bit memory write operations.
1715 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1716 @param This Pointer to local data for the interface.
1717 @param Address The physical address of the access.
1718 @param Data The data to write.
1723 PeiDefaultMemWrite16 (
1724 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1725 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1731 32-bit memory write operations.
1733 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1734 @param This Pointer to local data for the interface.
1735 @param Address The physical address of the access.
1736 @param Data The data to write.
1741 PeiDefaultMemWrite32 (
1742 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1743 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1749 64-bit memory write operations.
1751 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1752 @param This Pointer to local data for the interface.
1753 @param Address The physical address of the access.
1754 @param Data The data to write.
1759 PeiDefaultMemWrite64 (
1760 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1761 IN CONST EFI_PEI_CPU_IO_PPI
*This
,
1766 extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi
;
1769 // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
1773 Reads from a given location in the PCI configuration space.
1775 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1776 return EFI_NOT_YET_AVAILABLE.
1778 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1779 @param This Pointer to local data for the interface.
1780 @param Width The width of the access. Enumerated in bytes.
1781 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1782 @param Address The physical address of the access. The format of
1783 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1784 @param Buffer A pointer to the buffer of data.
1786 @retval EFI_SUCCESS The function completed successfully.
1787 @retval EFI_INVALID_PARAMETER The invalid access width.
1788 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1793 PeiDefaultPciCfg2Read (
1794 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1795 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1796 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1802 Write to a given location in the PCI configuration space.
1804 If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
1805 return EFI_NOT_YET_AVAILABLE.
1807 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
1808 @param This Pointer to local data for the interface.
1809 @param Width The width of the access. Enumerated in bytes.
1810 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
1811 @param Address The physical address of the access. The format of
1812 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
1813 @param Buffer A pointer to the buffer of data.
1815 @retval EFI_SUCCESS The function completed successfully.
1816 @retval EFI_INVALID_PARAMETER The invalid access width.
1817 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1821 PeiDefaultPciCfg2Write (
1822 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1823 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1824 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1830 This function performs a read-modify-write operation on the contents from a given
1831 location in the PCI configuration space.
1833 @param PeiServices An indirect pointer to the PEI Services Table
1834 published by the PEI Foundation.
1835 @param This Pointer to local data for the interface.
1836 @param Width The width of the access. Enumerated in bytes. Type
1837 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
1838 @param Address The physical address of the access.
1839 @param SetBits Points to value to bitwise-OR with the read configuration value.
1840 The size of the value is determined by Width.
1841 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
1842 The size of the value is determined by Width.
1844 @retval EFI_SUCCESS The function completed successfully.
1845 @retval EFI_INVALID_PARAMETER The invalid access width.
1846 @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
1850 PeiDefaultPciCfg2Modify (
1851 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1852 IN CONST EFI_PEI_PCI_CFG2_PPI
*This
,
1853 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
1859 extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi
;
1862 After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
1863 be re-installed with the instance in permanent memory and all cached FvPpi pointers in
1864 PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
1867 @param PrivateData Pointer to PEI_CORE_INSTANCE.
1871 IN PEI_CORE_INSTANCE
*PrivateData