]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/FSVariable/FSVariable.h
Update the copyright notice format
[mirror_edk2.git] / DuetPkg / FSVariable / FSVariable.h
CommitLineData
9071550e 1/*++\r
2\r
a17b7e9f 3Copyright (c) 2006 - 2010, Intel Corporation \r
9071550e 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
a24b4043 42#include <Guid/GlobalVariable.h>\r
9071550e 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
a24b4043 52#define VOLATILE_VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)\r
53#define VARIABLE_SCRATCH_SIZE MAX(FixedPcdGet32(PcdMaxVariableSize), FixedPcdGet32(PcdMaxHardwareErrorVariableSize))\r
9071550e 54#define VARIABLE_RECLAIM_THRESHOLD (1024)\r
a24b4043 55///\r
56/// The size of a 3 character ISO639 language code.\r
57///\r
58#define ISO_639_2_ENTRY_SIZE 3\r
9071550e 59\r
9071550e 60#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
61\r
62typedef enum {\r
63 Physical,\r
64 Virtual\r
65} VARIABLE_POINTER_TYPE;\r
66\r
67typedef enum {\r
68 NonVolatile,\r
69 Volatile,\r
70 MaxType\r
71} VARIABLE_STORAGE_TYPE;\r
72\r
73typedef struct {\r
74 VARIABLE_HEADER *CurrPtr;\r
75 VARIABLE_HEADER *EndPtr;\r
76 VARIABLE_HEADER *StartPtr;\r
77 VARIABLE_STORAGE_TYPE Type;\r
78} VARIABLE_POINTER_TRACK;\r
79\r
80#define VARIABLE_MEMBER_OFFSET(Member, StartOffset) \\r
81 ( sizeof (VARIABLE_STORE_HEADER) + (StartOffset) + \\r
82 (UINTN) ((UINT8 *) &((VARIABLE_HEADER*) 0)->Member - (UINT8 *) &((VARIABLE_HEADER*) 0)->StartId) \\r
83 )\r
84\r
85\r
86typedef struct {\r
87 EFI_EVENT_NOTIFY GoVirtualChildEvent[MaxType];\r
88 VARIABLE_STORAGE *VariableStore[MaxType]; // Instance of VariableStorage\r
89 VOID *VariableBase[MaxType]; // Start address of variable storage\r
90 UINTN LastVariableOffset[MaxType]; // The position to write new variable to (index from VariableBase)\r
91 VOID *Scratch; // Buffer used during reclaim\r
a24b4043 92 UINTN CommonVariableTotalSize;\r
93 UINTN HwErrVariableTotalSize;\r
94 CHAR8 PlatformLangCodes[256]; //Pre-allocate 256 bytes space to accommodate the PlatformlangCodes.\r
95 CHAR8 LangCodes[256]; //Pre-allocate 256 bytes space to accommodate the langCodes.\r
96 CHAR8 PlatformLang[8]; //Pre-allocate 8 bytes space to accommodate the Platformlang variable.\r
97 CHAR8 Lang[4]; //Pre-allocate 4 bytes space to accommodate the lang variable.\r
9071550e 98} VARIABLE_GLOBAL;\r
99\r
100//\r
101// Functions\r
102//\r
103\r
104EFI_STATUS\r
105EFIAPI\r
106VariableServiceInitialize (\r
107 IN EFI_HANDLE ImageHandle,\r
108 IN EFI_SYSTEM_TABLE *SystemTable\r
ed66e1bc 109 );\r
9071550e 110\r
111VOID\r
112EFIAPI\r
113VariableClassAddressChangeEvent (\r
114 IN EFI_EVENT Event,\r
115 IN VOID *Context\r
ed66e1bc 116 );\r
9071550e 117\r
118EFI_STATUS\r
119EFIAPI\r
3ffa0f1f 120DuetGetVariable (\r
9071550e 121 IN CHAR16 *VariableName,\r
122 IN EFI_GUID *VendorGuid,\r
123 OUT UINT32 *Attributes OPTIONAL,\r
124 IN OUT UINTN *DataSize,\r
125 OUT VOID *Data\r
ed66e1bc 126 );\r
9071550e 127\r
128EFI_STATUS\r
129EFIAPI\r
130GetNextVariableName (\r
131 IN OUT UINTN *VariableNameSize,\r
132 IN OUT CHAR16 *VariableName,\r
133 IN OUT EFI_GUID *VendorGuid\r
ed66e1bc 134 );\r
9071550e 135\r
136EFI_STATUS\r
137EFIAPI\r
138SetVariable (\r
139 IN CHAR16 *VariableName,\r
140 IN EFI_GUID *VendorGuid,\r
141 IN UINT32 Attributes,\r
142 IN UINTN DataSize,\r
143 IN VOID *Data\r
ed66e1bc 144 );\r
9071550e 145\r
9071550e 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\r
155#endif\r