]>
Commit | Line | Data |
---|---|---|
9071550e | 1 | /*++\r |
2 | \r | |
741a1e58 ED |
3 | Caution: This file is used for Duet platform only, do not use them in real platform.\r |
4 | All variable code, variable metadata, and variable data used by Duet platform are on \r | |
5 | disk. They can be changed by user. BIOS is not able to protoect those.\r | |
6 | Duet trusts all meta data from disk. If variable code, variable metadata and variable\r | |
7 | data is modified in inproper way, the behavior is undefined.\r | |
8 | \r | |
9 | Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r | |
b1f700a8 | 10 | This program and the accompanying materials \r |
9071550e | 11 | are licensed and made available under the terms and conditions of the BSD License \r |
12 | which accompanies this distribution. The full text of the license may be found at \r | |
13 | http://opensource.org/licenses/bsd-license.php \r | |
14 | \r | |
15 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
16 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
17 | \r | |
18 | Module Name:\r | |
19 | \r | |
20 | FSVariable.h\r | |
21 | \r | |
22 | Abstract:\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 | |
d7f79118 | 37 | #include <Library/MemoryAllocationLib.h>\r |
9071550e | 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 | |
3709c4cd | 48 | #include <Guid/VariableFormat.h>\r |
a24b4043 | 49 | #include <Guid/GlobalVariable.h>\r |
9071550e | 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 | |
9071550e | 57 | #include "VariableStorage.h"\r |
58 | \r | |
a24b4043 | 59 | #define VOLATILE_VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)\r |
60 | #define VARIABLE_SCRATCH_SIZE MAX(FixedPcdGet32(PcdMaxVariableSize), FixedPcdGet32(PcdMaxHardwareErrorVariableSize))\r | |
9071550e | 61 | #define VARIABLE_RECLAIM_THRESHOLD (1024)\r |
a24b4043 | 62 | ///\r |
63 | /// The size of a 3 character ISO639 language code.\r | |
64 | ///\r | |
65 | #define ISO_639_2_ENTRY_SIZE 3\r | |
9071550e | 66 | \r |
9071550e | 67 | #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r |
68 | \r | |
69 | typedef enum {\r | |
70 | Physical,\r | |
71 | Virtual\r | |
72 | } VARIABLE_POINTER_TYPE;\r | |
73 | \r | |
74 | typedef enum {\r | |
75 | NonVolatile,\r | |
76 | Volatile,\r | |
77 | MaxType\r | |
78 | } VARIABLE_STORAGE_TYPE;\r | |
79 | \r | |
80 | typedef 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 | |
93 | typedef 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 | |
a24b4043 | 99 | UINTN CommonVariableTotalSize;\r |
100 | UINTN HwErrVariableTotalSize;\r | |
d7f79118 RN |
101 | CHAR8 *PlatformLangCodes;\r |
102 | CHAR8 *LangCodes;\r | |
103 | CHAR8 *PlatformLang;\r | |
104 | CHAR8 Lang[ISO_639_2_ENTRY_SIZE + 1];\r | |
9071550e | 105 | } VARIABLE_GLOBAL;\r |
106 | \r | |
107 | //\r | |
108 | // Functions\r | |
109 | //\r | |
110 | \r | |
111 | EFI_STATUS\r | |
112 | EFIAPI\r | |
113 | VariableServiceInitialize (\r | |
114 | IN EFI_HANDLE ImageHandle,\r | |
115 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
ed66e1bc | 116 | );\r |
9071550e | 117 | \r |
118 | VOID\r | |
119 | EFIAPI\r | |
120 | VariableClassAddressChangeEvent (\r | |
121 | IN EFI_EVENT Event,\r | |
122 | IN VOID *Context\r | |
ed66e1bc | 123 | );\r |
9071550e | 124 | \r |
125 | EFI_STATUS\r | |
126 | EFIAPI\r | |
3ffa0f1f | 127 | DuetGetVariable (\r |
9071550e | 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\r | |
ed66e1bc | 133 | );\r |
9071550e | 134 | \r |
135 | EFI_STATUS\r | |
136 | EFIAPI\r | |
137 | GetNextVariableName (\r | |
138 | IN OUT UINTN *VariableNameSize,\r | |
139 | IN OUT CHAR16 *VariableName,\r | |
140 | IN OUT EFI_GUID *VendorGuid\r | |
ed66e1bc | 141 | );\r |
9071550e | 142 | \r |
143 | EFI_STATUS\r | |
144 | EFIAPI\r | |
145 | SetVariable (\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 | |
ed66e1bc | 151 | );\r |
9071550e | 152 | \r |
9071550e | 153 | EFI_STATUS\r |
154 | EFIAPI\r | |
155 | QueryVariableInfo (\r | |
156 | IN UINT32 Attributes,\r | |
157 | OUT UINT64 *MaximumVariableStorageSize,\r | |
158 | OUT UINT64 *RemainingVariableStorageSize,\r | |
159 | OUT UINT64 *MaximumVariableSize\r | |
ed66e1bc | 160 | );\r |
9071550e | 161 | \r |
162 | #endif\r |