Patchwork [1/2] uefirttime: add the fwts test for the UEFI get wakeup time runtime service

login
register
mail settings
Submitter Ivan Hu
Date Nov. 8, 2012, 6:11 a.m.
Message ID <1352355085-6932-1-git-send-email-ivan.hu@canonical.com>
Download mbox | patch
Permalink /patch/197777/
State Accepted
Headers show

Comments

Ivan Hu - Nov. 8, 2012, 6:11 a.m.
Add the fwts test which gets wakeup time using the UEFI runtime service
interfaces via efi_runtime driver.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/uefi/uefirttime/uefirttime.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
Colin King - Nov. 8, 2012, 9:09 a.m.
On 08/11/12 06:11, Ivan Hu wrote:
> Add the fwts test which gets wakeup time using the UEFI runtime service
> interfaces via efi_runtime driver.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>   src/uefi/uefirttime/uefirttime.c |   29 +++++++++++++++++++++++++++++
>   1 file changed, 29 insertions(+)
>
> diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c
> index 319ac76..280e48e 100644
> --- a/src/uefi/uefirttime/uefirttime.c
> +++ b/src/uefi/uefirttime/uefirttime.c
> @@ -313,9 +313,38 @@ static int uefirttime_test2(fwts_framework *fw)
>   	return FWTS_OK;
>   }
>
> +static int uefirttime_test3(fwts_framework *fw)
> +{
> +	long ioret;
> +	struct efi_getwakeuptime getwakeuptime;
> +	uint64_t status;
> +	uint8_t enabled, pending;
> +	EFI_TIME efi_time;
> +
> +	getwakeuptime.Enabled = &enabled;
> +	getwakeuptime.Pending = &pending;
> +	getwakeuptime.Time = &efi_time;
> +	getwakeuptime.status = &status;
> +
> +	ioret = ioctl(fd, EFI_RUNTIME_GET_WAKETIME, &getwakeuptime);
> +	if (ioret == -1) {
> +		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime",
> +			"Failed to get wakeup time with UEFI runtime service.");
> +		return FWTS_ERROR;
> +	}
> +
> +	if (!checktimefields(fw, getwakeuptime.Time))
> +		return FWTS_ERROR;
> +
> +	fwts_passed(fw, "UEFI runtime service GetWakeupTime interface test passed.");
> +
> +	return FWTS_OK;
> +}
> +
>   static fwts_framework_minor_test uefirttime_tests[] = {
>   	{ uefirttime_test1, "Test UEFI RT service get time interface." },
>   	{ uefirttime_test2, "Test UEFI RT service set time interface." },
> +	{ uefirttime_test3, "Test UEFI RT service get wakeup time interface." },
>   	{ NULL, NULL }
>   };
>
>
Looks good. Thanks,

Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung - Nov. 21, 2012, 2:45 a.m.
On 11/08/2012 02:11 PM, Ivan Hu wrote:
> Add the fwts test which gets wakeup time using the UEFI runtime service
> interfaces via efi_runtime driver.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>   src/uefi/uefirttime/uefirttime.c |   29 +++++++++++++++++++++++++++++
>   1 file changed, 29 insertions(+)
>
> diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c
> index 319ac76..280e48e 100644
> --- a/src/uefi/uefirttime/uefirttime.c
> +++ b/src/uefi/uefirttime/uefirttime.c
> @@ -313,9 +313,38 @@ static int uefirttime_test2(fwts_framework *fw)
>   	return FWTS_OK;
>   }
>
> +static int uefirttime_test3(fwts_framework *fw)
> +{
> +	long ioret;
> +	struct efi_getwakeuptime getwakeuptime;
> +	uint64_t status;
> +	uint8_t enabled, pending;
> +	EFI_TIME efi_time;
> +
> +	getwakeuptime.Enabled = &enabled;
> +	getwakeuptime.Pending = &pending;
> +	getwakeuptime.Time = &efi_time;
> +	getwakeuptime.status = &status;
> +
> +	ioret = ioctl(fd, EFI_RUNTIME_GET_WAKETIME, &getwakeuptime);
> +	if (ioret == -1) {
> +		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime",
> +			"Failed to get wakeup time with UEFI runtime service.");
> +		return FWTS_ERROR;
> +	}
> +
> +	if (!checktimefields(fw, getwakeuptime.Time))
> +		return FWTS_ERROR;
> +
> +	fwts_passed(fw, "UEFI runtime service GetWakeupTime interface test passed.");
> +
> +	return FWTS_OK;
> +}
> +
>   static fwts_framework_minor_test uefirttime_tests[] = {
>   	{ uefirttime_test1, "Test UEFI RT service get time interface." },
>   	{ uefirttime_test2, "Test UEFI RT service set time interface." },
> +	{ uefirttime_test3, "Test UEFI RT service get wakeup time interface." },
>   	{ NULL, NULL }
>   };
>
>
Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c
index 319ac76..280e48e 100644
--- a/src/uefi/uefirttime/uefirttime.c
+++ b/src/uefi/uefirttime/uefirttime.c
@@ -313,9 +313,38 @@  static int uefirttime_test2(fwts_framework *fw)
 	return FWTS_OK;
 }
 
+static int uefirttime_test3(fwts_framework *fw)
+{
+	long ioret;
+	struct efi_getwakeuptime getwakeuptime;
+	uint64_t status;
+	uint8_t enabled, pending;
+	EFI_TIME efi_time;
+
+	getwakeuptime.Enabled = &enabled;
+	getwakeuptime.Pending = &pending;
+	getwakeuptime.Time = &efi_time;
+	getwakeuptime.status = &status;
+
+	ioret = ioctl(fd, EFI_RUNTIME_GET_WAKETIME, &getwakeuptime);
+	if (ioret == -1) {
+		fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime",
+			"Failed to get wakeup time with UEFI runtime service.");
+		return FWTS_ERROR;
+	}
+
+	if (!checktimefields(fw, getwakeuptime.Time))
+		return FWTS_ERROR;
+
+	fwts_passed(fw, "UEFI runtime service GetWakeupTime interface test passed.");
+
+	return FWTS_OK;
+}
+
 static fwts_framework_minor_test uefirttime_tests[] = {
 	{ uefirttime_test1, "Test UEFI RT service get time interface." },
 	{ uefirttime_test2, "Test UEFI RT service set time interface." },
+	{ uefirttime_test3, "Test UEFI RT service get wakeup time interface." },
 	{ NULL, NULL }
 };