]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Guid/VariableFormat.h
remove redundant judgement as ALIGNMENT can only equate with 1 or 8 instead of 0
[mirror_edk2.git] / MdeModulePkg / Include / Guid / VariableFormat.h
CommitLineData
5f597758 1/** @file\r
e5618791
LG
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
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
22extern EFI_GUID gEfiVariableGuid;\r
23\r
ebafc55b 24///\r
e5618791
LG
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
ebafc55b 27///\r
3cfb790c 28#if defined (MDE_CPU_IPF)\r
9cad030b 29#define ALIGNMENT 8\r
3cfb790c 30#else\r
9cad030b 31#define ALIGNMENT 1\r
3cfb790c 32#endif\r
33\r
e5618791 34//\r
b9982883 35// GET_PAD_SIZE to calculate miminal pad bytes to make current size satisfy the alignment requirement\r
e5618791 36//\r
d4cb8e71 37#if (ALIGNMENT == 1)\r
e5618791
LG
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
9cad030b 46#define HEADER_ALIGNMENT 4\r
e5618791 47#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
9cad030b 48\r
ebafc55b 49///\r
e5618791 50/// Status of Variable Store Region\r
ebafc55b 51///\r
3cfb790c 52typedef enum {\r
53 EfiRaw,\r
54 EfiValid,\r
55 EfiInvalid,\r
56 EfiUnknown\r
57} VARIABLE_STORE_STATUS;\r
58\r
3cfb790c 59#pragma pack(1)\r
60\r
3709c4cd 61#define VARIABLE_STORE_SIGNATURE EFI_VARIABLE_GUID\r
ebafc55b
LG
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
3cfb790c 72typedef struct {\r
ebafc55b
LG
73 ///\r
74 /// Variable store region signature.\r
75 ///\r
3709c4cd 76 EFI_GUID Signature;\r
ebafc55b 77 ///\r
3709c4cd 78 /// Size of entire variable store, \r
79 /// including size of variable store header but not including the size of FvHeader.\r
ebafc55b 80 ///\r
3cfb790c 81 UINT32 Size;\r
ebafc55b
LG
82 ///\r
83 /// variable region format state\r
84 ///\r
3cfb790c 85 UINT8 Format;\r
ebafc55b
LG
86 ///\r
87 /// variable region healthy state\r
88 ///\r
3cfb790c 89 UINT8 State;\r
90 UINT16 Reserved;\r
91 UINT32 Reserved1;\r
92} VARIABLE_STORE_HEADER;\r
93\r
ebafc55b
LG
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
68dbca6c
LG
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
ebafc55b 106\r
ebafc55b 107///\r
e5618791 108/// Single Variable Data Header Structure\r
ebafc55b 109///\r
3cfb790c 110typedef struct {\r
ebafc55b
LG
111 ///\r
112 /// Variable Data Start Flag\r
113 ///\r
3cfb790c 114 UINT16 StartId;\r
ebafc55b
LG
115 ///\r
116 /// Variable State defined above\r
117 ///\r
3cfb790c 118 UINT8 State;\r
119 UINT8 Reserved;\r
ebafc55b
LG
120 ///\r
121 /// Attributes of variable defined in UEFI spec\r
122 ///\r
3cfb790c 123 UINT32 Attributes;\r
ebafc55b
LG
124 ///\r
125 /// Size of variable Null-terminated Unicode string name\r
126 ///\r
3cfb790c 127 UINT32 NameSize;\r
ebafc55b
LG
128 ///\r
129 /// Size of the variable data without this header\r
130 ///\r
3cfb790c 131 UINT32 DataSize;\r
ebafc55b 132 ///\r
e5618791 133 /// A unique identifier for the vendor that produce and consume this varaible.\r
ebafc55b 134 ///\r
3cfb790c 135 EFI_GUID VendorGuid;\r
136} VARIABLE_HEADER;\r
137\r
138#pragma pack()\r
139\r
3709c4cd 140typedef 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
147struct _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
3cfb790c 159#endif // _EFI_VARIABLE_H_\r