[PATCH 3/3] uefirtmisc: add checking the EFI_UNSUPPORTED return code

Ivan Hu ivan.hu at canonical.com
Tue Jun 11 10:18:57 UTC 2019


The UEFI spec 2.8(Matis 1961) adds EFI_UNSUPPORTED as a return code to most
UEFI runtime services for those embeded devices such as specified by the
ARM EBBR specification which are impractical or impossible to implement
in such a way that they can be used at runtime.

Add checking the EFI_UNSUPPORTED return code and skip the test for those
unsupported runtime services.

Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
 src/uefi/uefirtmisc/uefirtmisc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
index a09c745..b3fdf5f 100644
--- a/src/uefi/uefirtmisc/uefirtmisc.c
+++ b/src/uefi/uefirtmisc/uefirtmisc.c
@@ -89,6 +89,11 @@ static int getnexthighmonotoniccount_test(fwts_framework *fw, uint32_t multitest
 		long ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT, &getnexthighmonotoniccount);
 
 		if (ioret == -1) {
+			if (status == EFI_UNSUPPORTED) {
+				fwts_skipped(fw, "Skipping test, GetNextHighMonotonicCount runtime "
+					"service is not supported on this platform.");
+				return FWTS_SKIP;
+			}
 			fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetNextHighMonotonicCount",
 				"Failed to get high monotonic count with UEFI runtime service.");
 			fwts_uefi_print_status_info(fw, status);
@@ -229,6 +234,11 @@ static int uefirtmisc_test3(fwts_framework *fw)
 
 	ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT, &getnexthighmonotoniccount);
 	if (ioret == -1) {
+		if (status == EFI_UNSUPPORTED) {
+			fwts_skipped(fw, "Skipping test, GetNextHighMonotonicCount runtime "
+				"service is not supported on this platform.");
+			return FWTS_SKIP;
+		}
 		if (status == EFI_INVALID_PARAMETER) {
 			fwts_passed(fw, "Test with invalid NULL parameter returned "
 				"EFI_INVALID_PARAMETER as expected.");
-- 
2.7.4




More information about the fwts-devel mailing list