From 38ea3bfc6506174c3ae219b33171db2c2098afd1 Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Wed, 11 Feb 2026 16:56:20 +0100 Subject: efi_var_file: refactor to move buffer functions Currently efi_var_file.c has functions to store/read EFI variables to/from memory buffer. These functions can be used with other EFI variable stores so move them out to efi_var_common.c Signed-off-by: Shantur Rathore Signed-off-by: Michal Simek Tested-by: Neil Armstrong # on AML-S905D3-CC Reviewed-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt --- include/efi_variable.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/efi_variable.h') diff --git a/include/efi_variable.h b/include/efi_variable.h index 4065cf45eca..ee68fa4a885 100644 --- a/include/efi_variable.h +++ b/include/efi_variable.h @@ -161,6 +161,11 @@ efi_status_t efi_var_to_file(void); efi_status_t __maybe_unused efi_var_collect(struct efi_var_file **bufp, loff_t *lenp, u32 check_attr_mask); +/* GUID used by Shim to store the MOK database */ +#define SHIM_LOCK_GUID \ + EFI_GUID(0x605dab50, 0xe046, 0x4300, \ + 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23) + /** * efi_var_restore() - restore EFI variables from buffer * -- cgit v1.2.3 From 4fcc248c943b10889789f23b372ce37e06614a84 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 11 Feb 2026 16:56:21 +0100 Subject: efi_var: Unify read/write access helper function efi_var_to/from_file() suggest method where variables are placed. But there is no reason for it and generic name can be used to wire also different locations for variables. Signed-off-by: Michal Simek Reviewed-by: Ilias Apalodimas Tested-by: Neil Armstrong # on AML-S905D3-CC Reviewed-by: Heinrich Schuchardt --- include/efi_variable.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'include/efi_variable.h') diff --git a/include/efi_variable.h b/include/efi_variable.h index ee68fa4a885..fc1184e5ca1 100644 --- a/include/efi_variable.h +++ b/include/efi_variable.h @@ -137,13 +137,11 @@ struct efi_var_file { }; /** - * efi_var_to_file() - save non-volatile variables as file - * - * File ubootefi.var is created on the EFI system partion. + * efi_var_to_storage() - save non-volatile variables * * Return: status code */ -efi_status_t efi_var_to_file(void); +efi_status_t efi_var_to_storage(void); /** * efi_var_collect() - collect variables in buffer @@ -178,17 +176,14 @@ efi_status_t __maybe_unused efi_var_collect(struct efi_var_file **bufp, loff_t * efi_status_t efi_var_restore(struct efi_var_file *buf, bool safe); /** - * efi_var_from_file() - read variables from file - * - * File ubootefi.var is read from the EFI system partitions and the variables - * stored in the file are created. + * efi_var_from_storage() - read variables * * In case the file does not exist yet or a variable cannot be set EFI_SUCCESS * is returned. * * Return: status code */ -efi_status_t efi_var_from_file(void); +efi_status_t efi_var_from_storage(void); /** * efi_var_mem_init() - set-up variable list -- cgit v1.2.3