diff mbox series

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

Message ID 1560248337-10100-3-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show
Series [1/3] uefitime: add checking the EFI_UNSUPPORTED return code | expand

Commit Message

Ivan Hu June 11, 2019, 10:18 a.m. UTC
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@canonical.com>
---
 src/uefi/uefirtmisc/uefirtmisc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Colin Ian King June 11, 2019, 10:29 a.m. UTC | #1
On 11/06/2019 11:18, Ivan Hu wrote:
> 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@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.");
> 

Acked-bu: Colin Ian King <colin.king@canonical.com>
Alex Hung June 11, 2019, 4:38 p.m. UTC | #2
On 2019-06-11 3:18 a.m., Ivan Hu wrote:
> 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@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.");
> 



Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox series

Patch

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.");