TianoCore EDK2 master
Loading...
Searching...
No Matches
Variable.h File Reference

Go to the source code of this file.

Data Structures

struct  _EDKII_PEI_VARIABLE_PPI
 

Macros

#define EDKII_PEI_VARIABLE_PPI_GUID
 

Typedefs

typedef struct _EDKII_PEI_VARIABLE_PPI EDKII_PEI_VARIABLE_PPI
 
typedef EFI_STATUS(EFIAPI * EDKII_PEI_GET_VARIABLE) (IN CONST EDKII_PEI_VARIABLE_PPI *This, IN CONST CHAR16 *VariableName, IN CONST EFI_GUID *VariableGuid, OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, OUT VOID *Data OPTIONAL)
 
typedef EFI_STATUS(EFIAPI * EDKII_PEI_GET_NEXT_VARIABLE_NAME) (IN CONST EDKII_PEI_VARIABLE_PPI *This, IN OUT UINTN *VariableNameSize, IN OUT CHAR16 *VariableName, IN OUT EFI_GUID *VariableGuid)
 
typedef EFI_STATUS(EFIAPI * EDKII_PEI_SET_VARIABLE) (IN CONST EDKII_PEI_VARIABLE_PPI *This, IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)
 
typedef EFI_STATUS(EFIAPI * EDKII_PEI_QUERY_VARIABLE_INFO) (IN CONST EDKII_PEI_VARIABLE_PPI *This, IN UINT32 Attributes, OUT UINT64 *MaximumVariableStorageSize, OUT UINT64 *RemainingVariableStorageSize, OUT UINT64 *MaximumVariableSize)
 

Variables

EFI_GUID gEdkiiPeiVariablePpiGuid
 

Detailed Description

EDKII PEI Variable PPI provides an implementation of variables intended for use as a means to store data in the PEI environment.

Copyright (c) 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Variable.h.

Macro Definition Documentation

◆ EDKII_PEI_VARIABLE_PPI_GUID

#define EDKII_PEI_VARIABLE_PPI_GUID
Value:
{ \
0xe7b2cd04, 0x4b14, 0x44c2, { 0xb7, 0x48, 0xce, 0xaf, 0x2b, 0x66, 0x4a, 0xb0 } \
}

Definition at line 13 of file Variable.h.

Typedef Documentation

◆ EDKII_PEI_GET_NEXT_VARIABLE_NAME

typedef EFI_STATUS(EFIAPI * EDKII_PEI_GET_NEXT_VARIABLE_NAME) (IN CONST EDKII_PEI_VARIABLE_PPI *This, IN OUT UINTN *VariableNameSize, IN OUT CHAR16 *VariableName, IN OUT EFI_GUID *VariableGuid)

Return the next variable name and GUID.

This function is called multiple times to retrieve the VariableName and VariableGuid of all variables currently available in the system. On each call, the previous results are passed into the interface, and, on return, the interface returns the data for the next variable. To get started, VariableName should initially contain L"\0" and VariableNameSize should be sizeof(CHAR16). When the entire variable list has been returned, EFI_NOT_FOUND is returned.

Parameters
[in]ThisA pointer to this instance of the EDKII_PEI_VARIABLE_PPI.
[in,out]VariableNameSizeOn entry, points to the size of the buffer pointed to by VariableName. On return, the size of the variable name buffer.
[in,out]VariableNameOn entry, a pointer to a null-terminated string that is the variable's name. On return, points to the next variable's null-terminated name string.
[in,out]VariableGuidOn entry, a pointer to an EFI_GUID that is the variable's GUID. On return, a pointer to the next variable's GUID.
Return values
EFI_SUCCESSThe next variable name was read successfully.
EFI_NOT_FOUNDAll variables have been enumerated.
EFI_BUFFER_TOO_SMALLThe VariableNameSize is too small for the resulting data. VariableNameSize is updated with the size required for the specified variable.
EFI_INVALID_PARAMETERVariableName, VariableGuid or VariableNameSize is NULL.
EFI_DEVICE_ERRORThe variable could not be retrieved because of a device error.

Definition at line 89 of file Variable.h.

◆ EDKII_PEI_GET_VARIABLE

typedef EFI_STATUS(EFIAPI * EDKII_PEI_GET_VARIABLE) (IN CONST EDKII_PEI_VARIABLE_PPI *This, IN CONST CHAR16 *VariableName, IN CONST EFI_GUID *VariableGuid, OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, OUT VOID *Data OPTIONAL)

This service retrieves a variable's value using its name and GUID.

Read the specified variable from the UEFI variable store. If the Data buffer is too small to hold the contents of the variable, the error EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer size to obtain the data.

Parameters
[in]ThisA pointer to this instance of the EDKII_PEI_VARIABLE_PPI.
[in]VariableNameA pointer to a null-terminated string that is the variable's name.
[in]VariableGuidA pointer to an EFI_GUID that is the variable's GUID. The combination of VariableGuid and VariableName must be unique.
[out]AttributesIf non-NULL, on return, points to the variable's attributes.
[in,out]DataSizeOn entry, points to the size in bytes of the Data buffer. On return, points to the size of the data returned in Data.
[out]DataPoints to the buffer which will hold the returned variable value. May be NULL with a zero DataSize in order to determine the size of the buffer needed.
Return values
EFI_SUCCESSThe variable was read successfully.
EFI_NOT_FOUNDThe variable was not found.
EFI_BUFFER_TOO_SMALLThe DataSize is too small for the resulting data. DataSize is updated with the size required for the specified variable.
EFI_INVALID_PARAMETERVariableName, VariableGuid, DataSize or Data is NULL.
EFI_DEVICE_ERRORThe variable could not be retrieved because of a device error.

Definition at line 49 of file Variable.h.

◆ EDKII_PEI_QUERY_VARIABLE_INFO

typedef EFI_STATUS(EFIAPI * EDKII_PEI_QUERY_VARIABLE_INFO) (IN CONST EDKII_PEI_VARIABLE_PPI *This, IN UINT32 Attributes, OUT UINT64 *MaximumVariableStorageSize, OUT UINT64 *RemainingVariableStorageSize, OUT UINT64 *MaximumVariableSize)

Returns information about the UEFI variables.

Parameters
[in]ThisA pointer to this instance of the EDKII_PEI_VARIABLE_PPI.
[in]AttributesAttributes bitmask to specify the type of variables on which to return information.
[out]MaximumVariableStorageSizeOn output the maximum size of the storage space available for the EFI variables associated with the attributes specified.
[out]RemainingVariableStorageSizeReturns the remaining size of the storage space available for the EFI variables associated with the attributes specified.
[out]MaximumVariableSizeReturns the maximum size of the individual EFI variables associated with the attributes specified.
Return values
EFI_SUCCESSValid answer returned.
EFI_INVALID_PARAMETERAn invalid combination of attribute bits was supplied
EFI_UNSUPPORTEDThe attribute is not supported on this platform, and the MaximumVariableStorageSize, RemainingVariableStorageSize, MaximumVariableSize are undefined.

Definition at line 173 of file Variable.h.

◆ EDKII_PEI_SET_VARIABLE

typedef EFI_STATUS(EFIAPI * EDKII_PEI_SET_VARIABLE) (IN CONST EDKII_PEI_VARIABLE_PPI *This, IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)

Sets the value of a variable.

Parameters
[in]ThisA pointer to this instance of the EDKII_PEI_VARIABLE_PPI.
[in]VariableNameA Null-terminated string that is the name of the vendor's variable. Each VariableName is unique for each VendorGuid. VariableName must contain 1 or more characters. If VariableName is an empty string, then EFI_INVALID_PARAMETER is returned.
[in]VendorGuidA unique identifier for the vendor.
[in]AttributesAttributes bitmask to set for the variable.
[in]DataSizeThe size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE attribute is set, a size of zero causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is set, then a SetVariable() call with a DataSize of zero will not cause any change to the variable value.
[in]DataThe contents for the variable.
Return values
EFI_SUCCESSThe firmware has successfully stored the variable and its data as defined by the Attributes.
EFI_INVALID_PARAMETERAn invalid combination of attribute bits, name, and GUID was supplied, or the DataSize exceeds the maximum allowed.
EFI_INVALID_PARAMETERVariableName is an empty string.
EFI_OUT_OF_RESOURCESNot enough storage is available to hold the variable and its data.
EFI_DEVICE_ERRORThe variable could not be stored due to a hardware error.
EFI_WRITE_PROTECTEDThe variable in question is read-only.
EFI_WRITE_PROTECTEDThe variable in question cannot be deleted.
EFI_SECURITY_VIOLATIONThe variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, or EFI_VARIABLE_ENHANCED_AUTHENTICATED_ACCESS being set. Writing to authenticated variables is not supported in the PEI environment. Updates to authenticated variables can be requested during PEI via the EFI_AUTHENTICATED_VARIABLE_HOB, but these updates won't be written to non-volatile storage until later in DXE. The EFI_AUTHENTICATED_VARIABLE_HOB is a HOB with the GUID gEfiAuthenticatedVariableGuid. This HOB contains a VARIABLE_STORE_HEADER followed by one or more UEFI variables, which are stored as DWORD aligned tuples of (VARIABLE_HEADER + CHAR16 VariableName + VariableData). See MdeModulePkg/Include/Guid/VariableFormat.h for these data structure definitions and MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c for an example of how to parse these data structures.
EFI_NOT_FOUNDThe variable trying to be updated or deleted was not found.

Definition at line 139 of file Variable.h.

◆ EDKII_PEI_VARIABLE_PPI

Definition at line 18 of file Variable.h.