X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FVariable%2FRuntimeDxe%2FVariable.h;h=ac71f0c957ad8e77687cd92ec4ef902fe1079c75;hp=22aa5004cadeed0bb5182e4b35b0ab6cb3de5191;hb=fea55a166188d251e1f60ab2ba58c2dccdd11fb2;hpb=0f7aff7249ac162915c6869f30e50a9d6b33b61c diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h index 22aa5004ca..ac71f0c957 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h @@ -3,7 +3,7 @@ The internal header file includes the common header files, defines internal structure and functions used by Variable modules. -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2014, 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 @@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include #include @@ -37,8 +38,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include +#include +#include -#define VARIABLE_RECLAIM_THRESHOLD (1024) +#define VARIABLE_ATTRIBUTE_BS_RT (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS) +#define VARIABLE_ATTRIBUTE_NV_BS_RT (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_NON_VOLATILE) +#define VARIABLE_ATTRIBUTE_NV_BS_RT_AT (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) + +typedef struct { + CHAR16 *Name; + UINT32 Attributes; +} GLOBAL_VARIABLE_ENTRY; /// /// The size of a 3 character ISO639 language code. @@ -54,6 +65,13 @@ typedef enum { typedef struct { VARIABLE_HEADER *CurrPtr; + // + // If both ADDED and IN_DELETED_TRANSITION variable are present, + // InDeletedTransitionPtr will point to the IN_DELETED_TRANSITION one. + // Otherwise, CurrPtr will point to the ADDED or IN_DELETED_TRANSITION one, + // and InDeletedTransitionPtr will be NULL at the same time. + // + VARIABLE_HEADER *InDeletedTransitionPtr; VARIABLE_HEADER *EndPtr; VARIABLE_HEADER *StartPtr; BOOLEAN Volatile; @@ -83,10 +101,27 @@ typedef struct { typedef struct { EFI_GUID *Guid; CHAR16 *Name; - UINT32 Attributes; - UINTN DataSize; - VOID *Data; -} VARIABLE_CACHE_ENTRY; + UINTN VariableSize; +} VARIABLE_ENTRY_CONSISTENCY; + +typedef struct { + EFI_GUID Guid; + CHAR16 *Name; + LIST_ENTRY Link; +} VARIABLE_ENTRY; + +/** + Flush the HOB variable to flash. + + @param[in] VariableName Name of variable has been updated or deleted. + @param[in] VendorGuid Guid of variable has been updated or deleted. + +**/ +VOID +FlushHobVariableToFlash ( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid + ); /** Writes a buffer to variable storage space, in the working block. @@ -96,8 +131,7 @@ typedef struct { VariableBase. Fault Tolerant Write protocol is used for writing. @param VariableBase Base address of the variable to write. - @param Buffer Point to the data buffer. - @param BufferSize The number of bytes of the data Buffer. + @param VariableBuffer Point to the variable data buffer. @retval EFI_SUCCESS The function completed successfully. @retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol. @@ -107,8 +141,7 @@ typedef struct { EFI_STATUS FtwVariableSpace ( IN EFI_PHYSICAL_ADDRESS VariableBase, - IN UINT8 *Buffer, - IN UINTN BufferSize + IN VARIABLE_STORE_HEADER *VariableBuffer ); @@ -126,7 +159,7 @@ FtwVariableSpace ( @param[in] Attributes Attribues of the variable. - @param[in] Variable The variable information that is used to keep track of variable usage. + @param[in, out] Variable The variable information that is used to keep track of variable usage. @retval EFI_SUCCESS The update operation is success. @@ -140,7 +173,7 @@ UpdateVariable ( IN VOID *Data, IN UINTN DataSize, IN UINT32 Attributes OPTIONAL, - IN VARIABLE_POINTER_TRACK *Variable + IN OUT VARIABLE_POINTER_TRACK *Variable ); @@ -408,6 +441,31 @@ VariableServiceSetVariable ( IN VOID *Data ); +/** + + This code returns information about the EFI variables. + + @param Attributes Attributes bitmask to specify the type of variables + on which to return information. + @param MaximumVariableStorageSize Pointer to the maximum size of the storage space available + for the EFI variables associated with the attributes specified. + @param RemainingVariableStorageSize Pointer to the remaining size of the storage space available + for EFI variables associated with the attributes specified. + @param MaximumVariableSize Pointer to the maximum size of an individual EFI variables + associated with the attributes specified. + + @return EFI_SUCCESS Query successfully. + +**/ +EFI_STATUS +EFIAPI +VariableServiceQueryVariableInfoInternal ( + IN UINT32 Attributes, + OUT UINT64 *MaximumVariableStorageSize, + OUT UINT64 *RemainingVariableStorageSize, + OUT UINT64 *MaximumVariableSize + ); + /** This code returns information about the EFI variables. @@ -434,7 +492,30 @@ VariableServiceQueryVariableInfo ( OUT UINT64 *RemainingVariableStorageSize, OUT UINT64 *MaximumVariableSize ); - + +/** + Mark a variable that will become read-only after leaving the DXE phase of execution. + + @param[in] This The VARIABLE_LOCK_PROTOCOL instance. + @param[in] VariableName A pointer to the variable name that will be made read-only subsequently. + @param[in] VendorGuid A pointer to the vendor GUID that will be made read-only subsequently. + + @retval EFI_SUCCESS The variable specified by the VariableName and the VendorGuid was marked + as pending to be read-only. + @retval EFI_INVALID_PARAMETER VariableName or VendorGuid is NULL. + Or VariableName is an empty string. + @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has + already been signaled. + @retval EFI_OUT_OF_RESOURCES There is not enough resource to hold the lock request. +**/ +EFI_STATUS +EFIAPI +VariableLockRequestToLock ( + IN CONST EDKII_VARIABLE_LOCK_PROTOCOL *This, + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid + ); + extern VARIABLE_MODULE_GLOBAL *mVariableModuleGlobal; #endif