]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/FSVariable/FSVariable.h
clean up the un-suitable ';' location when declaring the functions.
[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
ed66e1bc 108 );\r
9071550e 109\r
110VOID\r
111EFIAPI\r
112VariableClassAddressChangeEvent (\r
113 IN EFI_EVENT Event,\r
114 IN VOID *Context\r
ed66e1bc 115 );\r
9071550e 116\r
117EFI_STATUS\r
118EFIAPI\r
119GetVariable (\r
120 IN CHAR16 *VariableName,\r
121 IN EFI_GUID *VendorGuid,\r
122 OUT UINT32 *Attributes OPTIONAL,\r
123 IN OUT UINTN *DataSize,\r
124 OUT VOID *Data\r
ed66e1bc 125 );\r
9071550e 126\r
127EFI_STATUS\r
128EFIAPI\r
129GetNextVariableName (\r
130 IN OUT UINTN *VariableNameSize,\r
131 IN OUT CHAR16 *VariableName,\r
132 IN OUT EFI_GUID *VendorGuid\r
ed66e1bc 133 );\r
9071550e 134\r
135EFI_STATUS\r
136EFIAPI\r
137SetVariable (\r
138 IN CHAR16 *VariableName,\r
139 IN EFI_GUID *VendorGuid,\r
140 IN UINT32 Attributes,\r
141 IN UINTN DataSize,\r
142 IN VOID *Data\r
ed66e1bc 143 );\r
9071550e 144\r
145#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
146EFI_STATUS\r
147EFIAPI\r
148QueryVariableInfo (\r
149 IN UINT32 Attributes,\r
150 OUT UINT64 *MaximumVariableStorageSize,\r
151 OUT UINT64 *RemainingVariableStorageSize,\r
152 OUT UINT64 *MaximumVariableSize\r
ed66e1bc 153 );\r
9071550e 154#endif // EFI_SPECIFICATION_VERSION >= 0x00020000\r
155\r
156#endif\r