
On 6/5/19 6:21 AM, AKASHI Takahiro wrote:
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 specified.
This is an experimental patch set and the aim is to enable this feature.
Hello Takahiro,
thanks a lot for all the effort you put in this.
Reusing parts of env is a valid possibility but I am not sure if this is the right approach for something that has to work at runtime.
I will need some time to layout my ideas of the design. Unfortunately I am on a sea kayaking trip this weekend. So I may need until June 16th for a thorough suggestion.
I have already picked the trivial patches from this patch series and will put them into the next pull request.
http://git.denx.de/?p=u-boot-efi.git;a=shortlog;h=refs/tags/efi-2019-07-rc4-...
Best regards
Heinich
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(-)