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