3. PEI Services Table
3.1. Introduction
The PEI Foundation establishes a system table named the PEI Services Table that is visible to all Pre-EFI Initialization Modules (PEIMs) in the system. A PEI Service is defined as a function, command, or other capability manifested by the PEI Foundation when that service’s initialization requirements are met. Because the PEI phase has no permanent memory available until nearly the end of the phase, the range of services created during the PEI phase cannot be as rich as those created during later phases. Because the location of the PEI Foundation and its temporary RAM is not known at build time, a pointer to the PEI Services Table is passed into each PEIM’s entry point and also to part of each PEIM-to-PEIM Interface (PPI).
Note: In the PEI Foundation use of the EFI_TABLE_HEADER for the PEI Services Table, there is special treatment of the CRC32 field. This value is ignorable for PEI and should be set to zero.
3.2. PEI Services Table
3.2.1. EFI_PEI_SERVICES
3.2.1.1. Summary
The PEI Services Table includes a list of function pointers in a table. The table is located in the temporary or permanent memory, depending upon the capabilities and phase of execution of PEI. The functions in this table are defined in PEI Services.
3.2.1.3. Parameters
HdrThe table header for the PEI Services Table. This header contains the
PEI_SERVICES_SIGNATUREandPEI_SERVICES_REVISIONvalues along with the size of theEFI_PEI_SERVICESstructure and a 32-bit CRC to verify that the contents of the PEI Foundation Services Table are valid.InstallPpiInstalls an interface in the PEI PEIM-to-PEIM Interface (PPI) database by GUID. See the
InstallPpi()function description in this document.
ReInstallPpiReinstalls an interface in the PEI PPI database by GUID. See the
ReinstallPpi()function description in this document.
LocatePpiLocates an interface in the PEI PPI database by GUID. See the
LocatePpi()function description in this document.
NotifyPpiInstalls the notification service to be called back upon the installation or reinstallation of a given interface. See the
NotifyPpi()function description in this document.
GetBootModeReturns the present value of the boot mode. See the
GetBootMode()function description in this document.
SetBootModeSets the value of the boot mode. See the
SetBootMode()function description in this document.
GetHobListReturns the pointer to the list of Hand-Off Blocks (HOBs) in memory. See the
GetHobList()function description in this document.
CreateHobAbstracts the creation of HOB headers. See the
CreateHob()function description in this document.
FfsFindNextVolumeDiscovers instances of firmware volumes in the system. See the
FfsFindNextVolume()function description in this document.
FfsFindNextFileDiscovers instances of firmware files in the system. See the
FfsFindNextFile()function description in this document.
FfsFindSectionDataSearches for a section in a firmware file. See the
FfsFindSectionData()function description in this document.
InstallPeiMemoryRegisters the found memory configuration with the PEI Foundation. See the
InstallPeiMemory()function description in this document.
AllocatePagesAllocates memory ranges that are managed by the PEI Foundation. See the
AllocatePages()function description in this document.AllocatePoolAllocates memory ranges that are managed by the PEI Foundation. See the AllocatePool() function description in this document.
CopyMemCopies the contents of one buffer to another buffer. See the
CopyMem()function description in this document.
SetMemFills a buffer with a specified value. See the
SetMem()function description in this document.
ReportStatusCodeProvides an interface that a PEIM can call to report a status code. See the
ReportStatusCode()function description in this document. This is installed by provider PEIM by copying the interface into the PEI Service table.
ResetSystemResets the entire platform. See the
ResetSystem()function description in this document. This is installed by provider PEIM by copying the interface into the PEI Service table.
ResetSystem2Resets the entire platform. See the
ResetSystem2()function description in this document. This is installed by provider PEIM by copying the interface into the PEI Service table.
CpuIoProvides an interface that a PEIM can call to execute an I/O transaction. This interface is installed by provider PEIM by copying the interface into the PEI Service table.
PciCfgProvides an interface that a PEIM can call to execute PCI Configuration transactions. This interface is installed by provider PEIM by copying the interface into the
EFI_PEI_SERVICEStable.
FfsFindFileByNameDiscovers firmware files within a volume by name. See
FfsFindFileByName()in this document.
FfsGetFileInfoReturn information about a particular file. See
FfsGetFileInfo()in this document.
FfsGetFileInfo2Return information about a particular file. See
FfsGetFileInfo2()in this document.
FfsGetVolumeInfoReturn information about a particular volume. See
FfsGetVolumeInfo()in this document.
RegisterForShadowRegister a driver to be re-loaded when memory is available. See
RegisterForShadow()in this document.
FindSectionData3Searches for a section in a firmware file. See the
FfsFindSectionData3()function description in this document.
FreePagesReleases memory previously allocated using
AllocatePages().
3.2.1.4. Description
EFI_PEI_SERVICES is a collection of functions whose
implementation is provided by the PEI Foundation. These
services fall into various classes, including the following:
Managing the boot mode
Allocating both early and permanent memory
Supporting the Firmware File System (FFS)
Abstracting the PPI database abstraction
Creating Hand-Off Blocks (HOBs)
A pointer to the EFI_PEI_SERVICES table is passed into
each PEIM when the PEIM is invoked by the PEI Foundation. As
such, every PEIM has access to these services. Unlike the
UEFI Boot Services, the PEI Services have no calling
restrictions, such as the UEFI 2.0 Task Priority Level (TPL)
limitations. Specifically, a service can be called from a
PEIM or notification service.
Some of the services are also a proxy to platform-provided
services, such as the Reset Services, Status Code Services,
and I/O abstractions. This partitioning has been designed to
provide a consistent interface to all PEIMs without
encumbering a PEI Foundation implementation with
platform-specific knowledge. Any callable services beyond
the set in this table should be invoked using a PPI. The
latter PEIM-installed services will return
EFI_NOT_AVAILABLE_YET until a PEIM copies an instance of
the interface into the EFI_PEI_SERVICES table.