TianoCore EDK2 master
|
#include "UnitTestPeiServicesTablePointerLib.h"
Go to the source code of this file.
This file implements some PEI services.
Copyright (c) 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestAllocatePages | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_MEMORY_TYPE | MemoryType, | ||
IN UINTN | Pages, | ||
OUT EFI_PHYSICAL_ADDRESS * | Memory | ||
) |
The purpose of the service is to publish an interface that allows PEIMs to allocate memory ranges that are managed by the PEI Foundation.
Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap. After InstallPeiMemory() is called, PEI will allocate pages within the region of memory provided by InstallPeiMemory() service in a best-effort fashion. Location-specific allocations are not managed by the PEI foundation code.
PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
MemoryType | The type of memory to allocate. |
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. |
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 EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode, EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData, EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS. |
Definition at line 179 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestAllocatePool | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN UINTN | Size, | ||
OUT VOID ** | Buffer | ||
) |
Pool allocation service. Before permanent memory is discovered, the pool will be allocated in the heap in temporary memory. Generally, the size of the heap in temporary memory does not exceed 64K, so the biggest pool size could be allocated is 64K.
PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
Size | Amount of memory required |
Buffer | Address of pointer to the buffer |
EFI_SUCCESS | The allocation was successful |
EFI_OUT_OF_RESOURCES | There is not enough heap to satisfy the requirement to allocate the requested size. |
Definition at line 207 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestFfsFindFileByName | ( | IN CONST EFI_GUID * | FileName, |
IN EFI_PEI_FV_HANDLE | VolumeHandle, | ||
OUT EFI_PEI_FILE_HANDLE * | FileHandle | ||
) |
Find a file within a volume by its name.
FileName | A pointer to the name of the file to find within the firmware volume. |
VolumeHandle | The firmware volume to search |
FileHandle | Upon exit, points to the found file's handle or NULL if it could not be found. |
EFI_SUCCESS | File was found. |
EFI_NOT_FOUND | File was not found. |
EFI_INVALID_PARAMETER | VolumeHandle or FileHandle or FileName was NULL. |
Definition at line 282 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestFfsFindNextFile | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN UINT8 | SearchType, | ||
IN EFI_PEI_FV_HANDLE | FvHandle, | ||
IN OUT EFI_PEI_FILE_HANDLE * | FileHandle | ||
) |
Searches for the next matching file in the firmware volume.
PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
SearchType | Filter to find only files of this type. Type EFI_FV_FILETYPE_ALL causes no filtering to be done. |
FvHandle | Handle of firmware volume in which to search. |
FileHandle | On entry, points to the current handle from which to begin searching or NULL to start at the beginning of the firmware volume. On exit, points the file handle of the next file in the volume or NULL if there are no more files. |
EFI_NOT_FOUND | The file was not found. |
EFI_NOT_FOUND | The header checksum was not zero. |
EFI_SUCCESS | The file was found. |
Definition at line 93 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestFfsFindNextVolume | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN UINTN | Instance, | ||
IN OUT EFI_PEI_FV_HANDLE * | VolumeHandle | ||
) |
Search the firmware volumes by index
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). |
VolumeHandle | On exit, points to the next volume handle or NULL if it does not exist. |
EFI_INVALID_PARAMETER | VolumeHandle is NULL |
EFI_NOT_FOUND | The volume was not found. |
EFI_SUCCESS | The volume was found. |
Definition at line 66 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestFfsFindSectionData | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_SECTION_TYPE | SectionType, | ||
IN EFI_PEI_FILE_HANDLE | FileHandle, | ||
OUT VOID ** | SectionData | ||
) |
Searches for the next matching section within the specified file.
PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation |
SectionType | Filter to find only sections of this type. |
FileHandle | Pointer to the current file to search. |
SectionData | A pointer to the discovered section, if successful. NULL if section not found |
EFI_NOT_FOUND | The section was not found. |
EFI_SUCCESS | The section was found. |
Definition at line 118 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestFfsFindSectionData3 | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_SECTION_TYPE | SectionType, | ||
IN UINTN | SectionInstance, | ||
IN EFI_PEI_FILE_HANDLE | FileHandle, | ||
OUT VOID ** | SectionData, | ||
OUT UINT32 * | AuthenticationStatus | ||
) |
Searches for the next matching section within the specified file.
PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
SectionType | The value of the section type to find. |
SectionInstance | Section instance to find. |
FileHandle | Handle of the firmware file to search. |
SectionData | A pointer to the discovered section, if successful. |
AuthenticationStatus | A pointer to the authentication status for this section. |
EFI_SUCCESS | The section was found. |
EFI_NOT_FOUND | The section was not found. |
Definition at line 375 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestFfsGetFileInfo | ( | IN EFI_PEI_FILE_HANDLE | FileHandle, |
OUT EFI_FV_FILE_INFO * | FileInfo | ||
) |
Returns information about a specific file.
FileHandle | Handle of the file. |
FileInfo | Upon exit, points to the file's information. |
EFI_INVALID_PARAMETER | If FileInfo is NULL. |
EFI_INVALID_PARAMETER | If FileHandle does not represent a valid file. |
EFI_SUCCESS | File information returned. |
Definition at line 304 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestFfsGetFileInfo2 | ( | IN EFI_PEI_FILE_HANDLE | FileHandle, |
OUT EFI_FV_FILE_INFO2 * | FileInfo | ||
) |
Returns information about a specific file.
FileHandle | Handle of the file. |
FileInfo | Upon exit, points to the file's information. |
EFI_INVALID_PARAMETER | If FileInfo is NULL. |
EFI_INVALID_PARAMETER | If FileHandle does not represent a valid file. |
EFI_SUCCESS | File information returned. |
Definition at line 400 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestFfsGetVolumeInfo | ( | IN EFI_PEI_FV_HANDLE | VolumeHandle, |
OUT EFI_FV_INFO * | VolumeInfo | ||
) |
Returns information about the specified volume.
This function returns information about a specific firmware volume, including its name, type, attributes, starting address and size.
VolumeHandle | Handle of the volume. |
VolumeInfo | Upon exit, points to the volume's information. |
EFI_SUCCESS | Volume information returned. |
EFI_INVALID_PARAMETER | If VolumeHandle does not represent a valid volume. |
EFI_INVALID_PARAMETER | If VolumeHandle is NULL. |
EFI_SUCCESS | Information successfully returned. |
EFI_INVALID_PARAMETER | The volume designated by the VolumeHandle is not available. |
Definition at line 331 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestFreePages | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PHYSICAL_ADDRESS | Memory, | ||
IN UINTN | Pages | ||
) |
Frees memory pages.
[in] | PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
[in] | Memory | The base physical address of the pages to be freed. |
[in] | Pages | The number of contiguous 4 KB pages to free. |
EFI_SUCCESS | The requested pages were freed. |
EFI_INVALID_PARAMETER | Memory is not a page-aligned address or Pages is invalid. |
EFI_NOT_FOUND | The requested memory pages were not allocated with AllocatePages(). |
Definition at line 423 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestGetBootMode | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN OUT EFI_BOOT_MODE * | BootMode | ||
) |
This service enables PEIMs to ascertain the present value of the boot mode.
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. |
EFI_SUCCESS | The boot mode was returned successfully. |
EFI_INVALID_PARAMETER | BootMode is NULL. |
Definition at line 23 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestInstallPeiMemory | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PHYSICAL_ADDRESS | MemoryBegin, | ||
IN UINT64 | MemoryLength | ||
) |
This function registers the found memory configuration with the PEI Foundation.
The usage model is that the PEIM that discovers the permanent memory shall invoke this service. This routine will hold discoveried memory information into PeiCore's private data, and set SwitchStackSignal flag. After PEIM who discovery memory is dispatched, PeiDispatcher will migrate temporary memory to permanent memory.
PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
MemoryBegin | Start of memory address. |
MemoryLength | Length of memory. |
Definition at line 146 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestRegisterForShadow | ( | IN EFI_PEI_FILE_HANDLE | FileHandle | ) |
This routine enables a PEIM to register itself for shadow when the PEI Foundation discovers permanent memory.
FileHandle | File handle of a PEIM. |
EFI_NOT_FOUND | The file handle doesn't point to PEIM itself. |
EFI_ALREADY_STARTED | Indicate that the PEIM has been registered itself. |
EFI_SUCCESS | Successfully to register itself. |
Definition at line 352 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestReportStatusCode | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_STATUS_CODE_TYPE | CodeType, | ||
IN EFI_STATUS_CODE_VALUE | Value, | ||
IN UINT32 | Instance, | ||
IN CONST EFI_GUID * | CallerId, | ||
IN CONST EFI_STATUS_CODE_DATA *Data | OPTIONAL | ||
) |
Core version of the Status Code reporter
PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
CodeType | Type of Status Code. |
Value | Value to output for Status Code. |
Instance | Instance Number of this status code. |
CallerId | ID of the caller of this status code. |
Data | Optional data associated with this status code. |
EFI_SUCCESS | if status code is successfully reported |
EFI_NOT_AVAILABLE_YET | if StatusCodePpi has not been installed |
Definition at line 234 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestResetSystem | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices | ) |
Core version of the Reset System
PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
EFI_NOT_AVAILABLE_YET | PPI not available yet. |
EFI_DEVICE_ERROR | Did not reset system. Otherwise, resets the system. |
Definition at line 260 of file UnitTestPeiServicesTablePointerLibMisc.c.
EFI_STATUS EFIAPI UnitTestSetBootMode | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_BOOT_MODE | BootMode | ||
) |
This service enables PEIMs to update the boot mode variable.
PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. |
BootMode | The value of the boot mode to set. |
Definition at line 43 of file UnitTestPeiServicesTablePointerLibMisc.c.