]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Include/Guid/VariableFormat.h
Clean up include of ACPI header file so that only IndustryStandard/Acpi.h is needed...
[mirror_edk2.git] / MdeModulePkg / Include / Guid / VariableFormat.h
... / ...
CommitLineData
1/** @file\r
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
4\r
5Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
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
10\r
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
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
22extern EFI_GUID gEfiVariableGuid;\r
23\r
24///\r
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
28///\r
29#if defined (MDE_CPU_IPF)\r
30#define ALIGNMENT 8\r
31#else\r
32#define ALIGNMENT 1\r
33#endif\r
34\r
35//\r
36// GET_PAD_SIZE calculates the miminal pad bytes needed to make the current pad size satisfy the alignment requirement.\r
37//\r
38#if (ALIGNMENT == 1)\r
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
47#define HEADER_ALIGNMENT 4\r
48#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
49\r
50///\r
51/// Status of Variable Store Region.\r
52///\r
53typedef enum {\r
54 EfiRaw,\r
55 EfiValid,\r
56 EfiInvalid,\r
57 EfiUnknown\r
58} VARIABLE_STORE_STATUS;\r
59\r
60#pragma pack(1)\r
61\r
62#define VARIABLE_STORE_SIGNATURE EFI_VARIABLE_GUID\r
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
73typedef struct {\r
74 ///\r
75 /// Variable store region signature.\r
76 ///\r
77 EFI_GUID Signature;\r
78 ///\r
79 /// Size of entire variable store, \r
80 /// including size of variable store header but not including the size of FvHeader.\r
81 ///\r
82 UINT32 Size;\r
83 ///\r
84 /// Variable region format state.\r
85 ///\r
86 UINT8 Format;\r
87 ///\r
88 /// Variable region healthy state.\r
89 ///\r
90 UINT8 State;\r
91 UINT16 Reserved;\r
92 UINT32 Reserved1;\r
93} VARIABLE_STORE_HEADER;\r
94\r
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
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
107\r
108///\r
109/// Single Variable Data Header Structure.\r
110///\r
111typedef struct {\r
112 ///\r
113 /// Variable Data Start Flag.\r
114 ///\r
115 UINT16 StartId;\r
116 ///\r
117 /// Variable State defined above.\r
118 ///\r
119 UINT8 State;\r
120 UINT8 Reserved;\r
121 ///\r
122 /// Attributes of variable defined in UEFI specification.\r
123 ///\r
124 UINT32 Attributes;\r
125 ///\r
126 /// Size of variable null-terminated Unicode string name.\r
127 ///\r
128 UINT32 NameSize;\r
129 ///\r
130 /// Size of the variable data without this header.\r
131 ///\r
132 UINT32 DataSize;\r
133 ///\r
134 /// A unique identifier for the vendor that produces and consumes this varaible.\r
135 ///\r
136 EFI_GUID VendorGuid;\r
137} VARIABLE_HEADER;\r
138\r
139#pragma pack()\r
140\r
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
145/// The variable driver collects all variables that were used at boot service time and produces this list.\r
146/// This is an optional feature to dump all used variables in shell environment. \r
147///\r
148struct _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 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
158};\r
159\r
160#endif // _EFI_VARIABLE_H_\r