Skip to content

efi_vars: Implement SPI Flash storage for EFI

Michal Simek u-boot 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest4 patches 10 repliesIn review
  2. v73 patches 10 repliesSuperseded
  3. v63 patches 6 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v53 patches3 repliesSuperseded
v43 patches11 repliesSuperseded

Changes in v8 from the cover letter

- new patch
- Add missing EFI_VARIABLE_SF_STORE dependency to EFI_VARIABLE_SF_DEVICE_INDEX

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4efi_var_file: refactor to move buffer functionsinclude/efi_variable.h lib/efi_loader/Makefile lib/efi_loader/efi_var_common.c +2 more+60 -631 reply
2/4efi_var: Unify read/write access helper functioninclude/efi_variable.h lib/efi_loader/efi_var_file.c lib/efi_loader/efi_variable.c+10 -150 replies
3/4efi_loader: Setup default location for UEFI Variables storinglib/efi_loader/Kconfig+2 -11 reply
4/4efi_vars: Implement SPI Flash storelib/efi_loader/Kconfig lib/efi_loader/Makefile lib/efi_loader/efi_var_sf.c+127 -18 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchNeil ArmstrongIlias Apalodimas
1/4T-b R-b
2/4T-b R-b
3/4R-b
4/4T-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v8 thread

Cover letter [PATCH v8 0/4] efi_vars: Implement SPI Flash storage for EFI

This is updated series based on v3 version sent here
https://lore.kernel.org/all/[email protected]/

that's why I am continuing on v4 instead of starting from scratch.

Tested on kv260 with saving variables to location where User MTD partition is.
CONFIG_EFI_VARIABLE_SF_STORE=y
CONFIG_EFI_RT_VOLATILE_STORE=y CONFIG_EFI_VARIABLE_SF_OFFSET=0x22a0000

In Linux:

root@som:~# mount | grep efivars
none on /sys/firmware/efi/efivars type efivarfs (rw,relatime)
root@som:~# printf '\x07\x00\x00\x00Hello' \
  | sudo tee /sys/firmware/efi/efivars/TestVar-12345678-1234-1234-1234-123456789abc
Helloroot@som:~#
root@som:~# dd if=/sys/firmware/efi/efivars/VarToFile-b2ac5fc9-92b7-4acd-aeac-11e818c3130c \
       of=/tmp/vars skip=4 bs=1
1352+0 records in
1352+0 records out
1352 bytes (1.4 kB, 1.3 KiB) copied, 0.380992 s, 3.5 kB/s
root@som:~# flashcp /tmp/vars /dev/mtd16
root@som:~# reboot

Reboot and then in U-Boot:

ZynqMP> pri -e
...
TestVar:

    12345678-1234-1234-1234-123456789abc (12345678-1234-1234-1234-123456789abc)
    NV|BS|RT, DataSize = 0x5
    00000000: 48 65 6c 6c 6f                                   Hello

...

Thanks,
Michal

Changes in v8:
- new patch
- Add missing EFI_VARIABLE_SF_STORE dependency to EFI_VARIABLE_SF_DEVICE_INDEX

Changes in v7:
- sed -i 's/efi_var_from/efi_var_from_storage/g'
- sed -i 's/efi_var_from/efi_var_from_storage/g'

Changes in v6:
- Return EFI_SUCCESS in efi_set_variable_int() when CONFIG_EFI_VARIABLE_NO_STORE is enabled
- sed -i 's/efi_var_read/efi_var_from/g'
- sed -i 's/efi_var_write/efi_var_to_storage/g'
- sed -i 's/efi_var_read/efi_var_from/g'
- sed -i 's/efi_var_write/efi_var_to_storage/g'

Changes in v5:
- Invert logic in efi_variable.c and avoid #if

Changes in v4:
- New patch based on review comments from v3
- Extend Kconfig description
- Extend commit message and describe efivar missing part
- use unify methods for reading/writing variable

Changes in v3:
- Fixed compiler warnings.

Changes in v2:
- Refactored efi_var_file to move common parts out as requested
- Changed ifdefs to use CONFIG_IS_DEFINED
- Fixed typos

Michal Simek (2):
efi_var: Unify read/write access helper function
efi_loader: Setup default location for UEFI Variables storing

Shantur Rathore (2):
efi_var_file: refactor to move buffer functions
efi_vars: Implement SPI Flash store

 include/efi_variable.h          | 18 +++----
 lib/efi_loader/Kconfig          | 38 +++++++++++++-
 lib/efi_loader/Makefile         |  3 +-
 lib/efi_loader/efi_var_common.c | 42 +++++++++++++++
 lib/efi_loader/efi_var_file.c   | 65 ++---------------------
 lib/efi_loader/efi_var_sf.c     | 92 +++++++++++++++++++++++++++++++++
 lib/efi_loader/efi_variable.c   | 19 ++++---
 7 files changed, 198 insertions(+), 79 deletions(-)
 create mode 100644 lib/efi_loader/efi_var_sf.c
Signature · 4 lines
2.43.0

base-commit: 8fe0e8e4dd573290bf845ee3fb12b346509be028
branch: debian-sent3