diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-06-22 18:10:27 +0200 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-07-11 23:14:16 +0200 |
commit | f2d2b3a11ce18663ea95c29eb2c609efd77b7999 (patch) | |
tree | fd8efa3a96100832d69e1a48dec31fa8b246bb23 /include/efi_variable.h | |
parent | 5a8d1f60b2505cf2ee116ac38e54e65b757a1773 (diff) |
efi_loader: prepare for read only OP-TEE variables
We currently have two implementations of UEFI variables:
* variables provided via an OP-TEE module
* variables stored in the U-Boot environment
Read only variables are up to now only implemented in the U-Boot
environment implementation.
Provide a common interface for both implementations that allows handling
read-only variables.
As variable access is limited to very few source files put variable
related definitions into new include efi_variable.h instead of efi_loader.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'include/efi_variable.h')
-rw-r--r-- | include/efi_variable.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/include/efi_variable.h b/include/efi_variable.h new file mode 100644 index 0000000000..6789118eba --- /dev/null +++ b/include/efi_variable.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2020, Heinrich Schuchardt <xypron.glpk@gmx.de> + */ + +#ifndef _EFI_VARIABLE_H +#define _EFI_VARIABLE_H + +#include <linux/bitops.h> + +#define EFI_VARIABLE_READ_ONLY BIT(31) + +/** + * efi_get_variable() - retrieve value of a UEFI variable + * + * @variable_name: name of the variable + * @vendor: vendor GUID + * @attributes: attributes of the variable + * @data_size: size of the buffer to which the variable value is copied + * @data: buffer to which the variable value is copied + * @timep: authentication time (seconds since start of epoch) + * Return: status code + */ +efi_status_t efi_get_variable_int(u16 *variable_name, const efi_guid_t *vendor, + u32 *attributes, efi_uintn_t *data_size, + void *data, u64 *timep); + +/** + * efi_set_variable() - set value of a UEFI variable + * + * @variable_name: name of the variable + * @vendor: vendor GUID + * @attributes: attributes of the variable + * @data_size: size of the buffer with the variable value + * @data: buffer with the variable value + * @ro_check: check the read only read only bit in attributes + * Return: status code + */ +efi_status_t efi_set_variable_int(u16 *variable_name, const efi_guid_t *vendor, + u32 attributes, efi_uintn_t data_size, + const void *data, bool ro_check); + +#endif |