[PATCH 2/2] uefi: move fwts_uefi_rt_support_status_get to init function
Ivan Hu
ivan.hu at canonical.com
Fri Mar 12 11:30:15 UTC 2021
For further usage, no function changed
Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
src/uefi/uefirtmisc/uefirtmisc.c | 10 ++++++----
src/uefi/uefirttime/uefirttime.c | 11 ++++++-----
src/uefi/uefirtvariable/uefirtvariable.c | 12 ++++++------
3 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
index 835cec34..67c49bd3 100644
--- a/src/uefi/uefirtmisc/uefirtmisc.c
+++ b/src/uefi/uefirtmisc/uefirtmisc.c
@@ -43,11 +43,17 @@
static int fd;
static EFI_GUID gEfiCapsuleHeaderGuid = EFI_CAPSULE_GUID;
+static bool have_rtsupported;
+static uint32_t runtimeservicessupported;
+
static int uefirtmisc_init(fwts_framework *fw)
{
if (fwts_lib_efi_runtime_module_init(fw, &fd) == FWTS_ABORTED)
return FWTS_ABORTED;
+ fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
+ &runtimeservicessupported);
+
return FWTS_OK;
}
@@ -247,14 +253,10 @@ static int uefirtmisc_test4(fwts_framework *fw)
{
long ioret;
uint64_t status;
- bool have_rtsupported;
- uint32_t runtimeservicessupported;
struct efi_getnexthighmonotoniccount getnexthighmonotoniccount;
uint32_t highcount;
- fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
- &runtimeservicessupported);
if (!have_rtsupported) {
fwts_skipped(fw, "Cannot get the RuntimeServicesSupported "
"mask from the kernel. This IOCTL was "
diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c
index 72667e35..61d691d2 100644
--- a/src/uefi/uefirttime/uefirttime.c
+++ b/src/uefi/uefirttime/uefirttime.c
@@ -38,6 +38,9 @@
static int fd;
static const uint32_t dayofmonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+static bool have_rtsupported;
+static uint32_t runtimeservicessupported;
+
static bool dayvalid(EFI_TIME *Time)
{
if (Time->Day < 1)
@@ -172,6 +175,9 @@ static int uefirttime_init(fwts_framework *fw)
if (fwts_lib_efi_runtime_module_init(fw, &fd) == FWTS_ABORTED)
return FWTS_ABORTED;
+ fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
+ &runtimeservicessupported);
+
return FWTS_OK;
}
@@ -1142,8 +1148,6 @@ static int uefirttime_test37(fwts_framework *fw)
static int uefirttime_test38(fwts_framework *fw)
{
long ioret;
- bool have_rtsupported;
- uint32_t runtimeservicessupported;
struct efi_settime settime;
uint64_t status = ~0ULL;
@@ -1155,9 +1159,6 @@ static int uefirttime_test38(fwts_framework *fw)
EFI_TIME efi_time;
EFI_TIME_CAPABILITIES efi_time_cap;
- fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
- &runtimeservicessupported);
-
if (!have_rtsupported) {
fwts_skipped(fw, "Cannot get the RuntimeServicesSupported "
"mask from the kernel. This IOCTL was "
diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index f39c7b2a..5c016108 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -64,6 +64,9 @@ static uint16_t variablenametest[] = {'T', 'e', 's', 't', 'v', 'a', 'r', '\0'};
static uint16_t variablenametest2[] = {'T', 'e', 's', 't', 'v', 'a', 'r', ' ', '\0'};
static uint16_t variablenametest3[] = {'T', 'e', 's', 't', 'v', 'a', '\0'};
+static bool have_rtsupported;
+static uint32_t runtimeservicessupported;
+
static void uefirtvariable_env_cleanup(void)
{
struct efi_setvariable setvariable;
@@ -100,6 +103,9 @@ static int uefirtvariable_init(fwts_framework *fw)
uefirtvariable_env_cleanup();
+ fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
+ &runtimeservicessupported);
+
return FWTS_OK;
}
@@ -2020,9 +2026,6 @@ static int uefirtvariable_test9(fwts_framework *fw)
{
long ioret;
- bool have_rtsupported;
- uint32_t runtimeservicessupported;
-
struct efi_getvariable getvariable;
struct efi_setvariable setvariable;
struct efi_getnextvariablename getnextvariablename;
@@ -2041,9 +2044,6 @@ static int uefirtvariable_test9(fwts_framework *fw)
uint64_t getdatasize = sizeof(testdata);
uint32_t attr;
- fwts_uefi_rt_support_status_get(fd, &have_rtsupported,
- &runtimeservicessupported);
-
if (!have_rtsupported) {
fwts_skipped(fw, "Cannot get the RuntimeServicesSupported "
"mask from the kernel. This IOCTL was "
--
2.25.1
More information about the fwts-devel
mailing list