]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - DuetPkg/FSVariable/FSVariable.h
DuetPkg FSVariable: Add missing change in e286e118bafa
[mirror_edk2.git] / DuetPkg / FSVariable / FSVariable.h
... / ...
CommitLineData
1/*++\r
2\r
3Caution: This file is used for Duet platform only, do not use them in real platform.\r
4All variable code, variable metadata, and variable data used by Duet platform are on \r
5disk. They can be changed by user. BIOS is not able to protoect those.\r
6Duet trusts all meta data from disk. If variable code, variable metadata and variable\r
7data is modified in inproper way, the behavior is undefined.\r
8\r
9Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
10This program and the accompanying materials \r
11are licensed and made available under the terms and conditions of the BSD License \r
12which accompanies this distribution. The full text of the license may be found at \r
13http://opensource.org/licenses/bsd-license.php \r
14 \r
15THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
16WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
17\r
18Module Name:\r
19\r
20 FSVariable.h\r
21 \r
22Abstract:\r
23\r
24--*/\r
25\r
26#ifndef _FS_VARIABLE_H\r
27#define _FS_VARIABLE_H\r
28\r
29//\r
30// Statements that include other header files\r
31//\r
32#include <PiDxe.h>\r
33\r
34#include <Library/BaseLib.h>\r
35#include <Library/PcdLib.h>\r
36#include <Library/BaseMemoryLib.h>\r
37#include <Library/MemoryAllocationLib.h>\r
38#include <Library/UefiBootServicesTableLib.h>\r
39#include <Library/UefiRuntimeLib.h>\r
40#include <Library/DebugLib.h>\r
41#include <Library/UefiLib.h>\r
42#include <Library/HobLib.h>\r
43#include <Library/DxeServicesTableLib.h>\r
44#include <Library/DevicePathLib.h>\r
45\r
46#include <Guid/HobList.h>\r
47#include <Guid/FlashMapHob.h>\r
48#include <Guid/VariableFormat.h>\r
49#include <Guid/GlobalVariable.h>\r
50#include <Protocol/Variable.h>\r
51#include <Protocol/VariableWrite.h>\r
52#include <Protocol/SimpleFileSystem.h>\r
53#include <Protocol/BlockIo.h>\r
54\r
55\r
56#include "EfiFlashMap.h"\r
57#include "VariableStorage.h"\r
58\r
59#define VOLATILE_VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)\r
60#define VARIABLE_SCRATCH_SIZE MAX(FixedPcdGet32(PcdMaxVariableSize), FixedPcdGet32(PcdMaxHardwareErrorVariableSize))\r
61#define VARIABLE_RECLAIM_THRESHOLD (1024)\r
62///\r
63/// The size of a 3 character ISO639 language code.\r
64///\r
65#define ISO_639_2_ENTRY_SIZE 3\r
66\r
67#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
68\r
69typedef enum {\r
70 Physical,\r
71 Virtual\r
72} VARIABLE_POINTER_TYPE;\r
73\r
74typedef enum {\r
75 NonVolatile,\r
76 Volatile,\r
77 MaxType\r
78} VARIABLE_STORAGE_TYPE;\r
79\r
80typedef struct {\r
81 VARIABLE_HEADER *CurrPtr;\r
82 VARIABLE_HEADER *EndPtr;\r
83 VARIABLE_HEADER *StartPtr;\r
84 VARIABLE_STORAGE_TYPE Type;\r
85} VARIABLE_POINTER_TRACK;\r
86\r
87#define VARIABLE_MEMBER_OFFSET(Member, StartOffset) \\r
88 ( sizeof (VARIABLE_STORE_HEADER) + (StartOffset) + \\r
89 (UINTN) ((UINT8 *) &((VARIABLE_HEADER*) 0)->Member - (UINT8 *) &((VARIABLE_HEADER*) 0)->StartId) \\r
90 )\r
91\r
92\r
93typedef struct {\r
94 EFI_EVENT_NOTIFY GoVirtualChildEvent[MaxType];\r
95 VARIABLE_STORAGE *VariableStore[MaxType]; // Instance of VariableStorage\r
96 VOID *VariableBase[MaxType]; // Start address of variable storage\r
97 UINTN LastVariableOffset[MaxType]; // The position to write new variable to (index from VariableBase)\r
98 VOID *Scratch; // Buffer used during reclaim\r
99 UINTN CommonVariableTotalSize;\r
100 UINTN HwErrVariableTotalSize;\r
101 CHAR8 *PlatformLangCodes;\r
102 CHAR8 *LangCodes;\r
103 CHAR8 *PlatformLang;\r
104 CHAR8 Lang[ISO_639_2_ENTRY_SIZE + 1];\r
105} VARIABLE_GLOBAL;\r
106\r
107//\r
108// Functions\r
109//\r
110\r
111EFI_STATUS\r
112EFIAPI\r
113VariableServiceInitialize (\r
114 IN EFI_HANDLE ImageHandle,\r
115 IN EFI_SYSTEM_TABLE *SystemTable\r
116 );\r
117\r
118VOID\r
119EFIAPI\r
120VariableClassAddressChangeEvent (\r
121 IN EFI_EVENT Event,\r
122 IN VOID *Context\r
123 );\r
124\r
125EFI_STATUS\r
126EFIAPI\r
127DuetGetVariable (\r
128 IN CHAR16 *VariableName,\r
129 IN EFI_GUID *VendorGuid,\r
130 OUT UINT32 *Attributes OPTIONAL,\r
131 IN OUT UINTN *DataSize,\r
132 OUT VOID *Data OPTIONAL\r
133 );\r
134\r
135EFI_STATUS\r
136EFIAPI\r
137GetNextVariableName (\r
138 IN OUT UINTN *VariableNameSize,\r
139 IN OUT CHAR16 *VariableName,\r
140 IN OUT EFI_GUID *VendorGuid\r
141 );\r
142\r
143EFI_STATUS\r
144EFIAPI\r
145SetVariable (\r
146 IN CHAR16 *VariableName,\r
147 IN EFI_GUID *VendorGuid,\r
148 IN UINT32 Attributes,\r
149 IN UINTN DataSize,\r
150 IN VOID *Data\r
151 );\r
152\r
153EFI_STATUS\r
154EFIAPI\r
155QueryVariableInfo (\r
156 IN UINT32 Attributes,\r
157 OUT UINT64 *MaximumVariableStorageSize,\r
158 OUT UINT64 *RemainingVariableStorageSize,\r
159 OUT UINT64 *MaximumVariableSize\r
160 );\r
161\r
162#endif\r