]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Guid/VariableFormat.h
1. delete Include/Guid/VariableInfo.h
[mirror_edk2.git] / MdeModulePkg / Include / Guid / VariableFormat.h
1 /** @file
2 The variable data structures are related to EDK II specific UEFI variable implementation.
3 Variable data header and Variable storage region header are defined here.
4
5 Copyright (c) 2006 - 2008 Intel Corporation. <BR>
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef __VARIABLE_FORMAT_H__
17 #define __VARIABLE_FORMAT_H__
18
19 #define EFI_VARIABLE_GUID \
20 { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d } }
21
22 extern EFI_GUID gEfiVariableGuid;
23
24 ///
25 /// Alignment of variable name and data.
26 /// For IA32/X64 architecture, the alignment is set to 1, and 8 is for IPF archtecture.
27 ///
28 #if defined (MDE_CPU_IPF)
29 #define ALIGNMENT 8
30 #else
31 #define ALIGNMENT 1
32 #endif
33
34 //
35 // GET_PAD_SIZE to calculate miminal pad bytes to make current size satisfy the alignment requirement
36 //
37 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
38 #define GET_PAD_SIZE(a) (0)
39 #else
40 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
41 #endif
42
43 ///
44 /// Alignment of Variable Data Header in Variable Store region
45 ///
46 #define HEADER_ALIGNMENT 4
47 #define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
48
49 ///
50 /// Status of Variable Store Region
51 ///
52 typedef enum {
53 EfiRaw,
54 EfiValid,
55 EfiInvalid,
56 EfiUnknown
57 } VARIABLE_STORE_STATUS;
58
59 #pragma pack(1)
60
61 #define VARIABLE_STORE_SIGNATURE EFI_VARIABLE_GUID
62
63 ///
64 /// Variable Store Header Format and State
65 ///
66 #define VARIABLE_STORE_FORMATTED 0x5a
67 #define VARIABLE_STORE_HEALTHY 0xfe
68
69 ///
70 /// Variable Store region header
71 ///
72 typedef struct {
73 ///
74 /// Variable store region signature.
75 ///
76 EFI_GUID Signature;
77 ///
78 /// Size of entire variable store,
79 /// including size of variable store header but not including the size of FvHeader.
80 ///
81 UINT32 Size;
82 ///
83 /// variable region format state
84 ///
85 UINT8 Format;
86 ///
87 /// variable region healthy state
88 ///
89 UINT8 State;
90 UINT16 Reserved;
91 UINT32 Reserved1;
92 } VARIABLE_STORE_HEADER;
93
94 ///
95 /// Variable data start flag
96 ///
97 #define VARIABLE_DATA 0x55AA
98
99 ///
100 /// Variable State flags
101 ///
102 #define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transistion
103 #define VAR_DELETED 0xfd ///< Variable is obsolete
104 #define VAR_HEADER_VALID_ONLY 0x7f ///< Variable header has been valid
105 #define VAR_ADDED 0x3f ///< Variable has been completely added
106
107 ///
108 /// Single Variable Data Header Structure
109 ///
110 typedef struct {
111 ///
112 /// Variable Data Start Flag
113 ///
114 UINT16 StartId;
115 ///
116 /// Variable State defined above
117 ///
118 UINT8 State;
119 UINT8 Reserved;
120 ///
121 /// Attributes of variable defined in UEFI spec
122 ///
123 UINT32 Attributes;
124 ///
125 /// Size of variable Null-terminated Unicode string name
126 ///
127 UINT32 NameSize;
128 ///
129 /// Size of the variable data without this header
130 ///
131 UINT32 DataSize;
132 ///
133 /// A unique identifier for the vendor that produce and consume this varaible.
134 ///
135 EFI_GUID VendorGuid;
136 } VARIABLE_HEADER;
137
138 #pragma pack()
139
140 typedef struct _VARIABLE_INFO_ENTRY VARIABLE_INFO_ENTRY;
141
142 ///
143 /// This structure contains the variable list that is put in EFI system table.
144 /// The variable driver collects all used variables at boot service time and produce this list.
145 /// This is an optional feature to dump all used variables in shell environment.
146 ///
147 struct _VARIABLE_INFO_ENTRY {
148 VARIABLE_INFO_ENTRY *Next; ///> Pointer to next entry
149 EFI_GUID VendorGuid; ///> Guid of Variable
150 CHAR16 *Name; ///> Name of Variable
151 UINT32 Attributes; ///> Attributes of variable defined in UEFI spec
152 UINT32 ReadCount; ///> Times to read this variable
153 UINT32 WriteCount; ///> Times to write this variable
154 UINT32 DeleteCount; ///> Times to delete this variable
155 UINT32 CacheCount; ///> Times that cache hits this variable
156 BOOLEAN Volatile; ///> TRUE if volatile FALSE if non-volatile
157 };
158
159 #endif // _EFI_VARIABLE_H_