]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | The variable data structures are related to EDK II-specific implementation of UEFI variables.\r | |
3 | VariableFormat.h defines variable data headers and variable storage region headers.\r | |
4 | \r | |
5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials are licensed and made available under\r | |
7 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
8 | The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php.\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef __VARIABLE_FORMAT_H__\r | |
17 | #define __VARIABLE_FORMAT_H__\r | |
18 | \r | |
19 | #define EFI_VARIABLE_GUID \\r | |
20 | { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d } }\r | |
21 | \r | |
22 | #define EFI_AUTHENTICATED_VARIABLE_GUID \\r | |
23 | { 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 } }\r | |
24 | \r | |
25 | extern EFI_GUID gEfiVariableGuid;\r | |
26 | extern EFI_GUID gEfiAuthenticatedVariableGuid;\r | |
27 | \r | |
28 | ///\r | |
29 | /// Alignment of variable name and data, according to the architecture:\r | |
30 | /// * For IA-32 and Intel(R) 64 architectures: 1.\r | |
31 | ///\r | |
32 | #define ALIGNMENT 1\r | |
33 | \r | |
34 | //\r | |
35 | // GET_PAD_SIZE calculates the miminal pad bytes needed to make the current pad size satisfy the alignment requirement.\r | |
36 | //\r | |
37 | #if (ALIGNMENT == 1)\r | |
38 | #define GET_PAD_SIZE(a) (0)\r | |
39 | #else\r | |
40 | #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r | |
41 | #endif\r | |
42 | \r | |
43 | ///\r | |
44 | /// Alignment of Variable Data Header in Variable Store region.\r | |
45 | ///\r | |
46 | #define HEADER_ALIGNMENT 4\r | |
47 | #define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r | |
48 | \r | |
49 | ///\r | |
50 | /// Status of Variable Store Region.\r | |
51 | ///\r | |
52 | typedef enum {\r | |
53 | EfiRaw,\r | |
54 | EfiValid,\r | |
55 | EfiInvalid,\r | |
56 | EfiUnknown\r | |
57 | } VARIABLE_STORE_STATUS;\r | |
58 | \r | |
59 | #pragma pack(1)\r | |
60 | \r | |
61 | #define VARIABLE_STORE_SIGNATURE EFI_VARIABLE_GUID\r | |
62 | #define AUTHENTICATED_VARIABLE_STORE_SIGNATURE EFI_AUTHENTICATED_VARIABLE_GUID\r | |
63 | \r | |
64 | ///\r | |
65 | /// Variable Store Header Format and State.\r | |
66 | ///\r | |
67 | #define VARIABLE_STORE_FORMATTED 0x5a\r | |
68 | #define VARIABLE_STORE_HEALTHY 0xfe\r | |
69 | \r | |
70 | ///\r | |
71 | /// Variable Store region header.\r | |
72 | ///\r | |
73 | typedef struct {\r | |
74 | ///\r | |
75 | /// Variable store region signature.\r | |
76 | ///\r | |
77 | EFI_GUID Signature;\r | |
78 | ///\r | |
79 | /// Size of entire variable store,\r | |
80 | /// including size of variable store header but not including the size of FvHeader.\r | |
81 | ///\r | |
82 | UINT32 Size;\r | |
83 | ///\r | |
84 | /// Variable region format state.\r | |
85 | ///\r | |
86 | UINT8 Format;\r | |
87 | ///\r | |
88 | /// Variable region healthy state.\r | |
89 | ///\r | |
90 | UINT8 State;\r | |
91 | UINT16 Reserved;\r | |
92 | UINT32 Reserved1;\r | |
93 | } VARIABLE_STORE_HEADER;\r | |
94 | \r | |
95 | ///\r | |
96 | /// Variable data start flag.\r | |
97 | ///\r | |
98 | #define VARIABLE_DATA 0x55AA\r | |
99 | \r | |
100 | ///\r | |
101 | /// Variable State flags.\r | |
102 | ///\r | |
103 | #define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transition.\r | |
104 | #define VAR_DELETED 0xfd ///< Variable is obsolete.\r | |
105 | #define VAR_HEADER_VALID_ONLY 0x7f ///< Variable header has been valid.\r | |
106 | #define VAR_ADDED 0x3f ///< Variable has been completely added.\r | |
107 | \r | |
108 | ///\r | |
109 | /// Variable Attribute combinations.\r | |
110 | ///\r | |
111 | #define VARIABLE_ATTRIBUTE_NV_BS (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)\r | |
112 | #define VARIABLE_ATTRIBUTE_BS_RT (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)\r | |
113 | #define VARIABLE_ATTRIBUTE_BS_RT_AT (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)\r | |
114 | #define VARIABLE_ATTRIBUTE_NV_BS_RT (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_NON_VOLATILE)\r | |
115 | #define VARIABLE_ATTRIBUTE_NV_BS_RT_HR (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_HARDWARE_ERROR_RECORD)\r | |
116 | #define VARIABLE_ATTRIBUTE_NV_BS_RT_AT (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)\r | |
117 | #define VARIABLE_ATTRIBUTE_AT EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\r | |
118 | #define VARIABLE_ATTRIBUTE_NV_BS_RT_HR_AT (VARIABLE_ATTRIBUTE_NV_BS_RT_HR | VARIABLE_ATTRIBUTE_AT)\r | |
119 | ///\r | |
120 | /// EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and should be considered as reserved\r | |
121 | ///\r | |
122 | #define VARIABLE_ATTRIBUTE_AT_AW (EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)\r | |
123 | #define VARIABLE_ATTRIBUTE_NV_BS_RT_AW (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)\r | |
124 | #define VARIABLE_ATTRIBUTE_NV_BS_RT_HR_AT_AW (VARIABLE_ATTRIBUTE_NV_BS_RT_HR | VARIABLE_ATTRIBUTE_AT_AW)\r | |
125 | \r | |
126 | ///\r | |
127 | /// Single Variable Data Header Structure.\r | |
128 | ///\r | |
129 | typedef struct {\r | |
130 | ///\r | |
131 | /// Variable Data Start Flag.\r | |
132 | ///\r | |
133 | UINT16 StartId;\r | |
134 | ///\r | |
135 | /// Variable State defined above.\r | |
136 | ///\r | |
137 | UINT8 State;\r | |
138 | UINT8 Reserved;\r | |
139 | ///\r | |
140 | /// Attributes of variable defined in UEFI specification.\r | |
141 | ///\r | |
142 | UINT32 Attributes;\r | |
143 | ///\r | |
144 | /// Size of variable null-terminated Unicode string name.\r | |
145 | ///\r | |
146 | UINT32 NameSize;\r | |
147 | ///\r | |
148 | /// Size of the variable data without this header.\r | |
149 | ///\r | |
150 | UINT32 DataSize;\r | |
151 | ///\r | |
152 | /// A unique identifier for the vendor that produces and consumes this varaible.\r | |
153 | ///\r | |
154 | EFI_GUID VendorGuid;\r | |
155 | } VARIABLE_HEADER;\r | |
156 | \r | |
157 | ///\r | |
158 | /// Single Authenticated Variable Data Header Structure.\r | |
159 | ///\r | |
160 | typedef struct {\r | |
161 | ///\r | |
162 | /// Variable Data Start Flag.\r | |
163 | ///\r | |
164 | UINT16 StartId;\r | |
165 | ///\r | |
166 | /// Variable State defined above.\r | |
167 | ///\r | |
168 | UINT8 State;\r | |
169 | UINT8 Reserved;\r | |
170 | ///\r | |
171 | /// Attributes of variable defined in UEFI specification.\r | |
172 | ///\r | |
173 | UINT32 Attributes;\r | |
174 | ///\r | |
175 | /// Associated monotonic count value against replay attack.\r | |
176 | ///\r | |
177 | UINT64 MonotonicCount;\r | |
178 | ///\r | |
179 | /// Associated TimeStamp value against replay attack.\r | |
180 | ///\r | |
181 | EFI_TIME TimeStamp;\r | |
182 | ///\r | |
183 | /// Index of associated public key in database.\r | |
184 | ///\r | |
185 | UINT32 PubKeyIndex;\r | |
186 | ///\r | |
187 | /// Size of variable null-terminated Unicode string name.\r | |
188 | ///\r | |
189 | UINT32 NameSize;\r | |
190 | ///\r | |
191 | /// Size of the variable data without this header.\r | |
192 | ///\r | |
193 | UINT32 DataSize;\r | |
194 | ///\r | |
195 | /// A unique identifier for the vendor that produces and consumes this varaible.\r | |
196 | ///\r | |
197 | EFI_GUID VendorGuid;\r | |
198 | } AUTHENTICATED_VARIABLE_HEADER;\r | |
199 | \r | |
200 | typedef struct {\r | |
201 | EFI_GUID *Guid;\r | |
202 | CHAR16 *Name;\r | |
203 | UINTN VariableSize;\r | |
204 | } VARIABLE_ENTRY_CONSISTENCY;\r | |
205 | \r | |
206 | #pragma pack()\r | |
207 | \r | |
208 | typedef struct _VARIABLE_INFO_ENTRY VARIABLE_INFO_ENTRY;\r | |
209 | \r | |
210 | ///\r | |
211 | /// This structure contains the variable list that is put in EFI system table.\r | |
212 | /// The variable driver collects all variables that were used at boot service time and produces this list.\r | |
213 | /// This is an optional feature to dump all used variables in shell environment.\r | |
214 | ///\r | |
215 | struct _VARIABLE_INFO_ENTRY {\r | |
216 | VARIABLE_INFO_ENTRY *Next; ///< Pointer to next entry.\r | |
217 | EFI_GUID VendorGuid; ///< Guid of Variable.\r | |
218 | CHAR16 *Name; ///< Name of Variable.\r | |
219 | UINT32 Attributes; ///< Attributes of variable defined in UEFI specification.\r | |
220 | UINT32 ReadCount; ///< Number of times to read this variable.\r | |
221 | UINT32 WriteCount; ///< Number of times to write this variable.\r | |
222 | UINT32 DeleteCount; ///< Number of times to delete this variable.\r | |
223 | UINT32 CacheCount; ///< Number of times that cache hits this variable.\r | |
224 | BOOLEAN Volatile; ///< TRUE if volatile, FALSE if non-volatile.\r | |
225 | };\r | |
226 | \r | |
227 | #endif // _EFI_VARIABLE_H_\r |