]>
Commit | Line | Data |
---|---|---|
504214c4 | 1 | /** @file\r |
8d3a5c82 | 2 | \r |
504214c4 | 3 | The internal header file includes the common header files, defines\r |
8a2d4996 | 4 | internal structure and functions used by Variable modules.\r |
504214c4 | 5 | \r |
efb01a10 | 6 | Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r |
e5eed7d3 | 7 | This program and the accompanying materials\r |
8d3a5c82 | 8 | are licensed and made available under the terms and conditions of the BSD License\r |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
504214c4 | 15 | **/\r |
8d3a5c82 | 16 | \r |
7c80e839 | 17 | #ifndef _VARIABLE_H_\r |
18 | #define _VARIABLE_H_\r | |
8d3a5c82 | 19 | \r |
39099938 | 20 | #include <PiDxe.h>\r |
8d3a5c82 | 21 | #include <Protocol/VariableWrite.h>\r |
88a5561c | 22 | #include <Protocol/FaultTolerantWrite.h>\r |
8d3a5c82 | 23 | #include <Protocol/FirmwareVolumeBlock.h>\r |
24 | #include <Protocol/Variable.h>\r | |
ff843847 | 25 | #include <Protocol/VariableLock.h>\r |
efb01a10 | 26 | #include <Protocol/VarCheck.h>\r |
8d3a5c82 | 27 | #include <Library/PcdLib.h>\r |
0f7aff72 | 28 | #include <Library/HobLib.h>\r |
8d3a5c82 | 29 | #include <Library/UefiDriverEntryPoint.h>\r |
30 | #include <Library/DxeServicesTableLib.h>\r | |
31 | #include <Library/UefiRuntimeLib.h>\r | |
32 | #include <Library/DebugLib.h>\r | |
33 | #include <Library/BaseMemoryLib.h>\r | |
8d3a5c82 | 34 | #include <Library/UefiBootServicesTableLib.h>\r |
35 | #include <Library/UefiLib.h>\r | |
36 | #include <Library/BaseLib.h>\r | |
4cf894eb | 37 | #include <Library/SynchronizationLib.h>\r |
8d3a5c82 | 38 | #include <Library/MemoryAllocationLib.h>\r |
052ad7e1 | 39 | #include <Guid/GlobalVariable.h>\r |
01a5c994 | 40 | #include <Guid/EventGroup.h>\r |
3709c4cd | 41 | #include <Guid/VariableFormat.h>\r |
d6550260 | 42 | #include <Guid/SystemNvDataGuid.h>\r |
3e02ebb2 | 43 | #include <Guid/FaultTolerantWrite.h>\r |
a5f15e30 | 44 | #include <Guid/HardwareErrorVariable.h>\r |
4edb1866 | 45 | #include <Guid/VarErrorFlag.h>\r |
8d3a5c82 | 46 | \r |
255a3f33 RN |
47 | ///\r |
48 | /// The size of a 3 character ISO639 language code.\r | |
49 | ///\r | |
50 | #define ISO_639_2_ENTRY_SIZE 3\r | |
51 | \r | |
0f7aff72 RN |
52 | typedef enum {\r |
53 | VariableStoreTypeVolatile,\r | |
54 | VariableStoreTypeHob,\r | |
55 | VariableStoreTypeNv,\r | |
56 | VariableStoreTypeMax\r | |
57 | } VARIABLE_STORE_TYPE;\r | |
58 | \r | |
8d3a5c82 | 59 | typedef struct {\r |
60 | VARIABLE_HEADER *CurrPtr;\r | |
23b06935 SZ |
61 | //\r |
62 | // If both ADDED and IN_DELETED_TRANSITION variable are present,\r | |
63 | // InDeletedTransitionPtr will point to the IN_DELETED_TRANSITION one.\r | |
64 | // Otherwise, CurrPtr will point to the ADDED or IN_DELETED_TRANSITION one,\r | |
65 | // and InDeletedTransitionPtr will be NULL at the same time.\r | |
66 | //\r | |
67 | VARIABLE_HEADER *InDeletedTransitionPtr;\r | |
8d3a5c82 | 68 | VARIABLE_HEADER *EndPtr;\r |
69 | VARIABLE_HEADER *StartPtr;\r | |
70 | BOOLEAN Volatile;\r | |
71 | } VARIABLE_POINTER_TRACK;\r | |
72 | \r | |
73 | typedef struct {\r | |
0f7aff72 | 74 | EFI_PHYSICAL_ADDRESS HobVariableBase;\r |
8d3a5c82 | 75 | EFI_PHYSICAL_ADDRESS VolatileVariableBase;\r |
76 | EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;\r | |
77 | EFI_LOCK VariableServicesLock;\r | |
fdb7765f | 78 | UINT32 ReentrantState;\r |
8d3a5c82 | 79 | } VARIABLE_GLOBAL;\r |
80 | \r | |
81 | typedef struct {\r | |
052ad7e1 | 82 | VARIABLE_GLOBAL VariableGlobal;\r |
8d3a5c82 | 83 | UINTN VolatileLastVariableOffset;\r |
84 | UINTN NonVolatileLastVariableOffset;\r | |
4edb1866 SZ |
85 | UINTN CommonVariableSpace;\r |
86 | UINTN CommonMaxUserVariableSpace;\r | |
87 | UINTN CommonRuntimeVariableSpace;\r | |
2fcdca1d | 88 | UINTN CommonVariableTotalSize;\r |
4edb1866 | 89 | UINTN CommonUserVariableTotalSize;\r |
2fcdca1d | 90 | UINTN HwErrVariableTotalSize;\r |
255a3f33 RN |
91 | CHAR8 *PlatformLangCodes;\r |
92 | CHAR8 *LangCodes;\r | |
93 | CHAR8 *PlatformLang;\r | |
94 | CHAR8 Lang[ISO_639_2_ENTRY_SIZE + 1];\r | |
8a9e0b72 | 95 | EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbInstance;\r |
052ad7e1 A |
96 | } VARIABLE_MODULE_GLOBAL;\r |
97 | \r | |
ff843847 | 98 | typedef struct {\r |
ff843847 | 99 | LIST_ENTRY Link;\r |
efb01a10 SZ |
100 | EFI_GUID Guid;\r |
101 | //CHAR16 *Name;\r | |
ff843847 RN |
102 | } VARIABLE_ENTRY;\r |
103 | \r | |
335e2681 SZ |
104 | /**\r |
105 | Flush the HOB variable to flash.\r | |
106 | \r | |
107 | @param[in] VariableName Name of variable has been updated or deleted.\r | |
108 | @param[in] VendorGuid Guid of variable has been updated or deleted.\r | |
109 | \r | |
110 | **/\r | |
111 | VOID\r | |
112 | FlushHobVariableToFlash (\r | |
113 | IN CHAR16 *VariableName,\r | |
114 | IN EFI_GUID *VendorGuid\r | |
115 | );\r | |
116 | \r | |
c24b392c | 117 | /**\r |
118 | Writes a buffer to variable storage space, in the working block.\r | |
119 | \r | |
8a2d4996 | 120 | This function writes a buffer to variable storage space into a firmware\r |
121 | volume block device. The destination is specified by the parameter\r | |
c24b392c | 122 | VariableBase. Fault Tolerant Write protocol is used for writing.\r |
123 | \r | |
8a2d4996 | 124 | @param VariableBase Base address of the variable to write.\r |
128ef095 | 125 | @param VariableBuffer Point to the variable data buffer.\r |
c24b392c | 126 | \r |
8a2d4996 | 127 | @retval EFI_SUCCESS The function completed successfully.\r |
128 | @retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol.\r | |
129 | @retval EFI_ABORTED The function could not complete successfully.\r | |
c24b392c | 130 | \r |
131 | **/\r | |
132 | EFI_STATUS\r | |
133 | FtwVariableSpace (\r | |
134 | IN EFI_PHYSICAL_ADDRESS VariableBase,\r | |
128ef095 | 135 | IN VARIABLE_STORE_HEADER *VariableBuffer\r |
c24b392c | 136 | );\r |
137 | \r | |
138 | \r | |
8a2d4996 | 139 | /**\r |
140 | Update the variable region with Variable information. These are the same \r | |
141 | arguments as the EFI Variable services.\r | |
142 | \r | |
143 | @param[in] VariableName Name of variable.\r | |
144 | \r | |
145 | @param[in] VendorGuid Guid of variable.\r | |
146 | \r | |
147 | @param[in] Data Variable data.\r | |
148 | \r | |
149 | @param[in] DataSize Size of data. 0 means delete.\r | |
150 | \r | |
151 | @param[in] Attributes Attribues of the variable.\r | |
152 | \r | |
23b06935 | 153 | @param[in, out] Variable The variable information that is used to keep track of variable usage.\r |
8a2d4996 | 154 | \r |
155 | @retval EFI_SUCCESS The update operation is success.\r | |
156 | \r | |
157 | @retval EFI_OUT_OF_RESOURCES Variable region is full, cannot write other data into this region.\r | |
158 | \r | |
159 | **/\r | |
160 | EFI_STATUS\r | |
161 | UpdateVariable (\r | |
162 | IN CHAR16 *VariableName,\r | |
163 | IN EFI_GUID *VendorGuid,\r | |
164 | IN VOID *Data,\r | |
165 | IN UINTN DataSize,\r | |
166 | IN UINT32 Attributes OPTIONAL,\r | |
23b06935 | 167 | IN OUT VARIABLE_POINTER_TRACK *Variable\r |
8a2d4996 | 168 | );\r |
169 | \r | |
170 | \r | |
171 | /**\r | |
172 | Return TRUE if ExitBootServices () has been called.\r | |
173 | \r | |
174 | @retval TRUE If ExitBootServices () has been called.\r | |
175 | **/\r | |
176 | BOOLEAN\r | |
177 | AtRuntime (\r | |
178 | VOID\r | |
179 | );\r | |
180 | \r | |
181 | /**\r | |
182 | Initializes a basic mutual exclusion lock.\r | |
183 | \r | |
184 | This function initializes a basic mutual exclusion lock to the released state \r | |
185 | and returns the lock. Each lock provides mutual exclusion access at its task \r | |
186 | priority level. Since there is no preemption or multiprocessor support in EFI,\r | |
187 | acquiring the lock only consists of raising to the locks TPL.\r | |
188 | If Lock is NULL, then ASSERT().\r | |
189 | If Priority is not a valid TPL value, then ASSERT().\r | |
190 | \r | |
191 | @param Lock A pointer to the lock data structure to initialize.\r | |
192 | @param Priority EFI TPL is associated with the lock.\r | |
193 | \r | |
194 | @return The lock.\r | |
195 | \r | |
196 | **/\r | |
197 | EFI_LOCK *\r | |
198 | InitializeLock (\r | |
199 | IN OUT EFI_LOCK *Lock,\r | |
200 | IN EFI_TPL Priority\r | |
201 | );\r | |
202 | \r | |
203 | \r | |
204 | /**\r | |
205 | Acquires lock only at boot time. Simply returns at runtime.\r | |
206 | \r | |
207 | This is a temperary function that will be removed when\r | |
208 | EfiAcquireLock() in UefiLib can handle the call in UEFI\r | |
209 | Runtimer driver in RT phase.\r | |
210 | It calls EfiAcquireLock() at boot time, and simply returns\r | |
211 | at runtime.\r | |
212 | \r | |
213 | @param Lock A pointer to the lock to acquire.\r | |
214 | \r | |
215 | **/\r | |
216 | VOID\r | |
217 | AcquireLockOnlyAtBootTime (\r | |
218 | IN EFI_LOCK *Lock\r | |
219 | );\r | |
220 | \r | |
221 | \r | |
222 | /**\r | |
223 | Releases lock only at boot time. Simply returns at runtime.\r | |
224 | \r | |
225 | This is a temperary function which will be removed when\r | |
226 | EfiReleaseLock() in UefiLib can handle the call in UEFI\r | |
227 | Runtimer driver in RT phase.\r | |
228 | It calls EfiReleaseLock() at boot time and simply returns\r | |
229 | at runtime.\r | |
230 | \r | |
231 | @param Lock A pointer to the lock to release.\r | |
232 | \r | |
233 | **/\r | |
234 | VOID\r | |
235 | ReleaseLockOnlyAtBootTime (\r | |
236 | IN EFI_LOCK *Lock\r | |
237 | ); \r | |
238 | \r | |
239 | /**\r | |
240 | Retrive the FVB protocol interface by HANDLE.\r | |
241 | \r | |
242 | @param[in] FvBlockHandle The handle of FVB protocol that provides services for\r | |
243 | reading, writing, and erasing the target block.\r | |
244 | @param[out] FvBlock The interface of FVB protocol\r | |
245 | \r | |
246 | @retval EFI_SUCCESS The interface information for the specified protocol was returned.\r | |
247 | @retval EFI_UNSUPPORTED The device does not support the FVB protocol.\r | |
248 | @retval EFI_INVALID_PARAMETER FvBlockHandle is not a valid EFI_HANDLE or FvBlock is NULL.\r | |
249 | \r | |
250 | **/\r | |
251 | EFI_STATUS\r | |
252 | GetFvbByHandle (\r | |
253 | IN EFI_HANDLE FvBlockHandle,\r | |
254 | OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock\r | |
255 | );\r | |
256 | \r | |
257 | \r | |
258 | /**\r | |
259 | Retrive the Swap Address Range protocol interface.\r | |
260 | \r | |
261 | @param[out] SarProtocol The interface of SAR protocol\r | |
262 | \r | |
263 | @retval EFI_SUCCESS The SAR protocol instance was found and returned in SarProtocol.\r | |
264 | @retval EFI_NOT_FOUND The SAR protocol instance was not found.\r | |
265 | @retval EFI_INVALID_PARAMETER SarProtocol is NULL.\r | |
266 | \r | |
267 | **/\r | |
268 | EFI_STATUS\r | |
269 | GetSarProtocol (\r | |
270 | OUT VOID **SarProtocol\r | |
271 | );\r | |
272 | \r | |
273 | /**\r | |
274 | Function returns an array of handles that support the FVB protocol\r | |
275 | in a buffer allocated from pool. \r | |
276 | \r | |
277 | @param[out] NumberHandles The number of handles returned in Buffer.\r | |
278 | @param[out] Buffer A pointer to the buffer to return the requested\r | |
279 | array of handles that support FVB protocol.\r | |
280 | \r | |
281 | @retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of\r | |
282 | handles in Buffer was returned in NumberHandles.\r | |
283 | @retval EFI_NOT_FOUND No FVB handle was found.\r | |
284 | @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.\r | |
285 | @retval EFI_INVALID_PARAMETER NumberHandles is NULL or Buffer is NULL.\r | |
286 | \r | |
287 | **/\r | |
288 | EFI_STATUS\r | |
289 | GetFvbCountAndBuffer (\r | |
290 | OUT UINTN *NumberHandles,\r | |
291 | OUT EFI_HANDLE **Buffer\r | |
292 | );\r | |
293 | \r | |
294 | /**\r | |
295 | Initializes variable store area for non-volatile and volatile variable.\r | |
296 | \r | |
297 | @retval EFI_SUCCESS Function successfully executed.\r | |
298 | @retval EFI_OUT_OF_RESOURCES Fail to allocate enough memory resource.\r | |
299 | \r | |
300 | **/\r | |
301 | EFI_STATUS\r | |
302 | VariableCommonInitialize (\r | |
303 | VOID\r | |
304 | );\r | |
305 | \r | |
306 | /**\r | |
307 | This function reclaims variable storage if free size is below the threshold.\r | |
308 | \r | |
309 | **/\r | |
310 | VOID\r | |
311 | ReclaimForOS(\r | |
312 | VOID\r | |
313 | ); \r | |
314 | \r | |
315 | \r | |
316 | /**\r | |
317 | Initializes variable write service after FVB was ready.\r | |
318 | \r | |
319 | @retval EFI_SUCCESS Function successfully executed.\r | |
320 | @retval Others Fail to initialize the variable service.\r | |
321 | \r | |
322 | **/\r | |
323 | EFI_STATUS\r | |
324 | VariableWriteServiceInitialize (\r | |
325 | VOID\r | |
326 | );\r | |
327 | \r | |
328 | /**\r | |
329 | Retrive the SMM Fault Tolerent Write protocol interface.\r | |
330 | \r | |
331 | @param[out] FtwProtocol The interface of SMM Ftw protocol\r | |
332 | \r | |
333 | @retval EFI_SUCCESS The SMM SAR protocol instance was found and returned in SarProtocol.\r | |
334 | @retval EFI_NOT_FOUND The SMM SAR protocol instance was not found.\r | |
335 | @retval EFI_INVALID_PARAMETER SarProtocol is NULL.\r | |
336 | \r | |
337 | **/\r | |
338 | EFI_STATUS\r | |
339 | GetFtwProtocol (\r | |
340 | OUT VOID **FtwProtocol\r | |
341 | );\r | |
342 | \r | |
343 | /**\r | |
344 | Get the proper fvb handle and/or fvb protocol by the given Flash address.\r | |
345 | \r | |
346 | @param[in] Address The Flash address.\r | |
347 | @param[out] FvbHandle In output, if it is not NULL, it points to the proper FVB handle.\r | |
348 | @param[out] FvbProtocol In output, if it is not NULL, it points to the proper FVB protocol.\r | |
349 | \r | |
350 | **/\r | |
351 | EFI_STATUS\r | |
352 | GetFvbInfoByAddress (\r | |
353 | IN EFI_PHYSICAL_ADDRESS Address,\r | |
354 | OUT EFI_HANDLE *FvbHandle OPTIONAL,\r | |
355 | OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvbProtocol OPTIONAL\r | |
356 | );\r | |
357 | \r | |
4edb1866 SZ |
358 | /**\r |
359 | Finds variable in storage blocks of volatile and non-volatile storage areas.\r | |
360 | \r | |
361 | This code finds variable in storage blocks of volatile and non-volatile storage areas.\r | |
362 | If VariableName is an empty string, then we just return the first\r | |
363 | qualified variable without comparing VariableName and VendorGuid.\r | |
364 | If IgnoreRtCheck is TRUE, then we ignore the EFI_VARIABLE_RUNTIME_ACCESS attribute check\r | |
365 | at runtime when searching existing variable, only VariableName and VendorGuid are compared.\r | |
366 | Otherwise, variables without EFI_VARIABLE_RUNTIME_ACCESS are not visible at runtime.\r | |
367 | \r | |
368 | @param VariableName Name of the variable to be found.\r | |
369 | @param VendorGuid Vendor GUID to be found.\r | |
370 | @param PtrTrack VARIABLE_POINTER_TRACK structure for output,\r | |
371 | including the range searched and the target position.\r | |
372 | @param Global Pointer to VARIABLE_GLOBAL structure, including\r | |
373 | base of volatile variable storage area, base of\r | |
374 | NV variable storage area, and a lock.\r | |
375 | @param IgnoreRtCheck Ignore EFI_VARIABLE_RUNTIME_ACCESS attribute\r | |
376 | check at runtime when searching variable.\r | |
377 | \r | |
378 | @retval EFI_INVALID_PARAMETER If VariableName is not an empty string, while\r | |
379 | VendorGuid is NULL.\r | |
380 | @retval EFI_SUCCESS Variable successfully found.\r | |
381 | @retval EFI_NOT_FOUND Variable not found\r | |
382 | \r | |
383 | **/\r | |
384 | EFI_STATUS\r | |
385 | FindVariable (\r | |
386 | IN CHAR16 *VariableName,\r | |
387 | IN EFI_GUID *VendorGuid,\r | |
388 | OUT VARIABLE_POINTER_TRACK *PtrTrack,\r | |
389 | IN VARIABLE_GLOBAL *Global,\r | |
390 | IN BOOLEAN IgnoreRtCheck\r | |
391 | );\r | |
392 | \r | |
8a2d4996 | 393 | /**\r |
394 | \r | |
395 | This code finds variable in storage blocks (Volatile or Non-Volatile).\r | |
396 | \r | |
397 | @param VariableName Name of Variable to be found.\r | |
398 | @param VendorGuid Variable vendor GUID.\r | |
399 | @param Attributes Attribute value of the variable found.\r | |
400 | @param DataSize Size of Data found. If size is less than the\r | |
401 | data, this value contains the required size.\r | |
402 | @param Data Data pointer.\r | |
403 | \r | |
404 | @return EFI_INVALID_PARAMETER Invalid parameter.\r | |
405 | @return EFI_SUCCESS Find the specified variable.\r | |
406 | @return EFI_NOT_FOUND Not found.\r | |
407 | @return EFI_BUFFER_TO_SMALL DataSize is too small for the result.\r | |
408 | \r | |
409 | **/\r | |
410 | EFI_STATUS\r | |
411 | EFIAPI\r | |
412 | VariableServiceGetVariable (\r | |
413 | IN CHAR16 *VariableName,\r | |
414 | IN EFI_GUID *VendorGuid,\r | |
415 | OUT UINT32 *Attributes OPTIONAL,\r | |
416 | IN OUT UINTN *DataSize,\r | |
417 | OUT VOID *Data\r | |
418 | );\r | |
419 | \r | |
420 | /**\r | |
421 | \r | |
422 | This code Finds the Next available variable.\r | |
423 | \r | |
efb01a10 SZ |
424 | Caution: This function may receive untrusted input.\r |
425 | This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r | |
426 | \r | |
8a2d4996 | 427 | @param VariableNameSize Size of the variable name.\r |
428 | @param VariableName Pointer to variable name.\r | |
429 | @param VendorGuid Variable Vendor Guid.\r | |
430 | \r | |
431 | @return EFI_INVALID_PARAMETER Invalid parameter.\r | |
432 | @return EFI_SUCCESS Find the specified variable.\r | |
433 | @return EFI_NOT_FOUND Not found.\r | |
434 | @return EFI_BUFFER_TO_SMALL DataSize is too small for the result.\r | |
435 | \r | |
436 | **/\r | |
437 | EFI_STATUS\r | |
438 | EFIAPI\r | |
439 | VariableServiceGetNextVariableName (\r | |
440 | IN OUT UINTN *VariableNameSize,\r | |
441 | IN OUT CHAR16 *VariableName,\r | |
442 | IN OUT EFI_GUID *VendorGuid\r | |
443 | );\r | |
444 | \r | |
445 | /**\r | |
446 | \r | |
447 | This code sets variable in storage blocks (Volatile or Non-Volatile).\r | |
448 | \r | |
efb01a10 SZ |
449 | Caution: This function may receive untrusted input.\r |
450 | This function may be invoked in SMM mode, and datasize and data are external input.\r | |
451 | This function will do basic validation, before parse the data.\r | |
452 | \r | |
8a2d4996 | 453 | @param VariableName Name of Variable to be found.\r |
454 | @param VendorGuid Variable vendor GUID.\r | |
455 | @param Attributes Attribute value of the variable found\r | |
456 | @param DataSize Size of Data found. If size is less than the\r | |
457 | data, this value contains the required size.\r | |
458 | @param Data Data pointer.\r | |
459 | \r | |
460 | @return EFI_INVALID_PARAMETER Invalid parameter.\r | |
461 | @return EFI_SUCCESS Set successfully.\r | |
462 | @return EFI_OUT_OF_RESOURCES Resource not enough to set variable.\r | |
463 | @return EFI_NOT_FOUND Not found.\r | |
464 | @return EFI_WRITE_PROTECTED Variable is read-only.\r | |
465 | \r | |
466 | **/\r | |
467 | EFI_STATUS\r | |
468 | EFIAPI\r | |
469 | VariableServiceSetVariable (\r | |
470 | IN CHAR16 *VariableName,\r | |
471 | IN EFI_GUID *VendorGuid,\r | |
472 | IN UINT32 Attributes,\r | |
473 | IN UINTN DataSize,\r | |
474 | IN VOID *Data\r | |
475 | );\r | |
476 | \r | |
b2bd493e SZ |
477 | /**\r |
478 | \r | |
479 | This code returns information about the EFI variables.\r | |
480 | \r | |
efb01a10 SZ |
481 | Caution: This function may receive untrusted input.\r |
482 | This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r | |
483 | \r | |
b2bd493e SZ |
484 | @param Attributes Attributes bitmask to specify the type of variables\r |
485 | on which to return information.\r | |
486 | @param MaximumVariableStorageSize Pointer to the maximum size of the storage space available\r | |
487 | for the EFI variables associated with the attributes specified.\r | |
488 | @param RemainingVariableStorageSize Pointer to the remaining size of the storage space available\r | |
489 | for EFI variables associated with the attributes specified.\r | |
490 | @param MaximumVariableSize Pointer to the maximum size of an individual EFI variables\r | |
491 | associated with the attributes specified.\r | |
492 | \r | |
493 | @return EFI_SUCCESS Query successfully.\r | |
494 | \r | |
495 | **/\r | |
496 | EFI_STATUS\r | |
497 | EFIAPI\r | |
498 | VariableServiceQueryVariableInfoInternal (\r | |
499 | IN UINT32 Attributes,\r | |
500 | OUT UINT64 *MaximumVariableStorageSize,\r | |
501 | OUT UINT64 *RemainingVariableStorageSize,\r | |
502 | OUT UINT64 *MaximumVariableSize\r | |
503 | );\r | |
504 | \r | |
8a2d4996 | 505 | /**\r |
506 | \r | |
507 | This code returns information about the EFI variables.\r | |
508 | \r | |
efb01a10 SZ |
509 | Caution: This function may receive untrusted input.\r |
510 | This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r | |
511 | \r | |
8a2d4996 | 512 | @param Attributes Attributes bitmask to specify the type of variables\r |
513 | on which to return information.\r | |
514 | @param MaximumVariableStorageSize Pointer to the maximum size of the storage space available\r | |
515 | for the EFI variables associated with the attributes specified.\r | |
516 | @param RemainingVariableStorageSize Pointer to the remaining size of the storage space available\r | |
517 | for EFI variables associated with the attributes specified.\r | |
518 | @param MaximumVariableSize Pointer to the maximum size of an individual EFI variables\r | |
519 | associated with the attributes specified.\r | |
520 | \r | |
521 | @return EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.\r | |
522 | @return EFI_SUCCESS Query successfully.\r | |
523 | @return EFI_UNSUPPORTED The attribute is not supported on this platform.\r | |
524 | \r | |
525 | **/\r | |
526 | EFI_STATUS\r | |
527 | EFIAPI\r | |
528 | VariableServiceQueryVariableInfo (\r | |
529 | IN UINT32 Attributes,\r | |
530 | OUT UINT64 *MaximumVariableStorageSize,\r | |
531 | OUT UINT64 *RemainingVariableStorageSize,\r | |
532 | OUT UINT64 *MaximumVariableSize\r | |
533 | ); \r | |
ff843847 RN |
534 | \r |
535 | /**\r | |
536 | Mark a variable that will become read-only after leaving the DXE phase of execution.\r | |
537 | \r | |
538 | @param[in] This The VARIABLE_LOCK_PROTOCOL instance.\r | |
539 | @param[in] VariableName A pointer to the variable name that will be made read-only subsequently.\r | |
540 | @param[in] VendorGuid A pointer to the vendor GUID that will be made read-only subsequently.\r | |
541 | \r | |
542 | @retval EFI_SUCCESS The variable specified by the VariableName and the VendorGuid was marked\r | |
543 | as pending to be read-only.\r | |
544 | @retval EFI_INVALID_PARAMETER VariableName or VendorGuid is NULL.\r | |
545 | Or VariableName is an empty string.\r | |
546 | @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has\r | |
547 | already been signaled.\r | |
548 | @retval EFI_OUT_OF_RESOURCES There is not enough resource to hold the lock request.\r | |
549 | **/\r | |
550 | EFI_STATUS\r | |
551 | EFIAPI\r | |
552 | VariableLockRequestToLock (\r | |
553 | IN CONST EDKII_VARIABLE_LOCK_PROTOCOL *This,\r | |
554 | IN CHAR16 *VariableName,\r | |
555 | IN EFI_GUID *VendorGuid\r | |
556 | );\r | |
557 | \r | |
efb01a10 SZ |
558 | /**\r |
559 | Check if a Unicode character is a hexadecimal character.\r | |
560 | \r | |
561 | This function checks if a Unicode character is a\r | |
562 | hexadecimal character. The valid hexadecimal character is\r | |
563 | L'0' to L'9', L'a' to L'f', or L'A' to L'F'.\r | |
564 | \r | |
565 | \r | |
566 | @param Char The character to check against.\r | |
567 | \r | |
568 | @retval TRUE If the Char is a hexadecmial character.\r | |
569 | @retval FALSE If the Char is not a hexadecmial character.\r | |
570 | \r | |
571 | **/\r | |
572 | BOOLEAN\r | |
573 | EFIAPI\r | |
574 | IsHexaDecimalDigitCharacter (\r | |
575 | IN CHAR16 Char\r | |
576 | );\r | |
577 | \r | |
578 | /**\r | |
579 | Internal SetVariable check.\r | |
580 | \r | |
581 | @param[in] VariableName Name of Variable to set.\r | |
582 | @param[in] VendorGuid Variable vendor GUID.\r | |
583 | @param[in] Attributes Attribute value of the variable.\r | |
584 | @param[in] DataSize Size of Data to set.\r | |
585 | @param[in] Data Data pointer.\r | |
586 | \r | |
587 | @retval EFI_SUCCESS The SetVariable check result was success.\r | |
588 | @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID were supplied,\r | |
589 | or the DataSize exceeds the minimum or maximum allowed,\r | |
590 | or the Data value is not following UEFI spec for UEFI defined variables.\r | |
591 | @retval EFI_WRITE_PROTECTED The variable in question is read-only.\r | |
592 | @retval Others The return status from check handler.\r | |
593 | \r | |
594 | **/\r | |
595 | EFI_STATUS\r | |
596 | EFIAPI\r | |
597 | InternalVarCheckSetVariableCheck (\r | |
598 | IN CHAR16 *VariableName,\r | |
599 | IN EFI_GUID *VendorGuid,\r | |
600 | IN UINT32 Attributes,\r | |
601 | IN UINTN DataSize,\r | |
602 | IN VOID *Data\r | |
603 | );\r | |
604 | \r | |
605 | /**\r | |
606 | Register SetVariable check handler.\r | |
607 | \r | |
608 | @param[in] Handler Pointer to check handler.\r | |
609 | \r | |
610 | @retval EFI_SUCCESS The SetVariable check handler was registered successfully.\r | |
611 | @retval EFI_INVALID_PARAMETER Handler is NULL.\r | |
612 | @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has\r | |
613 | already been signaled.\r | |
614 | @retval EFI_OUT_OF_RESOURCES There is not enough resource for the SetVariable check handler register request.\r | |
615 | @retval EFI_UNSUPPORTED This interface is not implemented.\r | |
616 | For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present.\r | |
617 | \r | |
618 | **/\r | |
619 | EFI_STATUS\r | |
620 | EFIAPI\r | |
621 | VarCheckRegisterSetVariableCheckHandler (\r | |
622 | IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler\r | |
623 | );\r | |
624 | \r | |
625 | /**\r | |
626 | Variable property set.\r | |
627 | \r | |
628 | @param[in] Name Pointer to the variable name.\r | |
629 | @param[in] Guid Pointer to the vendor GUID.\r | |
630 | @param[in] VariableProperty Pointer to the input variable property.\r | |
631 | \r | |
632 | @retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully.\r | |
633 | @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string,\r | |
634 | or the fields of VariableProperty are not valid.\r | |
635 | @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has\r | |
636 | already been signaled.\r | |
637 | @retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request.\r | |
638 | \r | |
639 | **/\r | |
640 | EFI_STATUS\r | |
641 | EFIAPI\r | |
642 | VarCheckVariablePropertySet (\r | |
643 | IN CHAR16 *Name,\r | |
644 | IN EFI_GUID *Guid,\r | |
645 | IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty\r | |
646 | );\r | |
647 | \r | |
4edb1866 SZ |
648 | /**\r |
649 | Internal variable property get.\r | |
650 | \r | |
651 | @param[in] Name Pointer to the variable name.\r | |
652 | @param[in] Guid Pointer to the vendor GUID.\r | |
653 | @param[out] VariableProperty Pointer to the output variable property.\r | |
654 | \r | |
655 | @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully.\r | |
656 | @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found.\r | |
657 | \r | |
658 | **/\r | |
659 | EFI_STATUS\r | |
660 | EFIAPI\r | |
661 | InternalVarCheckVariablePropertyGet (\r | |
662 | IN CHAR16 *Name,\r | |
663 | IN EFI_GUID *Guid,\r | |
664 | OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty\r | |
665 | );\r | |
666 | \r | |
efb01a10 SZ |
667 | /**\r |
668 | Variable property get.\r | |
669 | \r | |
670 | @param[in] Name Pointer to the variable name.\r | |
671 | @param[in] Guid Pointer to the vendor GUID.\r | |
672 | @param[out] VariableProperty Pointer to the output variable property.\r | |
673 | \r | |
674 | @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully.\r | |
675 | @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string.\r | |
676 | @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found.\r | |
677 | \r | |
678 | **/\r | |
679 | EFI_STATUS\r | |
680 | EFIAPI\r | |
681 | VarCheckVariablePropertyGet (\r | |
682 | IN CHAR16 *Name,\r | |
683 | IN EFI_GUID *Guid,\r | |
684 | OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty\r | |
685 | );\r | |
686 | \r | |
4edb1866 SZ |
687 | /**\r |
688 | Initialize variable quota.\r | |
689 | \r | |
690 | **/\r | |
691 | VOID\r | |
692 | InitializeVariableQuota (\r | |
693 | VOID\r | |
694 | );\r | |
695 | \r | |
8a2d4996 | 696 | extern VARIABLE_MODULE_GLOBAL *mVariableModuleGlobal;\r |
697 | \r | |
8d3a5c82 | 698 | #endif\r |