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