EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index
Functions | Variables

MdeModulePkg/Universal/Variable/Pei/Variable.c File Reference

#include "Variable.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI PeimInitializeVariableServices (IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
VARIABLE_HEADERGetStartPointer (IN VARIABLE_STORE_HEADER *VarStoreHeader)
VARIABLE_HEADERGetEndPointer (IN VARIABLE_STORE_HEADER *VarStoreHeader)
BOOLEAN IsValidVariableHeader (IN VARIABLE_HEADER *Variable)
UINTN NameSizeOfVariable (IN VARIABLE_HEADER *Variable)
UINTN DataSizeOfVariable (IN VARIABLE_HEADER *Variable)
CHAR16GetVariableNamePtr (IN VARIABLE_HEADER *Variable)
UINT8GetVariableDataPtr (IN VARIABLE_HEADER *Variable)
VARIABLE_HEADERGetNextVariablePtr (IN VARIABLE_HEADER *Variable)
VARIABLE_STORE_STATUS GetVariableStoreStatus (IN VARIABLE_STORE_HEADER *VarStoreHeader)
EFI_STATUS CompareWithValidVariable (IN VARIABLE_HEADER *Variable, IN CONST CHAR16 *VariableName, IN CONST EFI_GUID *VendorGuid, OUT VARIABLE_POINTER_TRACK *PtrTrack)
VARIABLE_STORE_HEADERGetVariableStore (IN VARIABLE_STORE_TYPE Type, OUT VARIABLE_INDEX_TABLE **IndexTable OPTIONAL)
EFI_STATUS FindVariableEx (IN VARIABLE_STORE_HEADER *VariableStoreHeader, IN VARIABLE_INDEX_TABLE *IndexTable, IN CONST CHAR16 *VariableName, IN CONST EFI_GUID *VendorGuid, OUT VARIABLE_POINTER_TRACK *PtrTrack)
EFI_STATUS FindVariable (IN CONST CHAR16 *VariableName, IN CONST EFI_GUID *VendorGuid, OUT VARIABLE_POINTER_TRACK *PtrTrack)
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)
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)

Variables

EFI_PEI_READ_ONLY_VARIABLE2_PPI mVariablePpi
EFI_PEI_PPI_DESCRIPTOR mPpiListVariable

Detailed Description

Implement ReadOnly Variable Services required by PEIM and install PEI ReadOnly Varaiable2 PPI. These services operates the non volatile storage space.

Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name:

Definition in file Variable.c.


Function Documentation

EFI_STATUS CompareWithValidVariable ( IN VARIABLE_HEADER Variable,
IN CONST CHAR16 VariableName,
IN CONST EFI_GUID VendorGuid,
OUT VARIABLE_POINTER_TRACK PtrTrack 
)

This function compares a variable with variable entries in database.

Parameters:
VariablePointer to the variable in our database
VariableNameName of the variable to compare to 'Variable'
VendorGuidGUID of the variable to compare to 'Variable'
PtrTrackVariable Track Pointer structure that contains Variable Information.
Return values:
EFI_SUCCESSFound match variable
EFI_NOT_FOUNDVariable not found

Definition at line 290 of file Variable.c.

UINTN DataSizeOfVariable ( IN VARIABLE_HEADER Variable)

This code gets the size of data of variable.

Parameters:
VariablePointer to the Variable Header.
Returns:
Size of variable in bytes in type UINTN.

Definition at line 151 of file Variable.c.

EFI_STATUS FindVariable ( IN CONST CHAR16 VariableName,
IN CONST EFI_GUID VendorGuid,
OUT VARIABLE_POINTER_TRACK PtrTrack 
)

Find the variable in HOB and Non-Volatile variable storages.

Parameters:
VariableNameName of the variable to be found
VendorGuidVendor GUID to be found.
PtrTrackVariable Track Pointer structure that contains Variable Information.
Return values:
EFI_SUCCESSVariable found successfully
EFI_NOT_FOUNDVariable not found
EFI_INVALID_PARAMETERInvalid variable name

Definition at line 537 of file Variable.c.

EFI_STATUS FindVariableEx ( IN VARIABLE_STORE_HEADER VariableStoreHeader,
IN VARIABLE_INDEX_TABLE IndexTable,
IN CONST CHAR16 VariableName,
IN CONST EFI_GUID VendorGuid,
OUT VARIABLE_POINTER_TRACK PtrTrack 
)

Find the variable in the specified variable store.

Parameters:
VariableStoreHeaderPointer to the variable store header.
IndexTablePointer to the index table.
VariableNameName of the variable to be found
VendorGuidVendor GUID to be found.
PtrTrackVariable Track Pointer structure that contains Variable Information.
Return values:
EFI_SUCCESSVariable found successfully
EFI_NOT_FOUNDVariable not found
EFI_INVALID_PARAMETERInvalid variable name

Definition at line 410 of file Variable.c.

VARIABLE_HEADER* GetEndPointer ( IN VARIABLE_STORE_HEADER VarStoreHeader)

This code gets the pointer to the last variable memory pointer byte.

Parameters:
VarStoreHeaderPointer to the Variable Store Header.
Returns:
VARIABLE_HEADER* pointer to last unavailable Variable Header.

Definition at line 86 of file Variable.c.

VARIABLE_HEADER* GetNextVariablePtr ( IN VARIABLE_HEADER Variable)

This code gets the pointer to the next variable header.

Parameters:
VariablePointer to the Variable Header.
Returns:
A VARIABLE_HEADER* pointer to next variable header.

Definition at line 217 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.

Parameters:
VarStoreHeaderPointer to the Variable Store Header.
Returns:
Pointer to the first variable header

Definition at line 66 of file Variable.c.

UINT8* GetVariableDataPtr ( IN VARIABLE_HEADER Variable)

This code gets the pointer to the variable data.

Parameters:
VariablePointer to the Variable Header.
Returns:
A UINT8* pointer to Variable Data.

Definition at line 191 of file Variable.c.

CHAR16* GetVariableNamePtr ( IN VARIABLE_HEADER Variable)

This code gets the pointer to the variable name.

Parameters:
VariablePointer to the Variable Header.
Returns:
A CHAR16* pointer to Variable Name.

Definition at line 173 of file Variable.c.

VARIABLE_STORE_HEADER* GetVariableStore ( IN VARIABLE_STORE_TYPE  Type,
OUT VARIABLE_INDEX_TABLE **IndexTable  OPTIONAL 
)

Return the variable store header and the index table based on the Index.

Parameters:
TypeThe type of the variable store.
IndexTableReturn the index table.
Returns:
Pointer to the variable store header.

Definition at line 334 of file Variable.c.

VARIABLE_STORE_STATUS GetVariableStoreStatus ( IN VARIABLE_STORE_HEADER VarStoreHeader)

This code gets the pointer to the variable name.

Parameters:
VarStoreHeaderPointer to the Variable Store Header.
Return values:
EfiRawVariable store is raw
EfiValidVariable store is valid
EfiInvalidVariable store is invalid

Definition at line 248 of file Variable.c.

BOOLEAN IsValidVariableHeader ( IN VARIABLE_HEADER Variable)

This code checks if variable header is valid or not.

Parameters:
VariablePointer to the Variable Header.
Return values:
TRUEVariable header is valid.
FALSEVariable header is not valid.

Definition at line 107 of file Variable.c.

UINTN NameSizeOfVariable ( IN VARIABLE_HEADER Variable)

This code gets the size of name of variable.

Parameters:
VariablePointer to the Variable Header.
Returns:
Size of variable in bytes in type UINTN.

Definition at line 128 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.

Parameters:
ThisA pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.
VariableNameSizeOn entry, points to the size of the buffer pointed to by VariableName. On return, the size of the variable name buffer.
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.
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 variable was read successfully.
EFI_NOT_FOUNDThe variable could not be found.
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 675 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 
)

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:
ThisA pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.
VariableNameA pointer to a null-terminated string that is the variable's name.
VariableGuidA pointer to an EFI_GUID that is the variable's GUID. The combination of VariableGuid and VariableName must be unique.
AttributesIf non-NULL, on return, points to the variable's attributes.
DataSizeOn entry, points to the size in bytes of the Data buffer. On return, points to the size of the data returned in Data.
DataPoints to the buffer which will hold the returned variable value.
Return values:
EFI_SUCCESSThe variable was read successfully.
EFI_NOT_FOUNDThe variable could not be 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 597 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.

Parameters:
FileHandleHandle of the file being invoked. Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().
PeiServicesGeneral purpose services available to every PEIM.
Return values:
EFI_SUCCESSIf the interface could be successfully installed
OthersReturned from PeiServicesInstallPpi()

Definition at line 48 of file Variable.c.


Variable Documentation

Initial value:

Definition at line 29 of file Variable.c.

Initial value:

Definition at line 24 of file Variable.c.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines