From patchwork Thu Nov 8 06:11:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] uefirttime: add the fwts test for the UEFI get wakeup time runtime service From: IvanHu X-Patchwork-Id: 197777 Message-Id: <1352355085-6932-1-git-send-email-ivan.hu@canonical.com> To: fwts-devel@lists.ubuntu.com Date: Thu, 8 Nov 2012 14:11:25 +0800 Add the fwts test which gets wakeup time using the UEFI runtime service interfaces via efi_runtime driver. Signed-off-by: Ivan Hu Acked-by: Colin Ian King Acked-by: Alex Hung --- 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 } };