]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Guid/VariableFormat.h
Clean up DEC files:
[mirror_edk2.git] / MdeModulePkg / Include / Guid / VariableFormat.h
CommitLineData
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
d00ed85e 5Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
64a80549 6This program and the accompanying materials are licensed and made available under \r
7the terms and conditions of the BSD License that accompanies this distribution. \r
8The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php. \r
ebafc55b 10\r
64a80549 11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
3cfb790c 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
e9b67286 25/// Alignment of variable name and data, according to the architecture:\r
64a80549 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
64a80549 45/// Alignment of Variable Data Header in Variable Store region.\r
e5618791 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
64a80549 51/// Status of Variable Store Region.\r
ebafc55b 52///\r
3cfb790c 53typedef 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
64a80549 65/// Variable Store Header Format and State.\r
ebafc55b
LG
66///\r
67#define VARIABLE_STORE_FORMATTED 0x5a\r
68#define VARIABLE_STORE_HEALTHY 0xfe\r
69\r
70///\r
64a80549 71/// Variable Store region header.\r
ebafc55b 72///\r
3cfb790c 73typedef 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 83 ///\r
64a80549 84 /// Variable region format state.\r
ebafc55b 85 ///\r
3cfb790c 86 UINT8 Format;\r
ebafc55b 87 ///\r
64a80549 88 /// Variable region healthy state.\r
ebafc55b 89 ///\r
3cfb790c 90 UINT8 State;\r
91 UINT16 Reserved;\r
92 UINT32 Reserved1;\r
93} VARIABLE_STORE_HEADER;\r
94\r
ebafc55b 95///\r
64a80549 96/// Variable data start flag.\r
ebafc55b
LG
97///\r
98#define VARIABLE_DATA 0x55AA\r
99\r
100///\r
64a80549 101/// Variable State flags.\r
ebafc55b 102///\r
64a80549 103#define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transition.\r
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
64a80549 109/// Single Variable Data Header Structure.\r
ebafc55b 110///\r
3cfb790c 111typedef struct {\r
ebafc55b 112 ///\r
64a80549 113 /// Variable Data Start Flag.\r
ebafc55b 114 ///\r
3cfb790c 115 UINT16 StartId;\r
ebafc55b 116 ///\r
64a80549 117 /// Variable State defined above.\r
ebafc55b 118 ///\r
3cfb790c 119 UINT8 State;\r
120 UINT8 Reserved;\r
ebafc55b 121 ///\r
64a80549 122 /// Attributes of variable defined in UEFI specification.\r
ebafc55b 123 ///\r
3cfb790c 124 UINT32 Attributes;\r
ebafc55b 125 ///\r
64a80549 126 /// Size of variable null-terminated Unicode string name.\r
ebafc55b 127 ///\r
3cfb790c 128 UINT32 NameSize;\r
ebafc55b 129 ///\r
64a80549 130 /// Size of the variable data without this header.\r
ebafc55b 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 141typedef 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
148struct _VARIABLE_INFO_ENTRY {\r
64a80549 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 specification.\r
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