[U-Boot] [RFC 0/6] efi_loader: support runtime variable access via cache

AKASHI Takahiro takahiro.akashi at linaro.org
Wed Jun 5 04:21:36 UTC 2019

EBBR v1.0 section 2.5.3 says
  Even when SetVariable() is not supported during runtime services,
  firmware should cache variable names and values in EfiRuntimeServicesData
  memory so that GetVariable() and GetNextVeriableName() can behave as

This is an experimental patch set and the aim is to enable this feature.

Cache buffer is in the same format as U-Boot environment hash table,
but we cannot use functions in hashtable.c partly because most of U-Boot
code are not available at UEFI runtime and partly because entries in
a table are allocated by malloc(), which are again not available
at UEFI runtime. It is quite painful to modify exiting U-Boot code
so as to make it executable at UEFI runtime.

So I implemented a limited version of hsearch_r(). This may be
a discussion. Given that there are not so many UEFI variables,
we may want to use a simpler table format for caching.

Known issues:
* Currently I test this feature with a test which is temporarily embedded
  in ExitBootServices.
* After SetVirtualAddressMap, it won't work (TODO).
  ConvertPointer was implemented here just for this future work.
* So how can we test the feature?
  We can't use "printenv" command as its relocation won't take place.
* I see some Travis CI errors.
  This is probably due to no storage configured for UEFI variables.

Patch#1 to #4 are preparatory patches.
Patch#5 is mainly for testing.
Patch#6 is core part of this patch set.

AKASHI Takahiro (5):
  efi_loader: runtime: make SetVirtualAddressMap configurable
  efi: add RuntimeServicesSupported variable
  efi_loader: support convert_pointer at runtime
  cmd: efidebug: add "boot exit" sub-command
  efi_loader: variable: support runtime variable access via cache

Alexander Graf (1):
  efi_loader: Patch non-runtime code out at ExitBootServices already

 cmd/efidebug.c                     |  63 ++++
 include/efi_api.h                  |  15 +
 include/efi_loader.h               |  22 ++
 lib/efi_loader/Kconfig             |  24 ++
 lib/efi_loader/efi_boottime.c      |  11 +-
 lib/efi_loader/efi_runtime.c       | 155 ++++++++--
 lib/efi_loader/efi_setup.c         |   5 +
 lib/efi_loader/efi_variable.c      | 467 +++++++++++++++++++++++++++++
 test/py/tests/test_efi_selftest.py |   4 +-
 9 files changed, 735 insertions(+), 31 deletions(-)


More information about the U-Boot mailing list