X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FVariable%2FRuntimeDxe%2FVariable.h;h=7a3a5f34deab49838121ba2d0d159c763c75325c;hb=7cd69959463ac9c761163ed8e8a93907b68e70da;hp=9928837fd834523b47e83213a7069897925b1161;hpb=fa0737a839d070be2a53016a16abba29502b2510;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h index 9928837fd8..7a3a5f34de 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h @@ -2,7 +2,7 @@ The internal header file includes the common header files, defines internal structure and functions used by Variable modules. -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, 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 @@ -36,20 +36,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include #include -#include #include #include -#include #include +#include "PrivilegePolymorphic.h" + +#define NV_STORAGE_VARIABLE_BASE (EFI_PHYSICAL_ADDRESS) \ + (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0 ? \ + PcdGet64 (PcdFlashNvStorageVariableBase64) : \ + PcdGet32 (PcdFlashNvStorageVariableBase)) + #define EFI_VARIABLE_ATTRIBUTES_MASK (EFI_VARIABLE_NON_VOLATILE | \ EFI_VARIABLE_BOOTSERVICE_ACCESS | \ EFI_VARIABLE_RUNTIME_ACCESS | \ EFI_VARIABLE_HARDWARE_ERROR_RECORD | \ - EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \ EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ EFI_VARIABLE_APPEND_WRITE) @@ -87,6 +92,7 @@ typedef struct { UINT32 ReentrantState; BOOLEAN AuthFormat; BOOLEAN AuthSupport; + BOOLEAN EmuNvMode; } VARIABLE_GLOBAL; typedef struct { @@ -101,6 +107,7 @@ typedef struct { UINTN HwErrVariableTotalSize; UINTN MaxVariableSize; UINTN MaxAuthVariableSize; + UINTN MaxVolatileVariableSize; UINTN ScratchBufferSize; CHAR8 *PlatformLangCodes; CHAR8 *LangCodes; @@ -109,12 +116,6 @@ typedef struct { EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbInstance; } VARIABLE_MODULE_GLOBAL; -typedef struct { - LIST_ENTRY Link; - EFI_GUID Guid; - //CHAR16 *Name; -} VARIABLE_ENTRY; - /** Flush the HOB variable to flash. @@ -396,7 +397,7 @@ ReleaseLockOnlyAtBootTime ( ); /** - Retrive the FVB protocol interface by HANDLE. + Retrieve the FVB protocol interface by HANDLE. @param[in] FvBlockHandle The handle of FVB protocol that provides services for reading, writing, and erasing the target block. @@ -467,7 +468,18 @@ GetNonVolatileMaxVariableSize ( ); /** - Initializes variable write service after FVB was ready. + Get maximum variable size, covering both non-volatile and volatile variables. + + @return Maximum variable size. + +**/ +UINTN +GetMaxVariableSize ( + VOID + ); + +/** + Initializes variable write service. @retval EFI_SUCCESS Function successfully executed. @retval Others Fail to initialize the variable service. @@ -479,7 +491,7 @@ VariableWriteServiceInitialize ( ); /** - Retrive the SMM Fault Tolerent Write protocol interface. + Retrieve the SMM Fault Tolerent Write protocol interface. @param[out] FtwProtocol The interface of SMM Ftw protocol @@ -521,7 +533,8 @@ GetFvbInfoByAddress ( @param Attributes Attribute value of the variable found. @param DataSize Size of Data found. If size is less than the data, this value contains the required size. - @param Data Data pointer. + @param Data The buffer to return the contents of the variable. May be NULL + with a zero DataSize in order to determine the size buffer needed. @return EFI_INVALID_PARAMETER Invalid parameter. @return EFI_SUCCESS Find the specified variable. @@ -536,7 +549,7 @@ VariableServiceGetVariable ( IN EFI_GUID *VendorGuid, OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, - OUT VOID *Data + OUT VOID *Data OPTIONAL ); /** @@ -549,8 +562,11 @@ VariableServiceGetVariable ( @param[in] VendorGuid Variable Vendor Guid. @param[out] VariablePtr Pointer to variable header address. - @return EFI_SUCCESS Find the specified variable. - @return EFI_NOT_FOUND Not found. + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NOT_FOUND The next variable was not found. + @retval EFI_INVALID_PARAMETER If VariableName is not an empty string, while VendorGuid is NULL. + @retval EFI_INVALID_PARAMETER The input values of VariableName and VendorGuid are not a name and + GUID of an existing variable. **/ EFI_STATUS @@ -568,14 +584,22 @@ VariableServiceGetNextVariableInternal ( Caution: This function may receive untrusted input. This function may be invoked in SMM mode. This function will do basic validation, before parse the data. - @param VariableNameSize Size of the variable name. + @param VariableNameSize The size of the VariableName buffer. The size must be large + enough to fit input string supplied in VariableName buffer. @param VariableName Pointer to variable name. @param VendorGuid Variable Vendor Guid. - @return EFI_INVALID_PARAMETER Invalid parameter. - @return EFI_SUCCESS Find the specified variable. - @return EFI_NOT_FOUND Not found. - @return EFI_BUFFER_TO_SMALL DataSize is too small for the result. + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NOT_FOUND The next variable was not found. + @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result. + VariableNameSize has been updated with the size needed to complete the request. + @retval EFI_INVALID_PARAMETER VariableNameSize is NULL. + @retval EFI_INVALID_PARAMETER VariableName is NULL. + @retval EFI_INVALID_PARAMETER VendorGuid is NULL. + @retval EFI_INVALID_PARAMETER The input values of VariableName and VendorGuid are not a name and + GUID of an existing variable. + @retval EFI_INVALID_PARAMETER Null-terminator is not found in the first VariableNameSize bytes of + the input VariableName buffer. **/ EFI_STATUS @@ -702,53 +726,6 @@ VariableLockRequestToLock ( IN EFI_GUID *VendorGuid ); -/** - Check if a Unicode character is a hexadecimal character. - - This function checks if a Unicode character is a - hexadecimal character. The valid hexadecimal character is - L'0' to L'9', L'a' to L'f', or L'A' to L'F'. - - - @param Char The character to check against. - - @retval TRUE If the Char is a hexadecmial character. - @retval FALSE If the Char is not a hexadecmial character. - -**/ -BOOLEAN -EFIAPI -IsHexaDecimalDigitCharacter ( - IN CHAR16 Char - ); - -/** - Internal SetVariable check. - - @param[in] VariableName Name of Variable to set. - @param[in] VendorGuid Variable vendor GUID. - @param[in] Attributes Attribute value of the variable. - @param[in] DataSize Size of Data to set. - @param[in] Data Data pointer. - - @retval EFI_SUCCESS The SetVariable check result was success. - @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID were supplied, - or the DataSize exceeds the minimum or maximum allowed, - or the Data value is not following UEFI spec for UEFI defined variables. - @retval EFI_WRITE_PROTECTED The variable in question is read-only. - @retval Others The return status from check handler. - -**/ -EFI_STATUS -EFIAPI -InternalVarCheckSetVariableCheck ( - IN CHAR16 *VariableName, - IN EFI_GUID *VendorGuid, - IN UINT32 Attributes, - IN UINTN DataSize, - IN VOID *Data - ); - /** Register SetVariable check handler. @@ -769,45 +746,6 @@ VarCheckRegisterSetVariableCheckHandler ( IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler ); -/** - Internal variable property get. - - @param[in] Name Pointer to the variable name. - @param[in] Guid Pointer to the vendor GUID. - @param[out] VariableProperty Pointer to the output variable property. - - @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully. - @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found. - -**/ -EFI_STATUS -EFIAPI -InternalVarCheckVariablePropertyGet ( - IN CHAR16 *Name, - IN EFI_GUID *Guid, - OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty - ); - -/** - Internal variable property set. - - @param[in] Name Pointer to the variable name. - @param[in] Guid Pointer to the vendor GUID. - @param[in] VariableProperty Pointer to the input variable property. - - @retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully. - @retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request. - -**/ -EFI_STATUS -EFIAPI -InternalVarCheckVariablePropertySet ( - IN CHAR16 *Name, - IN EFI_GUID *Guid, - IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty - ); - - /** Variable property set. @@ -860,9 +798,14 @@ InitializeVariableQuota ( VOID ); -extern VARIABLE_MODULE_GLOBAL *mVariableModuleGlobal; +extern VARIABLE_MODULE_GLOBAL *mVariableModuleGlobal; +extern EFI_FIRMWARE_VOLUME_HEADER *mNvFvHeaderCache; +extern VARIABLE_STORE_HEADER *mNvVariableCache; +extern VARIABLE_INFO_ENTRY *gVariableInfo; +extern BOOLEAN mEndOfDxe; +extern VAR_CHECK_REQUEST_SOURCE mRequestSource; -extern AUTH_VAR_LIB_CONTEXT_OUT mContextOut; +extern AUTH_VAR_LIB_CONTEXT_OUT mAuthContextOut; /** Finds variable in storage blocks of volatile and non-volatile storage areas.