EFI PEI SERVICES

From PhoenixWiki

Jump to: navigation, search

The PEI Services Table includes a list of function pointers in a table. The table is located in the ROM or memory, depending upon the capabilities and phase of execution of PEI.

Contents

Prototype

typedef struct _EFI_PEI_SERVICES {
  EFI_TABLE_HEADER               Hdr;
  EFI_PEI_INSTALL_PPI            InstallPpi;
  EFI_PEI_REINSTALL_PPI          ReInstallPpi;
  EFI_PEI_LOCATE_PPI             LocatePpi;
  EFI_PEI_NOTIFY_PPI             NotifyPpi;
  EFI_PEI_GET_BOOT_MODE          GetBootMode;
  EFI_PEI_SET_BOOT_MODE          SetBootMode;
  EFI_PEI_GET_HOB_LIST           GetHobList;
  EFI_PEI_CREATE_HOB             CreateHob;
  EFI_PEI_FFS_FIND_NEXT_VOLUME   FfsFindNextVolume;
  EFI_PEI_FFS_FIND_NEXT_FILE     FfsFindNextFile;
  EFI_PEI_FFS_FIND_SECTION_DATA  FfsFindSectionData;
  EFI_PEI_INSTALL_PEI_MEMORY     InstallPeiMemory;
  EFI_PEI_ALLOCATE_PAGES         AllocatePages;
  EFI_PEI_ALLOCATE_POOL          AllocatePool;
  EFI_PEI_COPY_MEM               CopyMem;
  EFI_PEI_SET_MEM                CopyMem;
  EFI_PEI_REPORT_STATUS_CODE     CopyMem;
  EFI_PEI_RESET_SYSTEM           ResetSystem;
  EFI_PEI_CPU_IO_PPI             CpuIo;
  EFI_PEI_PCI_CFG_PPI            PciCfg;
} EFI_PEI_SERVICES;

Members

Member Description
Hdr The table header for the PEI Services Table. This header contains the PEI_SERVICES_SIGNATURE and PEI_SERVICES_REVISION values along with the size of the EFI_PEI_SERVICES structure and a 32-bit CRC to verify that the contents of the PEI Foundation Services Table are valid.
InstallPpi Installs an interface in the PEI PEIM-to-PEIM Interface (PPI) database by GUID.
ReInstallPpi Reinstalls an interface in the PEI PPI database by GUID.
LocatePpi Locates an interface in the PEI PPI database by GUID.
NotifyPpi Installs the notification service to be called back upon the installation or reinstallation of a given interface.
GetBootMode Returns the present value of the boot mode.
SetBootMode Sets the value of the boot mode.
GetHobList Returns the pointer to the list of Hand-Off Blocks (HOBs) in memory.
CreateHob Abstracts the creation of HOB headers.
FfsFindNextVolume Discovers instances of firmware volumes in the system.
FfsFindNextFile Discovers instances of firmware files in the system.
FfsFindSectionData Searches for the next matching file in the Firmware File System (FFS) volume.
InstallPeiMemory Registers the found memory configuration with the PEI Foundation.
AllocatePages Allocates memory ranges that are managed by the PEI Foundation.
AllocatePool Frees memory ranges that are managed by the PEI Foundation.
CopyMem Copies the contents of one buffer to another buffer.
SetMem Fills a buffer with a specified value.
ReportStatusCode Provides an interface that a PEIM can call to report a status code. This service is installed by an architectural PEI driver by copying the interface pointer into this table.
ResetSystem Resets the entire platform. This service is installed by an architectural PEI driver by copying the interface pointer into this table.
CpuIO Provides an interface that a PEIM can call to execute an I/O transaction. This service is installed by an architectural PEI driver by copying the interface pointer into this table.
PciCfg Provides an interface that a PEIM can call to execute PCI Configuration transactions. This service is installed by an architectural PEI driver by copying the interface pointer into this table.

Description

The 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 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. The latter PEIM-installed services will return EFI_NOT_AVAILABLE_YET until an architectural PEIM has installed an interface pointer into this table.

Any callable services beyond the set in this table should be invoked using a PPI.

NOTE: This is the pre-PI 1.0 definition.

InstallPpi()

This service is the first one provided by the PEI Foundation. This function installs an interface in the PEI PPI database by GUID. The purpose of the service is to publish an interface that other parties can use to call additional PEIMs.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_INSTALL_PPI) (
  IN struct _EFI_PEI_SERVICES **PeiServices,
  IN EFI_PEI_PPI_DESCRIPTOR   *PpiList
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
PpiList A pointer to the list of interfaces that the caller shall install.

Description
This service enables a given PEIM to register an interface into the PEI Foundation. The interface takes a pointer to a list of records that adhere to the format of a EFI_PEI_PPI_DESCRIPTOR. The list is embedded into the image of a PEIM. The length of the list of described by the EFI_PEI_PPI_DESCRIPTOR that has the EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST flag set in its Flags field. There shall be at least one EFI_PEI_PPI_DESCRIPTOR in the list.

There are two types of EFI_PEI_PPI_DESCRIPTORs that can be installed, including the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH and EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK.

Status Codes Returned

Status Code Description
EFI_SUCCESS The interface was successfully installed.
EFI_INVALID_PARAMETER The PpiList pointer is NULL.
EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.

ReinstallPpi()

This function reinstalls an interface in the PEI PPI database by GUID. The purpose of the service is to publish an interface that other parties can use to replace a same-named interface in the protocol database with a different interface.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_REINSTALL_PPI) (
  IN struct _EFI_PEI_SERVICES **PeiServices,
  IN EFI_PEI_PPI_DESCRIPTOR   *OldPpi,
  IN EFI_PEI_PPI_DESCRIPTOR   *NewPpi
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
OldPpi A pointer to the former PPI in the database.
NewPpi A pointer to the new interfaces that the caller shall install.

Description
This service enables PEIMs to replace an entry in the PPI database with an alternate entry. This service is similar to the UEFI ReinstallProtocolInterface(). The use of this service is similar inasmuch as a PEIM might wish to multiplex several services that are already installed, such as a console splitter.

ReinstallPpi() will only reinstall a single PPI instance. EFI_PEI_PPI_DESCRIPTORs can be concatenated to install a series of PPIs.

Status Codes Returned

Status Code Description
EFI_SUCCESS The interface was successfully installed.
EFI_INVALID_PARAMETER The PpiList pointer is NULL.
EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been installed.

LocatePpi()

This function locates an interface in the PEI PPI database by GUID.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_LOCATE_PPI) (
  IN     struct _EFI_PEI_SERVICES **PeiServices,
  IN     EFI_GUID                 *Guid,
  IN     UINTN                    Instance,
  IN OUT EFI_PEI_PPI_DESCRIPTOR   **PpiDescriptor,
  IN OUT VOID                      **Ppi
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES published by the PEI Foundation.
Guid A pointer to the GUID whose corresponding interface needs to be found.
Instance The N-th instance of the interface that is required.
PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
Ppi A pointer to the instance of the interface.

Description
This service enables PEIMs to discover a given instance of an interface. This interface differs from the interface discovery mechanism in the UEFI Specification, namely HandleProtocol(), in that the PEI PPI database does not expose the handle's name space. Instead, PEI manages the interface set by maintaining a partial order on the interfaces such that the Instance of the interface, among others, can be traversed.

LocatePpi() provides the ability to traverse all of the installed instances of a given GUIDnamed PPI. For example, there can be multiple instances of a PPI named Foo in the PPI database. An Instance value of 0 will provide the first instance of the PPI that is installed.

Correspondingly, an Instance value of 2 will provide the second, 3 the third, and so on. The Instance value designates when a PPI was installed. For an implementation that must reference all possible manifestations of a given GUID-named PPI, the code should invoke LocatePpi() with a monotonically increasing Instance number until EFI_NOT_FOUND is returned.

Status Codes Returned

Status Code Description
EFI_SUCCESS The interface was successfully returned.
EFI_NOT_FOUND The PPI descriptor is not found in the database.


NotifyPpi()

This function installs a notification service to be called back when a given interface is installed or reinstalled. The purpose of the service is to publish an interface that other parties can use to call additional PPIs that may materialize later.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_NOTIFY_PPI) (
  IN struct _EFI_PEI_SERVICES  **PeiServices,
  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
NotifyList A pointer to the list of notification interfaces that the caller shall install.

Description
This service enables PEIMs to register a given service to be invoked when another service is installed or reinstalled. This service is similar to the UEFI RegisterProtocolNotify().

The semantics of this event are slightly different than that of UEFI in that the callback is only invoked one time per installation of the notify service.

In addition, the PPI pointer is passed back to the agent that registered for the notification so that it can deference private data, if so needed.

Status Codes Returned

Status Code Description
EFI_SUCCESS The interface was successfully installed.
EFI_INVALID_PARAMETER The NotifyList pointer is NULL.
EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.
EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.

GetBootMode()

This function returns the present value of the boot mode.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_GET_BOOT_MODE) (
  IN  struct _EFI_PEI_SERVICES **PeiServices,
  OUT EFI_BOOT_MODE            *BootMode
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
BootMode A pointer to contain the value of the boot mode.

Description
This service enables PEIMs to ascertain the present value of the boot mode.

Status Codes Returned

Status Code Description
EFI_SUCCESS The boot mode was returned successfully.

SetBootMode

This function sets the value of the boot mode.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_SET_BOOT_MODE) (
  IN struct _EFI_PEI_SERVICES **PeiServices,
  IN EFI_BOOT_MODE            BootMode
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
BootMode The value of the boot mode to set.

Description
This service enables PEIMs to update the boot mode variable. This would be used by either the boot mode PPIs described in Architectural PPIs or by a PEIM that needs to engender a recovery condition.

Status Codes Returned

Status Code Description
EFI_SUCCESS The value was successfully updated.

GetHobList()

This function returns the pointer to the list of Hand-Off Blocks (HOBs) in memory.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_GET_HOB_LIST) (
  IN struct _EFI_PEI_SERVICES **PeiServices,
  IN OUT VOID                 **HobList
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
HobList A pointer to the list of HOBs that the PEI Foundation will initialize.

Description
This service enables a PEIM to ascertain the address of the list of HOBs in memory. This service should not be required by many modules in that the creation of HOBs is provided by the PEI Service CreateHob().

Status Codes Returned

Status Code Description
EFI_SUCCESS The list was successfully returned.
EFI_NOT_AVAILABLE_YET The HOB list is not yet published.

CreateHob()

This service published by the PEI Foundation abstracts the creation of a Hand-Off Block's (HOB’s) headers.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_CREATE_HOB) (
  IN     struct _EFI_PEI_SERVICES **PeiServices,
  IN     UINT16                   Type,
  IN     UINT16                   Length,
  IN OUT VOID                     **Hob
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
Type The type of HOB to be installed. The HOB types are described in EFI_HOB_GENERIC_HEADER.
Length The length of the HOB to be added.
Hob A pointer to the pointer to the created HOB header. The created HOB will always start with a EFI_HOB_GENERIC_HEADER.

Description
This service enables PEIMs to create various types of HOBs. This service handles the common work of allocating memory on the HOB list, filling in the type and length fields, and building the end of the HOB list. The final aspect of this service is to return a pointer to the newly allocated HOB. At this point, the caller can fill in the type-specific data. This service is always available because the HOBs can also be created on temporary memory.

There will be no error checking on the Length input argument. Instead, the implementation of this service will round up the allocation size that is specified in the Length field to be a multiple of 8 bytes in length. This rounding is consistent with the requirement that all of the HOBs, including the PHIT HOB, begin on an 8-byte boundary.

Status Codes Returned

Status Code Description
EFI_SUCCESS The HOB was successfully created.
EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.

FfsFindNextVolume()

The purpose of the service is to abstract the capability of the PEI Foundation to discover instances of firmware volumes in the system. Given the input file pointer, this service searches for the next matching file in the Firmware File System (FFS) volume.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_NEXT_VOLUME) (
  IN     struct _EFI_PEI_SERVICES   **PeiServices,
  IN     UINTN                          Instance,
  IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware Volume (BFV).
FwVolHeader Pointer to the firmware volume header of the volume to return.

Description
This service enables PEIMs to discover additional firmware volumes. This capability might be employed by the DXE IPL PPI to discover the DXE Foundation FFS file, for example, or for a PEIM to inspect all available volumes.

The PEI Foundation publishes this service to abstract the location of various firmware volumes. These volumes can include the boot firmware volume and any additional volumes exposed by the [[EFI_FIND_FV_PPI[[ instances, if the latter are available.

Status Codes Returned

Status Code Description
EFI_SUCCESS The volume was found.
EFI_NOT_FOUND The volume was not found.
EFI_INVALID_PARAMETER FwVolHeader is NULL

FfsFindNextFile()

The purpose of the service is to abstract the capability of the PEI Foundation to discover instances of firmware files in the system. Given the input file pointer, this service searches for the next matching file in the Firmware File System (FFS) volume.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_NEXT_FILE) (
  IN     struct _EFI_PEI_SERVICES   **PeiServices,
  IN     EFI_FV_FILETYPE            SearchType,
  IN     EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
  IN OUT EFI_FFS_FILE_HEADER        **FileHeader
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
SearchType A filter to find files only of this type. Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
FwVolHeader Pointer to the firmware volume header of the volume to search. This parameter must point to a valid FFS volume.
FileHeader Pointer to the current file from which to begin searching. This pointer will be updated upon return to reflect the file found.

Description
This service enables PEIMs to discover additional firmware files. This capability might be employed by the DXE IPL PPI to discover the DXE Foundation FFS file, for example. To find the first instance of a firmware file, pass a FileHeader value of NULL into the service.

For integrity checking of the file, only the header checksum is calculated. No other FFS integrity values are checked by this service.

Status Codes Returned

Status Code Description
EFI_SUCCESS The file was found.
EFI_NOT_FOUND The file was not found.
EFI_NOT_FOUND The header checksum was not zero.


FfsFindSectionData()

Given the input file pointer, this service searches for the next matching file in the Firmware File System (FFS) volume.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA) (
  IN     struct _EFI_PEI_SERVICES **PeiServices,
  IN     EFI_SECTION_TYPE         SectionType,
  IN     EFI_FFS_FILE_HEADER      *FfsFileHeader,
  IN OUT VOID                     **SectionData
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
SectionType The value of the section type to find.
FfsFileHeader A pointer to the file header that contains the set of sections to be searched.
SectionData A pointer to the discovered section, if successful.

Description
This service enables PEIMs to discover sections of a given type within a valid FFS file. The semantics of this interface are precise in that there can be only one instance of a given section type within a file, versus FfsFindNextFile(), which needs to be iteratively invoked.

Status Codes Returned

Status Code Description
EFI_SUCCESS The section was found.
EFI_NOT_FOUND The section was not found.

InstallPeiMemory()

This function registers the found memory configuration with the PEI Foundation.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_INSTALL_PEI_MEMORY) (
  IN struct _EFI_PEI_SERVICES **PeiServices,
  IN EFI_PHYSICAL_ADDRESS     MemoryBegin,
  IN UINT64                   MemoryLength
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
MemoryBegin The value of a region of installed memory.
MemoryLength The corresponding length of a region of installed memory.

Description
This service enables PEIMs to register the permanent memory configuration that has been initialized with the PEI Foundation. The result of this call-set is the creation of the appropriate Hand-Off Block (HOB) describing the physical memory.

The usage model is that the PEIM that discovers the permanent memory shall invoke this service.

The memory reported is a single contiguous run. It should be enough to allocate a PEI stack and some HOB list. The full memory map will be reported using the appropriate memory HOBs. The PEI Foundation will follow up with an installation of EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI.

Status Codes Returned

Status Code Description
EFI_SUCCESS The region was successfully installed in a HOB.
EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.

AllocatePages()

The purpose of the service is to publish an interface that allows PEIMs to allocate memory ranges that are managed by the PEI Foundation.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_ALLOCATE_PAGES) (
  IN  struct _EFI_PEI_SERVICES **PeiServices,
  IN  EFI_ALLOCATE_TYPE        Type,
  IN  EFI_MEMORY_TYPE          MemoryType,
  IN  UINTN                    Pages,
  OUT EFI_PHYSICAL_ADDRESS     *Memory,
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
Type The type of allocation to perform.
MemoryType The type of memory to allocate. The only types allowed are EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode, EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData, EfiACPIReclaimMemory, and EfiACPIMemoryNVS. Normal allocations (that is, allocations by any EFI application) are of type EfiLoaderData.
Pages The number of contiguous 4 KB pages to allocate.
Memory Pointer to a physical address. On output, the address is set to the base of the page range that was allocated.

Description
This service enables PEIMs to allocate memory after the permanent memory has been installed by a PEIM. The purpose of this service is to allow more state-ful, later PEIMs to have a single set of memory allocation services upon which to rely. This is especially of interest for services like the recovery PEIMs that might have to allocate large buffers for disk transactions and file system metadata. The memory regions that the memory allocation primitives manage will be described in the appropriate HOB type.

This service is not usable prior to the installation of main memory. There is no free memory. The expectation is that the implementation of this service will automate the creation of the Memory Allocation HOB types. As such, this is in the same spirit as the PEI Services to create the FV HOB, for example.

The service also supports the creation of Memory Allocation HOBs that describe the stack, bootstrap processor (BSP) BSPStore (“Backing Store Pointer Store”), and the DXE Foundation allocation. This additional information is conveyed through the final two arguments in this API and the description of the appropriate HOB types.

Status Codes Returned

Status Code Description
EFI_SUCCESS The memory range was successfully allocated.
EFI_OUT_OF_RESOURCES The pages could not be allocated.
EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.

AllocatePool()

The purpose of this service is to publish an interface that allows PEIMs to allocate memory ranges that are managed by the PEI Foundation.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_ALLOCATE_POOL) (
  IN  struct _EFI_PEI_SERVICES **PeiServices,
  IN  UINTN                    Size,
  OUT VOID                     **Buffer
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
Size The number of bytes to allocate from the pool.
Buffer If the call succeeds, a pointer to a pointer to the allocated buffer; undefined otherwise.

Description
This service allocates memory from the Hand-Off Block (HOB) heap. Because HOBs can be allocated from either temporary or permanent memory, this service is available throughout the entire PEI phase.

This service allocates memory in multiples of eight bytes to maintain the required HOB alignment. The early allocations from temporary memory will be migrated to permanent memory when permanent main memory is installed; this migration shall occur when the HOB list is migrated to permanent memory.

Status Codes Returned

Status Code Description
EFI_SUCCESS The allocation was successful.
EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.

CopyMem()

This service copies the contents of one buffer to another buffer.

Prototype

typedef
VOID
(EFIAPI *EFI_PEI_COPY_MEM) (
  IN VOID  *Destination,
  IN VOID  *Source,
  IN UINTN Length
  );

Parameters

Parameter Description
Destination Pointer to the destination buffer of the memory copy.
Source Pointer to the source buffer of the memory copy.
Length Number of bytes to copy from Source to Destination.

Description
This function copies Length bytes from the buffer Source to the buffer Destination.

Status Codes Returned
None.

SetMem()

The service fills a buffer with a specified value.

Prototype

typedef
VOID
(EFIAPI *EFI_PEI_SET_MEM) (
  IN VOID  *Buffer,
  IN UINTN Size,
  IN UINT8 Value
  );

Parameters

Parameter Description
Buffer Pointer to the buffer to fill.
Size Number of bytes in Buffer to fill.
Value Value to fill Buffer with.

Description
This function fills Size bytes of Buffer with Value.

Status Codes Returned
None.

ReportStatusCode()

This service publishes an interface that allows PEIMs to report status codes.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_REPORT_STATUS_CODE) (
  IN struct _EFI_PEI_SERVICES **PeiServices,
  IN EFI_STATUS_CODE_TYPE     Type,
  IN EFI_STATUS_CODE_VALUE    Value,
  IN UINT32                   Instance,
  IN EFI_GUID                 *CallerId OPTIONAL,
  IN EFI_STATUS_CODE_DATA     *Data OPTIONAL
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
Type Indicates the type of status code being reported.
Value Describes the current status of a hardware or software entity. This includes information about the class and subclass that is used to classify the entity as well as an operation. For progress codes, the operation is the current activity. For error codes, it is the exception. For debug codes, it is not defined at this time.
Instance The enumeration of a hardware or software entity within the system. A system may contain multiple entities that match a class/subclass pairing. The instance differentiates between them. An instance of 0 indicates that instance information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
CallerId This optional parameter may be used to identify the caller. This parameter allows the status code driver to apply different rules to different callers.
Data This optional parameter may be used to pass additional data. The contents of this data type may have additional GUID-specific data.

Description
The ReportStatusCode() function is called by PEIMs that wish to report status information on their progress. This will allow a platform owner to ascertain the state of the system, especially under conditions where the full consoles might not have been installed.

This is the entry point that PEIMs should use. This service can use all platform PEI Services, and when main memory is available, it can even construct a GUIDed HOB that conveys the pre-DXE data as an input to the data hub. This service can also publish an interface that is usable only from the DXE phase. This entry point should not be the same as that published to the PEIMs, and the implementation of this code path should not do the following:

  • Use any PEI Services or PPIs from other modules.
  • Make any presumptions about global memory allocation.

It can only operate on its local stack activation frame and must be careful about using I/O and memory-mapped I/O resources. These concerns, including the latter warning, arise because this service could be used during the “blackout” period between the termination of PEI and the beginning of DXE, prior to the loading of the DXE progress code driver. As such, the ownership of the memory map and platform resource allocation is indeterminate at this point in the platform evolution.

Status Codes Returned

Status Code Description
EFI_SUCCESS The function completed successfully.
EFI_NOT_AVAILABLE_YET No progress code provider has installed an interface in the system.

ResetSystem()

Resets the entire platform.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_PEI_RESET_SYSTEM) (
  IN struct _EFI_PEI_SERVICES **PeiServices
  );

Parameters

Parameter Description
PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.

Description
This service resets the entire platform, including all processors and devices, and reboots the system. It is important to have a standard variant of this function for cases such as the following:

  • Resetting the processor to change frequency settings
  • Restarting hardware to complete chipset initialization
  • Responding to exceptions from a catastrophic error

Status Codes Returned

Status Code Description
EFI_SUCCESS The function completed successfully.
EFI_NOT_AVAILABLE_YET The service has not been installed yet.

Copyright (C) 2008 Phoenix Technologies Ltd. All Rights Reserved. Portions copyright © 2002-2005 Intel Corporation. Used with permission.

Personal tools