]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/VariablePei/Variable.h
1) Fix the bug that Variable Cache Search does not be protected by lock during boot...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / VariablePei / Variable.h
CommitLineData
7ba905c9 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 Variable.h\r
15\r
16Abstract:\r
17\r
18 Tiano PEIM to provide the variable functionality\r
19\r
20--*/\r
21\r
22#ifndef _PEI_VARIABLE_H\r
23#define _PEI_VARIABLE_H\r
24\r
25#include <PiPei.h>\r
26#include <Ppi/ReadOnlyVariable.h>\r
27#include <Ppi/ReadOnlyVariable2.h>\r
28#include <Library/DebugLib.h>\r
29#include <Library/PeimEntryPoint.h>\r
30#include <Library/HobLib.h>\r
31#include <Library/PcdLib.h>\r
32#include <Library/BaseMemoryLib.h>\r
33#include <Library/PeiServicesTablePointerLib.h>\r
34#include <VariableFormat.h>\r
35\r
36//\r
37// Define GET_PAD_SIZE to optimize compiler\r
38//\r
39#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))\r
40#define GET_PAD_SIZE(a) (0)\r
41#else\r
42#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
43#endif\r
44\r
45#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
46\r
47#define GET_VARIABLE_DATA_PTR(a) \\r
48 (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (a) + (a)->NameSize + GET_PAD_SIZE ((a)->NameSize))\r
49\r
50typedef struct {\r
51 VARIABLE_HEADER *CurrPtr;\r
52 VARIABLE_HEADER *EndPtr;\r
53 VARIABLE_HEADER *StartPtr;\r
54} VARIABLE_POINTER_TRACK;\r
55\r
56#define VARIABLE_INDEX_TABLE_VOLUME 122\r
57\r
58#define EFI_VARIABLE_INDEX_TABLE_GUID \\r
59 { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }\r
60\r
61typedef struct {\r
62 UINT16 Length;\r
63 UINT16 GoneThrough;\r
64 VARIABLE_HEADER *EndPtr;\r
65 VARIABLE_HEADER *StartPtr;\r
66 UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME];\r
67} VARIABLE_INDEX_TABLE;\r
68\r
69\r
70//\r
71// Functions\r
72//\r
73EFI_STATUS\r
74EFIAPI\r
75PeimInitializeVariableServices (\r
76 IN EFI_FFS_FILE_HEADER *FfsHeader,\r
77 IN EFI_PEI_SERVICES **PeiServices\r
78 )\r
79/*++\r
80\r
81Routine Description:\r
82\r
83 TODO: Add function description\r
84\r
85Arguments:\r
86\r
87 FfsHeader - TODO: add argument description\r
88 PeiServices - TODO: add argument description\r
89\r
90Returns:\r
91\r
92 TODO: add return values\r
93\r
94--*/\r
95;\r
96\r
97EFI_STATUS\r
98EFIAPI\r
99PeiGetVariable (\r
100 IN EFI_PEI_SERVICES **PeiServices,\r
101 IN CHAR16 *VariableName,\r
102 IN EFI_GUID * VendorGuid,\r
103 OUT UINT32 *Attributes OPTIONAL,\r
104 IN OUT UINTN *DataSize,\r
105 OUT VOID *Data\r
106 )\r
107/*++\r
108\r
109Routine Description:\r
110\r
111 TODO: Add function description\r
112\r
113Arguments:\r
114\r
115 PeiServices - TODO: add argument description\r
116 VariableName - TODO: add argument description\r
117 VendorGuid - TODO: add argument description\r
118 Attributes - TODO: add argument description\r
119 DataSize - TODO: add argument description\r
120 Data - TODO: add argument description\r
121\r
122Returns:\r
123\r
124 TODO: add return values\r
125\r
126--*/\r
127;\r
128\r
129EFI_STATUS\r
130EFIAPI\r
131PeiGetVariable2 (\r
132 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
133 IN CONST CHAR16 *VariableName,\r
134 IN CONST EFI_GUID *VariableGuid,\r
135 OUT UINT32 *Attributes,\r
136 IN OUT UINTN *DataSize,\r
137 OUT VOID *Data\r
138 )\r
139/*++\r
140\r
141Routine Description:\r
142\r
143 Provide the read variable functionality of the variable services.\r
144\r
145Arguments:\r
146\r
147 PeiServices - General purpose services available to every PEIM.\r
148\r
149 VariableName - The variable name\r
150\r
151 VendorGuid - The vendor's GUID\r
152\r
153 Attributes - Pointer to the attribute\r
154\r
155 DataSize - Size of data\r
156\r
157 Data - Pointer to data\r
158\r
159Returns:\r
160\r
161 EFI_SUCCESS - The interface could be successfully installed\r
162\r
163 EFI_NOT_FOUND - The variable could not be discovered\r
164\r
165 EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough\r
166\r
167--*/\r
168; \r
169 \r
170EFI_STATUS\r
171EFIAPI\r
172PeiGetNextVariableName2 (\r
173 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
174 IN OUT UINTN *VariableNameSize,\r
175 IN OUT CHAR16 *VariableName,\r
176 IN OUT EFI_GUID *VariableGuid\r
177 )\r
178/*++\r
179\r
180Routine Description:\r
181\r
182 Provide the get next variable functionality of the variable services.\r
183\r
184Arguments:\r
185\r
186 PeiServices - General purpose services available to every PEIM.\r
187 VariabvleNameSize - The variable name's size.\r
188 VariableName - A pointer to the variable's name.\r
189 VariableGuid - A pointer to the EFI_GUID structure.\r
190\r
191 VariableNameSize - Size of the variable name\r
192\r
193 VariableName - The variable name\r
194\r
195 VendorGuid - The vendor's GUID\r
196\r
197Returns:\r
198\r
199 EFI_SUCCESS - The interface could be successfully installed\r
200\r
201 EFI_NOT_FOUND - The variable could not be discovered\r
202\r
203--*/\r
204;\r
205 \r
206EFI_STATUS\r
207EFIAPI\r
208PeiGetNextVariableName (\r
209 IN EFI_PEI_SERVICES **PeiServices,\r
210 IN OUT UINTN *VariableNameSize,\r
211 IN OUT CHAR16 *VariableName,\r
212 IN OUT EFI_GUID *VendorGuid\r
213 )\r
214/*++\r
215\r
216Routine Description:\r
217\r
218 TODO: Add function description\r
219\r
220Arguments:\r
221\r
222 PeiServices - TODO: add argument description\r
223 VariableNameSize - TODO: add argument description\r
224 VariableName - TODO: add argument description\r
225 VendorGuid - TODO: add argument description\r
226\r
227Returns:\r
228\r
229 TODO: add return values\r
230\r
231--*/\r
232;\r
233\r
234/**\r
235 Get one variable by the index count.\r
236\r
237 @param IndexTable The pointer to variable index table.\r
238 @param Count The index count of variable in index table.\r
239\r
240 @return The pointer to variable header indexed by count.\r
241\r
242**/\r
243VARIABLE_HEADER *\r
244GetVariableByIndex (\r
245 IN VARIABLE_INDEX_TABLE *IndexTable,\r
246 IN UINT32 Count\r
247 );\r
248\r
249/**\r
250 Record Variable in VariableIndex HOB.\r
251\r
252 Record Variable in VariableIndex HOB and update the length of variable index table.\r
253\r
254 @param IndexTable The pointer to variable index table.\r
255 @param Variable The pointer to the variable that will be recorded.\r
256\r
257 @retval VOID\r
258\r
259**/\r
260VOID\r
261VariableIndexTableUpdate (\r
262 IN OUT VARIABLE_INDEX_TABLE *IndexTable,\r
263 IN VARIABLE_HEADER *Variable\r
264 );\r
265\r
266#endif // _PEI_VARIABLE_H\r