]>
Commit | Line | Data |
---|---|---|
0c18794e | 1 | /** @file\r |
2 | The internal header file includes the common header files, defines\r | |
3 | internal structure and functions used by Variable modules.\r | |
4 | \r | |
83758cdc | 5 | Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r |
0c18794e | 6 | This program and the accompanying materials \r |
7 | are licensed and made available under the terms and conditions of the BSD License \r | |
8 | which accompanies this distribution. The full text of the license may be found at \r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _VARIABLE_H_\r | |
17 | #define _VARIABLE_H_\r | |
18 | \r | |
19 | #include <PiDxe.h>\r | |
20 | #include <Protocol/VariableWrite.h>\r | |
21 | #include <Protocol/FaultTolerantWrite.h>\r | |
22 | #include <Protocol/FirmwareVolumeBlock.h>\r | |
23 | #include <Protocol/Variable.h>\r | |
24 | #include <Library/PcdLib.h>\r | |
9a000b46 | 25 | #include <Library/HobLib.h>\r |
0c18794e | 26 | #include <Library/UefiDriverEntryPoint.h>\r |
27 | #include <Library/DxeServicesTableLib.h>\r | |
28 | #include <Library/UefiRuntimeLib.h>\r | |
29 | #include <Library/DebugLib.h>\r | |
30 | #include <Library/BaseMemoryLib.h>\r | |
31 | #include <Library/UefiBootServicesTableLib.h>\r | |
32 | #include <Library/UefiLib.h>\r | |
33 | #include <Library/BaseLib.h>\r | |
34 | #include <Library/SynchronizationLib.h>\r | |
35 | #include <Library/MemoryAllocationLib.h>\r | |
36 | #include <Library/BaseCryptLib.h>\r | |
37 | #include <Library/PlatformSecureLib.h>\r | |
38 | #include <Guid/GlobalVariable.h>\r | |
39 | #include <Guid/EventGroup.h>\r | |
40 | #include <Guid/AuthenticatedVariableFormat.h>\r | |
41 | #include <Guid/ImageAuthentication.h>\r | |
4d832aab | 42 | #include <Guid/SystemNvDataGuid.h>\r |
a5f15e30 | 43 | #include <Guid/HardwareErrorVariable.h>\r |
0c18794e | 44 | \r |
45 | #define VARIABLE_RECLAIM_THRESHOLD (1024)\r | |
275beb2b | 46 | #define EFI_VARIABLE_ATTRIBUTES_MASK (EFI_VARIABLE_NON_VOLATILE | \\r |
47 | EFI_VARIABLE_BOOTSERVICE_ACCESS | \\r | |
48 | EFI_VARIABLE_RUNTIME_ACCESS | \\r | |
49 | EFI_VARIABLE_HARDWARE_ERROR_RECORD | \\r | |
50 | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \\r | |
51 | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \\r | |
52 | EFI_VARIABLE_APPEND_WRITE)\r | |
0c18794e | 53 | \r |
54 | ///\r | |
55 | /// The size of a 3 character ISO639 language code.\r | |
56 | ///\r | |
57 | #define ISO_639_2_ENTRY_SIZE 3\r | |
58 | \r | |
9a000b46 RN |
59 | typedef enum {\r |
60 | VariableStoreTypeVolatile,\r | |
61 | VariableStoreTypeHob,\r | |
62 | VariableStoreTypeNv,\r | |
63 | VariableStoreTypeMax\r | |
64 | } VARIABLE_STORE_TYPE;\r | |
65 | \r | |
0c18794e | 66 | typedef struct {\r |
67 | VARIABLE_HEADER *CurrPtr;\r | |
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 | |
9a000b46 | 74 | EFI_PHYSICAL_ADDRESS HobVariableBase;\r |
0c18794e | 75 | EFI_PHYSICAL_ADDRESS VolatileVariableBase;\r |
76 | EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;\r | |
77 | EFI_LOCK VariableServicesLock;\r | |
78 | UINT32 ReentrantState;\r | |
79 | } VARIABLE_GLOBAL;\r | |
80 | \r | |
81 | typedef struct {\r | |
82 | VARIABLE_GLOBAL VariableGlobal;\r | |
83 | UINTN VolatileLastVariableOffset;\r | |
84 | UINTN NonVolatileLastVariableOffset;\r | |
85 | UINTN CommonVariableTotalSize;\r | |
86 | UINTN HwErrVariableTotalSize;\r | |
87 | CHAR8 *PlatformLangCodes;\r | |
88 | CHAR8 *LangCodes;\r | |
89 | CHAR8 *PlatformLang;\r | |
90 | CHAR8 Lang[ISO_639_2_ENTRY_SIZE + 1];\r | |
91 | EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbInstance;\r | |
92 | } VARIABLE_MODULE_GLOBAL;\r | |
93 | \r | |
94 | typedef struct {\r | |
95 | EFI_GUID *Guid;\r | |
96 | CHAR16 *Name;\r | |
97 | UINT32 Attributes;\r | |
98 | UINTN DataSize;\r | |
99 | VOID *Data;\r | |
100 | } VARIABLE_CACHE_ENTRY;\r | |
101 | \r | |
335e2681 SZ |
102 | /**\r |
103 | Flush the HOB variable to flash.\r | |
104 | \r | |
105 | @param[in] VariableName Name of variable has been updated or deleted.\r | |
106 | @param[in] VendorGuid Guid of variable has been updated or deleted.\r | |
107 | \r | |
108 | **/\r | |
109 | VOID\r | |
110 | FlushHobVariableToFlash (\r | |
111 | IN CHAR16 *VariableName,\r | |
112 | IN EFI_GUID *VendorGuid\r | |
113 | );\r | |
114 | \r | |
0c18794e | 115 | /**\r |
116 | Writes a buffer to variable storage space, in the working block.\r | |
117 | \r | |
118 | This function writes a buffer to variable storage space into a firmware\r | |
119 | volume block device. The destination is specified by the parameter\r | |
120 | VariableBase. Fault Tolerant Write protocol is used for writing.\r | |
121 | \r | |
122 | @param VariableBase Base address of the variable to write.\r | |
123 | @param Buffer Point to the data buffer.\r | |
124 | @param BufferSize The number of bytes of the data Buffer.\r | |
125 | \r | |
126 | @retval EFI_SUCCESS The function completed successfully.\r | |
127 | @retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol.\r | |
128 | @retval EFI_ABORTED The function could not complete successfully.\r | |
129 | \r | |
130 | **/\r | |
131 | EFI_STATUS\r | |
132 | FtwVariableSpace (\r | |
133 | IN EFI_PHYSICAL_ADDRESS VariableBase,\r | |
134 | IN UINT8 *Buffer,\r | |
135 | IN UINTN BufferSize\r | |
136 | );\r | |
137 | \r | |
138 | /**\r | |
139 | Finds variable in storage blocks of volatile and non-volatile storage areas.\r | |
140 | \r | |
141 | This code finds variable in storage blocks of volatile and non-volatile storage areas.\r | |
142 | If VariableName is an empty string, then we just return the first\r | |
143 | qualified variable without comparing VariableName and VendorGuid.\r | |
9622df63 SZ |
144 | If IgnoreRtCheck is TRUE, then we ignore the EFI_VARIABLE_RUNTIME_ACCESS attribute check\r |
145 | at runtime when searching existing variable, only VariableName and VendorGuid are compared.\r | |
146 | Otherwise, variables without EFI_VARIABLE_RUNTIME_ACCESS are not visible at runtime.\r | |
0c18794e | 147 | \r |
ecc722ad | 148 | @param[in] VariableName Name of the variable to be found.\r |
149 | @param[in] VendorGuid Vendor GUID to be found.\r | |
150 | @param[out] PtrTrack VARIABLE_POINTER_TRACK structure for output,\r | |
0c18794e | 151 | including the range searched and the target position.\r |
ecc722ad | 152 | @param[in] Global Pointer to VARIABLE_GLOBAL structure, including\r |
0c18794e | 153 | base of volatile variable storage area, base of\r |
154 | NV variable storage area, and a lock.\r | |
9622df63 SZ |
155 | @param[in] IgnoreRtCheck Ignore EFI_VARIABLE_RUNTIME_ACCESS attribute\r |
156 | check at runtime when searching variable.\r | |
0c18794e | 157 | \r |
158 | @retval EFI_INVALID_PARAMETER If VariableName is not an empty string, while\r | |
159 | VendorGuid is NULL.\r | |
160 | @retval EFI_SUCCESS Variable successfully found.\r | |
ecc722ad | 161 | @retval EFI_NOT_FOUND Variable not found\r |
0c18794e | 162 | \r |
163 | **/\r | |
164 | EFI_STATUS\r | |
165 | FindVariable (\r | |
166 | IN CHAR16 *VariableName,\r | |
167 | IN EFI_GUID *VendorGuid,\r | |
168 | OUT VARIABLE_POINTER_TRACK *PtrTrack,\r | |
ecc722ad | 169 | IN VARIABLE_GLOBAL *Global,\r |
9622df63 | 170 | IN BOOLEAN IgnoreRtCheck\r |
0c18794e | 171 | );\r |
172 | \r | |
173 | /**\r | |
174 | \r | |
175 | This code gets the pointer to the variable data.\r | |
176 | \r | |
177 | @param Variable Pointer to the Variable Header.\r | |
178 | \r | |
179 | @return Pointer to Variable Data.\r | |
180 | \r | |
181 | **/\r | |
182 | UINT8 *\r | |
183 | GetVariableDataPtr (\r | |
184 | IN VARIABLE_HEADER *Variable\r | |
185 | );\r | |
186 | \r | |
187 | /**\r | |
188 | \r | |
189 | This code gets the size of variable data.\r | |
190 | \r | |
191 | @param Variable Pointer to the Variable Header.\r | |
192 | \r | |
193 | @return Size of variable in bytes.\r | |
194 | \r | |
195 | **/\r | |
196 | UINTN\r | |
197 | DataSizeOfVariable (\r | |
198 | IN VARIABLE_HEADER *Variable\r | |
199 | );\r | |
200 | \r | |
201 | /**\r | |
202 | Update the variable region with Variable information. If EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is set,\r | |
203 | index of associated public key is needed.\r | |
204 | \r | |
205 | @param[in] VariableName Name of variable.\r | |
206 | @param[in] VendorGuid Guid of variable.\r | |
207 | @param[in] Data Variable data.\r | |
208 | @param[in] DataSize Size of data. 0 means delete.\r | |
209 | @param[in] Attributes Attributes of the variable.\r | |
210 | @param[in] KeyIndex Index of associated public key.\r | |
211 | @param[in] MonotonicCount Value of associated monotonic count.\r | |
212 | @param[in] Variable The variable information that is used to keep track of variable usage.\r | |
213 | \r | |
214 | @param[in] TimeStamp Value of associated TimeStamp.\r | |
215 | \r | |
216 | @retval EFI_SUCCESS The update operation is success.\r | |
217 | @retval EFI_OUT_OF_RESOURCES Variable region is full, cannot write other data into this region.\r | |
218 | \r | |
219 | **/\r | |
220 | EFI_STATUS\r | |
221 | UpdateVariable (\r | |
222 | IN CHAR16 *VariableName,\r | |
223 | IN EFI_GUID *VendorGuid,\r | |
224 | IN VOID *Data,\r | |
225 | IN UINTN DataSize,\r | |
226 | IN UINT32 Attributes OPTIONAL,\r | |
227 | IN UINT32 KeyIndex OPTIONAL,\r | |
228 | IN UINT64 MonotonicCount OPTIONAL,\r | |
229 | IN VARIABLE_POINTER_TRACK *Variable,\r | |
230 | IN EFI_TIME *TimeStamp OPTIONAL \r | |
231 | );\r | |
232 | \r | |
233 | \r | |
234 | /**\r | |
235 | Return TRUE if ExitBootServices () has been called.\r | |
236 | \r | |
237 | @retval TRUE If ExitBootServices () has been called.\r | |
238 | **/\r | |
239 | BOOLEAN\r | |
240 | AtRuntime (\r | |
241 | VOID\r | |
242 | );\r | |
243 | \r | |
244 | /**\r | |
245 | Initializes a basic mutual exclusion lock.\r | |
246 | \r | |
247 | This function initializes a basic mutual exclusion lock to the released state \r | |
248 | and returns the lock. Each lock provides mutual exclusion access at its task \r | |
249 | priority level. Since there is no preemption or multiprocessor support in EFI,\r | |
250 | acquiring the lock only consists of raising to the locks TPL.\r | |
251 | If Lock is NULL, then ASSERT().\r | |
252 | If Priority is not a valid TPL value, then ASSERT().\r | |
253 | \r | |
254 | @param Lock A pointer to the lock data structure to initialize.\r | |
255 | @param Priority EFI TPL is associated with the lock.\r | |
256 | \r | |
257 | @return The lock.\r | |
258 | \r | |
259 | **/\r | |
260 | EFI_LOCK *\r | |
261 | InitializeLock (\r | |
262 | IN OUT EFI_LOCK *Lock,\r | |
263 | IN EFI_TPL Priority\r | |
264 | );\r | |
265 | \r | |
266 | \r | |
267 | /**\r | |
268 | Acquires lock only at boot time. Simply returns at runtime.\r | |
269 | \r | |
270 | This is a temperary function that will be removed when\r | |
271 | EfiAcquireLock() in UefiLib can handle the call in UEFI\r | |
272 | Runtimer driver in RT phase.\r | |
273 | It calls EfiAcquireLock() at boot time, and simply returns\r | |
274 | at runtime.\r | |
275 | \r | |
276 | @param Lock A pointer to the lock to acquire.\r | |
277 | \r | |
278 | **/\r | |
279 | VOID\r | |
280 | AcquireLockOnlyAtBootTime (\r | |
281 | IN EFI_LOCK *Lock\r | |
282 | );\r | |
283 | \r | |
284 | \r | |
285 | /**\r | |
286 | Releases lock only at boot time. Simply returns at runtime.\r | |
287 | \r | |
288 | This is a temperary function which will be removed when\r | |
289 | EfiReleaseLock() in UefiLib can handle the call in UEFI\r | |
290 | Runtimer driver in RT phase.\r | |
291 | It calls EfiReleaseLock() at boot time and simply returns\r | |
292 | at runtime.\r | |
293 | \r | |
294 | @param Lock A pointer to the lock to release.\r | |
295 | \r | |
296 | **/\r | |
297 | VOID\r | |
298 | ReleaseLockOnlyAtBootTime (\r | |
299 | IN EFI_LOCK *Lock\r | |
300 | ); \r | |
301 | \r | |
302 | /**\r | |
303 | Retrive the FVB protocol interface by HANDLE.\r | |
304 | \r | |
305 | @param[in] FvBlockHandle The handle of FVB protocol that provides services for\r | |
306 | reading, writing, and erasing the target block.\r | |
307 | @param[out] FvBlock The interface of FVB protocol\r | |
308 | \r | |
309 | @retval EFI_SUCCESS The interface information for the specified protocol was returned.\r | |
310 | @retval EFI_UNSUPPORTED The device does not support the FVB protocol.\r | |
311 | @retval EFI_INVALID_PARAMETER FvBlockHandle is not a valid EFI_HANDLE or FvBlock is NULL.\r | |
312 | \r | |
313 | **/\r | |
314 | EFI_STATUS\r | |
315 | GetFvbByHandle (\r | |
316 | IN EFI_HANDLE FvBlockHandle,\r | |
317 | OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock\r | |
318 | );\r | |
319 | \r | |
320 | \r | |
321 | /**\r | |
322 | Retrive the Swap Address Range protocol interface.\r | |
323 | \r | |
324 | @param[out] SarProtocol The interface of SAR protocol\r | |
325 | \r | |
326 | @retval EFI_SUCCESS The SAR protocol instance was found and returned in SarProtocol.\r | |
327 | @retval EFI_NOT_FOUND The SAR protocol instance was not found.\r | |
328 | @retval EFI_INVALID_PARAMETER SarProtocol is NULL.\r | |
329 | \r | |
330 | **/\r | |
331 | EFI_STATUS\r | |
332 | GetSarProtocol (\r | |
333 | OUT VOID **SarProtocol\r | |
334 | );\r | |
335 | \r | |
336 | /**\r | |
337 | Function returns an array of handles that support the FVB protocol\r | |
338 | in a buffer allocated from pool. \r | |
339 | \r | |
340 | @param[out] NumberHandles The number of handles returned in Buffer.\r | |
341 | @param[out] Buffer A pointer to the buffer to return the requested\r | |
342 | array of handles that support FVB protocol.\r | |
343 | \r | |
344 | @retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of\r | |
345 | handles in Buffer was returned in NumberHandles.\r | |
346 | @retval EFI_NOT_FOUND No FVB handle was found.\r | |
347 | @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.\r | |
348 | @retval EFI_INVALID_PARAMETER NumberHandles is NULL or Buffer is NULL.\r | |
349 | \r | |
350 | **/\r | |
351 | EFI_STATUS\r | |
352 | GetFvbCountAndBuffer (\r | |
353 | OUT UINTN *NumberHandles,\r | |
354 | OUT EFI_HANDLE **Buffer\r | |
355 | );\r | |
356 | \r | |
357 | /**\r | |
358 | Initializes variable store area for non-volatile and volatile variable.\r | |
359 | \r | |
360 | @retval EFI_SUCCESS Function successfully executed.\r | |
361 | @retval EFI_OUT_OF_RESOURCES Fail to allocate enough memory resource.\r | |
362 | \r | |
363 | **/\r | |
364 | EFI_STATUS\r | |
365 | VariableCommonInitialize (\r | |
366 | VOID\r | |
367 | );\r | |
368 | \r | |
83758cdc | 369 | /**\r |
370 | \r | |
371 | Variable store garbage collection and reclaim operation.\r | |
372 | \r | |
373 | If ReclaimPubKeyStore is FALSE, reclaim variable space by deleting the obsoleted varaibles.\r | |
374 | If ReclaimPubKeyStore is TRUE, reclaim invalid key in public key database and update the PubKeyIndex\r | |
375 | for all the count-based authenticate variable in NV storage.\r | |
376 | \r | |
377 | @param[in] VariableBase Base address of variable store.\r | |
378 | @param[out] LastVariableOffset Offset of last variable.\r | |
379 | @param[in] IsVolatile The variable store is volatile or not;\r | |
380 | if it is non-volatile, need FTW.\r | |
381 | @param[in] UpdatingVariable Pointer to updating variable.\r | |
382 | @param[in] ReclaimPubKeyStore Reclaim for public key database or not.\r | |
383 | @param[in] ReclaimAnyway If TRUE, do reclaim anyway.\r | |
384 | \r | |
385 | @return EFI_OUT_OF_RESOURCES No enough memory resources.\r | |
386 | @return EFI_SUCCESS Reclaim operation has finished successfully.\r | |
387 | @return Others Unexpect error happened during reclaim operation.\r | |
388 | \r | |
389 | **/\r | |
390 | EFI_STATUS\r | |
391 | Reclaim (\r | |
392 | IN EFI_PHYSICAL_ADDRESS VariableBase,\r | |
393 | OUT UINTN *LastVariableOffset,\r | |
394 | IN BOOLEAN IsVolatile,\r | |
395 | IN VARIABLE_HEADER *UpdatingVariable,\r | |
396 | IN BOOLEAN ReclaimPubKeyStore,\r | |
397 | IN BOOLEAN ReclaimAnyway\r | |
398 | );\r | |
399 | \r | |
0c18794e | 400 | /**\r |
401 | This function reclaims variable storage if free size is below the threshold.\r | |
402 | \r | |
403 | **/\r | |
404 | VOID\r | |
405 | ReclaimForOS(\r | |
406 | VOID\r | |
407 | ); \r | |
408 | \r | |
409 | \r | |
410 | /**\r | |
411 | Initializes variable write service after FVB was ready.\r | |
412 | \r | |
413 | @retval EFI_SUCCESS Function successfully executed.\r | |
414 | @retval Others Fail to initialize the variable service.\r | |
415 | \r | |
416 | **/\r | |
417 | EFI_STATUS\r | |
418 | VariableWriteServiceInitialize (\r | |
419 | VOID\r | |
420 | );\r | |
421 | \r | |
422 | /**\r | |
423 | Retrive the SMM Fault Tolerent Write protocol interface.\r | |
424 | \r | |
425 | @param[out] FtwProtocol The interface of SMM Ftw protocol\r | |
426 | \r | |
427 | @retval EFI_SUCCESS The SMM SAR protocol instance was found and returned in SarProtocol.\r | |
428 | @retval EFI_NOT_FOUND The SMM SAR protocol instance was not found.\r | |
429 | @retval EFI_INVALID_PARAMETER SarProtocol is NULL.\r | |
430 | \r | |
431 | **/\r | |
432 | EFI_STATUS\r | |
433 | GetFtwProtocol (\r | |
434 | OUT VOID **FtwProtocol\r | |
435 | );\r | |
436 | \r | |
437 | /**\r | |
438 | Get the proper fvb handle and/or fvb protocol by the given Flash address.\r | |
439 | \r | |
440 | @param[in] Address The Flash address.\r | |
441 | @param[out] FvbHandle In output, if it is not NULL, it points to the proper FVB handle.\r | |
442 | @param[out] FvbProtocol In output, if it is not NULL, it points to the proper FVB protocol.\r | |
443 | \r | |
444 | **/\r | |
445 | EFI_STATUS\r | |
446 | GetFvbInfoByAddress (\r | |
447 | IN EFI_PHYSICAL_ADDRESS Address,\r | |
448 | OUT EFI_HANDLE *FvbHandle OPTIONAL,\r | |
449 | OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvbProtocol OPTIONAL\r | |
450 | );\r | |
451 | \r | |
452 | /**\r | |
453 | \r | |
454 | This code finds variable in storage blocks (Volatile or Non-Volatile).\r | |
455 | \r | |
dc204d5a JY |
456 | Caution: This function may receive untrusted input.\r |
457 | This function may be invoked in SMM mode, and datasize and data are external input.\r | |
458 | This function will do basic validation, before parse the data.\r | |
459 | \r | |
0c18794e | 460 | @param VariableName Name of Variable to be found.\r |
461 | @param VendorGuid Variable vendor GUID.\r | |
462 | @param Attributes Attribute value of the variable found.\r | |
463 | @param DataSize Size of Data found. If size is less than the\r | |
464 | data, this value contains the required size.\r | |
465 | @param Data Data pointer.\r | |
466 | \r | |
467 | @return EFI_INVALID_PARAMETER Invalid parameter.\r | |
468 | @return EFI_SUCCESS Find the specified variable.\r | |
469 | @return EFI_NOT_FOUND Not found.\r | |
470 | @return EFI_BUFFER_TO_SMALL DataSize is too small for the result.\r | |
471 | \r | |
472 | **/\r | |
473 | EFI_STATUS\r | |
474 | EFIAPI\r | |
475 | VariableServiceGetVariable (\r | |
476 | IN CHAR16 *VariableName,\r | |
477 | IN EFI_GUID *VendorGuid,\r | |
478 | OUT UINT32 *Attributes OPTIONAL,\r | |
479 | IN OUT UINTN *DataSize,\r | |
480 | OUT VOID *Data\r | |
481 | );\r | |
482 | \r | |
483 | /**\r | |
484 | \r | |
485 | This code Finds the Next available variable.\r | |
486 | \r | |
dc204d5a JY |
487 | Caution: This function may receive untrusted input.\r |
488 | This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r | |
489 | \r | |
0c18794e | 490 | @param VariableNameSize Size of the variable name.\r |
491 | @param VariableName Pointer to variable name.\r | |
492 | @param VendorGuid Variable Vendor Guid.\r | |
493 | \r | |
494 | @return EFI_INVALID_PARAMETER Invalid parameter.\r | |
495 | @return EFI_SUCCESS Find the specified variable.\r | |
496 | @return EFI_NOT_FOUND Not found.\r | |
497 | @return EFI_BUFFER_TO_SMALL DataSize is too small for the result.\r | |
498 | \r | |
499 | **/\r | |
500 | EFI_STATUS\r | |
501 | EFIAPI\r | |
502 | VariableServiceGetNextVariableName (\r | |
503 | IN OUT UINTN *VariableNameSize,\r | |
504 | IN OUT CHAR16 *VariableName,\r | |
505 | IN OUT EFI_GUID *VendorGuid\r | |
506 | );\r | |
507 | \r | |
508 | /**\r | |
509 | \r | |
510 | This code sets variable in storage blocks (Volatile or Non-Volatile).\r | |
511 | \r | |
dc204d5a JY |
512 | Caution: This function may receive untrusted input.\r |
513 | This function may be invoked in SMM mode, and datasize and data are external input.\r | |
514 | This function will do basic validation, before parse the data.\r | |
515 | This function will parse the authentication carefully to avoid security issues, like\r | |
516 | buffer overflow, integer overflow.\r | |
517 | This function will check attribute carefully to avoid authentication bypass.\r | |
518 | \r | |
0c18794e | 519 | @param VariableName Name of Variable to be found.\r |
520 | @param VendorGuid Variable vendor GUID.\r | |
521 | @param Attributes Attribute value of the variable found\r | |
522 | @param DataSize Size of Data found. If size is less than the\r | |
523 | data, this value contains the required size.\r | |
524 | @param Data Data pointer.\r | |
525 | \r | |
526 | @return EFI_INVALID_PARAMETER Invalid parameter.\r | |
527 | @return EFI_SUCCESS Set successfully.\r | |
528 | @return EFI_OUT_OF_RESOURCES Resource not enough to set variable.\r | |
529 | @return EFI_NOT_FOUND Not found.\r | |
530 | @return EFI_WRITE_PROTECTED Variable is read-only.\r | |
531 | \r | |
532 | **/\r | |
533 | EFI_STATUS\r | |
534 | EFIAPI\r | |
535 | VariableServiceSetVariable (\r | |
536 | IN CHAR16 *VariableName,\r | |
537 | IN EFI_GUID *VendorGuid,\r | |
538 | IN UINT32 Attributes,\r | |
539 | IN UINTN DataSize,\r | |
540 | IN VOID *Data\r | |
541 | );\r | |
542 | \r | |
543 | /**\r | |
544 | \r | |
545 | This code returns information about the EFI variables.\r | |
546 | \r | |
dc204d5a JY |
547 | Caution: This function may receive untrusted input.\r |
548 | This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r | |
549 | \r | |
0c18794e | 550 | @param Attributes Attributes bitmask to specify the type of variables\r |
551 | on which to return information.\r | |
552 | @param MaximumVariableStorageSize Pointer to the maximum size of the storage space available\r | |
553 | for the EFI variables associated with the attributes specified.\r | |
554 | @param RemainingVariableStorageSize Pointer to the remaining size of the storage space available\r | |
555 | for EFI variables associated with the attributes specified.\r | |
556 | @param MaximumVariableSize Pointer to the maximum size of an individual EFI variables\r | |
557 | associated with the attributes specified.\r | |
558 | \r | |
559 | @return EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.\r | |
560 | @return EFI_SUCCESS Query successfully.\r | |
561 | @return EFI_UNSUPPORTED The attribute is not supported on this platform.\r | |
562 | \r | |
563 | **/\r | |
564 | EFI_STATUS\r | |
565 | EFIAPI\r | |
566 | VariableServiceQueryVariableInfo (\r | |
567 | IN UINT32 Attributes,\r | |
568 | OUT UINT64 *MaximumVariableStorageSize,\r | |
569 | OUT UINT64 *RemainingVariableStorageSize,\r | |
570 | OUT UINT64 *MaximumVariableSize\r | |
571 | ); \r | |
572 | \r | |
573 | extern VARIABLE_MODULE_GLOBAL *mVariableModuleGlobal;\r | |
574 | \r | |
575 | #endif\r |