TianoCore EDK2 master
|
#include "Variable.h"
Go to the source code of this file.
Variables | |
EFI_PEI_READ_ONLY_VARIABLE2_PPI | mVariablePpi |
EFI_PEI_PPI_DESCRIPTOR | mPpiListVariable |
EFI_PEI_NOTIFY_DESCRIPTOR | mPostMemNotifyList |
Implement ReadOnly Variable Services required by PEIM and install PEI ReadOnly Varaiable2 PPI. These services operates the non volatile storage space.
Copyright (c) 2006 - 2024, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Variable.c.
EFI_STATUS EFIAPI BuildVariableRuntimeCacheInfoHob | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_NOTIFY_DESCRIPTOR * | NotifyDescriptor, | ||
IN VOID * | Ppi | ||
) |
Build gEdkiiVariableRuntimeCacheInfoHobGuid.
[in] | PeiServices | General purpose services available to every PEIM. |
[in] | NotifyDescriptor | The notification structure this PEIM registered on install. |
[in] | Ppi | The memory discovered PPI. Not used. |
EFI_SUCCESS | The function completed successfully. |
others | Failed to build VariableRuntimeCacheInfo Hob. |
Definition at line 1428 of file Variable.c.
UINTN CalculateAuthVarStorageSize | ( | IN VARIABLE_STORE_INFO * | StoreInfo, |
IN VARIABLE_STORE_HEADER * | NormalHobVarStorage | ||
) |
Calculate the auth variable storage size converted from normal variable storage.
[in] | StoreInfo | Pointer to the store info |
[in] | NormalHobVarStorage | Pointer to the normal variable storage header |
the | auth variable storage size |
Definition at line 1292 of file Variable.c.
Calculate Hob variable cache size.
[in] | NvAuthFlag | If the NV variable store is Auth. |
Maximum | of Nv variable cache size. |
Definition at line 1331 of file Variable.c.
Calculate Nv variable cache size.
[out] | NvAuthFlag | If the NV variable store is Auth. |
Maximum | of Nv variable cache size. |
Definition at line 1370 of file Variable.c.
BOOLEAN CompareVariableName | ( | IN VARIABLE_STORE_INFO * | StoreInfo, |
IN CONST CHAR16 * | Name1, | ||
IN CONST CHAR16 * | Name2, | ||
IN UINTN | NameSize | ||
) |
Compare two variable names, one of them may be inconsecutive.
StoreInfo | Pointer to variable store info structure. |
Name1 | Pointer to one variable name. |
Name2 | Pointer to another variable name. |
NameSize | Variable name size. |
TRUE | Name1 and Name2 are identical. |
FALSE | Name1 and Name2 are not identical. |
Definition at line 413 of file Variable.c.
EFI_STATUS CompareWithValidVariable | ( | IN VARIABLE_STORE_INFO * | StoreInfo, |
IN VARIABLE_HEADER * | Variable, | ||
IN VARIABLE_HEADER * | VariableHeader, | ||
IN CONST CHAR16 * | VariableName, | ||
IN CONST EFI_GUID * | VendorGuid, | ||
OUT VARIABLE_POINTER_TRACK * | PtrTrack | ||
) |
This function compares a variable with variable entries in database.
StoreInfo | Pointer to variable store info structure. |
Variable | Pointer to the variable in our database |
VariableHeader | Pointer to the Variable Header that has consecutive content. |
VariableName | Name of the variable to compare to 'Variable' |
VendorGuid | GUID of the variable to compare to 'Variable' |
PtrTrack | Variable Track Pointer structure that contains Variable Information. |
EFI_SUCCESS | Found match variable |
EFI_NOT_FOUND | Variable not found |
Definition at line 491 of file Variable.c.
UINTN DataSizeOfVariable | ( | IN VARIABLE_HEADER * | Variable, |
IN BOOLEAN | AuthFlag | ||
) |
This code gets the size of data of variable.
Variable | Pointer to the Variable Header. |
AuthFlag | Authenticated variable flag. |
Definition at line 215 of file Variable.c.
EFI_STATUS FindVariable | ( | IN CONST CHAR16 * | VariableName, |
IN CONST EFI_GUID * | VendorGuid, | ||
OUT VARIABLE_POINTER_TRACK * | PtrTrack, | ||
OUT VARIABLE_STORE_INFO * | StoreInfo | ||
) |
Find the variable in HOB and Non-Volatile variable storages.
VariableName | Name of the variable to be found |
VendorGuid | Vendor GUID to be found. |
PtrTrack | Variable Track Pointer structure that contains Variable Information. |
StoreInfo | Return the store info. |
EFI_SUCCESS | Variable found successfully |
EFI_NOT_FOUND | Variable not found |
EFI_INVALID_PARAMETER | Invalid variable name |
Definition at line 992 of file Variable.c.
EFI_STATUS FindVariableEx | ( | IN VARIABLE_STORE_INFO * | StoreInfo, |
IN CONST CHAR16 * | VariableName, | ||
IN CONST EFI_GUID * | VendorGuid, | ||
OUT VARIABLE_POINTER_TRACK * | PtrTrack | ||
) |
Find the variable in the specified variable store.
StoreInfo | Pointer to the store info structure. |
VariableName | Name of the variable to be found |
VendorGuid | Vendor GUID to be found. |
PtrTrack | Variable Track Pointer structure that contains Variable Information. |
EFI_SUCCESS | Variable found successfully |
EFI_NOT_FOUND | Variable not found |
EFI_INVALID_PARAMETER | Invalid variable name |
Definition at line 844 of file Variable.c.
VARIABLE_HEADER * GetEndPointer | ( | IN VARIABLE_STORE_HEADER * | VarStoreHeader | ) |
Gets the pointer to the end of the variable storage area.
This function gets pointer to the end of the variable storage area, according to the input variable store header.
VarStoreHeader | Pointer to the Variable Store Header. |
Definition at line 109 of file Variable.c.
VOID GetHobVariableStore | ( | OUT VARIABLE_STORE_INFO * | StoreInfo, |
OUT VARIABLE_STORE_HEADER ** | VariableStoreHeader | ||
) |
Get HOB variable store.
[out] | StoreInfo | Return the store info. |
[out] | VariableStoreHeader | Return variable store header. |
Definition at line 540 of file Variable.c.
VARIABLE_HEADER * GetNextVariablePtr | ( | IN VARIABLE_STORE_INFO * | StoreInfo, |
IN VARIABLE_HEADER * | Variable, | ||
IN VARIABLE_HEADER * | VariableHeader | ||
) |
This code gets the pointer to the next variable header.
StoreInfo | Pointer to variable store info structure. |
Variable | Pointer to the Variable Header. |
VariableHeader | Pointer to the Variable Header that has consecutive content. |
Definition at line 329 of file Variable.c.
VARIABLE_HEADER * GetStartPointer | ( | IN VARIABLE_STORE_HEADER * | VarStoreHeader | ) |
Gets the pointer to the first variable header in given variable store area.
VarStoreHeader | Pointer to the Variable Store Header. |
Definition at line 86 of file Variable.c.
UINT8 * GetVariableDataPtr | ( | IN VARIABLE_HEADER * | Variable, |
IN VARIABLE_HEADER * | VariableHeader, | ||
IN BOOLEAN | AuthFlag | ||
) |
This code gets the pointer to the variable data.
Variable | Pointer to the Variable Header. |
VariableHeader | Pointer to the Variable Header that has consecutive content. |
AuthFlag | Authenticated variable flag. |
Definition at line 300 of file Variable.c.
BOOLEAN GetVariableHeader | ( | IN VARIABLE_STORE_INFO * | StoreInfo, |
IN VARIABLE_HEADER * | Variable, | ||
OUT VARIABLE_HEADER ** | VariableHeader | ||
) |
Get variable header that has consecutive content.
StoreInfo | Pointer to variable store info structure. |
Variable | Pointer to the Variable Header. |
VariableHeader | Pointer to Pointer to the Variable Header that has consecutive content. |
TRUE | Variable header is valid. |
FALSE | Variable header is not valid. |
Definition at line 718 of file Variable.c.
This code gets the size of variable header.
AuthFlag | Authenticated variable flag. |
Definition at line 149 of file Variable.c.
VOID GetVariableNameOrData | ( | IN VARIABLE_STORE_INFO * | StoreInfo, |
IN UINT8 * | NameOrData, | ||
IN UINTN | Size, | ||
OUT UINT8 * | Buffer | ||
) |
Get variable name or data to output buffer.
StoreInfo | Pointer to variable store info structure. |
NameOrData | Pointer to the variable name/data that may be inconsecutive. |
Size | Variable name/data size. |
Buffer | Pointer to output buffer to hold the variable name/data. |
Definition at line 793 of file Variable.c.
CHAR16 * GetVariableNamePtr | ( | IN VARIABLE_HEADER * | Variable, |
IN BOOLEAN | AuthFlag | ||
) |
This code gets the pointer to the variable name.
Variable | Pointer to the Variable Header. |
AuthFlag | Authenticated variable flag. |
Definition at line 256 of file Variable.c.
VARIABLE_STORE_HEADER * GetVariableStore | ( | IN VARIABLE_STORE_TYPE | Type, |
OUT VARIABLE_STORE_INFO * | StoreInfo | ||
) |
Return the variable store header and the store info based on the Index.
Type | The type of the variable store. |
StoreInfo | Return the store info. |
Definition at line 594 of file Variable.c.
VARIABLE_STORE_STATUS GetVariableStoreStatus | ( | IN VARIABLE_STORE_HEADER * | VarStoreHeader | ) |
Get variable store status.
VarStoreHeader | Pointer to the Variable Store Header. |
EfiRaw | Variable store is raw |
EfiValid | Variable store is valid |
EfiInvalid | Variable store is invalid |
Definition at line 372 of file Variable.c.
EFI_GUID * GetVendorGuidPtr | ( | IN VARIABLE_HEADER * | Variable, |
IN BOOLEAN | AuthFlag | ||
) |
This code gets the pointer to the variable guid.
Variable | Pointer to the Variable Header. |
AuthFlag | Authenticated variable flag. |
Definition at line 274 of file Variable.c.
BOOLEAN IsValidVariableHeader | ( | IN VARIABLE_HEADER * | Variable | ) |
This code checks if variable header is valid or not.
Variable | Pointer to the Variable Header. |
TRUE | Variable header is valid. |
FALSE | Variable header is not valid. |
Definition at line 129 of file Variable.c.
UINTN NameSizeOfVariable | ( | IN VARIABLE_HEADER * | Variable, |
IN BOOLEAN | AuthFlag | ||
) |
This code gets the size of name of variable.
Variable | Pointer to the Variable Header. |
AuthFlag | Authenticated variable flag. |
Definition at line 174 of file Variable.c.
EFI_STATUS EFIAPI PeiGetNextVariableName | ( | IN CONST EFI_PEI_READ_ONLY_VARIABLE2_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 interface. When the entire variable list has been returned, EFI_NOT_FOUND is returned.
This | A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI. |
VariableNameSize | On entry, points to the size of the buffer pointed to by VariableName. On return, the size of the variable name buffer. |
VariableName | On 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. |
VariableGuid | On entry, a pointer to an EFI_GUID that is the variable's GUID. On return, a pointer to the next variable's GUID. |
EFI_SUCCESS | The variable was read successfully. |
EFI_NOT_FOUND | The variable could not be found. |
EFI_BUFFER_TOO_SMALL | The VariableNameSize is too small for the resulting data. VariableNameSize is updated with the size required for the specified variable. |
EFI_INVALID_PARAMETER | VariableName, VariableGuid or VariableNameSize is NULL. |
EFI_DEVICE_ERROR | The variable could not be retrieved because of a device error. |
Definition at line 1141 of file Variable.c.
EFI_STATUS EFIAPI PeiGetVariable | ( | IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI * | This, |
IN CONST CHAR16 * | VariableName, | ||
IN CONST EFI_GUID * | VariableGuid, | ||
OUT UINT32 * | Attributes, | ||
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.
This | A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI. |
VariableName | A pointer to a null-terminated string that is the variable's name. |
VariableGuid | A pointer to an EFI_GUID that is the variable's GUID. The combination of VariableGuid and VariableName must be unique. |
Attributes | If non-NULL, on return, points to the variable's attributes. |
DataSize | On entry, points to the size in bytes of the Data buffer. On return, points to the size of the data returned in Data. |
Data | Points 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. |
EFI_SUCCESS | The variable was read successfully. |
EFI_NOT_FOUND | The variable was be found. |
EFI_BUFFER_TOO_SMALL | The DataSize is too small for the resulting data. DataSize is updated with the size required for the specified variable. |
EFI_INVALID_PARAMETER | VariableName, VariableGuid, DataSize or Data is NULL. |
EFI_DEVICE_ERROR | The variable could not be retrieved because of a device error. |
Definition at line 1051 of file Variable.c.
EFI_STATUS EFIAPI PeimInitializeVariableServices | ( | IN EFI_PEI_FILE_HANDLE | FileHandle, |
IN CONST EFI_PEI_SERVICES ** | PeiServices | ||
) |
Provide the functionality of the variable services.
FileHandle | Handle of the file being invoked. Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile(). |
PeiServices | General purpose services available to every PEIM. |
EFI_SUCCESS | If the interface could be successfully installed |
Others | Returned from PeiServicesInstallPpi() |
Definition at line 64 of file Variable.c.
EFI_PEI_NOTIFY_DESCRIPTOR mPostMemNotifyList |
Definition at line 46 of file Variable.c.
EFI_PEI_PPI_DESCRIPTOR mPpiListVariable |
Definition at line 21 of file Variable.c.
EFI_PEI_READ_ONLY_VARIABLE2_PPI mVariablePpi |
Definition at line 16 of file Variable.c.