Variable.h revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang The internal header file includes the common header files, defines
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc internal structure and functions used by Variable modules.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcCopyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcThis program and the accompanying materials
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcare licensed and made available under the terms and conditions of the BSD License
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fangwhich accompanies this distribution. The full text of the license may be found at
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/// The size of a 3 character ISO639 language code.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxctypedef enum {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxctypedef struct {
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fangtypedef struct {
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fangtypedef struct {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxctypedef struct {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Writes a buffer to variable storage space, in the working block.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This function writes a buffer to variable storage space into a firmware
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang volume block device. The destination is specified by the parameter
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang VariableBase. Fault Tolerant Write protocol is used for writing.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param VariableBase Base address of the variable to write.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Buffer Point to the data buffer.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param BufferSize The number of bytes of the data Buffer.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @retval EFI_SUCCESS The function completed successfully.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @retval EFI_ABORTED The function could not complete successfully.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Finds variable in storage blocks of volatile and non-volatile storage areas.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This code finds variable in storage blocks of volatile and non-volatile storage areas.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc If VariableName is an empty string, then we just return the first
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc qualified variable without comparing VariableName and VendorGuid.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc If IgnoreRtCheck is TRUE, then we ignore the EFI_VARIABLE_RUNTIME_ACCESS attribute check
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc at runtime when searching existing variable, only VariableName and VendorGuid are compared.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Otherwise, variables without EFI_VARIABLE_RUNTIME_ACCESS are not visible at runtime.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] VariableName Name of the variable to be found.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] VendorGuid Vendor GUID to be found.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[out] PtrTrack VARIABLE_POINTER_TRACK structure for output,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc including the range searched and the target position.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] Global Pointer to VARIABLE_GLOBAL structure, including
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc base of volatile variable storage area, base of
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc NV variable storage area, and a lock.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] IgnoreRtCheck Ignore EFI_VARIABLE_RUNTIME_ACCESS attribute
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang check at runtime when searching variable.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_INVALID_PARAMETER If VariableName is not an empty string, while
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang VendorGuid is NULL.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_SUCCESS Variable successfully found.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_NOT_FOUND Variable not found
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This code gets the pointer to the variable data.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Variable Pointer to the Variable Header.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return Pointer to Variable Data.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang This code gets the size of variable data.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param Variable Pointer to the Variable Header.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return Size of variable in bytes.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Update the variable region with Variable information. If EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is set,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc index of associated public key is needed.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] VariableName Name of variable.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] VendorGuid Guid of variable.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] Data Variable data.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] DataSize Size of data. 0 means delete.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] Attributes Attributes of the variable.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] KeyIndex Index of associated public key.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] MonotonicCount Value of associated monotonic count.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] Variable The variable information that is used to keep track of variable usage.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] TimeStamp Value of associated TimeStamp.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @retval EFI_SUCCESS The update operation is success.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @retval EFI_OUT_OF_RESOURCES Variable region is full, cannot write other data into this region.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Return TRUE if ExitBootServices () has been called.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @retval TRUE If ExitBootServices () has been called.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Initializes a basic mutual exclusion lock.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This function initializes a basic mutual exclusion lock to the released state
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc and returns the lock. Each lock provides mutual exclusion access at its task
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc priority level. Since there is no preemption or multiprocessor support in EFI,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc acquiring the lock only consists of raising to the locks TPL.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc If Lock is NULL, then ASSERT().
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc If Priority is not a valid TPL value, then ASSERT().
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Lock A pointer to the lock data structure to initialize.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Priority EFI TPL is associated with the lock.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return The lock.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Acquires lock only at boot time. Simply returns at runtime.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang This is a temperary function that will be removed when
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang EfiAcquireLock() in UefiLib can handle the call in UEFI
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Runtimer driver in RT phase.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc It calls EfiAcquireLock() at boot time, and simply returns
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc at runtime.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Lock A pointer to the lock to acquire.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Releases lock only at boot time. Simply returns at runtime.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This is a temperary function which will be removed when
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc EfiReleaseLock() in UefiLib can handle the call in UEFI
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Runtimer driver in RT phase.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc It calls EfiReleaseLock() at boot time and simply returns
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc at runtime.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Lock A pointer to the lock to release.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Retrive the FVB protocol interface by HANDLE.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] FvBlockHandle The handle of FVB protocol that provides services for
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc reading, writing, and erasing the target block.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[out] FvBlock The interface of FVB protocol
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @retval EFI_SUCCESS The interface information for the specified protocol was returned.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @retval EFI_UNSUPPORTED The device does not support the FVB protocol.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @retval EFI_INVALID_PARAMETER FvBlockHandle is not a valid EFI_HANDLE or FvBlock is NULL.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Retrive the Swap Address Range protocol interface.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[out] SarProtocol The interface of SAR protocol
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_SUCCESS The SAR protocol instance was found and returned in SarProtocol.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_NOT_FOUND The SAR protocol instance was not found.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_INVALID_PARAMETER SarProtocol is NULL.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Function returns an array of handles that support the FVB protocol
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang in a buffer allocated from pool.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param[out] NumberHandles The number of handles returned in Buffer.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param[out] Buffer A pointer to the buffer to return the requested
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang array of handles that support FVB protocol.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang handles in Buffer was returned in NumberHandles.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_NOT_FOUND No FVB handle was found.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_INVALID_PARAMETER NumberHandles is NULL or Buffer is NULL.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Initializes variable store area for non-volatile and volatile variable.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_SUCCESS Function successfully executed.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_OUT_OF_RESOURCES Fail to allocate enough memory resource.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang This function reclaims variable storage if free size is below the threshold.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Initializes variable write service after FVB was ready.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_SUCCESS Function successfully executed.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval Others Fail to initialize the variable service.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Retrive the SMM Fault Tolerent Write protocol interface.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param[out] FtwProtocol The interface of SMM Ftw protocol
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_SUCCESS The SMM SAR protocol instance was found and returned in SarProtocol.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_NOT_FOUND The SMM SAR protocol instance was not found.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_INVALID_PARAMETER SarProtocol is NULL.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Get the proper fvb handle and/or fvb protocol by the given Flash address.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param[in] Address The Flash address.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param[out] FvbHandle In output, if it is not NULL, it points to the proper FVB handle.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param[out] FvbProtocol In output, if it is not NULL, it points to the proper FVB protocol.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvbProtocol OPTIONAL
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang This code finds variable in storage blocks (Volatile or Non-Volatile).
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param VariableName Name of Variable to be found.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param VendorGuid Variable vendor GUID.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param Attributes Attribute value of the variable found.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param DataSize Size of Data found. If size is less than the
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang data, this value contains the required size.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param Data Data pointer.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @return EFI_INVALID_PARAMETER Invalid parameter.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @return EFI_SUCCESS Find the specified variable.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @return EFI_NOT_FOUND Not found.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @return EFI_BUFFER_TO_SMALL DataSize is too small for the result.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This code Finds the Next available variable.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param VariableNameSize Size of the variable name.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param VariableName Pointer to variable name.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param VendorGuid Variable Vendor Guid.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return EFI_INVALID_PARAMETER Invalid parameter.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return EFI_SUCCESS Find the specified variable.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return EFI_NOT_FOUND Not found.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return EFI_BUFFER_TO_SMALL DataSize is too small for the result.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This code sets variable in storage blocks (Volatile or Non-Volatile).
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param VariableName Name of Variable to be found.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param VendorGuid Variable vendor GUID.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Attributes Attribute value of the variable found
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param DataSize Size of Data found. If size is less than the
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc data, this value contains the required size.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Data Data pointer.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return EFI_INVALID_PARAMETER Invalid parameter.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return EFI_SUCCESS Set successfully.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return EFI_OUT_OF_RESOURCES Resource not enough to set variable.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return EFI_NOT_FOUND Not found.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return EFI_WRITE_PROTECTED Variable is read-only.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This code returns information about the EFI variables.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Attributes Attributes bitmask to specify the type of variables
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc on which to return information.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param MaximumVariableStorageSize Pointer to the maximum size of the storage space available
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc for the EFI variables associated with the attributes specified.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param RemainingVariableStorageSize Pointer to the remaining size of the storage space available
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang for EFI variables associated with the attributes specified.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param MaximumVariableSize Pointer to the maximum size of an individual EFI variables
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang associated with the attributes specified.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @return EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @return EFI_SUCCESS Query successfully.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @return EFI_UNSUPPORTED The attribute is not supported on this platform.