summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <[email protected]>2025-11-14 10:32:44 +0100
committerHeinrich Schuchardt <[email protected]>2025-11-21 19:30:32 +0100
commit98838b56cdc6f03207cc2efb93f5de8d1b24974e (patch)
tree5b734a7cbe2baf40880863695238db2f2b14fefe /lib
parent178900ab9a80c7103fb7423e4298318374dd55cf (diff)
efi_selftest: simplify efi_st_query_variable_common
Use global st_runtime. Signed-off-by: Heinrich Schuchardt <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_selftest/efi_selftest_variables.c3
-rw-r--r--lib/efi_selftest/efi_selftest_variables_common.c55
-rw-r--r--lib/efi_selftest/efi_selftest_variables_runtime.c4
3 files changed, 27 insertions, 35 deletions
diff --git a/lib/efi_selftest/efi_selftest_variables.c b/lib/efi_selftest/efi_selftest_variables.c
index 3d5f38c6897..b92c3276b61 100644
--- a/lib/efi_selftest/efi_selftest_variables.c
+++ b/lib/efi_selftest/efi_selftest_variables.c
@@ -53,8 +53,7 @@ static int execute(void)
efi_guid_t guid;
int test_ret;
- test_ret = efi_st_query_variable_common(runtime,
- EFI_VARIABLE_BOOTSERVICE_ACCESS);
+ test_ret = efi_st_query_variable_common(EFI_VARIABLE_BOOTSERVICE_ACCESS);
if (test_ret != EFI_ST_SUCCESS) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
diff --git a/lib/efi_selftest/efi_selftest_variables_common.c b/lib/efi_selftest/efi_selftest_variables_common.c
index 453bc8709a6..704da016c6d 100644
--- a/lib/efi_selftest/efi_selftest_variables_common.c
+++ b/lib/efi_selftest/efi_selftest_variables_common.c
@@ -11,15 +11,13 @@
#define EFI_INVALID_ATTR BIT(30)
-int efi_st_query_variable_common(struct efi_runtime_services *runtime,
- u32 attributes)
+int efi_st_query_variable_common(u32 attributes)
{
efi_status_t ret;
u64 max_storage, rem_storage, max_size;
- ret = runtime->query_variable_info(attributes,
- &max_storage, &rem_storage,
- &max_size);
+ ret = st_runtime->query_variable_info(attributes, &max_storage,
+ &rem_storage, &max_size);
if (ret != EFI_SUCCESS) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
@@ -28,58 +26,54 @@ int efi_st_query_variable_common(struct efi_runtime_services *runtime,
return EFI_ST_FAILURE;
}
- ret = runtime->query_variable_info(EFI_VARIABLE_RUNTIME_ACCESS,
- &max_storage, &rem_storage,
- &max_size);
+ ret = st_runtime->query_variable_info(EFI_VARIABLE_RUNTIME_ACCESS,
+ &max_storage, &rem_storage,
+ &max_size);
if (ret != EFI_INVALID_PARAMETER) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
}
- ret = runtime->query_variable_info(attributes,
- NULL, &rem_storage,
- &max_size);
+ ret = st_runtime->query_variable_info(attributes, NULL, &rem_storage,
+ &max_size);
if (ret != EFI_INVALID_PARAMETER) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
}
- ret = runtime->query_variable_info(attributes,
- &max_storage, NULL,
- &max_size);
+ ret = st_runtime->query_variable_info(attributes, &max_storage, NULL,
+ &max_size);
if (ret != EFI_INVALID_PARAMETER) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
}
- ret = runtime->query_variable_info(attributes,
- &max_storage, &rem_storage,
- NULL);
+ ret = st_runtime->query_variable_info(attributes, &max_storage,
+ &rem_storage, NULL);
if (ret != EFI_INVALID_PARAMETER) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
}
- ret = runtime->query_variable_info(0, &max_storage, &rem_storage,
- &max_size);
+ ret = st_runtime->query_variable_info(0, &max_storage, &rem_storage,
+ &max_size);
if (ret != EFI_INVALID_PARAMETER) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
}
- ret = runtime->query_variable_info(attributes |
- EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS |
- EFI_VARIABLE_NON_VOLATILE,
- &max_storage, &rem_storage,
- &max_size);
+ ret = st_runtime->query_variable_info(
+ attributes | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS |
+ EFI_VARIABLE_NON_VOLATILE,
+ &max_storage, &rem_storage, &max_size);
if (ret != EFI_UNSUPPORTED) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
}
- ret = runtime->query_variable_info(EFI_VARIABLE_NON_VOLATILE,
- &max_storage, &rem_storage,
- &max_size);
+ ret = st_runtime->query_variable_info(EFI_VARIABLE_NON_VOLATILE,
+ &max_storage, &rem_storage,
+ &max_size);
if (ret != EFI_INVALID_PARAMETER) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
@@ -89,10 +83,9 @@ int efi_st_query_variable_common(struct efi_runtime_services *runtime,
* Use a mix existing/non-existing attribute bits from the
* UEFI spec
*/
- ret = runtime->query_variable_info(attributes | EFI_INVALID_ATTR |
- EFI_VARIABLE_NON_VOLATILE,
- &max_storage, &rem_storage,
- &max_size);
+ ret = st_runtime->query_variable_info(
+ attributes | EFI_INVALID_ATTR | EFI_VARIABLE_NON_VOLATILE,
+ &max_storage, &rem_storage, &max_size);
if (ret != EFI_INVALID_PARAMETER) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
diff --git a/lib/efi_selftest/efi_selftest_variables_runtime.c b/lib/efi_selftest/efi_selftest_variables_runtime.c
index 379c4f9c47b..4be37efc1fc 100644
--- a/lib/efi_selftest/efi_selftest_variables_runtime.c
+++ b/lib/efi_selftest/efi_selftest_variables_runtime.c
@@ -60,8 +60,8 @@ static int execute(void)
memset(v2, 0x1, sizeof(v2));
if (IS_ENABLED(CONFIG_EFI_VARIABLE_FILE_STORE)) {
- test_ret = efi_st_query_variable_common(runtime, EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS);
+ test_ret = efi_st_query_variable_common(EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS);
if (test_ret != EFI_ST_SUCCESS) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;