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