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

Ivan Hu ivan.hu at canonical.com
Thu Nov 8 06:11:25 UTC 2012


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 at 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 }
 };
 
-- 
1.7.10.4




More information about the fwts-devel mailing list