Volatile variable is read-only in runtime.
[mirror_edk2.git] / EdkModulePkg / Universal / EmuVariable / RuntimeDxe / Variable.h
CommitLineData
878ddf1f 1/*++\r
2\r
3Copyright (c) 2006, 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
11\r
12Module Name:\r
13\r
14 Variable.h\r
15 \r
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
29// \r
30#include <Common/Variable.h>\r
31\r
32#if defined (MDE_CPU_IPF)\r
33#define ALIGNMENT 8\r
34#else\r
35#define ALIGNMENT 1\r
36#endif\r
37\r
38\r
39#define VARIABLE_STORE_SIZE (64 * 1024)\r
40#define SCRATCH_SIZE (4 * 1024)\r
41\r
42//\r
43// Define GET_PAD_SIZE to optimize compiler\r
44//\r
45#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))\r
46#define GET_PAD_SIZE(a) (0)\r
47#else\r
48#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
49#endif\r
50\r
51#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
52\r
53typedef enum {\r
54 Physical,\r
55 Virtual\r
56} VARIABLE_POINTER_TYPE;\r
57\r
58typedef struct {\r
59 VARIABLE_HEADER *CurrPtr;\r
60 VARIABLE_HEADER *EndPtr;\r
61 VARIABLE_HEADER *StartPtr;\r
62 BOOLEAN Volatile;\r
63} VARIABLE_POINTER_TRACK;\r
64\r
65typedef struct {\r
66 EFI_PHYSICAL_ADDRESS VolatileVariableBase;\r
67 EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;\r
68} VARIABLE_GLOBAL;\r
69\r
70typedef struct {\r
71 VARIABLE_GLOBAL VariableBase[2];\r
72 UINTN VolatileLastVariableOffset;\r
73 UINTN NonVolatileLastVariableOffset;\r
74 UINT32 FvbInstance;\r
75} ESAL_VARIABLE_GLOBAL;\r
76\r
77//\r
78// Functions\r
79//\r
80EFI_STATUS\r
81EFIAPI\r
82VariableCommonInitialize (\r
83 IN EFI_HANDLE ImageHandle,\r
84 IN EFI_SYSTEM_TABLE *SystemTable\r
85 )\r
86;\r
87\r
88EFI_STATUS\r
89EFIAPI\r
90VariableServiceInitialize (\r
91 IN EFI_HANDLE ImageHandle,\r
92 IN EFI_SYSTEM_TABLE *SystemTable\r
93 )\r
94;\r
95\r
96VOID\r
97EFIAPI\r
98VariableClassAddressChangeEvent (\r
99 IN EFI_EVENT Event,\r
100 IN VOID *Context\r
101 )\r
102;\r
103\r
104EFI_STATUS\r
105EFIAPI\r
106GetVariable (\r
107 IN CHAR16 *VariableName,\r
108 IN EFI_GUID * VendorGuid,\r
109 OUT UINT32 *Attributes OPTIONAL,\r
110 IN OUT UINTN *DataSize,\r
111 OUT VOID *Data,\r
112 IN VARIABLE_GLOBAL * Global,\r
113 IN UINT32 Instance\r
114 )\r
115;\r
116\r
117EFI_STATUS\r
118EFIAPI\r
119GetNextVariableName (\r
120 IN OUT UINTN *VariableNameSize,\r
121 IN OUT CHAR16 *VariableName,\r
122 IN OUT EFI_GUID *VendorGuid,\r
123 IN VARIABLE_GLOBAL *Global,\r
124 IN UINT32 Instance\r
125 )\r
126;\r
127\r
128EFI_STATUS\r
129EFIAPI\r
130SetVariable (\r
131 IN CHAR16 *VariableName,\r
132 IN EFI_GUID *VendorGuid,\r
133 IN UINT32 Attributes,\r
134 IN UINTN DataSize,\r
135 IN VOID *Data,\r
136 IN VARIABLE_GLOBAL *Global,\r
137 IN UINTN *VolatileOffset,\r
138 IN UINTN *NonVolatileOffset,\r
139 IN UINT32 Instance\r
140 )\r
141;\r
142\r
045f4521 143#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
144EFI_STATUS\r
145EFIAPI\r
146QueryVariableInfo (\r
147 IN UINT32 Attributes,\r
148 OUT UINT64 *MaximumVariableStorageSize,\r
149 OUT UINT64 *RemainingVariableStorageSize,\r
150 OUT UINT64 *MaximumVariableSize,\r
151 IN VARIABLE_GLOBAL *Global,\r
152 IN UINT32 Instance\r
153 )\r
154;\r
155#endif\r
156\r
878ddf1f 157#endif\r