From patchwork Fri Mar 27 05:27:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 244398 List-Id: U-Boot discussion From: xypron.glpk at gmx.de (Heinrich Schuchardt) Date: Fri, 27 Mar 2020 06:27:44 +0100 Subject: [PATCH 00/16] efi_loader: non-volatile and runtime variables Message-ID: <20200327052800.11022-1-xypron.glpk@gmx.de> Up to UEFI variable where stored in U-Boot environment variables. Saving UEFI variables was not possible without saving the U-Boot environment variables. With this patch series file ubootefi.var in the EFI system partition is used for saving UEFI variables. Furthermore the UEFI variables are exposed at runtime and are writable at runtime. The missing piece is transferring the variable changed at runtime back to the firmware. I will evaluate the following options: * using a fixed memory address: we could read the memory area after a reboot * using a systemd service which is called before the system goes down Many of the CCs are due to the changes in disk/part_efi.c. Here the logic to detect the EFI system partition is introduced (patch 04/16). Heinrich Schuchardt (16): cmd: efidebug: fix int to pointer cast efi_loader: only reserve memory if fdt node enabled efi_loader: eliminate EFI_CALL() for variable access part: detect EFI system partition efi_loader: identify EFI system partition efi_loader: keep attributes in efi_set_variable_int() efi_loader: export initialization state efi_loader: change setup sequence efi_loader: imply FAT, FAT_WRITE efi_loader: UEFI variable persistence efi_loader: export efi_convert_pointer() efi_loader: optional pointer for ConvertPointer efi_loader: memory buffer for variables efi_loader: use memory based variable storage efi_loader: enable UEFI variables at runtime efi_selftest: adjust runtime test for variables cmd/bootefi.c | 3 +- cmd/efidebug.c | 71 +- cmd/nvedit_efi.c | 18 +- disk/part_dos.c | 10 +- disk/part_efi.c | 12 +- include/efi_api.h | 2 + include/efi_loader.h | 22 + include/efi_variable.h | 52 ++ include/part.h | 11 +- lib/efi_loader/Kconfig | 10 + lib/efi_loader/Makefile | 2 + lib/efi_loader/efi_bootmgr.c | 20 +- lib/efi_loader/efi_disk.c | 20 + lib/efi_loader/efi_runtime.c | 20 +- lib/efi_loader/efi_setup.c | 54 +- lib/efi_loader/efi_variable.c | 635 ++++++------------ lib/efi_loader/efi_variables_file.c | 235 +++++++ lib/efi_loader/efi_variables_mem.c | 324 +++++++++ .../efi_selftest_variables_runtime.c | 47 +- 19 files changed, 1037 insertions(+), 531 deletions(-) create mode 100644 include/efi_variable.h create mode 100644 lib/efi_loader/efi_variables_file.c create mode 100644 lib/efi_loader/efi_variables_mem.c --- 2.25.1