GetVariable()
and SetVariable()
services to read and write UEFI variables. UEFI Drivers for add-in adapters, such as PCI adapters, should not use these services to access configuration information for the adapter. Instead, the add-in adapter should provide its own local storage for configuration information. UEFI Drivers provided with UEFI system firmware use UEFI variables to store configuration information. Examples found in the EDK II of UEFI Drivers use UEFI variables to store configuration information include the IPv4 and IPv6 network stacks in the MdeModulePkg/Universal/Network
and the NetworkPkg
.gEfiGlobalVariableGuid
in the EDK II, that is reserved for UEFI variables defined by the _UEFI Specification. UEFI Drivers must never use this GUID to store their configuration information.BOOTSERVICE_ACCESS
ExitBootServices()
is called. The variable is not available afterBOOTSERVICE_ACCESS | RUNTIME_ACCESS
NON_VOLATILE | BOOTSERVICE_ACCESS
ExitBootServices()
is called and the contents are persistent acrossNON_VOLATILE | BOOTSERVICE_ACCESS | RUNTIME_ACCESS
EFI_HII_CONFIG_ACCESS_PROTOCOL
protocol instance. The services GetVariable()
and SetVariable()
are used to get and set configuration information associated with HII setup screens provided by the UEFI Driver using the UEFI HII infrastructure that is described in more detail in Chapter 12.BOOTSERVICE_ACCESS
should be used with a UEFI variable used as a mailbox to store state information that is required by multiple HII forms or multiple HII callbacks.EXAMPLE_CONFIGURATION
fromGetVariable()
service to read the configuration structure from the UEFI variable written in the previous example.GetVariable()
function from the EDK II library UefiLib
to read the configuration structure from the UEFI variable. The UEFI variable contents are allocated from pool, so the variable contents must be freed after they are used. The UefiLib
function GetVariable()
supports reading both fixed size UEFI variables such as an EXAMPLE_CONFIGURATION
structure and UEFI variables whose size may vary.