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