Up: internals-protocols


6.3.1 Variable Store

The internal `variable store' protocol is used to provide storage for variables that can be accessed through the runtime services. The protocol exposes characteristics of the store along with a set of functions used to read, clear and update the contents of the store. The store is divided into a number of banks, where each bank can be read and updated individually.

6.3.1.1 Interface

The interface provided by the `variable store' protocol has the following functions and variables:

— Variable Store: efi_uint32_t revision

Revision of the interface, should be EFI_VARIABLE_STORE_PROTOCOL_REVISION.

— Variable Store: efi_uint32_t attributes

Attributes of the store. See related defintions below for a list of available attributes.

— Variable Store: efi_uint_t bank_size

Size in bytes of each bank in the store.

— Variable Store: efi_uint_t num_banks

Number of banks that the store presents.

— Variable Store: efi_status_t read (efi_variable_store_t *this, efi_uint_t bank, void *buffer)

Read the content of bank bank into buffer buffer. The buffer must at least be able to hold the amount of data that the store defines for a bank.

— Variable Store: efi_status_t update (efi_variable_store_t *this, efi_uint_t bank, void *buffer)

Update the content of bank bank with the data in buffer buffer. The buffer msut at least hold the amount of data that the store defined for a bank.

— Variable Store: efi_status_t clear (efi_variable_store_t *this, efi_uint_t bank)

Reset content of bank bank.

6.3.1.2 Related Definitions

     #define EFI_VARIABLE_STORE_GUID (efi_guid_t) 		\
       { 0xdfc23a79, 0xd3f9, 0x4a0e,   			\
         { 0xac, 0xcb, 0x7f, 0x11, 0xf1, 0x53, 0xf2, 0xa7 }  \
       }

The protocol interface contains an attributes variable that defines under what situations the store can be used;

EFI_VARIABLE_STORE_NONVOLATILE
The store provides nonvolatile storage. Variables will survive a power-cycle.
EFI_VARIABLE_STORE_BOOT_SERVICE
The store is only available while the boot services are still running.
EFI_VARIABLE_STORE_RUNTIME
The store is available in runtime mode; i.e, after boot services has been terminated.

The protocol interface contains a revision member that defines the version of the interface. All future versions of the interface will be compatible. If non-compatible changes have to be introduced, a new guid will be allocated for the protocol.

EFI_VARIABLE_STORE_PROTOCOL_REVISION
Protocol interface revision.