]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/VariableFormat.h
Code Clean for Driver PlatformDriOverrideDxe and PlatOverMngr application. And Clean...
[mirror_edk2.git] / MdeModulePkg / Include / VariableFormat.h
1 /** @file
2 The variable data structure related to EDK II specific UEFI variable implementation.
3
4 Copyright (c) 2006 - 2008 Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __VARIABLE_FORMAT_H__
16 #define __VARIABLE_FORMAT_H__
17
18 ///
19 /// Maximum buffer for the single variable.
20 ///
21 #ifndef MAX_VARIABLE_SIZE
22 #define MAX_VARIABLE_SIZE FixedPcdGet32(PcdMaxVariableSize)
23 #endif
24
25 ///
26 /// Maximum buffer for Hardware error record variable
27 ///
28 #ifndef MAX_HARDWARE_ERROR_VARIABLE_SIZE
29 #define MAX_HARDWARE_ERROR_VARIABLE_SIZE FixedPcdGet32(PcdMaxHardwareErrorVariableSize)
30 #endif
31
32 ///
33 /// The alignment of variable's start offset.
34 /// For IA32/X64 architecture, the alignment is set to 1, and
35 /// 8 is for IPF archtecture.
36 ///
37 #if defined (MDE_CPU_IPF)
38 #define ALIGNMENT 8
39 #else
40 #define ALIGNMENT 1
41 #endif
42
43 #define HEADER_ALIGNMENT 4
44
45 ///
46 /// Variable Store Status
47 ///
48 typedef enum {
49 EfiRaw,
50 EfiValid,
51 EfiInvalid,
52 EfiUnknown
53 } VARIABLE_STORE_STATUS;
54
55 #pragma pack(1)
56
57 #define VARIABLE_STORE_SIGNATURE SIGNATURE_32 ('$', 'V', 'S', 'S')
58
59 ///
60 /// Variable Store Header Format and State
61 ///
62 #define VARIABLE_STORE_FORMATTED 0x5a
63 #define VARIABLE_STORE_HEALTHY 0xfe
64
65 ///
66 /// Variable Store region header
67 ///
68 typedef struct {
69 ///
70 /// Variable store region signature.
71 ///
72 UINT32 Signature;
73 ///
74 /// Size of variable store region including this header
75 ///
76 UINT32 Size;
77 ///
78 /// variable region format state
79 ///
80 UINT8 Format;
81 ///
82 /// variable region healthy state
83 ///
84 UINT8 State;
85 UINT16 Reserved;
86 UINT32 Reserved1;
87 } VARIABLE_STORE_HEADER;
88
89 ///
90 /// Variable data start flag
91 ///
92 #define VARIABLE_DATA 0x55AA
93
94 ///
95 /// Variable State flags
96 ///
97 #define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transistion
98 #define VAR_DELETED 0xfd ///< Variable is obsolete
99 #define VAR_HEADER_VALID_ONLY 0x7f ///< Variable header has been valid
100 #define VAR_ADDED 0x3f ///< Variable has been completely added
101
102 ///
103 /// Removed
104 ///
105 #define IS_VARIABLE_STATE(_c, _Mask) (BOOLEAN) (((~_c) & (~_Mask)) != 0)
106
107 ///
108 /// Variable Data Header Structure
109 ///
110 typedef struct {
111 ///
112 /// Variable Data Start Flag
113 ///
114 UINT16 StartId;
115 ///
116 /// Variable State defined above
117 ///
118 UINT8 State;
119 UINT8 Reserved;
120 ///
121 /// Attributes of variable defined in UEFI spec
122 ///
123 UINT32 Attributes;
124 ///
125 /// Size of variable Null-terminated Unicode string name
126 ///
127 UINT32 NameSize;
128 ///
129 /// Size of the variable data without this header
130 ///
131 UINT32 DataSize;
132 ///
133 /// A unique identifier for the vendor.
134 ///
135 EFI_GUID VendorGuid;
136 } VARIABLE_HEADER;
137
138 #pragma pack()
139
140 #endif // _EFI_VARIABLE_H_