diff options
author | Tom Rini <trini@konsulko.com> | 2024-04-08 14:33:59 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-04-08 14:33:59 -0600 |
commit | 069d07396e30aa9be396c1dd3fc158ac199e6843 (patch) | |
tree | f4f2b1af27384f789e5531f9a98cf61ad7f2cdf3 /lib/efi_selftest/efi_selftest_variables.c | |
parent | 9cba29b19f43f9450117e8bc89e7dda691ed5ab5 (diff) | |
parent | 3f8d13044b32ddd906bb9f2fc705b988ec93df35 (diff) |
Merge tag 'efi-2024-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2024-07-rc1
Documentation:
* improve description of FAT partition name generation
* add missing :: in doc/usage/cmd/itest.rst
UEFI:
* fix address mode for __efi_runtime_start/stop,
__efi_runtime_rel_start/stop
* fix size of variable attribute constants
* enable booting via EFI boot manager by default
* correct the sequence of the EFI boot methods
* correct finding the default EFI binary
* don't delete variable from memory if update failed
* fix append write behavior to non-existent variable
* Use binman for testing capsule updates on the sandbox
* Consider capsule test files in .gitignore and make clean
Diffstat (limited to 'lib/efi_selftest/efi_selftest_variables.c')
-rw-r--r-- | lib/efi_selftest/efi_selftest_variables.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/lib/efi_selftest/efi_selftest_variables.c b/lib/efi_selftest/efi_selftest_variables.c index c7a3fdbaa67..39ad03a090d 100644 --- a/lib/efi_selftest/efi_selftest_variables.c +++ b/lib/efi_selftest/efi_selftest_variables.c @@ -131,13 +131,57 @@ static int execute(void) (unsigned int)len); if (memcmp(data, v, len)) efi_st_todo("GetVariable returned wrong value\n"); - /* Append variable 2 */ + + /* Append variable 2, write to non-existent variable with datasize=0 */ + ret = runtime->set_variable(u"efi_none", &guid_vendor1, + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_APPEND_WRITE, + 0, v); + if (ret != EFI_SUCCESS) { + efi_st_error( + "SetVariable(APPEND_WRITE) with size 0 to non-existent variable returns wrong code\n"); + return EFI_ST_FAILURE; + } + len = EFI_ST_MAX_DATA_SIZE; + ret = runtime->get_variable(u"efi_none", &guid_vendor1, + &attr, &len, data); + if (ret != EFI_NOT_FOUND) { + efi_st_error("Variable must not be created\n"); + return EFI_ST_FAILURE; + } + /* Append variable 2, write to non-existent variable with valid data size*/ ret = runtime->set_variable(u"efi_none", &guid_vendor1, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_APPEND_WRITE, 15, v); + if (ret != EFI_SUCCESS) { + efi_st_error("SetVariable(APPEND_WRITE) with valid size and data to non-existent variable must be succcessful\n"); + return EFI_ST_FAILURE; + } + len = EFI_ST_MAX_DATA_SIZE; + ret = runtime->get_variable(u"efi_none", &guid_vendor1, + &attr, &len, data); + if (ret != EFI_SUCCESS) { + efi_st_error("GetVariable failed\n"); + return EFI_ST_FAILURE; + } + if (len != 15) + efi_st_todo("GetVariable returned wrong length %u\n", + (unsigned int)len); + if (memcmp(data, v, len)) + efi_st_todo("GetVariable returned wrong value\n"); + /* Delete variable efi_none */ + ret = runtime->set_variable(u"efi_none", &guid_vendor1, + 0, 0, NULL); + if (ret != EFI_SUCCESS) { + efi_st_error("SetVariable failed\n"); + return EFI_ST_FAILURE; + } + len = EFI_ST_MAX_DATA_SIZE; + ret = runtime->get_variable(u"efi_none", &guid_vendor1, + &attr, &len, data); if (ret != EFI_NOT_FOUND) { - efi_st_error("SetVariable(APPEND_WRITE) with size 0 to non-existent variable returns wrong code\n"); + efi_st_error("Variable was not deleted\n"); return EFI_ST_FAILURE; } /* Enumerate variables */ |