clean-up MdeModulePkg/Include/Protocol.
[edk2.git] / MdeModulePkg / Include / VariableFormat.h
blob2f7c7c6663b70483d08132cfce2138fb768b1ee1
1 /** @file
2 The variable data structure related to EDK II specific UEFI variable implementation.
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
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.
13 **/
15 #ifndef __VARIABLE_FORMAT_H__
16 #define __VARIABLE_FORMAT_H__
18 ///
19 /// Maximum buffer for the single variable.
20 ///
21 #ifndef MAX_VARIABLE_SIZE
22 #define MAX_VARIABLE_SIZE FixedPcdGet32(PcdMaxVariableSize)
23 #endif
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
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
43 #define HEADER_ALIGNMENT 4
45 ///
46 /// Variable Store Status
47 ///
48 typedef enum {
49 EfiRaw,
50 EfiValid,
51 EfiInvalid,
52 EfiUnknown
53 } VARIABLE_STORE_STATUS;
55 #pragma pack(1)
57 #define VARIABLE_STORE_SIGNATURE SIGNATURE_32 ('$', 'V', 'S', 'S')
59 ///
60 /// Variable Store Header Format and State
61 ///
62 #define VARIABLE_STORE_FORMATTED 0x5a
63 #define VARIABLE_STORE_HEALTHY 0xfe
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;
89 ///
90 /// Variable data start flag
91 ///
92 #define VARIABLE_DATA 0x55AA
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
103 /// Variable Data Header Structure
105 typedef struct {
107 /// Variable Data Start Flag
109 UINT16 StartId;
111 /// Variable State defined above
113 UINT8 State;
114 UINT8 Reserved;
116 /// Attributes of variable defined in UEFI spec
118 UINT32 Attributes;
120 /// Size of variable Null-terminated Unicode string name
122 UINT32 NameSize;
124 /// Size of the variable data without this header
126 UINT32 DataSize;
128 /// A unique identifier for the vendor.
130 EFI_GUID VendorGuid;
131 } VARIABLE_HEADER;
133 #pragma pack()
135 #endif // _EFI_VARIABLE_H_