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