From patchwork Tue Jun 11 10:18:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1113620 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45NQvw5L2vz9s5c; Tue, 11 Jun 2019 20:19:08 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hadrs-0000Y8-GY; Tue, 11 Jun 2019 10:19:04 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hadrr-0000Y0-4T for fwts-devel@lists.ubuntu.com; Tue, 11 Jun 2019 10:19:03 +0000 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hadrq-000529-9U; Tue, 11 Jun 2019 10:19:02 +0000 From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/3] uefitime: add checking the EFI_UNSUPPORTED return code Date: Tue, 11 Jun 2019 18:18:55 +0800 Message-Id: <1560248337-10100-1-git-send-email-ivan.hu@canonical.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" 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 Acked-by: Colin Ian King Acked-by: Alex Hung --- src/uefi/uefirttime/uefirttime.c | 90 +++++++++++++++++++++++++++++++++------- 1 file changed, 76 insertions(+), 14 deletions(-) diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c index 7626f06..c0ff61d 100644 --- a/src/uefi/uefirttime/uefirttime.c +++ b/src/uefi/uefirttime/uefirttime.c @@ -215,6 +215,11 @@ static int uefirttime_test1(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime", "Failed to get time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -244,6 +249,11 @@ static int uefirttime_test_gettime_invalid( ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } if (status == EFI_INVALID_PARAMETER) { fwts_passed(fw, "UEFI runtime service GetTime interface test " "passed, returned EFI_INVALID_PARAMETER as expected."); @@ -291,6 +301,11 @@ static int uefirttime_test4(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime", "Failed to get time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -330,6 +345,11 @@ static int uefirttime_test4(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime", "Failed to set time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -344,6 +364,11 @@ static int uefirttime_test4(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime", "Failed to get time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -385,6 +410,11 @@ static int uefirttime_test4(fwts_framework *fw) status = ~0ULL; ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime", "Failed to set time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -407,6 +437,11 @@ static int uefirttime_test_settime_invalid( ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, settime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } if (status == EFI_INVALID_PARAMETER) { fwts_passed(fw, "UEFI runtime service SetTime interface test " "passed, returned EFI_INVALID_PARAMETER as expected."); @@ -439,6 +474,11 @@ static int uefirttime_test_settime_invalid_time( ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime", "Failed to get wakeup time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -474,6 +514,11 @@ static int uefirttime_test_settime_invalid_time( settime.status = &status; ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime", "Failed to set wakeup time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -627,7 +672,7 @@ static int uefirttime_test18(fwts_framework *fw) if (status == EFI_UNSUPPORTED) { fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime", "Failed to get wakeup time with UEFI runtime service."); @@ -653,17 +698,19 @@ static int uefirttime_test_getwaketime_invalid( ioret = ioctl(fd, EFI_RUNTIME_GET_WAKETIME, getwakeuptime); if (ioret == -1) { - if (status == EFI_INVALID_PARAMETER || - status == EFI_UNSUPPORTED) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTimeWakeupTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } + if (status == EFI_INVALID_PARAMETER) { fwts_passed(fw, "UEFI runtime service GetTimeWakeupTime interface test " - "passed, returned EFI_INVALID_PARAMETER or " - "EFI_UNSUPPORTED as expected."); + "passed, returned EFI_INVALID_PARAMETER as expected."); return FWTS_OK; } else { fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime", "Failed to get correct return status from UEFI " - "runtime service, expecting EFI_INVALID_PARAMETER " - "or EFI_UNSUPPORTED."); + "runtime service, expecting EFI_INVALID_PARAMETER."); fwts_uefi_print_status_info(fw, status); return FWTS_ERROR; } @@ -743,6 +790,11 @@ static int uefirttime_test23(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime", "Failed to get time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -760,9 +812,9 @@ static int uefirttime_test23(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime); if (ioret == -1) { if (status == EFI_UNSUPPORTED) { - fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " + fwts_skipped(fw, "Skipping test, SetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetWakeupTime", "Failed to set wakeup time with UEFI runtime service."); @@ -783,7 +835,7 @@ static int uefirttime_test23(fwts_framework *fw) if (status == EFI_UNSUPPORTED) { fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime", "Failed to get wakeup time with UEFI runtime service."); @@ -815,6 +867,11 @@ static int uefirttime_test23(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetWakeupTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetWakeupTime", "Failed to set wakeup time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -829,7 +886,7 @@ static int uefirttime_test23(fwts_framework *fw) if (status == EFI_UNSUPPORTED) { fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime", "Failed to get wakeup time with UEFI runtime service."); @@ -861,9 +918,9 @@ static int uefirttime_test_setwakeuptime_invalid( ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, setwakeuptime); if (ioret == -1) { if (status == EFI_UNSUPPORTED) { - fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " + fwts_skipped(fw, "Skipping test, SetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } if (status == EFI_INVALID_PARAMETER) { fwts_passed(fw, "UEFI runtime service SetTimeWakeupTime interface test " @@ -912,7 +969,7 @@ static int uefirttime_test_setwakeuptime_invalid_time( if (status == EFI_UNSUPPORTED) { fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime", "Failed to get wakeup time with UEFI runtime service."); @@ -951,6 +1008,11 @@ static int uefirttime_test_setwakeuptime_invalid_time( setwakeuptime.Enabled = true; ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetWakeupTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetWakeupTime", "Failed to set wakeup time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); From patchwork Tue Jun 11 10:18:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1113621 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45NQw02fRvz9sDB; Tue, 11 Jun 2019 20:19:12 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hadrx-0000ZM-L2; Tue, 11 Jun 2019 10:19:09 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hadrv-0000Ym-5K for fwts-devel@lists.ubuntu.com; Tue, 11 Jun 2019 10:19:07 +0000 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hadru-00053B-9i; Tue, 11 Jun 2019 10:19:06 +0000 From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/3] uefirtvariable: add checking the EFI_UNSUPPORTED return code Date: Tue, 11 Jun 2019 18:18:56 +0800 Message-Id: <1560248337-10100-2-git-send-email-ivan.hu@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560248337-10100-1-git-send-email-ivan.hu@canonical.com> References: <1560248337-10100-1-git-send-email-ivan.hu@canonical.com> X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" 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 --- src/uefi/uefirtvariable/uefirtvariable.c | 86 ++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 3 deletions(-) diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c index 6aa44d3..9dffcab 100644 --- a/src/uefi/uefirtvariable/uefirtvariable.c +++ b/src/uefi/uefirtvariable/uefirtvariable.c @@ -156,6 +156,11 @@ static int getvariable_test( ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } if (status == EFI_OUT_OF_RESOURCES) { fwts_uefi_print_status_info(fw, status); fwts_skipped(fw, @@ -231,6 +236,11 @@ static int getvariable_test( ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetVariable", "Failed to delete variable with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -247,6 +257,11 @@ err_restore_env: ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetVariable", "Failed to delete variable with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -323,6 +338,11 @@ static int getnextvariable_test1(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } if (status == EFI_OUT_OF_RESOURCES) { fwts_uefi_print_status_info(fw, status); fwts_skipped(fw, @@ -362,7 +382,11 @@ static int getnextvariable_test1(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTVARIABLENAME, &getnextvariablename); if (ioret == -1) { - + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetNextVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } /* no next variable was found*/ if (*getnextvariablename.status == EFI_NOT_FOUND) break; @@ -429,6 +453,11 @@ static int getnextvariable_test1(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetVariable", "Failed to delete variable with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -445,6 +474,11 @@ err_restore_env: ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetVariable", "Failed to delete variable with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -512,7 +546,11 @@ static int getnextvariable_test2(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTVARIABLENAME, &getnextvariablename); if (ioret == -1) { - + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } /* no next variable was found*/ if (*getnextvariablename.status == EFI_NOT_FOUND) break; @@ -673,7 +711,11 @@ static int getnextvariable_test3(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTVARIABLENAME, &getnextvariablename); if (ioret == -1) { - + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } /* no next variable was found*/ if (*getnextvariablename.status == EFI_NOT_FOUND) break; @@ -789,6 +831,12 @@ static int getnextvariable_test4(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_NEXTVARIABLENAME, &getnextvariablename); + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetNextVaiable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } + if (ioret != -1 || status != EFI_INVALID_PARAMETER) { fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetNextVariableName", @@ -898,6 +946,12 @@ static int setvariable_insertvariable( setvariable.status = &status; ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable); + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } + if (ioret == -1) { if ((status == EFI_INVALID_PARAMETER) && ((attributes & FWTS_UEFI_VARIABLE_ENHANCED_AUTHENTICATED_ACCESS) || @@ -966,6 +1020,11 @@ static int setvariable_checkvariable( ioret = ioctl(fd, EFI_RUNTIME_GET_VARIABLE, &getvariable); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetVariable", "Failed to get variable with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -1021,6 +1080,11 @@ static int setvariable_checkvariable_notfound( ioret = ioctl(fd, EFI_RUNTIME_GET_VARIABLE, &getvariable); + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } /* expect the uefi runtime interface return EFI_NOT_FOUND */ if (ioret == -1) { if (*getvariable.status == EFI_NOT_FOUND) @@ -1059,6 +1123,12 @@ static int setvariable_invalidattr( ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable); + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } + if ((status == EFI_SUCCESS) && (ioret != -1)) { if ((attributes & FWTS_UEFI_VARIABLE_ENHANCED_AUTHENTICATED_ACCESS) && (attributes & FWTS_UEFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) && @@ -1838,6 +1908,11 @@ static void getvariable_test_invalid( *(getvariable->status) = ~0ULL; ioret = ioctl(fd, EFI_RUNTIME_GET_VARIABLE, getvariable); + if (*(getvariable->status) == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetVariable runtime " + "service is not supported on this platform."); + return; + } if (ioret == -1) { if (*(getvariable->status) == EFI_INVALID_PARAMETER) { fwts_passed(fw, "GetVariable with %s returned error " @@ -1882,6 +1957,11 @@ static int uefirtvariable_test8(fwts_framework *fw) setvariable.status = &status; ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable); + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetVariable runtime " + "service is not supported on this platform."); + return FWTS_OK; + } if (ioret == -1) { if (status == EFI_OUT_OF_RESOURCES) { fwts_uefi_print_status_info(fw, status); From patchwork Tue Jun 11 10:18:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1113622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45NQw32JgRz9sDB; Tue, 11 Jun 2019 20:19:15 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hads0-0000aa-OG; Tue, 11 Jun 2019 10:19:12 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hadrz-0000aF-5O for fwts-devel@lists.ubuntu.com; Tue, 11 Jun 2019 10:19:11 +0000 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hadry-00053Q-Ac; Tue, 11 Jun 2019 10:19:10 +0000 From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 3/3] uefirtmisc: add checking the EFI_UNSUPPORTED return code Date: Tue, 11 Jun 2019 18:18:57 +0800 Message-Id: <1560248337-10100-3-git-send-email-ivan.hu@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560248337-10100-1-git-send-email-ivan.hu@canonical.com> References: <1560248337-10100-1-git-send-email-ivan.hu@canonical.com> X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" 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 Acked-by: Alex Hung --- 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.");