TianoCore EDK2 master
Loading...
Searching...
No Matches
VariableSupport.h File Reference

Go to the source code of this file.

Data Structures

struct  FMP_CONTROLLER_STATE
 

Macros

#define DEFAULT_VERSION   0x1
 
#define DEFAULT_LOWESTSUPPORTEDVERSION   0x0
 
#define DEFAULT_LASTATTEMPTSTATUS   0x0
 
#define DEFAULT_LASTATTEMPTVERSION   0x0
 
#define VARNAME_VERSION   L"FmpVersion"
 
#define VARNAME_LSV   L"FmpLsv"
 
#define VARNAME_LASTATTEMPTSTATUS   L"LastAttemptStatus"
 
#define VARNAME_LASTATTEMPTVERSION   L"LastAttemptVersion"
 
#define VARNAME_FMPSTATE   L"FmpState"
 

Functions

VOID GenerateFmpVariableNames (IN OUT FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private)
 
UINT32 GetVersionFromVariable (IN FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private)
 
UINT32 GetLowestSupportedVersionFromVariable (IN FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private)
 
UINT32 GetLastAttemptStatusFromVariable (IN FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private)
 
UINT32 GetLastAttemptVersionFromVariable (IN FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private)
 
VOID SetVersionInVariable (IN FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private, IN UINT32 Version)
 
VOID SetLowestSupportedVersionInVariable (IN FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private, IN UINT32 LowestSupportedVersion)
 
VOID SetLastAttemptStatusInVariable (IN FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private, IN UINT32 LastAttemptStatus)
 
VOID SetLastAttemptVersionInVariable (IN FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private, IN UINT32 LastAttemptVersion)
 
EFI_STATUS LockAllFmpVariables (IN FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private)
 

Detailed Description

UEFI variable support functions for Firmware Management Protocol based firmware updates.

Copyright (c) 2016, Microsoft Corporation. All rights reserved.
Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file VariableSupport.h.

Macro Definition Documentation

◆ DEFAULT_LASTATTEMPTSTATUS

#define DEFAULT_LASTATTEMPTSTATUS   0x0

Definition at line 20 of file VariableSupport.h.

◆ DEFAULT_LASTATTEMPTVERSION

#define DEFAULT_LASTATTEMPTVERSION   0x0

Definition at line 21 of file VariableSupport.h.

◆ DEFAULT_LOWESTSUPPORTEDVERSION

#define DEFAULT_LOWESTSUPPORTEDVERSION   0x0

Definition at line 19 of file VariableSupport.h.

◆ DEFAULT_VERSION

#define DEFAULT_VERSION   0x1

Default values for FMP Controller State information

Definition at line 18 of file VariableSupport.h.

◆ VARNAME_FMPSTATE

#define VARNAME_FMPSTATE   L"FmpState"

Base UEFI Variable name for FMP Controller State information stored in a merged UEFI Variable. If the separate UEFI Variables above are detected, then they are merged into a single variable and the separate variables are deleted.

Definition at line 38 of file VariableSupport.h.

◆ VARNAME_LASTATTEMPTSTATUS

#define VARNAME_LASTATTEMPTSTATUS   L"LastAttemptStatus"

Definition at line 29 of file VariableSupport.h.

◆ VARNAME_LASTATTEMPTVERSION

#define VARNAME_LASTATTEMPTVERSION   L"LastAttemptVersion"

Definition at line 30 of file VariableSupport.h.

◆ VARNAME_LSV

#define VARNAME_LSV   L"FmpLsv"

Definition at line 28 of file VariableSupport.h.

◆ VARNAME_VERSION

#define VARNAME_VERSION   L"FmpVersion"

Base UEFI Variable names for FMP Controller State information stored in separate variables.

Definition at line 27 of file VariableSupport.h.

Function Documentation

◆ GenerateFmpVariableNames()

VOID GenerateFmpVariableNames ( IN OUT FIRMWARE_MANAGEMENT_PRIVATE_DATA Private)

Generate the names of the UEFI Variables used to store state information for a managed controller. The UEFI Variables names are a combination of a base name and an optional hardware instance value as a 16 character hex value. If the hardware instance value is 0, then the 16 character hex value is not included. These storage for the UEFI Variable names are allocated using the UEFI Boot Service AllocatePool() and the pointers are stored in the Private. The following are examples of variable names produces for hardware instance value 0 and value 0x1234567812345678.

FmpVersion FmpLsv LastAttemptStatus LastAttemptVersion FmpDxe

FmpVersion1234567812345678 FmpLsv1234567812345678 LastAttemptStatus1234567812345678 LastAttemptVersion1234567812345678 FmpDxe1234567812345678

Parameters
[in,out]PrivatePrivate context structure for the managed controller.

Generate the names of the UEFI Variables used to store state information for a managed controller. The UEFI Variables names are a combination of a base name and an optional hardware instance value as a 16 character hex value. If the hardware instance value is 0, then the 16 character hex value is not included. These storage for the UEFI Variable names are allocated using the UEFI Boot Service AllocatePool() and the pointers are stored in the Private. The following are examples of variable names produces for hardware instance value 0 and value 0x1234567812345678.

FmpVersion FmpLsv LastAttemptStatus LastAttemptVersion FmpState

FmpVersion1234567812345678 FmpLsv1234567812345678 LastAttemptStatus1234567812345678 LastAttemptVersion1234567812345678 FmpState1234567812345678

Parameters
[in,out]PrivatePrivate context structure for the managed controller.

Definition at line 207 of file VariableSupport.c.

◆ GetLastAttemptStatusFromVariable()

UINT32 GetLastAttemptStatusFromVariable ( IN FIRMWARE_MANAGEMENT_PRIVATE_DATA Private)

Returns the value used to fill in the LastAttemptStatus field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The value is read from a UEFI variable. If the UEFI variables does not exist, then a default last attempt status value is returned.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpDxe"

Parameters
[in]PrivatePrivate context structure for the managed controller.
Returns
The last attempt status value for the most recent capsule update.

Returns the value used to fill in the LastAttemptStatus field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The value is read from a UEFI variable. If the UEFI variables does not exist, then a default last attempt status value is returned.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpState"

Parameters
[in]PrivatePrivate context structure for the managed controller.
Returns
The last attempt status value for the most recent capsule update.

Definition at line 422 of file VariableSupport.c.

◆ GetLastAttemptVersionFromVariable()

UINT32 GetLastAttemptVersionFromVariable ( IN FIRMWARE_MANAGEMENT_PRIVATE_DATA Private)

Returns the value used to fill in the LastAttemptVersion field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The value is read from a UEFI variable. If the UEFI variables does not exist, then a default last attempt version value is returned.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpDxe"

Parameters
[in]PrivatePrivate context structure for the managed controller.
Returns
The last attempt version value for the most recent capsule update.

Returns the value used to fill in the LastAttemptVersion field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The value is read from a UEFI variable. If the UEFI variables does not exist, then a default last attempt version value is returned.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpState"

Parameters
[in]PrivatePrivate context structure for the managed controller.
Returns
The last attempt version value for the most recent capsule update.

Definition at line 464 of file VariableSupport.c.

◆ GetLowestSupportedVersionFromVariable()

UINT32 GetLowestSupportedVersionFromVariable ( IN FIRMWARE_MANAGEMENT_PRIVATE_DATA Private)

Returns the value used to fill in the LowestSupportedVersion field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The value is read from a UEFI variable. If the UEFI variables does not exist, then a default lowest supported version value is returned.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpDxe"

Parameters
[in]PrivatePrivate context structure for the managed controller.
Returns
The lowest supported version of the firmware image in the firmware device.

Returns the value used to fill in the LowestSupportedVersion field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The value is read from a UEFI variable. If the UEFI variables does not exist, then a default lowest supported version value is returned.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpState"

Parameters
[in]PrivatePrivate context structure for the managed controller.
Returns
The lowest supported version of the firmware image in the firmware device.

Definition at line 380 of file VariableSupport.c.

◆ GetVersionFromVariable()

UINT32 GetVersionFromVariable ( IN FIRMWARE_MANAGEMENT_PRIVATE_DATA Private)

Returns the value used to fill in the Version field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The value is read from a UEFI variable. If the UEFI variables does not exist, then a default version value is returned.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpDxe"

Parameters
[in]PrivatePrivate context structure for the managed controller.
Returns
The version of the firmware image in the firmware device.

Returns the value used to fill in the Version field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The value is read from a UEFI variable. If the UEFI variables does not exist, then a default version value is returned.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpState"

Parameters
[in]PrivatePrivate context structure for the managed controller.
Returns
The version of the firmware image in the firmware device.

Definition at line 337 of file VariableSupport.c.

◆ LockAllFmpVariables()

EFI_STATUS LockAllFmpVariables ( IN FIRMWARE_MANAGEMENT_PRIVATE_DATA Private)

Locks all the UEFI Variables that use gEfiCallerIdGuid of the currently executing module.

Parameters
[in]PrivatePrivate context structure for the managed controller.
Return values
EFI_SUCCESSAll UEFI variables are locked.
EFI_UNSUPPORTEDVariable Lock Protocol not found.
OtherOne of the UEFI variables could not be locked.

◆ SetLastAttemptStatusInVariable()

VOID SetLastAttemptStatusInVariable ( IN FIRMWARE_MANAGEMENT_PRIVATE_DATA Private,
IN UINT32  LastAttemptStatus 
)

Saves the last attempt status value of the most recent FMP capsule update to a UEFI variable.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpDxe"

Parameters
[in]PrivatePrivate context structure for the managed controller.
[in]LastAttemptStatusThe last attempt status of the most recent FMP capsule update.

Saves the last attempt status value of the most recent FMP capsule update to a UEFI variable.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpState"

Parameters
[in]PrivatePrivate context structure for the managed controller.
[in]LastAttemptStatusThe last attempt status of the most recent FMP capsule update.

Definition at line 638 of file VariableSupport.c.

◆ SetLastAttemptVersionInVariable()

VOID SetLastAttemptVersionInVariable ( IN FIRMWARE_MANAGEMENT_PRIVATE_DATA Private,
IN UINT32  LastAttemptVersion 
)

Saves the last attempt version value of the most recent FMP capsule update to a UEFI variable.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpDxe"

Parameters
[in]PrivatePrivate context structure for the managed controller.
[in]LastAttemptVersionThe last attempt version value of the most recent FMP capsule update.

Saves the last attempt version value of the most recent FMP capsule update to a UEFI variable.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpState"

Parameters
[in]PrivatePrivate context structure for the managed controller.
[in]LastAttemptVersionThe last attempt version value of the most recent FMP capsule update.

Definition at line 706 of file VariableSupport.c.

◆ SetLowestSupportedVersionInVariable()

VOID SetLowestSupportedVersionInVariable ( IN FIRMWARE_MANAGEMENT_PRIVATE_DATA Private,
IN UINT32  LowestSupportedVersion 
)

Saves the lowest supported version current of the firmware image in the firmware device to a UEFI variable.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpDxe"

Parameters
[in]PrivatePrivate context structure for the managed controller.
[in]LowestSupportedVersionThe lowest supported version of the firmware image in the firmware device.

Saves the lowest supported version current of the firmware image in the firmware device to a UEFI variable.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpState"

Parameters
[in]PrivatePrivate context structure for the managed controller.
[in]LowestSupportedVersionThe lowest supported version of the firmware image in the firmware device.

Definition at line 570 of file VariableSupport.c.

◆ SetVersionInVariable()

VOID SetVersionInVariable ( IN FIRMWARE_MANAGEMENT_PRIVATE_DATA Private,
IN UINT32  Version 
)

Saves the version current of the firmware image in the firmware device to a UEFI variable.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpDxe"

Parameters
[in]PrivatePrivate context structure for the managed controller.
[in]VersionThe version of the firmware image in the firmware device.

Saves the version current of the firmware image in the firmware device to a UEFI variable.

UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpState"

Parameters
[in]PrivatePrivate context structure for the managed controller.
[in]VersionThe version of the firmware image in the firmware device.

Definition at line 502 of file VariableSupport.c.