]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - DuetPkg/FSVariable/FSVariable.h
Fix Duet hang/reboot issue due to the NULL instance of CpuExceptionHandlerLib is...
[mirror_edk2.git] / DuetPkg / FSVariable / FSVariable.h
... / ...
CommitLineData
1/*++\r
2\r
3Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
4This 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/MemoryAllocationLib.h>\r
32#include <Library/UefiBootServicesTableLib.h>\r
33#include <Library/UefiRuntimeLib.h>\r
34#include <Library/DebugLib.h>\r
35#include <Library/UefiLib.h>\r
36#include <Library/HobLib.h>\r
37#include <Library/DxeServicesTableLib.h>\r
38#include <Library/DevicePathLib.h>\r
39\r
40#include <Guid/HobList.h>\r
41#include <Guid/FlashMapHob.h>\r
42#include <Guid/VariableFormat.h>\r
43#include <Guid/GlobalVariable.h>\r
44#include <Protocol/Variable.h>\r
45#include <Protocol/VariableWrite.h>\r
46#include <Protocol/SimpleFileSystem.h>\r
47#include <Protocol/BlockIo.h>\r
48\r
49\r
50#include "EfiFlashMap.h"\r
51#include "VariableStorage.h"\r
52\r
53#define VOLATILE_VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)\r
54#define VARIABLE_SCRATCH_SIZE MAX(FixedPcdGet32(PcdMaxVariableSize), FixedPcdGet32(PcdMaxHardwareErrorVariableSize))\r
55#define VARIABLE_RECLAIM_THRESHOLD (1024)\r
56///\r
57/// The size of a 3 character ISO639 language code.\r
58///\r
59#define ISO_639_2_ENTRY_SIZE 3\r
60\r
61#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
62\r
63typedef enum {\r
64 Physical,\r
65 Virtual\r
66} VARIABLE_POINTER_TYPE;\r
67\r
68typedef enum {\r
69 NonVolatile,\r
70 Volatile,\r
71 MaxType\r
72} VARIABLE_STORAGE_TYPE;\r
73\r
74typedef struct {\r
75 VARIABLE_HEADER *CurrPtr;\r
76 VARIABLE_HEADER *EndPtr;\r
77 VARIABLE_HEADER *StartPtr;\r
78 VARIABLE_STORAGE_TYPE Type;\r
79} VARIABLE_POINTER_TRACK;\r
80\r
81#define VARIABLE_MEMBER_OFFSET(Member, StartOffset) \\r
82 ( sizeof (VARIABLE_STORE_HEADER) + (StartOffset) + \\r
83 (UINTN) ((UINT8 *) &((VARIABLE_HEADER*) 0)->Member - (UINT8 *) &((VARIABLE_HEADER*) 0)->StartId) \\r
84 )\r
85\r
86\r
87typedef struct {\r
88 EFI_EVENT_NOTIFY GoVirtualChildEvent[MaxType];\r
89 VARIABLE_STORAGE *VariableStore[MaxType]; // Instance of VariableStorage\r
90 VOID *VariableBase[MaxType]; // Start address of variable storage\r
91 UINTN LastVariableOffset[MaxType]; // The position to write new variable to (index from VariableBase)\r
92 VOID *Scratch; // Buffer used during reclaim\r
93 UINTN CommonVariableTotalSize;\r
94 UINTN HwErrVariableTotalSize;\r
95 CHAR8 *PlatformLangCodes;\r
96 CHAR8 *LangCodes;\r
97 CHAR8 *PlatformLang;\r
98 CHAR8 Lang[ISO_639_2_ENTRY_SIZE + 1];\r
99} VARIABLE_GLOBAL;\r
100\r
101//\r
102// Functions\r
103//\r
104\r
105EFI_STATUS\r
106EFIAPI\r
107VariableServiceInitialize (\r
108 IN EFI_HANDLE ImageHandle,\r
109 IN EFI_SYSTEM_TABLE *SystemTable\r
110 );\r
111\r
112VOID\r
113EFIAPI\r
114VariableClassAddressChangeEvent (\r
115 IN EFI_EVENT Event,\r
116 IN VOID *Context\r
117 );\r
118\r
119EFI_STATUS\r
120EFIAPI\r
121DuetGetVariable (\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
129EFI_STATUS\r
130EFIAPI\r
131GetNextVariableName (\r
132 IN OUT UINTN *VariableNameSize,\r
133 IN OUT CHAR16 *VariableName,\r
134 IN OUT EFI_GUID *VendorGuid\r
135 );\r
136\r
137EFI_STATUS\r
138EFIAPI\r
139SetVariable (\r
140 IN CHAR16 *VariableName,\r
141 IN EFI_GUID *VendorGuid,\r
142 IN UINT32 Attributes,\r
143 IN UINTN DataSize,\r
144 IN VOID *Data\r
145 );\r
146\r
147EFI_STATUS\r
148EFIAPI\r
149QueryVariableInfo (\r
150 IN UINT32 Attributes,\r
151 OUT UINT64 *MaximumVariableStorageSize,\r
152 OUT UINT64 *RemainingVariableStorageSize,\r
153 OUT UINT64 *MaximumVariableSize\r
154 );\r
155\r
156#endif\r