]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/FSVariable/FSVariable.h
fixed ECC issues.
[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
3709c4cd 41#include <Guid/VariableFormat.h>\r
9071550e 42\r
43#include <Protocol/Variable.h>\r
44#include <Protocol/VariableWrite.h>\r
45#include <Protocol/SimpleFileSystem.h>\r
46#include <Protocol/BlockIo.h>\r
47\r
48\r
49#include "EfiFlashMap.h"\r
9071550e 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
9071550e 56#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
57\r
58typedef enum {\r
59 Physical,\r
60 Virtual\r
61} VARIABLE_POINTER_TYPE;\r
62\r
63typedef enum {\r
64 NonVolatile,\r
65 Volatile,\r
66 MaxType\r
67} VARIABLE_STORAGE_TYPE;\r
68\r
69typedef struct {\r
70 VARIABLE_HEADER *CurrPtr;\r
71 VARIABLE_HEADER *EndPtr;\r
72 VARIABLE_HEADER *StartPtr;\r
73 VARIABLE_STORAGE_TYPE Type;\r
74} VARIABLE_POINTER_TRACK;\r
75\r
76#define VARIABLE_MEMBER_OFFSET(Member, StartOffset) \\r
77 ( sizeof (VARIABLE_STORE_HEADER) + (StartOffset) + \\r
78 (UINTN) ((UINT8 *) &((VARIABLE_HEADER*) 0)->Member - (UINT8 *) &((VARIABLE_HEADER*) 0)->StartId) \\r
79 )\r
80\r
81\r
82typedef struct {\r
83 EFI_EVENT_NOTIFY GoVirtualChildEvent[MaxType];\r
84 VARIABLE_STORAGE *VariableStore[MaxType]; // Instance of VariableStorage\r
85 VOID *VariableBase[MaxType]; // Start address of variable storage\r
86 UINTN LastVariableOffset[MaxType]; // The position to write new variable to (index from VariableBase)\r
87 VOID *Scratch; // Buffer used during reclaim\r
88} VARIABLE_GLOBAL;\r
89\r
90//\r
91// Functions\r
92//\r
93\r
94EFI_STATUS\r
95EFIAPI\r
96VariableServiceInitialize (\r
97 IN EFI_HANDLE ImageHandle,\r
98 IN EFI_SYSTEM_TABLE *SystemTable\r
ed66e1bc 99 );\r
9071550e 100\r
101VOID\r
102EFIAPI\r
103VariableClassAddressChangeEvent (\r
104 IN EFI_EVENT Event,\r
105 IN VOID *Context\r
ed66e1bc 106 );\r
9071550e 107\r
108EFI_STATUS\r
109EFIAPI\r
3ffa0f1f 110DuetGetVariable (\r
9071550e 111 IN CHAR16 *VariableName,\r
112 IN EFI_GUID *VendorGuid,\r
113 OUT UINT32 *Attributes OPTIONAL,\r
114 IN OUT UINTN *DataSize,\r
115 OUT VOID *Data\r
ed66e1bc 116 );\r
9071550e 117\r
118EFI_STATUS\r
119EFIAPI\r
120GetNextVariableName (\r
121 IN OUT UINTN *VariableNameSize,\r
122 IN OUT CHAR16 *VariableName,\r
123 IN OUT EFI_GUID *VendorGuid\r
ed66e1bc 124 );\r
9071550e 125\r
126EFI_STATUS\r
127EFIAPI\r
128SetVariable (\r
129 IN CHAR16 *VariableName,\r
130 IN EFI_GUID *VendorGuid,\r
131 IN UINT32 Attributes,\r
132 IN UINTN DataSize,\r
133 IN VOID *Data\r
ed66e1bc 134 );\r
9071550e 135\r
136#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
137EFI_STATUS\r
138EFIAPI\r
139QueryVariableInfo (\r
140 IN UINT32 Attributes,\r
141 OUT UINT64 *MaximumVariableStorageSize,\r
142 OUT UINT64 *RemainingVariableStorageSize,\r
143 OUT UINT64 *MaximumVariableSize\r
ed66e1bc 144 );\r
9071550e 145#endif // EFI_SPECIFICATION_VERSION >= 0x00020000\r
146\r
147#endif\r