a6e5c3bdc5a0776ce016d429266d1f76e6bffcc7
[mirror_edk2.git] / EdkModulePkg / Include / Common / Variable.h
1 /**@file
2 Header file for EFI Variable Services.
3
4 Copyright (c) 2006 - 2007 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 _EFI_VARIABLE_H_
16 #define _EFI_VARIABLE_H_
17
18 #define VARIABLE_STORE_SIGNATURE EFI_SIGNATURE_32 ('$', 'V', 'S', 'S')
19
20 #define MAX_VARIABLE_SIZE 1024
21
22 #define VARIABLE_DATA 0x55AA
23
24 //
25 // Variable Store Header flags
26 //
27 #define VARIABLE_STORE_FORMATTED 0x5a
28 #define VARIABLE_STORE_HEALTHY 0xfe
29
30 //
31 // The alignment of variable's start offset.
32 // For IA32/X64 architecture, the alignment is set to 1, and
33 // 8 is for IPF archtecture.
34 //
35 #if defined (MDE_CPU_IPF)
36 #define ALIGNMENT 8
37 #else
38 #define ALIGNMENT 1
39 #endif
40
41 //
42 // Variable Store Status
43 //
44 typedef enum {
45 EfiRaw,
46 EfiValid,
47 EfiInvalid,
48 EfiUnknown
49 } VARIABLE_STORE_STATUS;
50
51 //
52 // Variable State flags
53 //
54 #define VAR_IN_DELETED_TRANSITION 0xfe // Variable is in obsolete transistion
55 #define VAR_DELETED 0xfd // Variable is obsolete
56 #define VAR_ADDED 0x7f // Variable has been completely added
57 #define IS_VARIABLE_STATE(_c, _Mask) (BOOLEAN) (((~_c) & (~_Mask)) != 0)
58
59 #pragma pack(1)
60
61 typedef struct {
62 UINT32 Signature;
63 UINT32 Size;
64 UINT8 Format;
65 UINT8 State;
66 UINT16 Reserved;
67 UINT32 Reserved1;
68 } VARIABLE_STORE_HEADER;
69
70 typedef struct {
71 UINT16 StartId;
72 UINT8 State;
73 UINT8 Reserved;
74 UINT32 Attributes;
75 UINT32 NameSize;
76 UINT32 DataSize;
77 EFI_GUID VendorGuid;
78 } VARIABLE_HEADER;
79
80 #pragma pack()
81
82 #endif // _EFI_VARIABLE_H_