]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.h
Support load 64 bit image from 32 bit core.
[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
128ef095 146 @param VariableBuffer Point to the variable data buffer.\r
0c18794e 147\r
148 @retval EFI_SUCCESS The function completed successfully.\r
149 @retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol.\r
150 @retval EFI_ABORTED The function could not complete successfully.\r
151\r
152**/\r
153EFI_STATUS\r
154FtwVariableSpace (\r
155 IN EFI_PHYSICAL_ADDRESS VariableBase,\r
128ef095 156 IN VARIABLE_STORE_HEADER *VariableBuffer\r
0c18794e 157 );\r
158\r
159/**\r
160 Finds variable in storage blocks of volatile and non-volatile storage areas.\r
161\r
162 This code finds variable in storage blocks of volatile and non-volatile storage areas.\r
163 If VariableName is an empty string, then we just return the first\r
164 qualified variable without comparing VariableName and VendorGuid.\r
9622df63
SZ
165 If IgnoreRtCheck is TRUE, then we ignore the EFI_VARIABLE_RUNTIME_ACCESS attribute check\r
166 at runtime when searching existing variable, only VariableName and VendorGuid are compared.\r
167 Otherwise, variables without EFI_VARIABLE_RUNTIME_ACCESS are not visible at runtime.\r
0c18794e 168\r
ecc722ad 169 @param[in] VariableName Name of the variable to be found.\r
170 @param[in] VendorGuid Vendor GUID to be found.\r
171 @param[out] PtrTrack VARIABLE_POINTER_TRACK structure for output,\r
0c18794e 172 including the range searched and the target position.\r
ecc722ad 173 @param[in] Global Pointer to VARIABLE_GLOBAL structure, including\r
0c18794e 174 base of volatile variable storage area, base of\r
175 NV variable storage area, and a lock.\r
9622df63
SZ
176 @param[in] IgnoreRtCheck Ignore EFI_VARIABLE_RUNTIME_ACCESS attribute\r
177 check at runtime when searching variable.\r
0c18794e 178\r
179 @retval EFI_INVALID_PARAMETER If VariableName is not an empty string, while\r
180 VendorGuid is NULL.\r
181 @retval EFI_SUCCESS Variable successfully found.\r
ecc722ad 182 @retval EFI_NOT_FOUND Variable not found\r
0c18794e 183\r
184**/\r
185EFI_STATUS\r
186FindVariable (\r
187 IN CHAR16 *VariableName,\r
188 IN EFI_GUID *VendorGuid,\r
189 OUT VARIABLE_POINTER_TRACK *PtrTrack,\r
ecc722ad 190 IN VARIABLE_GLOBAL *Global,\r
9622df63 191 IN BOOLEAN IgnoreRtCheck\r
0c18794e 192 );\r
193\r
194/**\r
195\r
196 This code gets the pointer to the variable data.\r
197\r
198 @param Variable Pointer to the Variable Header.\r
199\r
200 @return Pointer to Variable Data.\r
201\r
202**/\r
203UINT8 *\r
204GetVariableDataPtr (\r
205 IN VARIABLE_HEADER *Variable\r
206 );\r
207\r
208/**\r
209\r
210 This code gets the size of variable data.\r
211\r
212 @param Variable Pointer to the Variable Header.\r
213\r
214 @return Size of variable in bytes.\r
215\r
216**/\r
217UINTN\r
218DataSizeOfVariable (\r
219 IN VARIABLE_HEADER *Variable\r
220 );\r
221\r
222/**\r
223 Update the variable region with Variable information. If EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is set,\r
224 index of associated public key is needed.\r
225\r
226 @param[in] VariableName Name of variable.\r
227 @param[in] VendorGuid Guid of variable.\r
228 @param[in] Data Variable data.\r
229 @param[in] DataSize Size of data. 0 means delete.\r
230 @param[in] Attributes Attributes of the variable.\r
231 @param[in] KeyIndex Index of associated public key.\r
232 @param[in] MonotonicCount Value of associated monotonic count.\r
23b06935 233 @param[in, out] Variable The variable information that is used to keep track of variable usage.\r
0c18794e 234\r
235 @param[in] TimeStamp Value of associated TimeStamp.\r
236\r
237 @retval EFI_SUCCESS The update operation is success.\r
238 @retval EFI_OUT_OF_RESOURCES Variable region is full, cannot write other data into this region.\r
239\r
240**/\r
241EFI_STATUS\r
242UpdateVariable (\r
243 IN CHAR16 *VariableName,\r
244 IN EFI_GUID *VendorGuid,\r
245 IN VOID *Data,\r
246 IN UINTN DataSize,\r
247 IN UINT32 Attributes OPTIONAL,\r
248 IN UINT32 KeyIndex OPTIONAL,\r
249 IN UINT64 MonotonicCount OPTIONAL,\r
23b06935 250 IN OUT VARIABLE_POINTER_TRACK *Variable,\r
0c18794e 251 IN EFI_TIME *TimeStamp OPTIONAL \r
252 );\r
253\r
254\r
255/**\r
256 Return TRUE if ExitBootServices () has been called.\r
257 \r
258 @retval TRUE If ExitBootServices () has been called.\r
259**/\r
260BOOLEAN\r
261AtRuntime (\r
262 VOID\r
263 );\r
264\r
265/**\r
266 Initializes a basic mutual exclusion lock.\r
267\r
268 This function initializes a basic mutual exclusion lock to the released state \r
269 and returns the lock. Each lock provides mutual exclusion access at its task \r
270 priority level. Since there is no preemption or multiprocessor support in EFI,\r
271 acquiring the lock only consists of raising to the locks TPL.\r
272 If Lock is NULL, then ASSERT().\r
273 If Priority is not a valid TPL value, then ASSERT().\r
274\r
275 @param Lock A pointer to the lock data structure to initialize.\r
276 @param Priority EFI TPL is associated with the lock.\r
277\r
278 @return The lock.\r
279\r
280**/\r
281EFI_LOCK *\r
282InitializeLock (\r
283 IN OUT EFI_LOCK *Lock,\r
284 IN EFI_TPL Priority\r
285 );\r
286\r
287 \r
288/**\r
289 Acquires lock only at boot time. Simply returns at runtime.\r
290\r
291 This is a temperary function that will be removed when\r
292 EfiAcquireLock() in UefiLib can handle the call in UEFI\r
293 Runtimer driver in RT phase.\r
294 It calls EfiAcquireLock() at boot time, and simply returns\r
295 at runtime.\r
296\r
297 @param Lock A pointer to the lock to acquire.\r
298\r
299**/\r
300VOID\r
301AcquireLockOnlyAtBootTime (\r
302 IN EFI_LOCK *Lock\r
303 );\r
304\r
305\r
306/**\r
307 Releases lock only at boot time. Simply returns at runtime.\r
308\r
309 This is a temperary function which will be removed when\r
310 EfiReleaseLock() in UefiLib can handle the call in UEFI\r
311 Runtimer driver in RT phase.\r
312 It calls EfiReleaseLock() at boot time and simply returns\r
313 at runtime.\r
314\r
315 @param Lock A pointer to the lock to release.\r
316\r
317**/\r
318VOID\r
319ReleaseLockOnlyAtBootTime (\r
320 IN EFI_LOCK *Lock\r
321 ); \r
322\r
323/**\r
324 Retrive the FVB protocol interface by HANDLE.\r
325\r
326 @param[in] FvBlockHandle The handle of FVB protocol that provides services for\r
327 reading, writing, and erasing the target block.\r
328 @param[out] FvBlock The interface of FVB protocol\r
329\r
330 @retval EFI_SUCCESS The interface information for the specified protocol was returned.\r
331 @retval EFI_UNSUPPORTED The device does not support the FVB protocol.\r
332 @retval EFI_INVALID_PARAMETER FvBlockHandle is not a valid EFI_HANDLE or FvBlock is NULL.\r
333 \r
334**/\r
335EFI_STATUS\r
336GetFvbByHandle (\r
337 IN EFI_HANDLE FvBlockHandle,\r
338 OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock\r
339 );\r
340\r
341\r
342/**\r
343 Retrive the Swap Address Range protocol interface.\r
344\r
345 @param[out] SarProtocol The interface of SAR protocol\r
346\r
347 @retval EFI_SUCCESS The SAR protocol instance was found and returned in SarProtocol.\r
348 @retval EFI_NOT_FOUND The SAR protocol instance was not found.\r
349 @retval EFI_INVALID_PARAMETER SarProtocol is NULL.\r
350\r
351**/\r
352EFI_STATUS\r
353GetSarProtocol (\r
354 OUT VOID **SarProtocol\r
355 );\r
356\r
357/**\r
358 Function returns an array of handles that support the FVB protocol\r
359 in a buffer allocated from pool. \r
360\r
361 @param[out] NumberHandles The number of handles returned in Buffer.\r
362 @param[out] Buffer A pointer to the buffer to return the requested\r
363 array of handles that support FVB protocol.\r
364\r
365 @retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of\r
366 handles in Buffer was returned in NumberHandles.\r
367 @retval EFI_NOT_FOUND No FVB handle was found.\r
368 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.\r
369 @retval EFI_INVALID_PARAMETER NumberHandles is NULL or Buffer is NULL.\r
370 \r
371**/\r
372EFI_STATUS\r
373GetFvbCountAndBuffer (\r
374 OUT UINTN *NumberHandles,\r
375 OUT EFI_HANDLE **Buffer\r
376 );\r
377\r
378/**\r
379 Initializes variable store area for non-volatile and volatile variable.\r
380\r
381 @retval EFI_SUCCESS Function successfully executed.\r
382 @retval EFI_OUT_OF_RESOURCES Fail to allocate enough memory resource.\r
383\r
384**/\r
385EFI_STATUS\r
386VariableCommonInitialize (\r
387 VOID\r
388 );\r
389\r
83758cdc 390/**\r
391\r
392 Variable store garbage collection and reclaim operation.\r
393\r
394 If ReclaimPubKeyStore is FALSE, reclaim variable space by deleting the obsoleted varaibles.\r
395 If ReclaimPubKeyStore is TRUE, reclaim invalid key in public key database and update the PubKeyIndex\r
396 for all the count-based authenticate variable in NV storage.\r
397\r
ca5a7d87 398 @param[in] VariableBase Base address of variable store.\r
399 @param[out] LastVariableOffset Offset of last variable.\r
400 @param[in] IsVolatile The variable store is volatile or not;\r
401 if it is non-volatile, need FTW.\r
402 @param[in, out] UpdatingPtrTrack Pointer to updating variable pointer track structure.\r
7baf3c69
SZ
403 @param[in] NewVariable Pointer to new variable.\r
404 @param[in] NewVariableSize New variable size.\r
ca5a7d87 405 @param[in] ReclaimPubKeyStore Reclaim for public key database or not.\r
83758cdc 406 \r
83758cdc 407 @return EFI_SUCCESS Reclaim operation has finished successfully.\r
7baf3c69 408 @return EFI_OUT_OF_RESOURCES No enough memory resources or variable space.\r
ca5a7d87 409 @return EFI_DEVICE_ERROR The public key database doesn't exist.\r
83758cdc 410 @return Others Unexpect error happened during reclaim operation.\r
411\r
412**/\r
413EFI_STATUS\r
414Reclaim (\r
ca5a7d87 415 IN EFI_PHYSICAL_ADDRESS VariableBase,\r
416 OUT UINTN *LastVariableOffset,\r
417 IN BOOLEAN IsVolatile,\r
418 IN OUT VARIABLE_POINTER_TRACK *UpdatingPtrTrack,\r
7baf3c69
SZ
419 IN VARIABLE_HEADER *NewVariable,\r
420 IN UINTN NewVariableSize,\r
421 IN BOOLEAN ReclaimPubKeyStore\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