2008-04-09 09:07:50 +02:00
|
|
|
/** @file
|
2007-07-19 12:09:07 +02:00
|
|
|
|
2008-04-09 09:07:50 +02:00
|
|
|
The internal header file includes the common header files, defines
|
2010-12-10 10:27:54 +01:00
|
|
|
internal structure and functions used by Variable modules.
|
2008-04-09 09:07:50 +02:00
|
|
|
|
2015-01-05 04:38:36 +01:00
|
|
|
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
2010-04-24 11:33:45 +02:00
|
|
|
This program and the accompanying materials
|
2007-07-19 12:09:07 +02:00
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
2008-04-09 09:07:50 +02:00
|
|
|
**/
|
2007-07-19 12:09:07 +02:00
|
|
|
|
2008-12-12 10:27:17 +01:00
|
|
|
#ifndef _VARIABLE_H_
|
|
|
|
#define _VARIABLE_H_
|
2007-07-19 12:09:07 +02:00
|
|
|
|
2008-10-09 03:12:34 +02:00
|
|
|
#include <PiDxe.h>
|
2007-07-19 12:09:07 +02:00
|
|
|
#include <Protocol/VariableWrite.h>
|
2009-03-04 02:27:50 +01:00
|
|
|
#include <Protocol/FaultTolerantWrite.h>
|
2007-07-19 12:09:07 +02:00
|
|
|
#include <Protocol/FirmwareVolumeBlock.h>
|
|
|
|
#include <Protocol/Variable.h>
|
2013-05-17 05:49:35 +02:00
|
|
|
#include <Protocol/VariableLock.h>
|
2015-01-05 04:38:36 +01:00
|
|
|
#include <Protocol/VarCheck.h>
|
2007-07-19 12:09:07 +02:00
|
|
|
#include <Library/PcdLib.h>
|
2011-10-14 07:19:39 +02:00
|
|
|
#include <Library/HobLib.h>
|
2007-07-19 12:09:07 +02:00
|
|
|
#include <Library/UefiDriverEntryPoint.h>
|
|
|
|
#include <Library/DxeServicesTableLib.h>
|
|
|
|
#include <Library/UefiRuntimeLib.h>
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
#include <Library/UefiBootServicesTableLib.h>
|
|
|
|
#include <Library/UefiLib.h>
|
|
|
|
#include <Library/BaseLib.h>
|
2009-01-30 01:33:39 +01:00
|
|
|
#include <Library/SynchronizationLib.h>
|
2007-07-19 12:09:07 +02:00
|
|
|
#include <Library/MemoryAllocationLib.h>
|
2007-10-05 16:40:23 +02:00
|
|
|
#include <Guid/GlobalVariable.h>
|
2009-02-03 12:09:53 +01:00
|
|
|
#include <Guid/EventGroup.h>
|
2009-02-27 06:35:08 +01:00
|
|
|
#include <Guid/VariableFormat.h>
|
2011-12-12 20:00:59 +01:00
|
|
|
#include <Guid/SystemNvDataGuid.h>
|
2013-07-03 11:08:40 +02:00
|
|
|
#include <Guid/FaultTolerantWrite.h>
|
2012-05-30 04:53:10 +02:00
|
|
|
#include <Guid/HardwareErrorVariable.h>
|
2007-07-19 12:09:07 +02:00
|
|
|
|
2013-08-19 07:16:45 +02:00
|
|
|
#define VARIABLE_ATTRIBUTE_BS_RT (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)
|
|
|
|
#define VARIABLE_ATTRIBUTE_NV_BS_RT (VARIABLE_ATTRIBUTE_BS_RT | EFI_VARIABLE_NON_VOLATILE)
|
|
|
|
#define VARIABLE_ATTRIBUTE_NV_BS_RT_AT (VARIABLE_ATTRIBUTE_NV_BS_RT | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
|
|
|
|
|
2010-11-18 02:40:22 +01:00
|
|
|
///
|
|
|
|
/// The size of a 3 character ISO639 language code.
|
|
|
|
///
|
|
|
|
#define ISO_639_2_ENTRY_SIZE 3
|
|
|
|
|
2011-10-14 07:19:39 +02:00
|
|
|
typedef enum {
|
|
|
|
VariableStoreTypeVolatile,
|
|
|
|
VariableStoreTypeHob,
|
|
|
|
VariableStoreTypeNv,
|
|
|
|
VariableStoreTypeMax
|
|
|
|
} VARIABLE_STORE_TYPE;
|
|
|
|
|
2007-07-19 12:09:07 +02:00
|
|
|
typedef struct {
|
|
|
|
VARIABLE_HEADER *CurrPtr;
|
2013-01-18 02:12:32 +01:00
|
|
|
//
|
|
|
|
// If both ADDED and IN_DELETED_TRANSITION variable are present,
|
|
|
|
// InDeletedTransitionPtr will point to the IN_DELETED_TRANSITION one.
|
|
|
|
// Otherwise, CurrPtr will point to the ADDED or IN_DELETED_TRANSITION one,
|
|
|
|
// and InDeletedTransitionPtr will be NULL at the same time.
|
|
|
|
//
|
|
|
|
VARIABLE_HEADER *InDeletedTransitionPtr;
|
2007-07-19 12:09:07 +02:00
|
|
|
VARIABLE_HEADER *EndPtr;
|
|
|
|
VARIABLE_HEADER *StartPtr;
|
|
|
|
BOOLEAN Volatile;
|
|
|
|
} VARIABLE_POINTER_TRACK;
|
|
|
|
|
|
|
|
typedef struct {
|
2011-10-14 07:19:39 +02:00
|
|
|
EFI_PHYSICAL_ADDRESS HobVariableBase;
|
2007-07-19 12:09:07 +02:00
|
|
|
EFI_PHYSICAL_ADDRESS VolatileVariableBase;
|
|
|
|
EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;
|
|
|
|
EFI_LOCK VariableServicesLock;
|
2008-01-09 11:10:16 +01:00
|
|
|
UINT32 ReentrantState;
|
2007-07-19 12:09:07 +02:00
|
|
|
} VARIABLE_GLOBAL;
|
|
|
|
|
|
|
|
typedef struct {
|
2007-10-05 16:40:23 +02:00
|
|
|
VARIABLE_GLOBAL VariableGlobal;
|
2007-07-19 12:09:07 +02:00
|
|
|
UINTN VolatileLastVariableOffset;
|
|
|
|
UINTN NonVolatileLastVariableOffset;
|
2009-04-07 08:42:12 +02:00
|
|
|
UINTN CommonVariableTotalSize;
|
|
|
|
UINTN HwErrVariableTotalSize;
|
2010-11-18 02:40:22 +01:00
|
|
|
CHAR8 *PlatformLangCodes;
|
|
|
|
CHAR8 *LangCodes;
|
|
|
|
CHAR8 *PlatformLang;
|
|
|
|
CHAR8 Lang[ISO_639_2_ENTRY_SIZE + 1];
|
2009-03-09 07:39:13 +01:00
|
|
|
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbInstance;
|
2007-10-05 16:40:23 +02:00
|
|
|
} VARIABLE_MODULE_GLOBAL;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
EFI_GUID *Guid;
|
|
|
|
CHAR16 *Name;
|
2014-03-25 07:56:55 +01:00
|
|
|
UINTN VariableSize;
|
|
|
|
} VARIABLE_ENTRY_CONSISTENCY;
|
2007-07-19 12:09:07 +02:00
|
|
|
|
2013-05-17 05:49:35 +02:00
|
|
|
typedef struct {
|
|
|
|
LIST_ENTRY Link;
|
2015-01-05 04:38:36 +01:00
|
|
|
EFI_GUID Guid;
|
|
|
|
//CHAR16 *Name;
|
2013-05-17 05:49:35 +02:00
|
|
|
} VARIABLE_ENTRY;
|
|
|
|
|
2013-01-04 13:21:59 +01:00
|
|
|
/**
|
|
|
|
Flush the HOB variable to flash.
|
|
|
|
|
|
|
|
@param[in] VariableName Name of variable has been updated or deleted.
|
|
|
|
@param[in] VendorGuid Guid of variable has been updated or deleted.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
FlushHobVariableToFlash (
|
|
|
|
IN CHAR16 *VariableName,
|
|
|
|
IN EFI_GUID *VendorGuid
|
|
|
|
);
|
|
|
|
|
2009-02-06 06:37:46 +01:00
|
|
|
/**
|
|
|
|
Writes a buffer to variable storage space, in the working block.
|
|
|
|
|
2010-12-10 10:27:54 +01:00
|
|
|
This function writes a buffer to variable storage space into a firmware
|
|
|
|
volume block device. The destination is specified by the parameter
|
2009-02-06 06:37:46 +01:00
|
|
|
VariableBase. Fault Tolerant Write protocol is used for writing.
|
|
|
|
|
2010-12-10 10:27:54 +01:00
|
|
|
@param VariableBase Base address of the variable to write.
|
2013-11-12 14:31:43 +01:00
|
|
|
@param VariableBuffer Point to the variable data buffer.
|
2009-02-06 06:37:46 +01:00
|
|
|
|
2010-12-10 10:27:54 +01:00
|
|
|
@retval EFI_SUCCESS The function completed successfully.
|
|
|
|
@retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol.
|
|
|
|
@retval EFI_ABORTED The function could not complete successfully.
|
2009-02-06 06:37:46 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
FtwVariableSpace (
|
|
|
|
IN EFI_PHYSICAL_ADDRESS VariableBase,
|
2013-11-12 14:31:43 +01:00
|
|
|
IN VARIABLE_STORE_HEADER *VariableBuffer
|
2009-02-06 06:37:46 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2010-12-10 10:27:54 +01:00
|
|
|
/**
|
|
|
|
Update the variable region with Variable information. These are the same
|
|
|
|
arguments as the EFI Variable services.
|
|
|
|
|
|
|
|
@param[in] VariableName Name of variable.
|
|
|
|
|
|
|
|
@param[in] VendorGuid Guid of variable.
|
|
|
|
|
|
|
|
@param[in] Data Variable data.
|
|
|
|
|
|
|
|
@param[in] DataSize Size of data. 0 means delete.
|
|
|
|
|
|
|
|
@param[in] Attributes Attribues of the variable.
|
|
|
|
|
2013-01-18 02:12:32 +01:00
|
|
|
@param[in, out] Variable The variable information that is used to keep track of variable usage.
|
2010-12-10 10:27:54 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The update operation is success.
|
|
|
|
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Variable region is full, cannot write other data into this region.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
UpdateVariable (
|
|
|
|
IN CHAR16 *VariableName,
|
|
|
|
IN EFI_GUID *VendorGuid,
|
|
|
|
IN VOID *Data,
|
|
|
|
IN UINTN DataSize,
|
|
|
|
IN UINT32 Attributes OPTIONAL,
|
2013-01-18 02:12:32 +01:00
|
|
|
IN OUT VARIABLE_POINTER_TRACK *Variable
|
2010-12-10 10:27:54 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Return TRUE if ExitBootServices () has been called.
|
|
|
|
|
|
|
|
@retval TRUE If ExitBootServices () has been called.
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
AtRuntime (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Initializes a basic mutual exclusion lock.
|
|
|
|
|
|
|
|
This function initializes a basic mutual exclusion lock to the released state
|
|
|
|
and returns the lock. Each lock provides mutual exclusion access at its task
|
|
|
|
priority level. Since there is no preemption or multiprocessor support in EFI,
|
|
|
|
acquiring the lock only consists of raising to the locks TPL.
|
|
|
|
If Lock is NULL, then ASSERT().
|
|
|
|
If Priority is not a valid TPL value, then ASSERT().
|
|
|
|
|
|
|
|
@param Lock A pointer to the lock data structure to initialize.
|
|
|
|
@param Priority EFI TPL is associated with the lock.
|
|
|
|
|
|
|
|
@return The lock.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_LOCK *
|
|
|
|
InitializeLock (
|
|
|
|
IN OUT EFI_LOCK *Lock,
|
|
|
|
IN EFI_TPL Priority
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Acquires lock only at boot time. Simply returns at runtime.
|
|
|
|
|
|
|
|
This is a temperary function that will be removed when
|
|
|
|
EfiAcquireLock() in UefiLib can handle the call in UEFI
|
|
|
|
Runtimer driver in RT phase.
|
|
|
|
It calls EfiAcquireLock() at boot time, and simply returns
|
|
|
|
at runtime.
|
|
|
|
|
|
|
|
@param Lock A pointer to the lock to acquire.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
AcquireLockOnlyAtBootTime (
|
|
|
|
IN EFI_LOCK *Lock
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Releases lock only at boot time. Simply returns at runtime.
|
|
|
|
|
|
|
|
This is a temperary function which will be removed when
|
|
|
|
EfiReleaseLock() in UefiLib can handle the call in UEFI
|
|
|
|
Runtimer driver in RT phase.
|
|
|
|
It calls EfiReleaseLock() at boot time and simply returns
|
|
|
|
at runtime.
|
|
|
|
|
|
|
|
@param Lock A pointer to the lock to release.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
ReleaseLockOnlyAtBootTime (
|
|
|
|
IN EFI_LOCK *Lock
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Retrive the FVB protocol interface by HANDLE.
|
|
|
|
|
|
|
|
@param[in] FvBlockHandle The handle of FVB protocol that provides services for
|
|
|
|
reading, writing, and erasing the target block.
|
|
|
|
@param[out] FvBlock The interface of FVB protocol
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The interface information for the specified protocol was returned.
|
|
|
|
@retval EFI_UNSUPPORTED The device does not support the FVB protocol.
|
|
|
|
@retval EFI_INVALID_PARAMETER FvBlockHandle is not a valid EFI_HANDLE or FvBlock is NULL.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
GetFvbByHandle (
|
|
|
|
IN EFI_HANDLE FvBlockHandle,
|
|
|
|
OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Retrive the Swap Address Range protocol interface.
|
|
|
|
|
|
|
|
@param[out] SarProtocol The interface of SAR protocol
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The SAR protocol instance was found and returned in SarProtocol.
|
|
|
|
@retval EFI_NOT_FOUND The SAR protocol instance was not found.
|
|
|
|
@retval EFI_INVALID_PARAMETER SarProtocol is NULL.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
GetSarProtocol (
|
|
|
|
OUT VOID **SarProtocol
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function returns an array of handles that support the FVB protocol
|
|
|
|
in a buffer allocated from pool.
|
|
|
|
|
|
|
|
@param[out] NumberHandles The number of handles returned in Buffer.
|
|
|
|
@param[out] Buffer A pointer to the buffer to return the requested
|
|
|
|
array of handles that support FVB protocol.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of
|
|
|
|
handles in Buffer was returned in NumberHandles.
|
|
|
|
@retval EFI_NOT_FOUND No FVB handle was found.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.
|
|
|
|
@retval EFI_INVALID_PARAMETER NumberHandles is NULL or Buffer is NULL.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
GetFvbCountAndBuffer (
|
|
|
|
OUT UINTN *NumberHandles,
|
|
|
|
OUT EFI_HANDLE **Buffer
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Initializes variable store area for non-volatile and volatile variable.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS Function successfully executed.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Fail to allocate enough memory resource.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
VariableCommonInitialize (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
This function reclaims variable storage if free size is below the threshold.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
ReclaimForOS(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Initializes variable write service after FVB was ready.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS Function successfully executed.
|
|
|
|
@retval Others Fail to initialize the variable service.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
VariableWriteServiceInitialize (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Retrive the SMM Fault Tolerent Write protocol interface.
|
|
|
|
|
|
|
|
@param[out] FtwProtocol The interface of SMM Ftw protocol
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The SMM SAR protocol instance was found and returned in SarProtocol.
|
|
|
|
@retval EFI_NOT_FOUND The SMM SAR protocol instance was not found.
|
|
|
|
@retval EFI_INVALID_PARAMETER SarProtocol is NULL.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
GetFtwProtocol (
|
|
|
|
OUT VOID **FtwProtocol
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Get the proper fvb handle and/or fvb protocol by the given Flash address.
|
|
|
|
|
|
|
|
@param[in] Address The Flash address.
|
|
|
|
@param[out] FvbHandle In output, if it is not NULL, it points to the proper FVB handle.
|
|
|
|
@param[out] FvbProtocol In output, if it is not NULL, it points to the proper FVB protocol.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
GetFvbInfoByAddress (
|
|
|
|
IN EFI_PHYSICAL_ADDRESS Address,
|
|
|
|
OUT EFI_HANDLE *FvbHandle OPTIONAL,
|
|
|
|
OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvbProtocol OPTIONAL
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
This code finds variable in storage blocks (Volatile or Non-Volatile).
|
|
|
|
|
|
|
|
@param VariableName Name of Variable to be found.
|
|
|
|
@param VendorGuid Variable vendor GUID.
|
|
|
|
@param Attributes Attribute value of the variable found.
|
|
|
|
@param DataSize Size of Data found. If size is less than the
|
|
|
|
data, this value contains the required size.
|
|
|
|
@param Data Data pointer.
|
|
|
|
|
|
|
|
@return EFI_INVALID_PARAMETER Invalid parameter.
|
|
|
|
@return EFI_SUCCESS Find the specified variable.
|
|
|
|
@return EFI_NOT_FOUND Not found.
|
|
|
|
@return EFI_BUFFER_TO_SMALL DataSize is too small for the result.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VariableServiceGetVariable (
|
|
|
|
IN CHAR16 *VariableName,
|
|
|
|
IN EFI_GUID *VendorGuid,
|
|
|
|
OUT UINT32 *Attributes OPTIONAL,
|
|
|
|
IN OUT UINTN *DataSize,
|
|
|
|
OUT VOID *Data
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
This code Finds the Next available variable.
|
|
|
|
|
2015-01-05 04:38:36 +01:00
|
|
|
Caution: This function may receive untrusted input.
|
|
|
|
This function may be invoked in SMM mode. This function will do basic validation, before parse the data.
|
|
|
|
|
2010-12-10 10:27:54 +01:00
|
|
|
@param VariableNameSize Size of the variable name.
|
|
|
|
@param VariableName Pointer to variable name.
|
|
|
|
@param VendorGuid Variable Vendor Guid.
|
|
|
|
|
|
|
|
@return EFI_INVALID_PARAMETER Invalid parameter.
|
|
|
|
@return EFI_SUCCESS Find the specified variable.
|
|
|
|
@return EFI_NOT_FOUND Not found.
|
|
|
|
@return EFI_BUFFER_TO_SMALL DataSize is too small for the result.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VariableServiceGetNextVariableName (
|
|
|
|
IN OUT UINTN *VariableNameSize,
|
|
|
|
IN OUT CHAR16 *VariableName,
|
|
|
|
IN OUT EFI_GUID *VendorGuid
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
This code sets variable in storage blocks (Volatile or Non-Volatile).
|
|
|
|
|
2015-01-05 04:38:36 +01:00
|
|
|
Caution: This function may receive untrusted input.
|
|
|
|
This function may be invoked in SMM mode, and datasize and data are external input.
|
|
|
|
This function will do basic validation, before parse the data.
|
|
|
|
|
2010-12-10 10:27:54 +01:00
|
|
|
@param VariableName Name of Variable to be found.
|
|
|
|
@param VendorGuid Variable vendor GUID.
|
|
|
|
@param Attributes Attribute value of the variable found
|
|
|
|
@param DataSize Size of Data found. If size is less than the
|
|
|
|
data, this value contains the required size.
|
|
|
|
@param Data Data pointer.
|
|
|
|
|
|
|
|
@return EFI_INVALID_PARAMETER Invalid parameter.
|
|
|
|
@return EFI_SUCCESS Set successfully.
|
|
|
|
@return EFI_OUT_OF_RESOURCES Resource not enough to set variable.
|
|
|
|
@return EFI_NOT_FOUND Not found.
|
|
|
|
@return EFI_WRITE_PROTECTED Variable is read-only.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VariableServiceSetVariable (
|
|
|
|
IN CHAR16 *VariableName,
|
|
|
|
IN EFI_GUID *VendorGuid,
|
|
|
|
IN UINT32 Attributes,
|
|
|
|
IN UINTN DataSize,
|
|
|
|
IN VOID *Data
|
|
|
|
);
|
|
|
|
|
2014-03-25 07:56:55 +01:00
|
|
|
/**
|
|
|
|
|
|
|
|
This code returns information about the EFI variables.
|
|
|
|
|
2015-01-05 04:38:36 +01:00
|
|
|
Caution: This function may receive untrusted input.
|
|
|
|
This function may be invoked in SMM mode. This function will do basic validation, before parse the data.
|
|
|
|
|
2014-03-25 07:56:55 +01:00
|
|
|
@param Attributes Attributes bitmask to specify the type of variables
|
|
|
|
on which to return information.
|
|
|
|
@param MaximumVariableStorageSize Pointer to the maximum size of the storage space available
|
|
|
|
for the EFI variables associated with the attributes specified.
|
|
|
|
@param RemainingVariableStorageSize Pointer to the remaining size of the storage space available
|
|
|
|
for EFI variables associated with the attributes specified.
|
|
|
|
@param MaximumVariableSize Pointer to the maximum size of an individual EFI variables
|
|
|
|
associated with the attributes specified.
|
|
|
|
|
|
|
|
@return EFI_SUCCESS Query successfully.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VariableServiceQueryVariableInfoInternal (
|
|
|
|
IN UINT32 Attributes,
|
|
|
|
OUT UINT64 *MaximumVariableStorageSize,
|
|
|
|
OUT UINT64 *RemainingVariableStorageSize,
|
|
|
|
OUT UINT64 *MaximumVariableSize
|
|
|
|
);
|
|
|
|
|
2010-12-10 10:27:54 +01:00
|
|
|
/**
|
|
|
|
|
|
|
|
This code returns information about the EFI variables.
|
|
|
|
|
2015-01-05 04:38:36 +01:00
|
|
|
Caution: This function may receive untrusted input.
|
|
|
|
This function may be invoked in SMM mode. This function will do basic validation, before parse the data.
|
|
|
|
|
2010-12-10 10:27:54 +01:00
|
|
|
@param Attributes Attributes bitmask to specify the type of variables
|
|
|
|
on which to return information.
|
|
|
|
@param MaximumVariableStorageSize Pointer to the maximum size of the storage space available
|
|
|
|
for the EFI variables associated with the attributes specified.
|
|
|
|
@param RemainingVariableStorageSize Pointer to the remaining size of the storage space available
|
|
|
|
for EFI variables associated with the attributes specified.
|
|
|
|
@param MaximumVariableSize Pointer to the maximum size of an individual EFI variables
|
|
|
|
associated with the attributes specified.
|
|
|
|
|
|
|
|
@return EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.
|
|
|
|
@return EFI_SUCCESS Query successfully.
|
|
|
|
@return EFI_UNSUPPORTED The attribute is not supported on this platform.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VariableServiceQueryVariableInfo (
|
|
|
|
IN UINT32 Attributes,
|
|
|
|
OUT UINT64 *MaximumVariableStorageSize,
|
|
|
|
OUT UINT64 *RemainingVariableStorageSize,
|
|
|
|
OUT UINT64 *MaximumVariableSize
|
|
|
|
);
|
2013-05-17 05:49:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
Mark a variable that will become read-only after leaving the DXE phase of execution.
|
|
|
|
|
|
|
|
@param[in] This The VARIABLE_LOCK_PROTOCOL instance.
|
|
|
|
@param[in] VariableName A pointer to the variable name that will be made read-only subsequently.
|
|
|
|
@param[in] VendorGuid A pointer to the vendor GUID that will be made read-only subsequently.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The variable specified by the VariableName and the VendorGuid was marked
|
|
|
|
as pending to be read-only.
|
|
|
|
@retval EFI_INVALID_PARAMETER VariableName or VendorGuid is NULL.
|
|
|
|
Or VariableName is an empty string.
|
|
|
|
@retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
|
|
|
|
already been signaled.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES There is not enough resource to hold the lock request.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VariableLockRequestToLock (
|
|
|
|
IN CONST EDKII_VARIABLE_LOCK_PROTOCOL *This,
|
|
|
|
IN CHAR16 *VariableName,
|
|
|
|
IN EFI_GUID *VendorGuid
|
|
|
|
);
|
|
|
|
|
2015-01-05 04:38:36 +01:00
|
|
|
/**
|
|
|
|
Check if a Unicode character is a hexadecimal character.
|
|
|
|
|
|
|
|
This function checks if a Unicode character is a
|
|
|
|
hexadecimal character. The valid hexadecimal character is
|
|
|
|
L'0' to L'9', L'a' to L'f', or L'A' to L'F'.
|
|
|
|
|
|
|
|
|
|
|
|
@param Char The character to check against.
|
|
|
|
|
|
|
|
@retval TRUE If the Char is a hexadecmial character.
|
|
|
|
@retval FALSE If the Char is not a hexadecmial character.
|
|
|
|
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
IsHexaDecimalDigitCharacter (
|
|
|
|
IN CHAR16 Char
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Internal SetVariable check.
|
|
|
|
|
|
|
|
@param[in] VariableName Name of Variable to set.
|
|
|
|
@param[in] VendorGuid Variable vendor GUID.
|
|
|
|
@param[in] Attributes Attribute value of the variable.
|
|
|
|
@param[in] DataSize Size of Data to set.
|
|
|
|
@param[in] Data Data pointer.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The SetVariable check result was success.
|
|
|
|
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID were supplied,
|
|
|
|
or the DataSize exceeds the minimum or maximum allowed,
|
|
|
|
or the Data value is not following UEFI spec for UEFI defined variables.
|
|
|
|
@retval EFI_WRITE_PROTECTED The variable in question is read-only.
|
|
|
|
@retval Others The return status from check handler.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
InternalVarCheckSetVariableCheck (
|
|
|
|
IN CHAR16 *VariableName,
|
|
|
|
IN EFI_GUID *VendorGuid,
|
|
|
|
IN UINT32 Attributes,
|
|
|
|
IN UINTN DataSize,
|
|
|
|
IN VOID *Data
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Register SetVariable check handler.
|
|
|
|
|
|
|
|
@param[in] Handler Pointer to check handler.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The SetVariable check handler was registered successfully.
|
|
|
|
@retval EFI_INVALID_PARAMETER Handler is NULL.
|
|
|
|
@retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
|
|
|
|
already been signaled.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES There is not enough resource for the SetVariable check handler register request.
|
|
|
|
@retval EFI_UNSUPPORTED This interface is not implemented.
|
|
|
|
For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VarCheckRegisterSetVariableCheckHandler (
|
|
|
|
IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Variable property set.
|
|
|
|
|
|
|
|
@param[in] Name Pointer to the variable name.
|
|
|
|
@param[in] Guid Pointer to the vendor GUID.
|
|
|
|
@param[in] VariableProperty Pointer to the input variable property.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully.
|
|
|
|
@retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string,
|
|
|
|
or the fields of VariableProperty are not valid.
|
|
|
|
@retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
|
|
|
|
already been signaled.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VarCheckVariablePropertySet (
|
|
|
|
IN CHAR16 *Name,
|
|
|
|
IN EFI_GUID *Guid,
|
|
|
|
IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Variable property get.
|
|
|
|
|
|
|
|
@param[in] Name Pointer to the variable name.
|
|
|
|
@param[in] Guid Pointer to the vendor GUID.
|
|
|
|
@param[out] VariableProperty Pointer to the output variable property.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully.
|
|
|
|
@retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string.
|
|
|
|
@retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VarCheckVariablePropertyGet (
|
|
|
|
IN CHAR16 *Name,
|
|
|
|
IN EFI_GUID *Guid,
|
|
|
|
OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty
|
|
|
|
);
|
|
|
|
|
2010-12-10 10:27:54 +01:00
|
|
|
extern VARIABLE_MODULE_GLOBAL *mVariableModuleGlobal;
|
|
|
|
|
2007-07-19 12:09:07 +02:00
|
|
|
#endif
|