The ALIGNMENT definition has been moved to common header file.
[mirror_edk2.git] / EdkModulePkg / Universal / EmuVariable / RuntimeDxe / Variable.h
CommitLineData
878ddf1f 1/*++\r
2\r
ce8bd86e 3Copyright (c) 2006 - 2007, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
878ddf1f 11\r
12Module Name:\r
13\r
14 Variable.h\r
ce8bd86e 15\r
878ddf1f 16Abstract:\r
17\r
18--*/\r
19\r
20#ifndef _VARIABLE_H\r
21#define _VARIABLE_H\r
22\r
23//\r
24// Statements that include other header files\r
25//\r
26\r
27//\r
28// BugBug: We need relcate the head file.\r
ce8bd86e 29//\r
878ddf1f 30#include <Common/Variable.h>\r
31\r
878ddf1f 32#define VARIABLE_STORE_SIZE (64 * 1024)\r
33#define SCRATCH_SIZE (4 * 1024)\r
34\r
35//\r
36// Define GET_PAD_SIZE to optimize compiler\r
37//\r
38#if ((ALIGNMENT == 0) || (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#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
45\r
46typedef enum {\r
47 Physical,\r
48 Virtual\r
49} VARIABLE_POINTER_TYPE;\r
50\r
51typedef struct {\r
52 VARIABLE_HEADER *CurrPtr;\r
53 VARIABLE_HEADER *EndPtr;\r
54 VARIABLE_HEADER *StartPtr;\r
55 BOOLEAN Volatile;\r
56} VARIABLE_POINTER_TRACK;\r
57\r
58typedef struct {\r
59 EFI_PHYSICAL_ADDRESS VolatileVariableBase;\r
60 EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;\r
6ed71dcc 61 EFI_LOCK VariableServicesLock;\r
878ddf1f 62} VARIABLE_GLOBAL;\r
63\r
64typedef struct {\r
6ed71dcc 65 VARIABLE_GLOBAL VariableGlobal[2];\r
878ddf1f 66 UINTN VolatileLastVariableOffset;\r
67 UINTN NonVolatileLastVariableOffset;\r
68 UINT32 FvbInstance;\r
69} ESAL_VARIABLE_GLOBAL;\r
70\r
92dda53e 71extern ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;\r
72\r
878ddf1f 73//\r
74// Functions\r
75//\r
76EFI_STATUS\r
77EFIAPI\r
78VariableCommonInitialize (\r
79 IN EFI_HANDLE ImageHandle,\r
80 IN EFI_SYSTEM_TABLE *SystemTable\r
81 )\r
82;\r
83\r
84EFI_STATUS\r
85EFIAPI\r
86VariableServiceInitialize (\r
87 IN EFI_HANDLE ImageHandle,\r
88 IN EFI_SYSTEM_TABLE *SystemTable\r
89 )\r
90;\r
91\r
92VOID\r
93EFIAPI\r
94VariableClassAddressChangeEvent (\r
95 IN EFI_EVENT Event,\r
96 IN VOID *Context\r
97 )\r
98;\r
99\r
100EFI_STATUS\r
101EFIAPI\r
102GetVariable (\r
103 IN CHAR16 *VariableName,\r
104 IN EFI_GUID * VendorGuid,\r
105 OUT UINT32 *Attributes OPTIONAL,\r
106 IN OUT UINTN *DataSize,\r
107 OUT VOID *Data,\r
108 IN VARIABLE_GLOBAL * Global,\r
109 IN UINT32 Instance\r
110 )\r
111;\r
112\r
113EFI_STATUS\r
114EFIAPI\r
115GetNextVariableName (\r
116 IN OUT UINTN *VariableNameSize,\r
117 IN OUT CHAR16 *VariableName,\r
118 IN OUT EFI_GUID *VendorGuid,\r
119 IN VARIABLE_GLOBAL *Global,\r
120 IN UINT32 Instance\r
121 )\r
122;\r
123\r
124EFI_STATUS\r
125EFIAPI\r
126SetVariable (\r
127 IN CHAR16 *VariableName,\r
128 IN EFI_GUID *VendorGuid,\r
129 IN UINT32 Attributes,\r
130 IN UINTN DataSize,\r
131 IN VOID *Data,\r
132 IN VARIABLE_GLOBAL *Global,\r
133 IN UINTN *VolatileOffset,\r
134 IN UINTN *NonVolatileOffset,\r
135 IN UINT32 Instance\r
136 )\r
137;\r
138\r
045f4521 139EFI_STATUS\r
140EFIAPI\r
141QueryVariableInfo (\r
142 IN UINT32 Attributes,\r
143 OUT UINT64 *MaximumVariableStorageSize,\r
144 OUT UINT64 *RemainingVariableStorageSize,\r
145 OUT UINT64 *MaximumVariableSize,\r
146 IN VARIABLE_GLOBAL *Global,\r
147 IN UINT32 Instance\r
148 )\r
149;\r
045f4521 150\r
878ddf1f 151#endif\r