Variable.h revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/** @file
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang The internal header file includes the common header files, defines
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc internal structure and functions used by Variable modules.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxchttp://opensource.org/licenses/bsd-license.php
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#ifndef _VARIABLE_H_
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#define _VARIABLE_H_
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <PiDxe.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Protocol/VariableWrite.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Protocol/FaultTolerantWrite.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Protocol/FirmwareVolumeBlock.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Protocol/Variable.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/PcdLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/HobLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/UefiDriverEntryPoint.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/DxeServicesTableLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/UefiRuntimeLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/DebugLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/BaseMemoryLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/UefiBootServicesTableLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/UefiLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/BaseLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/SynchronizationLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/MemoryAllocationLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/BaseCryptLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Library/PlatformSecureLib.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Guid/GlobalVariable.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Guid/EventGroup.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Guid/AuthenticatedVariableFormat.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Guid/ImageAuthentication.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#include <Guid/SystemNvDataGuid.h>
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#define VARIABLE_RECLAIM_THRESHOLD (1024)
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc///
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/// The size of a 3 character ISO639 language code.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc///
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc#define ISO_639_2_ENTRY_SIZE 3
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxctypedef enum {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc VariableStoreTypeVolatile,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc VariableStoreTypeHob,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc VariableStoreTypeNv,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc VariableStoreTypeMax
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc} VARIABLE_STORE_TYPE;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxctypedef struct {
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc VARIABLE_HEADER *CurrPtr;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc VARIABLE_HEADER *EndPtr;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc VARIABLE_HEADER *StartPtr;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc BOOLEAN Volatile;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc} VARIABLE_POINTER_TRACK;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fangtypedef struct {
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang EFI_PHYSICAL_ADDRESS HobVariableBase;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang EFI_PHYSICAL_ADDRESS VolatileVariableBase;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang EFI_LOCK VariableServicesLock;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang UINT32 ReentrantState;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang} VARIABLE_GLOBAL;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fangtypedef struct {
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang VARIABLE_GLOBAL VariableGlobal;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc UINTN VolatileLastVariableOffset;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc UINTN NonVolatileLastVariableOffset;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc UINTN CommonVariableTotalSize;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc UINTN HwErrVariableTotalSize;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc CHAR8 *PlatformLangCodes;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc CHAR8 *LangCodes;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc CHAR8 *PlatformLang;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc CHAR8 Lang[ISO_639_2_ENTRY_SIZE + 1];
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbInstance;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc} VARIABLE_MODULE_GLOBAL;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxctypedef struct {
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang EFI_GUID *Guid;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang CHAR16 *Name;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang UINT32 Attributes;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang UINTN DataSize;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc VOID *Data;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang} VARIABLE_CACHE_ENTRY;
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Writes a buffer to variable storage space, in the working block.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
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
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcEFI_STATUS
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcFtwVariableSpace (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN EFI_PHYSICAL_ADDRESS VariableBase,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN UINT8 *Buffer,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN UINTN BufferSize
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Finds variable in storage blocks of volatile and non-volatile storage areas.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
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
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
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFI_STATUS
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangFindVariable (
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN CHAR16 *VariableName,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN EFI_GUID *VendorGuid,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang OUT VARIABLE_POINTER_TRACK *PtrTrack,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN VARIABLE_GLOBAL *Global,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN BOOLEAN IgnoreRtCheck
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This code gets the pointer to the variable data.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Variable Pointer to the Variable Header.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return Pointer to Variable Data.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangUINT8 *
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangGetVariableDataPtr (
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN VARIABLE_HEADER *Variable
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang );
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang/**
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang This code gets the size of variable data.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param Variable Pointer to the Variable Header.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return Size of variable in bytes.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcUINTN
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcDataSizeOfVariable (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN VARIABLE_HEADER *Variable
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
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
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[in] TimeStamp Value of associated TimeStamp.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcEFI_STATUS
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcUpdateVariable (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN CHAR16 *VariableName,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN EFI_GUID *VendorGuid,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN VOID *Data,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN UINTN DataSize,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN UINT32 Attributes OPTIONAL,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN UINT32 KeyIndex OPTIONAL,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN UINT64 MonotonicCount OPTIONAL,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN VARIABLE_POINTER_TRACK *Variable,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN EFI_TIME *TimeStamp OPTIONAL
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Return TRUE if ExitBootServices () has been called.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @retval TRUE If ExitBootServices () has been called.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcBOOLEAN
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcAtRuntime (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc VOID
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Initializes a basic mutual exclusion lock.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Lock A pointer to the lock data structure to initialize.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Priority EFI TPL is associated with the lock.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @return The lock.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcEFI_LOCK *
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcInitializeLock (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN OUT EFI_LOCK *Lock,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN EFI_TPL Priority
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang );
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang/**
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Acquires lock only at boot time. Simply returns at runtime.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Lock A pointer to the lock to acquire.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcVOID
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcAcquireLockOnlyAtBootTime (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN EFI_LOCK *Lock
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Releases lock only at boot time. Simply returns at runtime.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param Lock A pointer to the lock to release.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcVOID
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcReleaseLockOnlyAtBootTime (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN EFI_LOCK *Lock
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Retrive the FVB protocol interface by HANDLE.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcEFI_STATUS
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcGetFvbByHandle (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN EFI_HANDLE FvBlockHandle,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc Retrive the Swap Address Range protocol interface.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param[out] SarProtocol The interface of SAR protocol
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
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
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFI_STATUS
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangGetSarProtocol (
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang OUT VOID **SarProtocol
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang );
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang/**
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Function returns an array of handles that support the FVB protocol
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang in a buffer allocated from pool.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
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
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
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFI_STATUS
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangGetFvbCountAndBuffer (
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang OUT UINTN *NumberHandles,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang OUT EFI_HANDLE **Buffer
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang );
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang/**
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Initializes variable store area for non-volatile and volatile variable.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_SUCCESS Function successfully executed.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_OUT_OF_RESOURCES Fail to allocate enough memory resource.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFI_STATUS
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangVariableCommonInitialize (
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang VOID
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang );
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang/**
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang This function reclaims variable storage if free size is below the threshold.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangVOID
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangReclaimForOS(
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang VOID
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang );
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang/**
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Initializes variable write service after FVB was ready.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval EFI_SUCCESS Function successfully executed.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @retval Others Fail to initialize the variable service.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFI_STATUS
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangVariableWriteServiceInitialize (
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang VOID
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang );
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang/**
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Retrive the SMM Fault Tolerent Write protocol interface.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang @param[out] FtwProtocol The interface of SMM Ftw protocol
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
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
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFI_STATUS
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangGetFtwProtocol (
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang OUT VOID **FtwProtocol
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang );
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang/**
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang Get the proper fvb handle and/or fvb protocol by the given Flash address.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
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
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFI_STATUS
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangGetFvbInfoByAddress (
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN EFI_PHYSICAL_ADDRESS Address,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang OUT EFI_HANDLE *FvbHandle OPTIONAL,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvbProtocol OPTIONAL
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang );
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang/**
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang This code finds variable in storage blocks (Volatile or Non-Volatile).
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
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
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.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFI_STATUS
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFIAPI
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangVariableServiceGetVariable (
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN CHAR16 *VariableName,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN EFI_GUID *VendorGuid,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang OUT UINT32 *Attributes OPTIONAL,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN OUT UINTN *DataSize,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc OUT VOID *Data
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This code Finds the Next available variable.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param VariableNameSize Size of the variable name.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param VariableName Pointer to variable name.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc @param VendorGuid Variable Vendor Guid.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcEFI_STATUS
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcEFIAPI
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcVariableServiceGetNextVariableName (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN OUT UINTN *VariableNameSize,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN OUT CHAR16 *VariableName,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN OUT EFI_GUID *VendorGuid
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This code sets variable in storage blocks (Volatile or Non-Volatile).
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
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
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc**/
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcEFI_STATUS
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcEFIAPI
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcVariableServiceSetVariable (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN CHAR16 *VariableName,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN EFI_GUID *VendorGuid,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN UINT32 Attributes,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN UINTN DataSize,
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang IN VOID *Data
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc/**
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc This code returns information about the EFI variables.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
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
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.
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang**/
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFI_STATUS
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker FangEFIAPI
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcVariableServiceQueryVariableInfo (
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc IN UINT32 Attributes,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc OUT UINT64 *MaximumVariableStorageSize,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc OUT UINT64 *RemainingVariableStorageSize,
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc OUT UINT64 *MaximumVariableSize
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc );
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxcextern VARIABLE_MODULE_GLOBAL *mVariableModuleGlobal;
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang#endif
e2cf88ac9d753a00c17aa235f6afdc76574fe3a6Quaker Fang