]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Variable/Pei/Variable.h
MdeModulePkg Variable: Abstract GetHobVariableStore function
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / Pei / Variable.h
index e0d8679d63442d198965e61d9f8d75531f08a46e..9e47ccf5ee3de0ffcd1e3bd267add64b593f2333 100644 (file)
@@ -1,9 +1,8 @@
 /** @file\r
-\r
   The internal header file includes the common header files, defines\r
   internal structure and functions used by PeiVariable module.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, 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
@@ -31,6 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/VariableFormat.h>\r
 #include <Guid/VariableIndexTable.h>\r
 #include <Guid/SystemNvDataGuid.h>\r
+#include <Guid/FaultTolerantWrite.h>\r
 \r
 typedef enum {\r
   VariableStoreTypeHob,\r
@@ -38,13 +38,25 @@ typedef enum {
   VariableStoreTypeMax\r
 } VARIABLE_STORE_TYPE;\r
 \r
+typedef struct {\r
+  VARIABLE_STORE_HEADER                   *VariableStoreHeader;\r
+  VARIABLE_INDEX_TABLE                    *IndexTable;\r
+  //\r
+  // If it is not NULL, it means there may be an inconsecutive variable whose\r
+  // partial content is still in NV storage, but another partial content is backed up\r
+  // in spare block.\r
+  //\r
+  FAULT_TOLERANT_WRITE_LAST_WRITE_DATA    *FtwLastWriteData;\r
+  BOOLEAN                                 AuthFlag;\r
+} VARIABLE_STORE_INFO;\r
+\r
 //\r
 // Functions\r
 //\r
 /**\r
   Provide the functionality of the variable services.\r
-  \r
-  @param  FileHandle  Handle of the file being invoked. \r
+\r
+  @param  FileHandle  Handle of the file being invoked.\r
                       Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().\r
   @param  PeiServices  General purpose services available to every PEIM.\r
 \r
@@ -62,7 +74,7 @@ PeimInitializeVariableServices (
 /**\r
   This service retrieves a variable's value using its name and GUID.\r
 \r
-  Read the specified variable from the UEFI variable store. If the Data \r
+  Read the specified variable from the UEFI variable store. If the Data\r
   buffer is too small to hold the contents of the variable, the error\r
   EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer\r
   size to obtain the data.\r
@@ -75,11 +87,12 @@ PeimInitializeVariableServices (
   @param  DataSize              On entry, points to the size in bytes of the Data buffer.\r
                                 On return, points to the size of the data returned in Data.\r
   @param  Data                  Points to the buffer which will hold the returned variable value.\r
+                                May be NULL with a zero DataSize in order to determine the size of the buffer needed.\r
 \r
   @retval EFI_SUCCESS           The variable was read successfully.\r
-  @retval EFI_NOT_FOUND         The variable could not be found.\r
-  @retval EFI_BUFFER_TOO_SMALL  The DataSize is too small for the resulting data. \r
-                                DataSize is updated with the size required for \r
+  @retval EFI_NOT_FOUND         The variable was not found.\r
+  @retval EFI_BUFFER_TOO_SMALL  The DataSize is too small for the resulting data.\r
+                                DataSize is updated with the size required for\r
                                 the specified variable.\r
   @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.\r
   @retval EFI_DEVICE_ERROR      The variable could not be retrieved because of a device error.\r
@@ -93,17 +106,17 @@ PeiGetVariable (
   IN CONST  EFI_GUID                        *VariableGuid,\r
   OUT       UINT32                          *Attributes,\r
   IN OUT    UINTN                           *DataSize,\r
-  OUT       VOID                            *Data\r
+  OUT       VOID                            *Data OPTIONAL\r
   );\r
 \r
 /**\r
   Return the next variable name and GUID.\r
 \r
-  This function is called multiple times to retrieve the VariableName \r
-  and VariableGuid of all variables currently available in the system. \r
-  On each call, the previous results are passed into the interface, \r
-  and, on return, the interface returns the data for the next \r
-  interface. When the entire variable list has been returned, \r
+  This function is called multiple times to retrieve the VariableName\r
+  and VariableGuid of all variables currently available in the system.\r
+  On each call, the previous results are passed into the interface,\r
+  and, on return, the interface returns the data for the next\r
+  interface. When the entire variable list has been returned,\r
   EFI_NOT_FOUND is returned.\r
 \r
   @param  This              A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
@@ -112,7 +125,7 @@ PeiGetVariable (
   @param  VariableName      On entry, a pointer to a null-terminated string that is the variable's name.\r
                             On return, points to the next variable's null-terminated name string.\r
 \r
-  @param  VariableGuid      On entry, a pointer to an UEFI _GUID that is the variable's GUID. \r
+  @param  VariableGuid      On entry, a pointer to an UEFI _GUID that is the variable's GUID.\r
                             On return, a pointer to the next variable's GUID.\r
 \r
   @retval EFI_SUCCESS           The variable was read successfully.\r