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