Add core FFS3 support, FwVolDxe and SectionExtraction.
[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
7Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
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
24extern EFI_GUID gEfiAuthenticatedVariableGuid;\r
25\r
26///\r
27/// Alignment of variable name and data, according to the architecture:\r
28/// * For IA-32 and Intel(R) 64 architectures: 1.\r
29/// * For IA-64 architecture: 8.\r
30///\r
31#if defined (MDE_CPU_IPF)\r
32#define ALIGNMENT 8\r
33#else\r
34#define ALIGNMENT 1\r
35#endif\r
36\r
37//\r
38// GET_PAD_SIZE calculates the miminal pad bytes needed to make the current pad size satisfy the alignment requirement.\r
39//\r
40#if (ALIGNMENT == 1)\r
41#define GET_PAD_SIZE(a) (0)\r
42#else\r
43#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
44#endif\r
45\r
46///\r
47/// Alignment of Variable Data Header in Variable Store region.\r
48///\r
49#define HEADER_ALIGNMENT 4\r
50#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
51\r
52///\r
53/// Status of Variable Store Region.\r
54///\r
55typedef enum {\r
56 EfiRaw,\r
57 EfiValid,\r
58 EfiInvalid,\r
59 EfiUnknown\r
60} VARIABLE_STORE_STATUS;\r
61\r
62#pragma pack(1)\r
63\r
64#define VARIABLE_STORE_SIGNATURE EFI_AUTHENTICATED_VARIABLE_GUID\r
65\r
66///\r
67/// Variable Store Header Format and State.\r
68///\r
69#define VARIABLE_STORE_FORMATTED 0x5a\r
70#define VARIABLE_STORE_HEALTHY 0xfe\r
71\r
72///\r
73/// Variable Store region header.\r
74///\r
75typedef struct {\r
76 ///\r
77 /// Variable store region signature.\r
78 ///\r
79 EFI_GUID Signature;\r
80 ///\r
81 /// Size of entire variable store, \r
82 /// including size of variable store header but not including the size of FvHeader.\r
83 ///\r
84 UINT32 Size;\r
85 ///\r
86 /// Variable region format state.\r
87 ///\r
88 UINT8 Format;\r
89 ///\r
90 /// Variable region healthy state.\r
91 ///\r
92 UINT8 State;\r
93 UINT16 Reserved;\r
94 UINT32 Reserved1;\r
95} VARIABLE_STORE_HEADER;\r
96\r
97///\r
98/// Variable data start flag.\r
99///\r
100#define VARIABLE_DATA 0x55AA\r
101\r
102///\r
103/// Variable State flags.\r
104///\r
105#define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transition.\r
106#define VAR_DELETED 0xfd ///< Variable is obsolete.\r
107#define VAR_HEADER_VALID_ONLY 0x7f ///< Variable header has been valid.\r
108#define VAR_ADDED 0x3f ///< Variable has been completely added.\r
109\r
110///\r
111/// Single Variable Data Header Structure.\r
112///\r
113typedef struct {\r
114 ///\r
115 /// Variable Data Start Flag.\r
116 ///\r
117 UINT16 StartId;\r
118 ///\r
119 /// Variable State defined above.\r
120 ///\r
121 UINT8 State;\r
122 UINT8 Reserved;\r
123 ///\r
124 /// Attributes of variable defined in UEFI specification.\r
125 ///\r
126 UINT32 Attributes;\r
127 ///\r
128 /// Associated monotonic count value against replay attack.\r
129 ///\r
130 UINT64 MonotonicCount;\r
131 ///\r
132 /// Associated TimeStamp value against replay attack. \r
133 ///\r
134 EFI_TIME TimeStamp;\r
135 ///\r
136 /// Index of associated public key in database.\r
137 ///\r
138 UINT32 PubKeyIndex;\r
139 ///\r
140 /// Size of variable null-terminated Unicode string name.\r
141 ///\r
142 UINT32 NameSize;\r
143 ///\r
144 /// Size of the variable data without this header.\r
145 ///\r
146 UINT32 DataSize;\r
147 ///\r
148 /// A unique identifier for the vendor that produces and consumes this varaible.\r
149 ///\r
150 EFI_GUID VendorGuid;\r
151} VARIABLE_HEADER;\r
152\r
153#pragma pack()\r
154\r
155typedef struct _VARIABLE_INFO_ENTRY VARIABLE_INFO_ENTRY;\r
156\r
157///\r
158/// This structure contains the variable list that is put in EFI system table.\r
159/// The variable driver collects all variables that were used at boot service time and produces this list.\r
160/// This is an optional feature to dump all used variables in shell environment. \r
161///\r
162struct _VARIABLE_INFO_ENTRY {\r
163 VARIABLE_INFO_ENTRY *Next; ///< Pointer to next entry.\r
164 EFI_GUID VendorGuid; ///< Guid of Variable.\r
165 CHAR16 *Name; ///< Name of Variable. \r
166 UINT32 Attributes; ///< Attributes of variable defined in UEFI spec.\r
167 UINT32 ReadCount; ///< Number of times to read this variable.\r
168 UINT32 WriteCount; ///< Number of times to write this variable.\r
169 UINT32 DeleteCount; ///< Number of times to delete this variable.\r
170 UINT32 CacheCount; ///< Number of times that cache hits this variable.\r
171 BOOLEAN Volatile; ///< TRUE if volatile, FALSE if non-volatile.\r
172};\r
173\r
174#endif // __AUTHENTICATED_VARIABLE_FORMAT_H__\r