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