`varstore` vs `efivarstore`


Konstantin Aladyshev
 

Hello!

Can someone explain to me, what is a typical reason for using
`varstore` instead of `efivarstore` for HII storage?

I understand that the `varstore` gives you more flexibility as you can
control the behaviour of save/load (=route/extract) functions. But
what can you achieve with this?

EDKII has several drivers with `varstore`, can you give me some
examples, why do they need exactly this type of storage?

./MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.vfr
./MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanup.vfr
./MdeModulePkg/Universal/PlatformDriOverrideDxe/Vfr.vfr
./NetworkPkg/HttpBootDxe/HttpBootConfigVfr.vfr
./NetworkPkg/Ip4Dxe/Ip4Config2.vfr
./NetworkPkg/Ip6Dxe/Ip6Config.vfr
./NetworkPkg/IScsiDxe/IScsiConfigVfr.vfr
./NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigVfr.vfr
./NetworkPkg/VlanConfigDxe/VlanConfig.vfr
./NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxe.vfr
./OvmfPkg/PlatformDxe/PlatformForms.vfr
./SecurityPkg/HddPassword/HddPassword.vfr
./SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordForm.vfr
./SecurityPkg/Tcg/TcgConfigDxe/TcgConfig.vfr
./SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig.vfr
./OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.Vfr

Best regards,
Konstantin Aladyshev


Tomas Pilar (tpilar)
 

I understand that the `varstore` gives you more flexibility as you can
control the behaviour of save/load (=route/extract) functions. But
what can you achieve with this?
For example, writing a third-party driver (optionROM for a PCIe card). Using a varstore allows you to control how the configuration is stored and where it is stored - likely you have a config flash partition on your device. Storing config on your device means the physical device carries its config to a new server when you move it.

Moreover, your device has to be compatible with many different builds of bioses in different servers. While we have UEFI standards and EDK2 libraries, there are nevertheless 'behavioural quirks' with many (especially older) implementations of UEFI in various servers. As a driver developer I was very cautious about letting the server handle the storage of my variables.

Cheers,
Tom