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