]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Guid/VariableFormat.h
MdeModulePkg: Deprecate EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
[mirror_edk2.git] / MdeModulePkg / Include / Guid / VariableFormat.h
index 8ff64cb2c83126016cc7cc6aa7dccf3e11a7abc9..b0c2616c4d9a96f988925e8b2d6e2b184a41dffd 100644 (file)
@@ -2,14 +2,14 @@
   The variable data structures are related to EDK II-specific implementation of UEFI variables.\r
   VariableFormat.h defines variable data headers and variable storage region headers.\r
 \r
-  Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r
-  All rights reserved. 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
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
+The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php.\r
 \r
-  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
+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
 **/\r
 \r
 #define EFI_VARIABLE_GUID \\r
   { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d } }\r
 \r
+#define EFI_AUTHENTICATED_VARIABLE_GUID \\r
+  { 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 } }\r
+\r
 extern EFI_GUID gEfiVariableGuid;\r
+extern EFI_GUID gEfiAuthenticatedVariableGuid;\r
 \r
 ///\r
 /// Alignment of variable name and data, according to the architecture:\r
-/// * For IA-32 and Intel(R) 64 architectures: 1\r
-/// * For IA-64 architecture: 8\r
+/// * For IA-32 and Intel(R) 64 architectures: 1.\r
+/// * For IA-64 architecture: 8.\r
 ///\r
 #if defined (MDE_CPU_IPF)\r
 #define ALIGNMENT         8\r
@@ -42,13 +46,13 @@ extern EFI_GUID gEfiVariableGuid;
 #endif\r
 \r
 ///\r
-/// Alignment of Variable Data Header in Variable Store region\r
+/// Alignment of Variable Data Header in Variable Store region.\r
 ///\r
 #define HEADER_ALIGNMENT  4\r
 #define HEADER_ALIGN(Header)  (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
 \r
 ///\r
-/// Status of Variable Store Region\r
+/// Status of Variable Store Region.\r
 ///\r
 typedef enum {\r
   EfiRaw,\r
@@ -60,15 +64,16 @@ typedef enum {
 #pragma pack(1)\r
 \r
 #define VARIABLE_STORE_SIGNATURE  EFI_VARIABLE_GUID\r
+#define AUTHENTICATED_VARIABLE_STORE_SIGNATURE  EFI_AUTHENTICATED_VARIABLE_GUID\r
 \r
 ///\r
-/// Variable Store Header Format and State\r
+/// Variable Store Header Format and State.\r
 ///\r
 #define VARIABLE_STORE_FORMATTED          0x5a\r
 #define VARIABLE_STORE_HEALTHY            0xfe\r
 \r
 ///\r
-/// Variable Store region header\r
+/// Variable Store region header.\r
 ///\r
 typedef struct {\r
   ///\r
@@ -76,16 +81,16 @@ typedef struct {
   ///\r
   EFI_GUID  Signature;\r
   ///\r
-  /// Size of entire variable store, \r
+  /// Size of entire variable store,\r
   /// including size of variable store header but not including the size of FvHeader.\r
   ///\r
   UINT32  Size;\r
   ///\r
-  /// variable region format state\r
+  /// Variable region format state.\r
   ///\r
   UINT8   Format;\r
   ///\r
-  /// variable region healthy state\r
+  /// Variable region healthy state.\r
   ///\r
   UINT8   State;\r
   UINT16  Reserved;\r
@@ -93,41 +98,59 @@ typedef struct {
 } VARIABLE_STORE_HEADER;\r
 \r
 ///\r
-/// Variable data start flag\r
+/// Variable data start flag.\r
 ///\r
 #define VARIABLE_DATA                     0x55AA\r
 \r
 ///\r
-/// Variable State flags\r
+/// Variable State flags.\r
+///\r
+#define VAR_IN_DELETED_TRANSITION     0xfe  ///< Variable is in obsolete transition.\r
+#define VAR_DELETED                   0xfd  ///< Variable is obsolete.\r
+#define VAR_HEADER_VALID_ONLY         0x7f  ///< Variable header has been valid.\r
+#define VAR_ADDED                     0x3f  ///< Variable has been completely added.\r
+\r
+///\r
+/// Variable Attribute combinations.\r
+///\r
+#define VARIABLE_ATTRIBUTE_NV_BS        (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_BS_RT        (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_BS_RT_AT     (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT     (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_NON_VOLATILE)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT_HR  (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_HARDWARE_ERROR_RECORD)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT_AT  (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_AT           EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT_HR_AT    (VARIABLE_ATTRIBUTE_NV_BS_RT_HR | VARIABLE_ATTRIBUTE_AT)\r
 ///\r
-#define VAR_IN_DELETED_TRANSITION     0xfe  ///< Variable is in obsolete transition\r
-#define VAR_DELETED                   0xfd  ///< Variable is obsolete\r
-#define VAR_HEADER_VALID_ONLY         0x7f  ///< Variable header has been valid\r
-#define VAR_ADDED                     0x3f  ///< Variable has been completely added\r
+/// EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and should be considered as reserved\r
+///\r
+#define VARIABLE_ATTRIBUTE_AT_AW        (EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT_AW  (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)\r
+#define VARIABLE_ATTRIBUTE_NV_BS_RT_HR_AT_AW    (VARIABLE_ATTRIBUTE_NV_BS_RT_HR | VARIABLE_ATTRIBUTE_AT_AW)\r
 \r
 ///\r
-/// Single Variable Data Header Structure\r
+/// Single Variable Data Header Structure.\r
 ///\r
 typedef struct {\r
   ///\r
-  /// Variable Data Start Flag\r
+  /// Variable Data Start Flag.\r
   ///\r
   UINT16      StartId;\r
   ///\r
-  /// Variable State defined above\r
+  /// Variable State defined above.\r
   ///\r
   UINT8       State;\r
   UINT8       Reserved;\r
   ///\r
-  /// Attributes of variable defined in UEFI spec\r
+  /// Attributes of variable defined in UEFI specification.\r
   ///\r
   UINT32      Attributes;\r
   ///\r
-  /// Size of variable null-terminated Unicode string name\r
+  /// Size of variable null-terminated Unicode string name.\r
   ///\r
   UINT32      NameSize;\r
   ///\r
-  /// Size of the variable data without this header\r
+  /// Size of the variable data without this header.\r
   ///\r
   UINT32      DataSize;\r
   ///\r
@@ -136,6 +159,55 @@ typedef struct {
   EFI_GUID    VendorGuid;\r
 } VARIABLE_HEADER;\r
 \r
+///\r
+/// Single Authenticated Variable Data Header Structure.\r
+///\r
+typedef struct {\r
+  ///\r
+  /// Variable Data Start Flag.\r
+  ///\r
+  UINT16      StartId;\r
+  ///\r
+  /// Variable State defined above.\r
+  ///\r
+  UINT8       State;\r
+  UINT8       Reserved;\r
+  ///\r
+  /// Attributes of variable defined in UEFI specification.\r
+  ///\r
+  UINT32      Attributes;\r
+  ///\r
+  /// Associated monotonic count value against replay attack.\r
+  ///\r
+  UINT64      MonotonicCount;\r
+  ///\r
+  /// Associated TimeStamp value against replay attack.\r
+  ///\r
+  EFI_TIME    TimeStamp;\r
+  ///\r
+  /// Index of associated public key in database.\r
+  ///\r
+  UINT32      PubKeyIndex;\r
+  ///\r
+  /// Size of variable null-terminated Unicode string name.\r
+  ///\r
+  UINT32      NameSize;\r
+  ///\r
+  /// Size of the variable data without this header.\r
+  ///\r
+  UINT32      DataSize;\r
+  ///\r
+  /// A unique identifier for the vendor that produces and consumes this varaible.\r
+  ///\r
+  EFI_GUID    VendorGuid;\r
+} AUTHENTICATED_VARIABLE_HEADER;\r
+\r
+typedef struct {\r
+  EFI_GUID    *Guid;\r
+  CHAR16      *Name;\r
+  UINTN       VariableSize;\r
+} VARIABLE_ENTRY_CONSISTENCY;\r
+\r
 #pragma pack()\r
 \r
 typedef struct _VARIABLE_INFO_ENTRY  VARIABLE_INFO_ENTRY;\r
@@ -143,18 +215,18 @@ typedef struct _VARIABLE_INFO_ENTRY  VARIABLE_INFO_ENTRY;
 ///\r
 /// This structure contains the variable list that is put in EFI system table.\r
 /// The variable driver collects all variables that were used at boot service time and produces this list.\r
-/// This is an optional feature to dump all used variables in shell environment. \r
+/// This is an optional feature to dump all used variables in shell environment.\r
 ///\r
 struct _VARIABLE_INFO_ENTRY {\r
-  VARIABLE_INFO_ENTRY *Next;       ///> Pointer to next entry\r
-  EFI_GUID            VendorGuid;  ///> Guid of Variable \r
-  CHAR16              *Name;       ///> Name of Variable \r
-  UINT32              Attributes;  ///> Attributes of variable defined in UEFI spec\r
-  UINT32              ReadCount;   ///> Number of times to read this variable\r
-  UINT32              WriteCount;  ///> Number of times to write this variable\r
-  UINT32              DeleteCount; ///> Number of times to delete this variable\r
-  UINT32              CacheCount;  ///> Number of times that cache hits this variable\r
-  BOOLEAN             Volatile;    ///> TRUE if volatile, FALSE if non-volatile\r
+  VARIABLE_INFO_ENTRY *Next;       ///< Pointer to next entry.\r
+  EFI_GUID            VendorGuid;  ///< Guid of Variable.\r
+  CHAR16              *Name;       ///< Name of Variable.\r
+  UINT32              Attributes;  ///< Attributes of variable defined in UEFI specification.\r
+  UINT32              ReadCount;   ///< Number of times to read this variable.\r
+  UINT32              WriteCount;  ///< Number of times to write this variable.\r
+  UINT32              DeleteCount; ///< Number of times to delete this variable.\r
+  UINT32              CacheCount;  ///< Number of times that cache hits this variable.\r
+  BOOLEAN             Volatile;    ///< TRUE if volatile, FALSE if non-volatile.\r
 };\r
 \r
 #endif // _EFI_VARIABLE_H_\r