]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Variable/EmuRuntimeDxe/Variable.h
MdeModulePkg Variable: Update GetNextVariableName to follow UEFI 2.7
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / EmuRuntimeDxe / Variable.h
index 482a192a381eb4de6e64e44fe65ed59846d7be87..985f56791909137dd26f8a1c53a631f90e81d468 100644 (file)
@@ -3,8 +3,8 @@
   The internal header file includes the common header files, defines\r
   internal structure and functions used by EmuVariable module.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\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
 http://opensource.org/licenses/bsd-license.php\r
@@ -31,12 +31,19 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/PcdLib.h>\r
-#include <VariableFormat.h>\r
+#include <Library/HobLib.h>\r
+#include <Guid/VariableFormat.h>\r
+#include <Guid/GlobalVariable.h>\r
 \r
 #include <Guid/EventGroup.h>\r
 \r
 #define GET_VARIABLE_NAME_PTR(a)  (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
 \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
@@ -59,7 +66,12 @@ typedef struct {
   VARIABLE_GLOBAL VariableGlobal[2];\r
   UINTN           VolatileLastVariableOffset;\r
   UINTN           NonVolatileLastVariableOffset;\r
-  UINT32          FvbInstance;\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
 } ESAL_VARIABLE_GLOBAL;\r
 \r
 ///\r
@@ -138,7 +150,6 @@ VariableClassAddressChangeEvent (
   @param  Data                   On input, the size in bytes of the return Data buffer.  \r
                                  On output, the size of data returned in Data.\r
   @param  Global                 Pointer to VARIABLE_GLOBAL structure\r
-  @param  Instance               Instance of the Firmware Volume.\r
 \r
   @retval EFI_SUCCESS            The function completed successfully. \r
   @retval EFI_NOT_FOUND          The variable was not found.\r
@@ -149,43 +160,45 @@ VariableClassAddressChangeEvent (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-GetVariable (\r
+EmuGetVariable (\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
+  IN      VARIABLE_GLOBAL   *Global\r
   );\r
 \r
 /**\r
 \r
   This code finds the next available variable.\r
 \r
-  @param  VariableNameSize       Size of the variable.\r
+  @param  VariableNameSize       The size of the VariableName buffer. The size must be large enough to fit input\r
+                                 string supplied in VariableName buffer.\r
   @param  VariableName           On input, supplies the last VariableName that was returned by GetNextVariableName().\r
                                  On output, returns the Null-terminated Unicode string of the current variable.\r
   @param  VendorGuid             On input, supplies the last VendorGuid that was returned by GetNextVariableName().\r
-                                 On output, returns the VendorGuid of the current variable.  \r
+                                 On output, returns the VendorGuid of the current variable.\r
   @param  Global                 Pointer to VARIABLE_GLOBAL structure.\r
-  @param  Instance               Instance of the Firmware Volume.\r
 \r
-  @retval EFI_SUCCESS            The function completed successfully. \r
+  @retval EFI_SUCCESS            The function completed successfully.\r
   @retval EFI_NOT_FOUND          The next variable was not found.\r
-  @retval EFI_BUFFER_TOO_SMALL   VariableNameSize is too small for the result. \r
+  @retval EFI_BUFFER_TOO_SMALL   The VariableNameSize is too small for the result.\r
                                  VariableNameSize has been updated with the size needed to complete the request.\r
   @retval EFI_INVALID_PARAMETER  VariableNameSize or VariableName or VendorGuid is NULL.\r
+  @retval EFI_INVALID_PARAMETER  The input values of VariableName and VendorGuid are not a name and\r
+                                 GUID of an existing variable.\r
+  @retval EFI_INVALID_PARAMETER  Null-terminator is not found in the first VariableNameSize bytes of\r
+                                 the input VariableName buffer.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-GetNextVariableName (\r
+EmuGetNextVariableName (\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      VARIABLE_GLOBAL   *Global\r
   );\r
 \r
 /**\r
@@ -205,7 +218,6 @@ GetNextVariableName (
   @param  Global                 Pointer to VARIABLE_GLOBAL structure\r
   @param  VolatileOffset         The offset of last volatile variable\r
   @param  NonVolatileOffset      The offset of last non-volatile variable\r
-  @param  Instance               Instance of the Firmware Volume.\r
 \r
   @retval EFI_SUCCESS            The firmware has successfully stored the variable and its data as \r
                                  defined by the Attributes.\r
@@ -220,7 +232,7 @@ GetNextVariableName (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-SetVariable (\r
+EmuSetVariable (\r
   IN CHAR16                  *VariableName,\r
   IN EFI_GUID                *VendorGuid,\r
   IN UINT32                  Attributes,\r
@@ -228,8 +240,7 @@ SetVariable (
   IN VOID                    *Data,\r
   IN VARIABLE_GLOBAL         *Global,\r
   IN UINTN                   *VolatileOffset,\r
-  IN UINTN                   *NonVolatileOffset,\r
-  IN UINT32                  Instance\r
+  IN UINTN                   *NonVolatileOffset\r
   );\r
 \r
 /**\r
@@ -245,7 +256,6 @@ SetVariable (
   @param  MaximumVariableSize          Returns the maximum size of an individual EFI variable \r
                                        associated with the attributes specified.\r
   @param  Global                       Pointer to VARIABLE_GLOBAL structure.\r
-  @param  Instance                     Instance of the Firmware Volume.\r
 \r
   @retval EFI_SUCCESS                  Valid answer returned.\r
   @retval EFI_INVALID_PARAMETER        An invalid combination of attribute bits was supplied\r
@@ -256,13 +266,12 @@ SetVariable (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-QueryVariableInfo (\r
+EmuQueryVariableInfo (\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
+  IN  VARIABLE_GLOBAL        *Global\r
   );\r
 \r
 #endif\r