From patchwork Tue Oct 2 06:12:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 188384 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 6C3B72C0084 for ; Tue, 2 Oct 2012 16:12:35 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TIvfj-0002ow-Cf; Tue, 02 Oct 2012 06:09:35 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TIvfh-0002or-RY for fwts-devel@lists.ubuntu.com; Tue, 02 Oct 2012 06:09:33 +0000 Received: from [175.41.48.77] (helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1TIviZ-0001rO-Sb; Tue, 02 Oct 2012 06:12:32 +0000 From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH] efi_runtime: add UEFI runtime service GetNextHighMonotonicCount interface Date: Tue, 2 Oct 2012 14:12:27 +0800 Message-Id: <1349158347-6243-1-git-send-email-ivan.hu@canonical.com> X-Mailer: git-send-email 1.7.9.5 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com Signed-off-by: Ivan Hu Acked-by: Colin Ian King Acked-by: Keng-Yu Lin --- efi_runtime/efi_runtime.c | 16 ++++++++++++++++ efi_runtime/efi_runtime.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c index 3ae2d8f..d5ff92b 100644 --- a/efi_runtime/efi_runtime.c +++ b/efi_runtime/efi_runtime.c @@ -119,6 +119,8 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd, struct efi_queryvariableinfo __user *pqueryvariableinfo; + struct efi_getnexthighmonotoniccount __user *pgetnexthighmonotoniccount; + switch (cmd) { case EFI_RUNTIME_GET_VARIABLE: pgetvariable = (struct efi_getvariable __user *)arg; @@ -281,6 +283,20 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd, return -EINVAL; return 0; + + case EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT: + + pgetnexthighmonotoniccount = (struct + efi_getnexthighmonotoniccount __user *)arg; + + status = efi.get_next_high_mono_count(pgetnexthighmonotoniccount + ->HighCount); + if (put_user(status, pgetnexthighmonotoniccount->status)) + return -EFAULT; + if (status != EFI_SUCCESS) + return -EINVAL; + + return 0; } return -ENOTTY; diff --git a/efi_runtime/efi_runtime.h b/efi_runtime/efi_runtime.h index cc33878..b8262c0 100644 --- a/efi_runtime/efi_runtime.h +++ b/efi_runtime/efi_runtime.h @@ -105,6 +105,11 @@ struct efi_setwakeuptime { uint64_t *status; } __attribute__ ((packed)); +struct efi_getnexthighmonotoniccount { + uint32_t *HighCount; + uint64_t *status; +} __attribute__ ((packed)); + /* ioctl calls that are permitted to the /dev/efi_runtime interface. */ #define EFI_RUNTIME_GET_VARIABLE \ _IOWR('p', 0x01, struct efi_getvariable) @@ -127,4 +132,7 @@ struct efi_setwakeuptime { #define EFI_RUNTIME_QUERY_VARIABLEINFO \ _IOR('p', 0x08, struct efi_queryvariableinfo) +#define EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT \ + _IOR('p', 0x09, struct efi_getnexthighmonotoniccount) + #endif /* _EFI_RUNTIME_H_ */