Update BGRT image buffer to be stored in EfiBootSerivesData according to ACPI5.0...
[mirror_edk2.git] / SecurityPkg / Include / Guid / AuthenticatedVariableFormat.h
CommitLineData
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
ecc722ad 7Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
0c18794e 8This program and the accompanying materials \r
9are licensed and made available under the terms and conditions of the BSD License \r
10which accompanies this distribution. The full text of the license may be found at \r
11http://opensource.org/licenses/bsd-license.php\r
12\r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14WITHOUT 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 28extern EFI_GUID gEfiAuthenticatedVariableGuid;\r
beda2356 29extern EFI_GUID gEfiSecureBootEnableDisableGuid;\r
c11d47b8 30extern EFI_GUID gEfiCertDbGuid;\r
31extern EFI_GUID gEfiCustomModeEnableGuid;\r
beda2356 32\r
33///\r
8f8ca22e 34/// "SecureBootEnable" variable for the Secure Boot feature enable/disable.\r
35/// This variable is used for allowing a physically present user to disable\r
36/// Secure Boot via firmware setup without the possession of PKpriv.\r
beda2356 37///\r
38#define EFI_SECURE_BOOT_ENABLE_NAME L"SecureBootEnable"\r
39#define SECURE_BOOT_ENABLE 1\r
40#define SECURE_BOOT_DISABLE 0\r
0c18794e 41\r
ecc722ad 42///\r
43/// "CustomMode" variable for two Secure Boot modes feature: "Custom" and "Standard".\r
44/// Standard Secure Boot mode is the default mode as UEFI Spec's description.\r
45/// Custom Secure Boot mode allows for more flexibility as specified in the following:\r
46/// Can enroll or delete PK without existing PK's private key.\r
47/// Can enroll or delete KEK without existing PK's private key.\r
48/// Can enroll or delete signature from DB/DBX without KEK's private key.\r
49///\r
50#define EFI_CUSTOM_MODE_NAME L"CustomMode"\r
51#define CUSTOM_SECURE_BOOT_MODE 1\r
52#define STANDARD_SECURE_BOOT_MODE 0\r
53\r
0c18794e 54///\r
55/// Alignment of variable name and data, according to the architecture:\r
56/// * For IA-32 and Intel(R) 64 architectures: 1.\r
57/// * For IA-64 architecture: 8.\r
58///\r
59#if defined (MDE_CPU_IPF)\r
60#define ALIGNMENT 8\r
61#else\r
62#define ALIGNMENT 1\r
63#endif\r
64\r
65//\r
66// GET_PAD_SIZE calculates the miminal pad bytes needed to make the current pad size satisfy the alignment requirement.\r
67//\r
68#if (ALIGNMENT == 1)\r
69#define GET_PAD_SIZE(a) (0)\r
70#else\r
71#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
72#endif\r
73\r
74///\r
75/// Alignment of Variable Data Header in Variable Store region.\r
76///\r
77#define HEADER_ALIGNMENT 4\r
78#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
79\r
80///\r
81/// Status of Variable Store Region.\r
82///\r
83typedef enum {\r
84 EfiRaw,\r
85 EfiValid,\r
86 EfiInvalid,\r
87 EfiUnknown\r
88} VARIABLE_STORE_STATUS;\r
89\r
90#pragma pack(1)\r
91\r
92#define VARIABLE_STORE_SIGNATURE EFI_AUTHENTICATED_VARIABLE_GUID\r
93\r
94///\r
95/// Variable Store Header Format and State.\r
96///\r
97#define VARIABLE_STORE_FORMATTED 0x5a\r
98#define VARIABLE_STORE_HEALTHY 0xfe\r
99\r
100///\r
101/// Variable Store region header.\r
102///\r
103typedef struct {\r
104 ///\r
105 /// Variable store region signature.\r
106 ///\r
107 EFI_GUID Signature;\r
108 ///\r
109 /// Size of entire variable store, \r
110 /// including size of variable store header but not including the size of FvHeader.\r
111 ///\r
112 UINT32 Size;\r
113 ///\r
114 /// Variable region format state.\r
115 ///\r
116 UINT8 Format;\r
117 ///\r
118 /// Variable region healthy state.\r
119 ///\r
120 UINT8 State;\r
121 UINT16 Reserved;\r
122 UINT32 Reserved1;\r
123} VARIABLE_STORE_HEADER;\r
124\r
125///\r
126/// Variable data start flag.\r
127///\r
128#define VARIABLE_DATA 0x55AA\r
129\r
130///\r
131/// Variable State flags.\r
132///\r
133#define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transition.\r
134#define VAR_DELETED 0xfd ///< Variable is obsolete.\r
135#define VAR_HEADER_VALID_ONLY 0x7f ///< Variable header has been valid.\r
136#define VAR_ADDED 0x3f ///< Variable has been completely added.\r
137\r
138///\r
139/// Single Variable Data Header Structure.\r
140///\r
141typedef struct {\r
142 ///\r
143 /// Variable Data Start Flag.\r
144 ///\r
145 UINT16 StartId;\r
146 ///\r
147 /// Variable State defined above.\r
148 ///\r
149 UINT8 State;\r
150 UINT8 Reserved;\r
151 ///\r
152 /// Attributes of variable defined in UEFI specification.\r
153 ///\r
154 UINT32 Attributes;\r
155 ///\r
156 /// Associated monotonic count value against replay attack.\r
157 ///\r
158 UINT64 MonotonicCount;\r
159 ///\r
160 /// Associated TimeStamp value against replay attack. \r
161 ///\r
162 EFI_TIME TimeStamp;\r
163 ///\r
164 /// Index of associated public key in database.\r
165 ///\r
166 UINT32 PubKeyIndex;\r
167 ///\r
168 /// Size of variable null-terminated Unicode string name.\r
169 ///\r
170 UINT32 NameSize;\r
171 ///\r
172 /// Size of the variable data without this header.\r
173 ///\r
174 UINT32 DataSize;\r
175 ///\r
176 /// A unique identifier for the vendor that produces and consumes this varaible.\r
177 ///\r
178 EFI_GUID VendorGuid;\r
179} VARIABLE_HEADER;\r
180\r
181#pragma pack()\r
182\r
183typedef struct _VARIABLE_INFO_ENTRY VARIABLE_INFO_ENTRY;\r
184\r
185///\r
186/// This structure contains the variable list that is put in EFI system table.\r
187/// The variable driver collects all variables that were used at boot service time and produces this list.\r
188/// This is an optional feature to dump all used variables in shell environment. \r
189///\r
190struct _VARIABLE_INFO_ENTRY {\r
191 VARIABLE_INFO_ENTRY *Next; ///< Pointer to next entry.\r
192 EFI_GUID VendorGuid; ///< Guid of Variable.\r
193 CHAR16 *Name; ///< Name of Variable. \r
194 UINT32 Attributes; ///< Attributes of variable defined in UEFI spec.\r
195 UINT32 ReadCount; ///< Number of times to read this variable.\r
196 UINT32 WriteCount; ///< Number of times to write this variable.\r
197 UINT32 DeleteCount; ///< Number of times to delete this variable.\r
198 UINT32 CacheCount; ///< Number of times that cache hits this variable.\r
199 BOOLEAN Volatile; ///< TRUE if volatile, FALSE if non-volatile.\r
200};\r
201\r
202#endif // __AUTHENTICATED_VARIABLE_FORMAT_H__\r