]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/FSVariable/FSVariable.h
Add missing module for duet package.
[mirror_edk2.git] / DuetPkg / FSVariable / FSVariable.h
CommitLineData
9071550e 1/*++\r
2\r
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
11\r
12Module Name:\r
13\r
14 FSVariable.h\r
15 \r
16Abstract:\r
17\r
18--*/\r
19\r
20#ifndef _FS_VARIABLE_H\r
21#define _FS_VARIABLE_H\r
22\r
23//\r
24// Statements that include other header files\r
25//\r
26#include <PiDxe.h>\r
27\r
28#include <Library/BaseLib.h>\r
29#include <Library/PcdLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
31#include <Library/UefiBootServicesTableLib.h>\r
32#include <Library/UefiRuntimeLib.h>\r
33#include <Library/DebugLib.h>\r
34#include <Library/UefiLib.h>\r
35#include <Library/HobLib.h>\r
36#include <Library/DxeServicesTableLib.h>\r
37#include <Library/DevicePathLib.h>\r
38\r
39#include <Guid/HobList.h>\r
40#include <Guid/FlashMapHob.h>\r
41\r
42#include <Protocol/Variable.h>\r
43#include <Protocol/VariableWrite.h>\r
44#include <Protocol/SimpleFileSystem.h>\r
45#include <Protocol/BlockIo.h>\r
46\r
47\r
48#include "EfiFlashMap.h"\r
49#include "VariableFormat.h"\r
50#include "VariableStorage.h"\r
51\r
52#define VOLATILE_VARIABLE_STORE_SIZE (64 * 1024)\r
53#define VARIABLE_SCRATCH_SIZE (4 * 1024)\r
54#define VARIABLE_RECLAIM_THRESHOLD (1024)\r
55\r
56//\r
57// Define GET_PAD_SIZE to optimize compiler\r
58//\r
59#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))\r
60#define GET_PAD_SIZE(a) (0)\r
61#else\r
62#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
63#endif\r
64\r
65#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
66\r
67typedef enum {\r
68 Physical,\r
69 Virtual\r
70} VARIABLE_POINTER_TYPE;\r
71\r
72typedef enum {\r
73 NonVolatile,\r
74 Volatile,\r
75 MaxType\r
76} VARIABLE_STORAGE_TYPE;\r
77\r
78typedef struct {\r
79 VARIABLE_HEADER *CurrPtr;\r
80 VARIABLE_HEADER *EndPtr;\r
81 VARIABLE_HEADER *StartPtr;\r
82 VARIABLE_STORAGE_TYPE Type;\r
83} VARIABLE_POINTER_TRACK;\r
84\r
85#define VARIABLE_MEMBER_OFFSET(Member, StartOffset) \\r
86 ( sizeof (VARIABLE_STORE_HEADER) + (StartOffset) + \\r
87 (UINTN) ((UINT8 *) &((VARIABLE_HEADER*) 0)->Member - (UINT8 *) &((VARIABLE_HEADER*) 0)->StartId) \\r
88 )\r
89\r
90\r
91typedef struct {\r
92 EFI_EVENT_NOTIFY GoVirtualChildEvent[MaxType];\r
93 VARIABLE_STORAGE *VariableStore[MaxType]; // Instance of VariableStorage\r
94 VOID *VariableBase[MaxType]; // Start address of variable storage\r
95 UINTN LastVariableOffset[MaxType]; // The position to write new variable to (index from VariableBase)\r
96 VOID *Scratch; // Buffer used during reclaim\r
97} VARIABLE_GLOBAL;\r
98\r
99//\r
100// Functions\r
101//\r
102\r
103EFI_STATUS\r
104EFIAPI\r
105VariableServiceInitialize (\r
106 IN EFI_HANDLE ImageHandle,\r
107 IN EFI_SYSTEM_TABLE *SystemTable\r
108 )\r
109;\r
110\r
111VOID\r
112EFIAPI\r
113VariableClassAddressChangeEvent (\r
114 IN EFI_EVENT Event,\r
115 IN VOID *Context\r
116 )\r
117;\r
118\r
119EFI_STATUS\r
120EFIAPI\r
121GetVariable (\r
122 IN CHAR16 *VariableName,\r
123 IN EFI_GUID *VendorGuid,\r
124 OUT UINT32 *Attributes OPTIONAL,\r
125 IN OUT UINTN *DataSize,\r
126 OUT VOID *Data\r
127 )\r
128;\r
129\r
130EFI_STATUS\r
131EFIAPI\r
132GetNextVariableName (\r
133 IN OUT UINTN *VariableNameSize,\r
134 IN OUT CHAR16 *VariableName,\r
135 IN OUT EFI_GUID *VendorGuid\r
136 )\r
137;\r
138\r
139EFI_STATUS\r
140EFIAPI\r
141SetVariable (\r
142 IN CHAR16 *VariableName,\r
143 IN EFI_GUID *VendorGuid,\r
144 IN UINT32 Attributes,\r
145 IN UINTN DataSize,\r
146 IN VOID *Data\r
147 )\r
148;\r
149\r
150#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
151EFI_STATUS\r
152EFIAPI\r
153QueryVariableInfo (\r
154 IN UINT32 Attributes,\r
155 OUT UINT64 *MaximumVariableStorageSize,\r
156 OUT UINT64 *RemainingVariableStorageSize,\r
157 OUT UINT64 *MaximumVariableSize\r
158 )\r
159;\r
160#endif // EFI_SPECIFICATION_VERSION >= 0x00020000\r
161\r
162#endif\r