diff mbox series

[3/3] uefi: significance of RuntimeServicesSupported == 0

Message ID 20201227205225.1091-4-xypron.glpk@gmx.de
State Superseded
Headers show
Series uefi: fix fwts_uefi_rt_support_status_get() | expand

Commit Message

Heinrich Schuchardt Dec. 27, 2020, 8:52 p.m. UTC
RuntimeServicesSupported == 0 means that no runtime service is implemented.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 src/uefi/uefirtmisc/uefirtmisc.c         |  9 ++----
 src/uefi/uefirttime/uefirttime.c         | 36 ++++++++----------------
 src/uefi/uefirtvariable/uefirtvariable.c | 36 ++++++++----------------
 3 files changed, 27 insertions(+), 54 deletions(-)

--
2.29.2
diff mbox series

Patch

diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
index 4b04f78a..0b274905 100644
--- a/src/uefi/uefirtmisc/uefirtmisc.c
+++ b/src/uefi/uefirtmisc/uefirtmisc.c
@@ -258,8 +258,7 @@  static int uefirtmisc_test4(fwts_framework *fw)
 	ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT, &getnexthighmonotoniccount);
 	if (ioret == -1) {
 		if (status == EFI_UNSUPPORTED) {
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT) {
 				fwts_failed(fw, LOG_LEVEL_HIGH,
 					"UEFIRuntimeGetNextHighMonotonicCount",
 					"Get the GetNextHighMonotonicCount runtime "
@@ -275,8 +274,7 @@  static int uefirtmisc_test4(fwts_framework *fw)
 				fwts_skipped(fw, "Unknown error occurred, skip test.");
 				return FWTS_SKIP;
 			}
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT) {
 				fwts_passed(fw, "UEFI GetNextHighMonotonicCount runtime "
 					"service supported status test passed.");
 			} else {
@@ -292,8 +290,7 @@  static int uefirtmisc_test4(fwts_framework *fw)
 			fwts_skipped(fw, "Unknown error occurred, skip test.");
 			return FWTS_SKIP;
 		}
-		if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT)
-			|| (var_runtimeservicessupported == 0)) {
+		if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT) {
 			fwts_passed(fw, "UEFI GetNextHighMonotonicCount runtime "
 				"service supported status test passed.");
 		} else {
diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c
index 67365759..856f768a 100644
--- a/src/uefi/uefirttime/uefirttime.c
+++ b/src/uefi/uefirttime/uefirttime.c
@@ -1162,8 +1162,7 @@  static int uefirttime_test38(fwts_framework *fw)
 	ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime);
 	if (ioret == -1) {
 		if (status == EFI_UNSUPPORTED) {
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_TIME)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_TIME) {
 				fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime",
 					"Get the GetTime runtime service supported "
 					"via RuntimeServicesSupported variable. "
@@ -1177,8 +1176,7 @@  static int uefirttime_test38(fwts_framework *fw)
 				fwts_skipped(fw, "Unknown error occurred, skip test.");
 				return FWTS_SKIP;
 			}
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_TIME)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_TIME) {
 				fwts_passed(fw, "UEFI GetTime runtime service "
 					"supported status test passed.");
 			} else {
@@ -1193,8 +1191,7 @@  static int uefirttime_test38(fwts_framework *fw)
 			fwts_skipped(fw, "Unknown error occurred, skip test.");
 			return FWTS_SKIP;
 		}
-		if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_TIME)
-			|| (var_runtimeservicessupported == 0)) {
+		if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_TIME) {
 			fwts_passed(fw, "UEFI GetTime runtime service "
 				"supported status test passed.");
 		} else {
@@ -1212,8 +1209,7 @@  static int uefirttime_test38(fwts_framework *fw)
 	ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime);
 	if (ioret == -1) {
 		if (status == EFI_UNSUPPORTED) {
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_TIME)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_TIME) {
 				fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime",
 					"Get the SetTime runtime service supported "
 					"via RuntimeServicesSupported variable. "
@@ -1227,8 +1223,7 @@  static int uefirttime_test38(fwts_framework *fw)
 				fwts_skipped(fw, "Unknown error occurred, skip test.");
 				return FWTS_SKIP;
 			}
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_TIME)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_TIME) {
 				fwts_passed(fw, "UEFI SetTime runtime service "
 					"supported status test passed.");
 			} else {
@@ -1243,8 +1238,7 @@  static int uefirttime_test38(fwts_framework *fw)
 			fwts_skipped(fw, "Unknown error occurred, skip test.");
 			return FWTS_SKIP;
 		}
-		if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_TIME)
-			|| (var_runtimeservicessupported == 0)) {
+		if (var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_TIME) {
 			fwts_passed(fw, "UEFI SetTime runtime service "
 				"supported status test passed.");
 		} else {
@@ -1263,8 +1257,7 @@  static int uefirttime_test38(fwts_framework *fw)
 	ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime);
 	if (ioret == -1) {
 		if (status == EFI_UNSUPPORTED) {
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_WAKEUP_TIME)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_WAKEUP_TIME) {
 				fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetWakeupTime",
 					"Get the SetWakeupTime runtime service supported "
 					"via RuntimeServicesSupported variable. "
@@ -1279,8 +1272,7 @@  static int uefirttime_test38(fwts_framework *fw)
 				fwts_skipped(fw, "Unknown error occurred, skip test.");
 				return FWTS_SKIP;
 			}
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_WAKEUP_TIME)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_WAKEUP_TIME) {
 				fwts_passed(fw, "UEFI SetWakeupTime runtime service "
 					"supported status test passed.");
 			} else {
@@ -1295,8 +1287,7 @@  static int uefirttime_test38(fwts_framework *fw)
 			fwts_skipped(fw, "Unknown error occurred, skip test.");
 			return FWTS_SKIP;
 		}
-		if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_WAKEUP_TIME)
-			|| (var_runtimeservicessupported == 0)) {
+		if (var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_WAKEUP_TIME) {
 			fwts_passed(fw, "UEFI SetWakeupTime runtime service "
 				"supported status test passed.");
 		} else {
@@ -1315,8 +1306,7 @@  static int uefirttime_test38(fwts_framework *fw)
 	ioret = ioctl(fd, EFI_RUNTIME_GET_WAKETIME, &getwakeuptime);
 	if (ioret == -1) {
 		if (status == EFI_UNSUPPORTED) {
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_WAKEUP_TIME)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_WAKEUP_TIME) {
 				fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime",
 					"Get the GetWakeupTime runtime service supported "
 					"via RuntimeServicesSupported variable. "
@@ -1330,8 +1320,7 @@  static int uefirttime_test38(fwts_framework *fw)
 				fwts_skipped(fw, "Unknown error occurred, skip test.");
 				return FWTS_SKIP;
 			}
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_WAKEUP_TIME)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_WAKEUP_TIME) {
 				fwts_passed(fw, "UEFI GetWakeupTime runtime service "
 					"supported status test passed.");
 			} else {
@@ -1346,8 +1335,7 @@  static int uefirttime_test38(fwts_framework *fw)
 			fwts_skipped(fw, "Unknow error occurred, skip test.");
 			return FWTS_SKIP;
 		}
-		if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_WAKEUP_TIME)
-			|| (var_runtimeservicessupported == 0)) {
+		if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_WAKEUP_TIME) {
 			fwts_passed(fw, "UEFI GetWakeupTime runtime service "
 				"supported status test passed.");
 		} else {
diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index 385c5405..3eb0ecc7 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -2052,8 +2052,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 	ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
 	if (ioret == -1) {
 		if (status == EFI_UNSUPPORTED) {
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_VARIABLE)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_VARIABLE) {
 				fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetVariable",
 					"Get the Setvariable runtime service supported "
 					"via RuntimeServicesSupported variable. "
@@ -2067,8 +2066,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 				fwts_skipped(fw, "Unknown error occurred, skip test.");
 				return FWTS_SKIP;
 			}
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_VARIABLE) ||
-				(var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_VARIABLE) {
 				fwts_passed(fw, "UEFI SetVariable runtime service "
 					"supported status test passed.");
 			} else {
@@ -2083,8 +2081,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 			fwts_skipped(fw, "Unknown error occurred, skip test.");
 			return FWTS_SKIP;
 		}
-		if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_VARIABLE) ||
-			(var_runtimeservicessupported == 0)) {
+		if (var_runtimeservicessupported & EFI_RT_SUPPORTED_SET_VARIABLE) {
 			fwts_passed(fw, "UEFI SetVariable runtime service "
 				"supported status test passed.");
 		} else {
@@ -2105,8 +2102,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 	ioret = ioctl(fd, EFI_RUNTIME_GET_VARIABLE, &getvariable);
 	if (ioret == -1) {
 		if (status == EFI_UNSUPPORTED) {
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_VARIABLE)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_VARIABLE) {
 				fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetVariable",
 					"Get the GetVariable runtime service supported "
 					"via RuntimeServicesSupported variable. "
@@ -2120,8 +2116,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 				fwts_skipped(fw, "Unknown error occurred, skip test.");
 				return FWTS_SKIP;
 			}
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_VARIABLE) ||
-				(var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_VARIABLE) {
 				fwts_passed(fw, "UEFI GetVariable runtime service "
 					"supported status test passed.");
 			} else {
@@ -2136,8 +2131,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 			fwts_skipped(fw, "Unknown error occurred, skip test.");
 			return FWTS_SKIP;
 		}
-		if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_VARIABLE) ||
-			(var_runtimeservicessupported == 0)) {
+		if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_VARIABLE) {
 			fwts_passed(fw, "UEFI GetVariable runtime service "
 				"supported status test passed.");
 		} else {
@@ -2168,8 +2162,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 	ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTVARIABLENAME, &getnextvariablename);
 	if (ioret == -1) {
 		if (status == EFI_UNSUPPORTED) {
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME) {
 				fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetNextVarName",
 					"Get the GetNextVarName runtime service supported "
 					"via RuntimeServicesSupported variable. "
@@ -2183,8 +2176,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 				fwts_skipped(fw, "Unknown error occurred, skip test.");
 				return FWTS_SKIP;
 			}
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME) {
 				fwts_passed(fw, "UEFI GetNextVarName runtime service "
 					"supported status test passed.");
 			} else {
@@ -2199,8 +2191,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 			fwts_skipped(fw, "Unknown error occurred, skip test.");
 			return FWTS_SKIP;
 		}
-		if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME)
-			|| (var_runtimeservicessupported == 0)) {
+		if (var_runtimeservicessupported & EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME) {
 			fwts_passed(fw, "UEFI GetNextVarName runtime service "
 				"supported status test passed.");
 		} else {
@@ -2221,8 +2212,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 	ioret = ioctl(fd, EFI_RUNTIME_QUERY_VARIABLEINFO, &queryvariableinfo);
 	if (ioret == -1) {
 		if (status == EFI_UNSUPPORTED) {
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO) {
 				fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeQueryVarInfo",
 					"Get the QueryVarInfo runtime service supported "
 					"via RuntimeServicesSupported variable. "
@@ -2236,8 +2226,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 				fwts_skipped(fw, "Unknown error occurred, skip test.");
 				return FWTS_SKIP;
 			}
-			if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)
-				|| (var_runtimeservicessupported == 0)) {
+			if (var_runtimeservicessupported & EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO) {
 				fwts_passed(fw, "UEFI QueryVarInfo runtime service "
 					"supported status test passed.");
 			} else {
@@ -2252,8 +2241,7 @@  static int uefirtvariable_test9(fwts_framework *fw)
 			fwts_skipped(fw, "Unknown error occurred, skip test.");
 			return FWTS_SKIP;
 		}
-		if ((var_runtimeservicessupported & EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)
-			|| (var_runtimeservicessupported == 0)) {
+		if (var_runtimeservicessupported & EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO) {
 			fwts_passed(fw, "UEFI QueryVarInfo runtime service "
 				"supported status test passed.");
 		} else {