mirror of https://github.com/acidanthera/audk.git
code scrub on VariableRuntime Dxe driver
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7016 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
57dba20b29
commit
7c80e839f7
|
@ -194,17 +194,15 @@ VariableClassAddressChangeEvent (
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Entry point of EmuVariable service module.
|
EmuVariable Driver main entry point. The Variable driver places the 4 EFI
|
||||||
|
runtime services in the EFI System Table and installs arch protocols
|
||||||
This function is the entry point of EmuVariable service module.
|
for variable read and write services being availible. It also registers
|
||||||
It registers all interfaces of Variable Services, initializes
|
|
||||||
variable store for non-volatile and volatile variables, and registers
|
|
||||||
notification function for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
|
notification function for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
|
||||||
|
|
||||||
@param ImageHandle The Image handle of this driver.
|
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||||
@param SystemTable The pointer of EFI_SYSTEM_TABLE.
|
@param[in] SystemTable A pointer to the EFI System Table.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Variable service successfully initialized.
|
@retval EFI_SUCCESS Variable service successfully initialized.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
|
|
@ -60,13 +60,13 @@ PeimInitializeVariableServices (
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This code gets the pointer to the first variable memory pointer byte.
|
|
||||||
|
|
||||||
@param VarStoreHeader Pointer to the Variable Store Header.
|
Gets the pointer to the first variable header in given variable store area.
|
||||||
|
|
||||||
@return VARIABLE_HEADER* pointer to last unavailable Variable Header.
|
@param VarStoreHeader Pointer to the Variable Store Header.
|
||||||
|
|
||||||
|
@return Pointer to the first variable header
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VARIABLE_HEADER *
|
VARIABLE_HEADER *
|
||||||
|
@ -137,9 +137,9 @@ NameSizeOfVariable (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Variable->State == (UINT8) (-1) ||
|
if (Variable->State == (UINT8) (-1) ||
|
||||||
Variable->DataSize == (UINT32) -1 ||
|
Variable->DataSize == (UINT32) (-1) ||
|
||||||
Variable->NameSize == (UINT32) -1 ||
|
Variable->NameSize == (UINT32) (-1) ||
|
||||||
Variable->Attributes == (UINT32) -1) {
|
Variable->Attributes == (UINT32) (-1)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (UINTN) Variable->NameSize;
|
return (UINTN) Variable->NameSize;
|
||||||
|
@ -159,10 +159,10 @@ DataSizeOfVariable (
|
||||||
IN VARIABLE_HEADER *Variable
|
IN VARIABLE_HEADER *Variable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Variable->State == (UINT8) -1 ||
|
if (Variable->State == (UINT8) (-1) ||
|
||||||
Variable->DataSize == (UINT32) -1 ||
|
Variable->DataSize == (UINT32) (-1) ||
|
||||||
Variable->NameSize == (UINT32) -1 ||
|
Variable->NameSize == (UINT32) (-1) ||
|
||||||
Variable->Attributes == (UINT32) -1) {
|
Variable->Attributes == (UINT32) (-1)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (UINTN) Variable->DataSize;
|
return (UINTN) Variable->DataSize;
|
||||||
|
|
|
@ -16,8 +16,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
|
||||||
#include "Variable.h"
|
#include "Variable.h"
|
||||||
#include <VariableFormat.h>
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets firmware volume block handle by given address.
|
||||||
|
|
||||||
|
This function gets firmware volume block handle whose
|
||||||
|
address range contains the parameter Address.
|
||||||
|
|
||||||
|
@param Address Address which should be contained
|
||||||
|
by returned FVB handle
|
||||||
|
@param FvbHandle Pointer to FVB handle for output
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS FVB handle successfully returned
|
||||||
|
@retval EFI_NOT_FOUND Fail to find FVB handle by address
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetFvbHandleByAddress (
|
GetFvbHandleByAddress (
|
||||||
IN EFI_PHYSICAL_ADDRESS Address,
|
IN EFI_PHYSICAL_ADDRESS Address,
|
||||||
|
@ -79,6 +92,23 @@ GetFvbHandleByAddress (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets LBA of block and offset by given address.
|
||||||
|
|
||||||
|
This function gets the Logical Block Address (LBA) of firmware
|
||||||
|
volume block containing the given address, and the offset of
|
||||||
|
address on the block.
|
||||||
|
|
||||||
|
@param Address Address which should be contained
|
||||||
|
by returned FVB handle
|
||||||
|
@param Lba Pointer to LBA for output
|
||||||
|
@param Offset Pointer to offset for output
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS LBA and offset successfully returned
|
||||||
|
@retval EFI_NOT_FOUND Fail to find FVB handle by address
|
||||||
|
@retval EFI_ABORTED Fail to find valid LBA and offset
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetLbaAndOffsetByAddress (
|
GetLbaAndOffsetByAddress (
|
||||||
IN EFI_PHYSICAL_ADDRESS Address,
|
IN EFI_PHYSICAL_ADDRESS Address,
|
||||||
|
@ -148,28 +178,28 @@ GetLbaAndOffsetByAddress (
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes a buffer to variable storage space, in the working block.
|
||||||
|
|
||||||
|
This function writes a buffer to variable storage space into firmware
|
||||||
|
volume block device. The destination is specified by parameter
|
||||||
|
VariableBase. Fault Tolerant Write protocol is used for writing.
|
||||||
|
|
||||||
|
@param VariableBase Base address of variable to write
|
||||||
|
@param Buffer Point to the data buffer
|
||||||
|
@param BufferSize The number of bytes of the data Buffer
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
FtwVariableSpace (
|
FtwVariableSpace (
|
||||||
IN EFI_PHYSICAL_ADDRESS VariableBase,
|
IN EFI_PHYSICAL_ADDRESS VariableBase,
|
||||||
IN UINT8 *Buffer,
|
IN UINT8 *Buffer,
|
||||||
IN UINTN BufferSize
|
IN UINTN BufferSize
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Write a buffer to Variable space, in the working block.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
FvbHandle - Indicates a handle to FVB to access variable store
|
|
||||||
Buffer - Point to the input buffer
|
|
||||||
BufferSize - The number of bytes of the input Buffer
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The function completed successfully
|
|
||||||
EFI_ABORTED - The function could not complete successfully
|
|
||||||
EFI_NOT_FOUND - Locate FVB protocol by handle fails
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HANDLE FvbHandle;
|
EFI_HANDLE FvbHandle;
|
||||||
|
@ -224,7 +254,7 @@ Returns:
|
||||||
FvbHandle,
|
FvbHandle,
|
||||||
VarLba, // LBA
|
VarLba, // LBA
|
||||||
VarOffset, // Offset
|
VarOffset, // Offset
|
||||||
&FtwBufferSize, // NumBytes,
|
&FtwBufferSize, // NumBytes
|
||||||
FtwBuffer
|
FtwBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -14,19 +14,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "Variable.h"
|
#include "Variable.h"
|
||||||
|
|
||||||
VARIABLE_MODULE_GLOBAL *mVariableModuleGlobal;
|
VARIABLE_MODULE_GLOBAL *mVariableModuleGlobal;
|
||||||
EFI_EVENT mVirtualAddressChangeEvent = NULL;
|
EFI_EVENT mVirtualAddressChangeEvent = NULL;
|
||||||
EFI_HANDLE mHandle = NULL;
|
EFI_HANDLE mHandle = NULL;
|
||||||
|
|
||||||
//
|
///
|
||||||
// The current Hii implementation accesses this variable a larg # of times on every boot.
|
/// The current Hii implementation accesses this variable many times on every boot.
|
||||||
// Other common variables are only accessed a single time. This is why this cache algorithm
|
/// Other common variables are only accessed once. This is why this cache algorithm
|
||||||
// only targets a single variable. Probably to get an performance improvement out of
|
/// only targets a single variable. Probably to get an performance improvement out of
|
||||||
// a Cache you would need a cache that improves the search performance for a variable.
|
/// a Cache you would need a cache that improves the search performance for a variable.
|
||||||
//
|
///
|
||||||
VARIABLE_CACHE_ENTRY mVariableCache[] = {
|
VARIABLE_CACHE_ENTRY mVariableCache[] = {
|
||||||
{
|
{
|
||||||
&gEfiGlobalVariableGuid,
|
&gEfiGlobalVariableGuid,
|
||||||
|
@ -41,11 +40,18 @@ GLOBAL_REMOVE_IF_UNREFERENCED VARIABLE_INFO_ENTRY *gVariableInfo = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
/**
|
||||||
// This is a temperary function which will be removed
|
Acquires lock only at boot time. Simply returns at runtime.
|
||||||
// when EfiAcquireLock in UefiLib can handle the
|
|
||||||
// the call in UEFI Runtimer driver in RT phase.
|
This is a temperary function which 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
|
VOID
|
||||||
AcquireLockOnlyAtBootTime (
|
AcquireLockOnlyAtBootTime (
|
||||||
IN EFI_LOCK *Lock
|
IN EFI_LOCK *Lock
|
||||||
|
@ -56,11 +62,18 @@ AcquireLockOnlyAtBootTime (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/**
|
||||||
// This is a temperary function which will be removed
|
Releases lock only at boot time. Simply returns at runtime.
|
||||||
// when EfiAcquireLock in UefiLib can handle the
|
|
||||||
// the call in UEFI Runtimer driver in RT phase.
|
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
|
VOID
|
||||||
ReleaseLockOnlyAtBootTime (
|
ReleaseLockOnlyAtBootTime (
|
||||||
IN EFI_LOCK *Lock
|
IN EFI_LOCK *Lock
|
||||||
|
@ -168,24 +181,20 @@ UpdateVariableInfo (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
This code checks if variable header is valid or not.
|
||||||
|
|
||||||
|
@param Variable Pointer to the Variable Header.
|
||||||
|
|
||||||
|
@retval TRUE Variable header is valid.
|
||||||
|
@retval FALSE Variable header is not valid.
|
||||||
|
|
||||||
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsValidVariableHeader (
|
IsValidVariableHeader (
|
||||||
IN VARIABLE_HEADER *Variable
|
IN VARIABLE_HEADER *Variable
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code checks if variable header is valid or not.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
Variable Pointer to the Variable Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
TRUE Variable header is valid.
|
|
||||||
FALSE Variable header is not valid.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
if (Variable == NULL || Variable->StartId != VARIABLE_DATA) {
|
if (Variable == NULL || Variable->StartId != VARIABLE_DATA) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -195,6 +204,25 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
This function writes data to the FWH at the correct LBA even if the LBAs
|
||||||
|
are fragmented.
|
||||||
|
|
||||||
|
@param Global Pointer to VARAIBLE_GLOBAL structure
|
||||||
|
@param Volatile Point out the Variable is Volatile or Non-Volatile
|
||||||
|
@param SetByIndex TRUE if target pointer is given as index
|
||||||
|
FALSE if target pointer is absolute
|
||||||
|
@param Instance Instance of FV Block services
|
||||||
|
@param DataPtrIndex Pointer to the Data from the end of VARIABLE_STORE_HEADER
|
||||||
|
structure
|
||||||
|
@param DataSize Size of data to be written
|
||||||
|
@param Buffer Pointer to the buffer from which data is written
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER Parameters not valid
|
||||||
|
@retval EFI_SUCCESS Variable store successfully updated
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
UpdateVariableStore (
|
UpdateVariableStore (
|
||||||
IN VARIABLE_GLOBAL *Global,
|
IN VARIABLE_GLOBAL *Global,
|
||||||
|
@ -205,31 +233,6 @@ UpdateVariableStore (
|
||||||
IN UINT32 DataSize,
|
IN UINT32 DataSize,
|
||||||
IN UINT8 *Buffer
|
IN UINT8 *Buffer
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This function writes data to the FWH at the correct LBA even if the LBAs
|
|
||||||
are fragmented.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Global - Pointer to VARAIBLE_GLOBAL structure
|
|
||||||
Volatile - If the Variable is Volatile or Non-Volatile
|
|
||||||
SetByIndex - TRUE: Target pointer is given as index
|
|
||||||
FALSE: Target pointer is absolute
|
|
||||||
Instance - Instance of FV Block services
|
|
||||||
DataPtrIndex - Pointer to the Data from the end of VARIABLE_STORE_HEADER
|
|
||||||
structure
|
|
||||||
DataSize - Size of data to be written.
|
|
||||||
Buffer - Pointer to the buffer from which data is written
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_INVALID_PARAMETER - Parameters not valid
|
|
||||||
EFI_SUCCESS - Variable store successfully updated
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
|
EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
|
||||||
UINTN BlockIndex2;
|
UINTN BlockIndex2;
|
||||||
|
@ -343,27 +346,21 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
This code gets the current status of Variable Store.
|
||||||
|
|
||||||
|
@param VarStoreHeader Pointer to the Variable Store Header.
|
||||||
|
|
||||||
|
@retval EfiRaw Variable store status is raw
|
||||||
|
@retval EfiValid Variable store status is valid
|
||||||
|
@retval EfiInvalid Variable store status is invalid
|
||||||
|
|
||||||
|
**/
|
||||||
VARIABLE_STORE_STATUS
|
VARIABLE_STORE_STATUS
|
||||||
GetVariableStoreStatus (
|
GetVariableStoreStatus (
|
||||||
IN VARIABLE_STORE_HEADER *VarStoreHeader
|
IN VARIABLE_STORE_HEADER *VarStoreHeader
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code gets the current status of Variable Store.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
VarStoreHeader Pointer to the Variable Store Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EfiRaw Variable store status is raw
|
|
||||||
EfiValid Variable store status is valid
|
|
||||||
EfiInvalid Variable store status is invalid
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
if (VarStoreHeader->Signature == VARIABLE_STORE_SIGNATURE &&
|
if (VarStoreHeader->Signature == VARIABLE_STORE_SIGNATURE &&
|
||||||
VarStoreHeader->Format == VARIABLE_STORE_FORMATTED &&
|
VarStoreHeader->Format == VARIABLE_STORE_FORMATTED &&
|
||||||
|
@ -384,107 +381,83 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
This code gets the size of name of variable.
|
||||||
|
|
||||||
|
@param Variable Pointer to the Variable Header
|
||||||
|
|
||||||
|
@return UINTN Size of variable in bytes
|
||||||
|
|
||||||
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
NameSizeOfVariable (
|
NameSizeOfVariable (
|
||||||
IN VARIABLE_HEADER *Variable
|
IN VARIABLE_HEADER *Variable
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code gets the size of name of variable.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Variable Pointer to the Variable Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
UINTN Size of variable in bytes
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
if (Variable->State == (UINT8) (-1) ||
|
if (Variable->State == (UINT8) (-1) ||
|
||||||
Variable->DataSize == (UINT32) -1 ||
|
Variable->DataSize == (UINT32) (-1) ||
|
||||||
Variable->NameSize == (UINT32) -1 ||
|
Variable->NameSize == (UINT32) (-1) ||
|
||||||
Variable->Attributes == (UINT32) -1) {
|
Variable->Attributes == (UINT32) (-1)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (UINTN) Variable->NameSize;
|
return (UINTN) Variable->NameSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
This code gets the size of variable data.
|
||||||
|
|
||||||
|
@param Variable Pointer to the Variable Header
|
||||||
|
|
||||||
|
@return Size of variable in bytes
|
||||||
|
|
||||||
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
DataSizeOfVariable (
|
DataSizeOfVariable (
|
||||||
IN VARIABLE_HEADER *Variable
|
IN VARIABLE_HEADER *Variable
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code gets the size of name of variable.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Variable Pointer to the Variable Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
UINTN Size of variable in bytes
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
if (Variable->State == (UINT8) -1 ||
|
if (Variable->State == (UINT8) (-1) ||
|
||||||
Variable->DataSize == (UINT32) -1 ||
|
Variable->DataSize == (UINT32) (-1) ||
|
||||||
Variable->NameSize == (UINT32) -1 ||
|
Variable->NameSize == (UINT32) (-1) ||
|
||||||
Variable->Attributes == (UINT32) -1) {
|
Variable->Attributes == (UINT32) (-1)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (UINTN) Variable->DataSize;
|
return (UINTN) Variable->DataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
This code gets the pointer to the variable name.
|
||||||
|
|
||||||
|
@param Variable Pointer to the Variable Header
|
||||||
|
|
||||||
|
@return Pointer to Variable Name which is Unicode encoding
|
||||||
|
|
||||||
|
**/
|
||||||
CHAR16 *
|
CHAR16 *
|
||||||
GetVariableNamePtr (
|
GetVariableNamePtr (
|
||||||
IN VARIABLE_HEADER *Variable
|
IN VARIABLE_HEADER *Variable
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code gets the pointer to the variable name.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Variable Pointer to the Variable Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
CHAR16* Pointer to Variable Name
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return (CHAR16 *) (Variable + 1);
|
return (CHAR16 *) (Variable + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
This code gets the pointer to the variable data.
|
||||||
|
|
||||||
|
@param Variable Pointer to the Variable Header
|
||||||
|
|
||||||
|
@return Pointer to Variable Data
|
||||||
|
|
||||||
|
**/
|
||||||
UINT8 *
|
UINT8 *
|
||||||
GetVariableDataPtr (
|
GetVariableDataPtr (
|
||||||
IN VARIABLE_HEADER *Variable
|
IN VARIABLE_HEADER *Variable
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code gets the pointer to the variable data.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Variable Pointer to the Variable Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
UINT8* Pointer to Variable Data
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
UINTN Value;
|
UINTN Value;
|
||||||
|
|
||||||
|
@ -499,25 +472,19 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
This code gets the pointer to the next variable header.
|
||||||
|
|
||||||
|
@param Variable Pointer to the Variable Header
|
||||||
|
|
||||||
|
@return Pointer to next variable header
|
||||||
|
|
||||||
|
**/
|
||||||
VARIABLE_HEADER *
|
VARIABLE_HEADER *
|
||||||
GetNextVariablePtr (
|
GetNextVariablePtr (
|
||||||
IN VARIABLE_HEADER *Variable
|
IN VARIABLE_HEADER *Variable
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code gets the pointer to the next variable header.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Variable Pointer to the Variable Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
VARIABLE_HEADER* Pointer to next variable header.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
UINTN Value;
|
UINTN Value;
|
||||||
|
|
||||||
|
@ -535,25 +502,19 @@ Returns:
|
||||||
return (VARIABLE_HEADER *) HEADER_ALIGN (Value);
|
return (VARIABLE_HEADER *) HEADER_ALIGN (Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Gets the pointer to the first variable header in given variable store area.
|
||||||
|
|
||||||
|
@param VarStoreHeader Pointer to the Variable Store Header.
|
||||||
|
|
||||||
|
@return Pointer to the first variable header
|
||||||
|
|
||||||
|
**/
|
||||||
VARIABLE_HEADER *
|
VARIABLE_HEADER *
|
||||||
GetStartPointer (
|
GetStartPointer (
|
||||||
IN VARIABLE_STORE_HEADER *VarStoreHeader
|
IN VARIABLE_STORE_HEADER *VarStoreHeader
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code gets the pointer to the first variable memory pointer byte
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
VarStoreHeader Pointer to the Variable Store Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
VARIABLE_HEADER* Pointer to last unavailable Variable Header
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// The end of variable store
|
// The end of variable store
|
||||||
|
@ -561,25 +522,22 @@ Returns:
|
||||||
return (VARIABLE_HEADER *) HEADER_ALIGN (VarStoreHeader + 1);
|
return (VARIABLE_HEADER *) HEADER_ALIGN (VarStoreHeader + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Gets the pointer to the end of the variable storage area.
|
||||||
|
|
||||||
|
This function gets pointer to the end of the variable storage
|
||||||
|
area, according to the input variable store header.
|
||||||
|
|
||||||
|
@param VarStoreHeader Pointer to the Variable Store Header
|
||||||
|
|
||||||
|
@return Pointer to the end of the variable storage area
|
||||||
|
|
||||||
|
**/
|
||||||
VARIABLE_HEADER *
|
VARIABLE_HEADER *
|
||||||
GetEndPointer (
|
GetEndPointer (
|
||||||
IN VARIABLE_STORE_HEADER *VarStoreHeader
|
IN VARIABLE_STORE_HEADER *VarStoreHeader
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code gets the pointer to the last variable memory pointer byte
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
VarStoreHeader Pointer to the Variable Store Header.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
VARIABLE_HEADER* Pointer to last unavailable Variable Header
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// The end of variable store
|
// The end of variable store
|
||||||
|
@ -588,6 +546,21 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Variable store garbage collection and reclaim operation.
|
||||||
|
|
||||||
|
@param VariableBase Base address of variable store
|
||||||
|
@param LastVariableOffset Offset of last variable
|
||||||
|
@param IsVolatile The variable store is volatile or not,
|
||||||
|
if it is non-volatile, need FTW
|
||||||
|
@param UpdatingVariable Pointer to updateing variable.
|
||||||
|
|
||||||
|
@return EFI_OUT_OF_RESOURCES
|
||||||
|
@return EFI_SUCCESS
|
||||||
|
@return Others
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
Reclaim (
|
Reclaim (
|
||||||
IN EFI_PHYSICAL_ADDRESS VariableBase,
|
IN EFI_PHYSICAL_ADDRESS VariableBase,
|
||||||
|
@ -595,24 +568,6 @@ Reclaim (
|
||||||
IN BOOLEAN IsVolatile,
|
IN BOOLEAN IsVolatile,
|
||||||
IN VARIABLE_HEADER *UpdatingVariable
|
IN VARIABLE_HEADER *UpdatingVariable
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Variable store garbage collection and reclaim operation
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
VariableBase Base address of variable store
|
|
||||||
LastVariableOffset Offset of last variable
|
|
||||||
IsVolatile The variable store is volatile or not,
|
|
||||||
if it is non-volatile, need FTW
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI STATUS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
VARIABLE_HEADER *Variable;
|
VARIABLE_HEADER *Variable;
|
||||||
VARIABLE_HEADER *AddedVariable;
|
VARIABLE_HEADER *AddedVariable;
|
||||||
|
@ -671,10 +626,6 @@ Returns:
|
||||||
CopyMem (ValidBuffer, VariableStoreHeader, sizeof (VARIABLE_STORE_HEADER));
|
CopyMem (ValidBuffer, VariableStoreHeader, sizeof (VARIABLE_STORE_HEADER));
|
||||||
CurrPtr = (UINT8 *) GetStartPointer ((VARIABLE_STORE_HEADER *) ValidBuffer);
|
CurrPtr = (UINT8 *) GetStartPointer ((VARIABLE_STORE_HEADER *) ValidBuffer);
|
||||||
|
|
||||||
//
|
|
||||||
// Start Pointers for the variable.
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reinstall all ADDED variables as long as they are not identical to Updating Variable
|
// Reinstall all ADDED variables as long as they are not identical to Updating Variable
|
||||||
//
|
//
|
||||||
|
@ -842,16 +793,23 @@ UpdateVariableCache (
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Search the cache to see if the variable is in the cache.
|
Search the cache to check if the variable is in it.
|
||||||
|
|
||||||
@param[in] VariableName Name of variable
|
This function searches the variable cache. If the variable to find exists, return its data
|
||||||
@param[in] VendorGuid Guid of variable
|
and attributes.
|
||||||
@param[in] Attribute Attribue returned
|
|
||||||
@param[in] DataSize Size of data returned
|
|
||||||
@param[in] Data Variable data returned
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS VariableGuid & VariableName data was returned.
|
@param VariableName A Null-terminated Unicode string that is the name of the vendor's
|
||||||
@retval other Not found.
|
variable. Each VariableName is unique for each
|
||||||
|
VendorGuid.
|
||||||
|
@param VendorGuid A unique identifier for the vendor
|
||||||
|
@param Attributes Pointer to the attributes bitmask of the variable for output.
|
||||||
|
@param DataSize On input, size of the buffer of Data.
|
||||||
|
On output, size of the variable's data.
|
||||||
|
@param Data Pointer to the data buffer for output.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS VariableGuid & VariableName data was returned.
|
||||||
|
@retval EFI_NOT_FOUND No matching variable found in cache.
|
||||||
|
@retval EFI_BUFFER_TOO_SMALL *DataSize is smaller than size of the variable's data to return.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -897,7 +855,28 @@ FindVariableInCache (
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Finds variable in storage blocks of volatile and non-volatile storage areas.
|
||||||
|
|
||||||
|
This code finds variable in storage blocks of volatile and non-volatile storage areas.
|
||||||
|
If VariableName is an empty string, then we just return the first
|
||||||
|
qualified variable without comparing VariableName and VendorGuid.
|
||||||
|
Otherwise, VariableName and VendorGuid are compared.
|
||||||
|
|
||||||
|
@param VariableName Name of the variable to be found
|
||||||
|
@param VendorGuid Vendor GUID to be found.
|
||||||
|
@param PtrTrack VARIABLE_POINTER_TRACK structure for output,
|
||||||
|
including the range searched and the target position.
|
||||||
|
@param Global Pointer to VARIABLE_GLOBAL structure, including
|
||||||
|
base of volatile variable storage area, base of
|
||||||
|
NV variable storage area, and a lock.
|
||||||
|
|
||||||
|
@retval EFI_INVALID_PARAMETER If VariableName is not an empty string, while
|
||||||
|
VendorGuid is NULL
|
||||||
|
@retval EFI_SUCCESS Variable successfully found
|
||||||
|
@retval EFI_INVALID_PARAMETER Variable not found
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
FindVariable (
|
FindVariable (
|
||||||
IN CHAR16 *VariableName,
|
IN CHAR16 *VariableName,
|
||||||
|
@ -905,26 +884,6 @@ FindVariable (
|
||||||
OUT VARIABLE_POINTER_TRACK *PtrTrack,
|
OUT VARIABLE_POINTER_TRACK *PtrTrack,
|
||||||
IN VARIABLE_GLOBAL *Global
|
IN VARIABLE_GLOBAL *Global
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code finds variable in storage blocks (Volatile or Non-Volatile)
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
VariableName Name of the variable to be found
|
|
||||||
VendorGuid Vendor GUID to be found.
|
|
||||||
PtrTrack Variable Track Pointer structure that contains
|
|
||||||
Variable Information.
|
|
||||||
Contains the pointer of Variable header.
|
|
||||||
Global VARIABLE_GLOBAL pointer
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI STATUS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
VARIABLE_HEADER *Variable[2];
|
VARIABLE_HEADER *Variable[2];
|
||||||
VARIABLE_HEADER *InDeletedVariable;
|
VARIABLE_HEADER *InDeletedVariable;
|
||||||
|
@ -1013,33 +972,23 @@ Returns:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
/*++
|
This code finds variable in storage blocks (Volatile or Non-Volatile).
|
||||||
|
|
||||||
Routine Description:
|
@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.
|
||||||
|
|
||||||
This code finds variable in storage blocks (Volatile or Non-Volatile)
|
@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
|
||||||
|
|
||||||
Arguments:
|
**/
|
||||||
|
|
||||||
VariableName Name of Variable to be found
|
|
||||||
VendorGuid Variable vendor GUID
|
|
||||||
Attributes OPTIONAL Attribute value of the variable found
|
|
||||||
DataSize Size of Data found. If size is less than the
|
|
||||||
data, this value contains the required size.
|
|
||||||
Data Data pointer
|
|
||||||
Global Pointer to VARIABLE_GLOBAL structure
|
|
||||||
Instance Instance of the Firmware Volume.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_INVALID_PARAMETER - Invalid parameter
|
|
||||||
EFI_SUCCESS - Find the specified variable
|
|
||||||
EFI_NOT_FOUND - Not found
|
|
||||||
EFI_BUFFER_TO_SMALL - DataSize is too small for the result
|
|
||||||
|
|
||||||
|
|
||||||
--*/
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
RuntimeServiceGetVariable (
|
RuntimeServiceGetVariable (
|
||||||
|
@ -1111,25 +1060,20 @@ Done:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*++
|
/**
|
||||||
|
|
||||||
Routine Description:
|
This code Finds the Next available variable.
|
||||||
|
|
||||||
This code Finds the Next available variable
|
@param VariableNameSize Size of the variable name
|
||||||
|
@param VariableName Pointer to variable name
|
||||||
|
@param VendorGuid Variable Vendor Guid
|
||||||
|
|
||||||
Arguments:
|
@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
|
||||||
|
|
||||||
VariableNameSize Size of the variable
|
**/
|
||||||
VariableName Pointer to variable name
|
|
||||||
VendorGuid Variable Vendor Guid
|
|
||||||
Global VARIABLE_GLOBAL structure pointer.
|
|
||||||
Instance FV instance
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI STATUS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
RuntimeServiceGetNextVariableName (
|
RuntimeServiceGetNextVariableName (
|
||||||
|
@ -1217,36 +1161,24 @@ Done:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
/*++
|
This code sets variable in storage blocks (Volatile or Non-Volatile).
|
||||||
|
|
||||||
Routine Description:
|
@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
|
||||||
|
|
||||||
This code sets variable in storage blocks (Volatile or Non-Volatile)
|
@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
|
||||||
|
|
||||||
Arguments:
|
**/
|
||||||
|
|
||||||
VariableName Name of Variable to be found
|
|
||||||
VendorGuid Variable vendor GUID
|
|
||||||
Attributes Attribute value of the variable found
|
|
||||||
DataSize Size of Data found. If size is less than the
|
|
||||||
data, this value contains the required size.
|
|
||||||
Data Data pointer
|
|
||||||
Global Pointer to VARIABLE_GLOBAL structure
|
|
||||||
VolatileOffset The offset of last volatile variable
|
|
||||||
NonVolatileOffset The offset of last non-volatile variable
|
|
||||||
Instance Instance of the Firmware Volume.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_INVALID_PARAMETER - Invalid parameter
|
|
||||||
EFI_SUCCESS - Set successfully
|
|
||||||
EFI_OUT_OF_RESOURCES - Resource not enough to set variable
|
|
||||||
EFI_NOT_FOUND - Not found
|
|
||||||
EFI_DEVICE_ERROR - Variable can not be saved due to hardware failure
|
|
||||||
EFI_WRITE_PROTECTED - Variable is read-only
|
|
||||||
|
|
||||||
--*/
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
RuntimeServiceSetVariable (
|
RuntimeServiceSetVariable (
|
||||||
|
@ -1677,34 +1609,24 @@ Done:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This code returns information about the EFI variables.
|
This code returns information about the EFI variables.
|
||||||
|
|
||||||
Arguments:
|
@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.
|
||||||
|
|
||||||
Attributes Attributes bitmask to specify the type of variables
|
@return EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.
|
||||||
on which to return information.
|
@return EFI_SUCCESS Query successfully.
|
||||||
MaximumVariableStorageSize Pointer to the maximum size of the storage space available
|
@return EFI_UNSUPPORTED The attribute is not supported on this platform.
|
||||||
for the EFI variables associated with the attributes specified.
|
|
||||||
RemainingVariableStorageSize Pointer to the remaining size of the storage space available
|
|
||||||
for EFI variables associated with the attributes specified.
|
|
||||||
MaximumVariableSize Pointer to the maximum size of an individual EFI variables
|
|
||||||
associated with the attributes specified.
|
|
||||||
Global Pointer to VARIABLE_GLOBAL structure.
|
|
||||||
Instance Instance of the Firmware Volume.
|
|
||||||
|
|
||||||
Returns:
|
**/
|
||||||
|
|
||||||
EFI STATUS
|
|
||||||
EFI_INVALID_PARAMETER - An invalid combination of attribute bits was supplied.
|
|
||||||
EFI_SUCCESS - Query successfully.
|
|
||||||
EFI_UNSUPPORTED - The attribute is not supported on this platform.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
RuntimeServiceQueryVariableInfo (
|
RuntimeServiceQueryVariableInfo (
|
||||||
|
@ -1819,6 +1741,18 @@ RuntimeServiceQueryVariableInfo (
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Notification function of EVT_GROUP_READY_TO_BOOT event group.
|
||||||
|
|
||||||
|
This is a notification function registered on EVT_GROUP_READY_TO_BOOT event group.
|
||||||
|
When the Boot Manager is about to load and execute a boot option, it reclaims variable
|
||||||
|
storage if free size is below the threshold.
|
||||||
|
|
||||||
|
@param Event Event whose notification function is being invoked
|
||||||
|
@param Context Pointer to the notification function's context
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ReclaimForOS(
|
ReclaimForOS(
|
||||||
|
@ -1846,30 +1780,21 @@ ReclaimForOS(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initializes variable store area for non-volatile and volatile variable.
|
||||||
|
|
||||||
|
@param ImageHandle The Image handle of this driver.
|
||||||
|
@param SystemTable The pointer of EFI_SYSTEM_TABLE.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Function successfully executed.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Fail to allocate enough memory resource.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
VariableCommonInitialize (
|
VariableCommonInitialize (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
This function does common initialization for variable services
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
ImageHandle - The firmware allocated handle for the EFI image.
|
|
||||||
SystemTable - A pointer to the EFI System Table.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
Status code.
|
|
||||||
|
|
||||||
EFI_NOT_FOUND - Variable store area not found.
|
|
||||||
EFI_UNSUPPORTED - Currently only one non-volatile variable store is supported.
|
|
||||||
EFI_SUCCESS - Variable services successfully initialized.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
|
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
|
||||||
|
@ -2061,6 +1986,16 @@ Done:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
|
||||||
|
|
||||||
|
This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
|
||||||
|
It convers pointer to new virtual address.
|
||||||
|
|
||||||
|
@param Event Event whose notification function is being invoked
|
||||||
|
@param Context Pointer to the notification function's context
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
VariableClassAddressChangeEvent (
|
VariableClassAddressChangeEvent (
|
||||||
|
@ -2083,13 +2018,13 @@ VariableClassAddressChangeEvent (
|
||||||
/**
|
/**
|
||||||
Variable Driver main entry point. The Variable driver places the 4 EFI
|
Variable Driver main entry point. The Variable driver places the 4 EFI
|
||||||
runtime services in the EFI System Table and installs arch protocols
|
runtime services in the EFI System Table and installs arch protocols
|
||||||
for variable read and write services being availible.
|
for variable read and write services being availible. It also registers
|
||||||
|
notification function for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
|
||||||
|
|
||||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||||
@param[in] SystemTable A pointer to the EFI System Table.
|
@param[in] SystemTable A pointer to the EFI System Table.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The entry point is executed successfully.
|
@retval EFI_SUCCESS Variable service successfully initialized.
|
||||||
@retval other Some error occurs when executing this entry point.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
|
|
@ -14,8 +14,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _VARIABLE_H
|
#ifndef _VARIABLE_H_
|
||||||
#define _VARIABLE_H
|
#define _VARIABLE_H_
|
||||||
|
|
||||||
#include <PiDxe.h>
|
#include <PiDxe.h>
|
||||||
#include <Protocol/VariableWrite.h>
|
#include <Protocol/VariableWrite.h>
|
||||||
|
|
Loading…
Reference in New Issue