]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h
Calculate enough space for 2 variables (public key and variable data) instead of...
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / RuntimeDxe / Variable.h
index 5cb20f28233caa4805f8e31dfca2534e4d1f9a6d..ac71f0c957ad8e77687cd92ec4ef902fe1079c75 100644 (file)
@@ -1,7 +1,10 @@
-/*++\r
+/** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+  The internal header file includes the common header files, defines\r
+  internal structure and functions used by Variable modules.\r
+\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -9,162 +12,510 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-  Variable.h\r
-\r
-Abstract:\r
-\r
---*/\r
+**/\r
 \r
-#ifndef _VARIABLE_H\r
-#define _VARIABLE_H\r
+#ifndef _VARIABLE_H_\r
+#define _VARIABLE_H_\r
 \r
 #include <PiDxe.h>\r
 #include <Protocol/VariableWrite.h>\r
-#include <Protocol/FaultTolerantWriteLite.h>\r
+#include <Protocol/FaultTolerantWrite.h>\r
 #include <Protocol/FirmwareVolumeBlock.h>\r
 #include <Protocol/Variable.h>\r
+#include <Protocol/VariableLock.h>\r
 #include <Library/PcdLib.h>\r
+#include <Library/HobLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/DxeServicesTableLib.h>\r
 #include <Library/UefiRuntimeLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
-#include <Library/FvbServiceLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/BaseLib.h>\r
+#include <Library/SynchronizationLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
-#include <Library/HobLib.h>\r
-#include <Guid/FlashMapHob.h>\r
-#include <VariableFormat.h>\r
+#include <Guid/GlobalVariable.h>\r
+#include <Guid/EventGroup.h>\r
+#include <Guid/VariableFormat.h>\r
+#include <Guid/SystemNvDataGuid.h>\r
+#include <Guid/FaultTolerantWrite.h>\r
+#include <Guid/HardwareErrorVariable.h>\r
 \r
-#define VARIABLE_RECLAIM_THRESHOLD (1024)\r
+#define VARIABLE_ATTRIBUTE_BS_RT        (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT     (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_NON_VOLATILE)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT_AT  (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)\r
 \r
-#define VARIABLE_STORE_SIZE (64 * 1024)\r
-#define SCRATCH_SIZE        (4 * 1024)\r
-\r
-//\r
-// Define GET_PAD_SIZE to optimize compiler\r
-//\r
-#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))\r
-#define GET_PAD_SIZE(a) (0)\r
-#else\r
-#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
-#endif\r
+typedef struct {\r
+  CHAR16      *Name;\r
+  UINT32      Attributes;\r
+} GLOBAL_VARIABLE_ENTRY;\r
 \r
-#define GET_VARIABLE_NAME_PTR(a)  (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
+///\r
+/// The size of a 3 character ISO639 language code.\r
+///\r
+#define ISO_639_2_ENTRY_SIZE    3\r
 \r
 typedef enum {\r
-  Physical,\r
-  Virtual\r
-} VARIABLE_POINTER_TYPE;\r
+  VariableStoreTypeVolatile,\r
+  VariableStoreTypeHob,\r
+  VariableStoreTypeNv,\r
+  VariableStoreTypeMax\r
+} VARIABLE_STORE_TYPE;\r
 \r
 typedef struct {\r
   VARIABLE_HEADER *CurrPtr;\r
+  //\r
+  // If both ADDED and IN_DELETED_TRANSITION variable are present,\r
+  // InDeletedTransitionPtr will point to the IN_DELETED_TRANSITION one.\r
+  // Otherwise, CurrPtr will point to the ADDED or IN_DELETED_TRANSITION one,\r
+  // and InDeletedTransitionPtr will be NULL at the same time.\r
+  //\r
+  VARIABLE_HEADER *InDeletedTransitionPtr;\r
   VARIABLE_HEADER *EndPtr;\r
   VARIABLE_HEADER *StartPtr;\r
   BOOLEAN         Volatile;\r
 } VARIABLE_POINTER_TRACK;\r
 \r
 typedef struct {\r
+  EFI_PHYSICAL_ADDRESS  HobVariableBase;\r
   EFI_PHYSICAL_ADDRESS  VolatileVariableBase;\r
   EFI_PHYSICAL_ADDRESS  NonVolatileVariableBase;\r
   EFI_LOCK              VariableServicesLock;\r
+  UINT32                ReentrantState;\r
 } VARIABLE_GLOBAL;\r
 \r
 typedef struct {\r
-  VARIABLE_GLOBAL VariableGlobal[2];\r
+  VARIABLE_GLOBAL VariableGlobal;\r
   UINTN           VolatileLastVariableOffset;\r
   UINTN           NonVolatileLastVariableOffset;\r
-  UINT32          FvbInstance;\r
-} ESAL_VARIABLE_GLOBAL;\r
+  UINTN           CommonVariableTotalSize;\r
+  UINTN           HwErrVariableTotalSize;\r
+  CHAR8           *PlatformLangCodes;\r
+  CHAR8           *LangCodes;\r
+  CHAR8           *PlatformLang;\r
+  CHAR8           Lang[ISO_639_2_ENTRY_SIZE + 1];\r
+  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbInstance;\r
+} VARIABLE_MODULE_GLOBAL;\r
+\r
+typedef struct {\r
+  EFI_GUID    *Guid;\r
+  CHAR16      *Name;\r
+  UINTN       VariableSize;\r
+} VARIABLE_ENTRY_CONSISTENCY;\r
+\r
+typedef struct {\r
+  EFI_GUID    Guid;\r
+  CHAR16      *Name;\r
+  LIST_ENTRY  Link;\r
+} VARIABLE_ENTRY;\r
+\r
+/**\r
+  Flush the HOB variable to flash.\r
 \r
-extern ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;\r
+  @param[in] VariableName       Name of variable has been updated or deleted.\r
+  @param[in] VendorGuid         Guid of variable has been updated or deleted.\r
 \r
-//\r
-// Functions\r
-//\r
+**/\r
+VOID\r
+FlushHobVariableToFlash (\r
+  IN CHAR16                     *VariableName,\r
+  IN EFI_GUID                   *VendorGuid\r
+  );\r
+\r
+/**\r
+  Writes a buffer to variable storage space, in the working block.\r
+\r
+  This function writes a buffer to variable storage space into a firmware\r
+  volume block device. The destination is specified by the parameter\r
+  VariableBase. Fault Tolerant Write protocol is used for writing.\r
+\r
+  @param  VariableBase   Base address of the variable to write.\r
+  @param  VariableBuffer Point to the variable data buffer.\r
+\r
+  @retval EFI_SUCCESS    The function completed successfully.\r
+  @retval EFI_NOT_FOUND  Fail to locate Fault Tolerant Write protocol.\r
+  @retval EFI_ABORTED    The function could not complete successfully.\r
+\r
+**/\r
 EFI_STATUS\r
-EFIAPI\r
-VariableCommonInitialize (\r
-  IN EFI_HANDLE         ImageHandle,\r
-  IN EFI_SYSTEM_TABLE   *SystemTable\r
+FtwVariableSpace (\r
+  IN EFI_PHYSICAL_ADDRESS   VariableBase,\r
+  IN VARIABLE_STORE_HEADER  *VariableBuffer\r
   );\r
 \r
+\r
+/**\r
+  Update the variable region with Variable information. These are the same \r
+  arguments as the EFI Variable services.\r
+\r
+  @param[in] VariableName       Name of variable.\r
+\r
+  @param[in] VendorGuid         Guid of variable.\r
+\r
+  @param[in] Data               Variable data.\r
+\r
+  @param[in] DataSize           Size of data. 0 means delete.\r
+\r
+  @param[in] Attributes         Attribues of the variable.\r
+\r
+  @param[in, out] Variable      The variable information that is used to keep track of variable usage.\r
+\r
+  @retval EFI_SUCCESS           The update operation is success.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Variable region is full, cannot write other data into this region.\r
+\r
+**/\r
 EFI_STATUS\r
-EFIAPI\r
-VariableServiceInitialize (\r
-  IN EFI_HANDLE         ImageHandle,\r
-  IN EFI_SYSTEM_TABLE   *SystemTable\r
+UpdateVariable (\r
+  IN      CHAR16          *VariableName,\r
+  IN      EFI_GUID        *VendorGuid,\r
+  IN      VOID            *Data,\r
+  IN      UINTN           DataSize,\r
+  IN      UINT32          Attributes OPTIONAL,\r
+  IN OUT  VARIABLE_POINTER_TRACK *Variable\r
+  );\r
+\r
+\r
+/**\r
+  Return TRUE if ExitBootServices () has been called.\r
+  \r
+  @retval TRUE If ExitBootServices () has been called.\r
+**/\r
+BOOLEAN\r
+AtRuntime (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Initializes a basic mutual exclusion lock.\r
+\r
+  This function initializes a basic mutual exclusion lock to the released state \r
+  and returns the lock.  Each lock provides mutual exclusion access at its task \r
+  priority level.  Since there is no preemption or multiprocessor support in EFI,\r
+  acquiring the lock only consists of raising to the locks TPL.\r
+  If Lock is NULL, then ASSERT().\r
+  If Priority is not a valid TPL value, then ASSERT().\r
+\r
+  @param  Lock       A pointer to the lock data structure to initialize.\r
+  @param  Priority   EFI TPL is associated with the lock.\r
+\r
+  @return The lock.\r
+\r
+**/\r
+EFI_LOCK *\r
+InitializeLock (\r
+  IN OUT EFI_LOCK  *Lock,\r
+  IN EFI_TPL        Priority\r
   );\r
 \r
+  \r
+/**\r
+  Acquires lock only at boot time. Simply returns at runtime.\r
+\r
+  This is a temperary function that will be removed when\r
+  EfiAcquireLock() in UefiLib can handle the call in UEFI\r
+  Runtimer driver in RT phase.\r
+  It calls EfiAcquireLock() at boot time, and simply returns\r
+  at runtime.\r
+\r
+  @param  Lock         A pointer to the lock to acquire.\r
+\r
+**/\r
 VOID\r
-EFIAPI\r
-VariableClassAddressChangeEvent (\r
-  IN EFI_EVENT        Event,\r
-  IN VOID             *Context\r
+AcquireLockOnlyAtBootTime (\r
+  IN EFI_LOCK  *Lock\r
+  );\r
+\r
+\r
+/**\r
+  Releases lock only at boot time. Simply returns at runtime.\r
+\r
+  This is a temperary function which will be removed when\r
+  EfiReleaseLock() in UefiLib can handle the call in UEFI\r
+  Runtimer driver in RT phase.\r
+  It calls EfiReleaseLock() at boot time and simply returns\r
+  at runtime.\r
+\r
+  @param  Lock         A pointer to the lock to release.\r
+\r
+**/\r
+VOID\r
+ReleaseLockOnlyAtBootTime (\r
+  IN EFI_LOCK  *Lock\r
+  );  \r
+\r
+/**\r
+  Retrive the FVB protocol interface by HANDLE.\r
+\r
+  @param[in]  FvBlockHandle     The handle of FVB protocol that provides services for\r
+                                reading, writing, and erasing the target block.\r
+  @param[out] FvBlock           The interface of FVB protocol\r
+\r
+  @retval EFI_SUCCESS           The interface information for the specified protocol was returned.\r
+  @retval EFI_UNSUPPORTED       The device does not support the FVB protocol.\r
+  @retval EFI_INVALID_PARAMETER FvBlockHandle is not a valid EFI_HANDLE or FvBlock is NULL.\r
+  \r
+**/\r
+EFI_STATUS\r
+GetFvbByHandle (\r
+  IN  EFI_HANDLE                          FvBlockHandle,\r
+  OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  **FvBlock\r
+  );\r
+\r
+\r
+/**\r
+  Retrive the Swap Address Range protocol interface.\r
+\r
+  @param[out] SarProtocol       The interface of SAR protocol\r
+\r
+  @retval EFI_SUCCESS           The SAR protocol instance was found and returned in SarProtocol.\r
+  @retval EFI_NOT_FOUND         The SAR protocol instance was not found.\r
+  @retval EFI_INVALID_PARAMETER SarProtocol is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+GetSarProtocol (\r
+  OUT VOID                                **SarProtocol\r
+  );\r
+\r
+/**\r
+  Function returns an array of handles that support the FVB protocol\r
+  in a buffer allocated from pool. \r
+\r
+  @param[out]  NumberHandles    The number of handles returned in Buffer.\r
+  @param[out]  Buffer           A pointer to the buffer to return the requested\r
+                                array of  handles that support FVB protocol.\r
+\r
+  @retval EFI_SUCCESS           The array of handles was returned in Buffer, and the number of\r
+                                handles in Buffer was returned in NumberHandles.\r
+  @retval EFI_NOT_FOUND         No FVB handle was found.\r
+  @retval EFI_OUT_OF_RESOURCES  There is not enough pool memory to store the matching results.\r
+  @retval EFI_INVALID_PARAMETER NumberHandles is NULL or Buffer is NULL.\r
+  \r
+**/\r
+EFI_STATUS\r
+GetFvbCountAndBuffer (\r
+  OUT UINTN                               *NumberHandles,\r
+  OUT EFI_HANDLE                          **Buffer\r
+  );\r
+\r
+/**\r
+  Initializes variable store area for non-volatile and volatile variable.\r
+\r
+  @retval EFI_SUCCESS           Function successfully executed.\r
+  @retval EFI_OUT_OF_RESOURCES  Fail to allocate enough memory resource.\r
+\r
+**/\r
+EFI_STATUS\r
+VariableCommonInitialize (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  This function reclaims variable storage if free size is below the threshold.\r
+  \r
+**/\r
+VOID\r
+ReclaimForOS(\r
+  VOID\r
+  );  \r
+\r
+\r
+/**\r
+  Initializes variable write service after FVB was ready.\r
+\r
+  @retval EFI_SUCCESS          Function successfully executed.\r
+  @retval Others               Fail to initialize the variable service.\r
+\r
+**/\r
+EFI_STATUS\r
+VariableWriteServiceInitialize (\r
+  VOID\r
+  );\r
+  \r
+/**\r
+  Retrive the SMM Fault Tolerent Write protocol interface.\r
+\r
+  @param[out] FtwProtocol       The interface of SMM Ftw protocol\r
+\r
+  @retval EFI_SUCCESS           The SMM SAR protocol instance was found and returned in SarProtocol.\r
+  @retval EFI_NOT_FOUND         The SMM SAR protocol instance was not found.\r
+  @retval EFI_INVALID_PARAMETER SarProtocol is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+GetFtwProtocol (\r
+  OUT VOID                                **FtwProtocol\r
+  );\r
+\r
+/**\r
+  Get the proper fvb handle and/or fvb protocol by the given Flash address.\r
+\r
+  @param[in] Address        The Flash address.\r
+  @param[out] FvbHandle     In output, if it is not NULL, it points to the proper FVB handle.\r
+  @param[out] FvbProtocol   In output, if it is not NULL, it points to the proper FVB protocol.\r
+\r
+**/\r
+EFI_STATUS\r
+GetFvbInfoByAddress (\r
+  IN  EFI_PHYSICAL_ADDRESS                Address,\r
+  OUT EFI_HANDLE                          *FvbHandle OPTIONAL,\r
+  OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  **FvbProtocol OPTIONAL\r
   );\r
 \r
+/**\r
+\r
+  This code finds variable in storage blocks (Volatile or Non-Volatile).\r
+\r
+  @param VariableName               Name of Variable to be found.\r
+  @param VendorGuid                 Variable vendor GUID.\r
+  @param Attributes                 Attribute value of the variable found.\r
+  @param DataSize                   Size of Data found. If size is less than the\r
+                                    data, this value contains the required size.\r
+  @param Data                       Data pointer.\r
+                      \r
+  @return EFI_INVALID_PARAMETER     Invalid parameter.\r
+  @return EFI_SUCCESS               Find the specified variable.\r
+  @return EFI_NOT_FOUND             Not found.\r
+  @return EFI_BUFFER_TO_SMALL       DataSize is too small for the result.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-GetVariable (\r
+VariableServiceGetVariable (\r
   IN      CHAR16            *VariableName,\r
-  IN      EFI_GUID          * VendorGuid,\r
+  IN      EFI_GUID          *VendorGuid,\r
   OUT     UINT32            *Attributes OPTIONAL,\r
   IN OUT  UINTN             *DataSize,\r
-  OUT     VOID              *Data,\r
-  IN      VARIABLE_GLOBAL   * Global,\r
-  IN      UINT32            Instance\r
+  OUT     VOID              *Data\r
   );\r
 \r
+/**\r
+\r
+  This code Finds the Next available variable.\r
+\r
+  @param VariableNameSize           Size of the variable name.\r
+  @param VariableName               Pointer to variable name.\r
+  @param VendorGuid                 Variable Vendor Guid.\r
+\r
+  @return EFI_INVALID_PARAMETER     Invalid parameter.\r
+  @return EFI_SUCCESS               Find the specified variable.\r
+  @return EFI_NOT_FOUND             Not found.\r
+  @return EFI_BUFFER_TO_SMALL       DataSize is too small for the result.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-GetNextVariableName (\r
+VariableServiceGetNextVariableName (\r
   IN OUT  UINTN             *VariableNameSize,\r
   IN OUT  CHAR16            *VariableName,\r
-  IN OUT  EFI_GUID          *VendorGuid,\r
-  IN      VARIABLE_GLOBAL   *Global,\r
-  IN      UINT32            Instance\r
+  IN OUT  EFI_GUID          *VendorGuid\r
   );\r
 \r
+/**\r
+\r
+  This code sets variable in storage blocks (Volatile or Non-Volatile).\r
+\r
+  @param VariableName                     Name of Variable to be found.\r
+  @param VendorGuid                       Variable vendor GUID.\r
+  @param Attributes                       Attribute value of the variable found\r
+  @param DataSize                         Size of Data found. If size is less than the\r
+                                          data, this value contains the required size.\r
+  @param Data                             Data pointer.\r
+\r
+  @return EFI_INVALID_PARAMETER           Invalid parameter.\r
+  @return EFI_SUCCESS                     Set successfully.\r
+  @return EFI_OUT_OF_RESOURCES            Resource not enough to set variable.\r
+  @return EFI_NOT_FOUND                   Not found.\r
+  @return EFI_WRITE_PROTECTED             Variable is read-only.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-SetVariable (\r
+VariableServiceSetVariable (\r
   IN CHAR16                  *VariableName,\r
   IN EFI_GUID                *VendorGuid,\r
   IN UINT32                  Attributes,\r
   IN UINTN                   DataSize,\r
-  IN VOID                    *Data,\r
-  IN VARIABLE_GLOBAL         *Global,\r
-  IN UINTN                   *VolatileOffset,\r
-  IN UINTN                   *NonVolatileOffset,\r
-  IN UINT32                  Instance\r
+  IN VOID                    *Data\r
   );\r
 \r
+/**\r
+\r
+  This code returns information about the EFI variables.\r
+\r
+  @param Attributes                     Attributes bitmask to specify the type of variables\r
+                                        on which to return information.\r
+  @param MaximumVariableStorageSize     Pointer to the maximum size of the storage space available\r
+                                        for the EFI variables associated with the attributes specified.\r
+  @param RemainingVariableStorageSize   Pointer to the remaining size of the storage space available\r
+                                        for EFI variables associated with the attributes specified.\r
+  @param MaximumVariableSize            Pointer to the maximum size of an individual EFI variables\r
+                                        associated with the attributes specified.\r
+\r
+  @return EFI_SUCCESS                   Query successfully.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-QueryVariableInfo (\r
+VariableServiceQueryVariableInfoInternal (\r
   IN  UINT32                 Attributes,\r
   OUT UINT64                 *MaximumVariableStorageSize,\r
   OUT UINT64                 *RemainingVariableStorageSize,\r
-  OUT UINT64                 *MaximumVariableSize,\r
-  IN  VARIABLE_GLOBAL        *Global,\r
-  IN  UINT32                 Instance\r
+  OUT UINT64                 *MaximumVariableSize\r
   );\r
 \r
+/**\r
+\r
+  This code returns information about the EFI variables.\r
+\r
+  @param Attributes                     Attributes bitmask to specify the type of variables\r
+                                        on which to return information.\r
+  @param MaximumVariableStorageSize     Pointer to the maximum size of the storage space available\r
+                                        for the EFI variables associated with the attributes specified.\r
+  @param RemainingVariableStorageSize   Pointer to the remaining size of the storage space available\r
+                                        for EFI variables associated with the attributes specified.\r
+  @param MaximumVariableSize            Pointer to the maximum size of an individual EFI variables\r
+                                        associated with the attributes specified.\r
+\r
+  @return EFI_INVALID_PARAMETER         An invalid combination of attribute bits was supplied.\r
+  @return EFI_SUCCESS                   Query successfully.\r
+  @return EFI_UNSUPPORTED               The attribute is not supported on this platform.\r
+\r
+**/\r
 EFI_STATUS\r
-GetFvbHandleByAddress (\r
-  IN  EFI_PHYSICAL_ADDRESS   VariableStoreBase,\r
-  OUT EFI_HANDLE             *FvbHandle\r
-  );\r
+EFIAPI\r
+VariableServiceQueryVariableInfo (\r
+  IN  UINT32                 Attributes,\r
+  OUT UINT64                 *MaximumVariableStorageSize,\r
+  OUT UINT64                 *RemainingVariableStorageSize,\r
+  OUT UINT64                 *MaximumVariableSize\r
+  );  \r
+\r
+/**\r
+  Mark a variable that will become read-only after leaving the DXE phase of execution.\r
+\r
+  @param[in] This          The VARIABLE_LOCK_PROTOCOL instance.\r
+  @param[in] VariableName  A pointer to the variable name that will be made read-only subsequently.\r
+  @param[in] VendorGuid    A pointer to the vendor GUID that will be made read-only subsequently.\r
 \r
+  @retval EFI_SUCCESS           The variable specified by the VariableName and the VendorGuid was marked\r
+                                as pending to be read-only.\r
+  @retval EFI_INVALID_PARAMETER VariableName or VendorGuid is NULL.\r
+                                Or VariableName is an empty string.\r
+  @retval EFI_ACCESS_DENIED     EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has\r
+                                already been signaled.\r
+  @retval EFI_OUT_OF_RESOURCES  There is not enough resource to hold the lock request.\r
+**/\r
 EFI_STATUS\r
-FtwVariableSpace (\r
-  IN EFI_PHYSICAL_ADDRESS   VariableBaseAddress,\r
-  IN UINT8                  *Buffer,\r
-  IN UINTN                  BufferSize\r
+EFIAPI\r
+VariableLockRequestToLock (\r
+  IN CONST EDKII_VARIABLE_LOCK_PROTOCOL *This,\r
+  IN       CHAR16                       *VariableName,\r
+  IN       EFI_GUID                     *VendorGuid\r
   );\r
 \r
+extern VARIABLE_MODULE_GLOBAL  *mVariableModuleGlobal;\r
+\r
 #endif\r