]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/VariableFormat.h
sync comments, fix function header, rename variable name to follow coding style.
[mirror_edk2.git] / MdeModulePkg / Include / VariableFormat.h
1 /** @file
2 EDK II specific implementation of UEFI variable depend on data structure.
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 #define VARIABLE_STORE_SIGNATURE EFI_SIGNATURE_32 ('$', 'V', 'S', 'S')
19
20 #ifndef MAX_VARIABLE_SIZE
21 #define MAX_VARIABLE_SIZE FixedPcdGet32(PcdMaxVariableSize)
22 #endif
23 //
24 // Enlarges the hardware error record maximum variable size to 32K bytes
25 //
26 #ifndef MAX_HARDWARE_ERROR_VARIABLE_SIZE
27 #define MAX_HARDWARE_ERROR_VARIABLE_SIZE FixedPcdGet32(PcdMaxHardwareErrorVariableSize)
28 #endif
29
30 #define VARIABLE_DATA 0x55AA
31
32 //
33 // Variable Store Header flags
34 //
35 #define VARIABLE_STORE_FORMATTED 0x5a
36 #define VARIABLE_STORE_HEALTHY 0xfe
37
38 //
39 // The alignment of variable's start offset.
40 // For IA32/X64 architecture, the alignment is set to 1, and
41 // 8 is for IPF archtecture.
42 //
43 #if defined (MDE_CPU_IPF)
44 #define ALIGNMENT 8
45 #else
46 #define ALIGNMENT 1
47 #endif
48
49 #define HEADER_ALIGNMENT 4
50
51 //
52 // Variable Store Status
53 //
54 typedef enum {
55 EfiRaw,
56 EfiValid,
57 EfiInvalid,
58 EfiUnknown
59 } VARIABLE_STORE_STATUS;
60
61 //
62 // Variable State flags
63 //
64 #define VAR_IN_DELETED_TRANSITION 0xfe // Variable is in obsolete transistion
65 #define VAR_DELETED 0xfd // Variable is obsolete
66 #define VAR_HEADER_VALID_ONLY 0x7f // Variable header has been valid
67 #define VAR_ADDED 0x3f // Variable has been completely added
68 //
69 #define IS_VARIABLE_STATE(_c, _Mask) (BOOLEAN) (((~_c) & (~_Mask)) != 0)
70
71 #pragma pack(1)
72
73 //
74 // Variable Store region header
75 //
76 typedef struct {
77 UINT32 Signature;
78 UINT32 Size;
79 UINT8 Format;
80 UINT8 State;
81 UINT16 Reserved;
82 UINT32 Reserved1;
83 } VARIABLE_STORE_HEADER;
84
85 //
86 // Variable header structure
87 //
88 typedef struct {
89 UINT16 StartId;
90 UINT8 State;
91 UINT8 Reserved;
92 UINT32 Attributes;
93 UINT32 NameSize;
94 UINT32 DataSize;
95 EFI_GUID VendorGuid;
96 } VARIABLE_HEADER;
97
98 #pragma pack()
99
100 #endif // _EFI_VARIABLE_H_