From patchwork Tue Oct 2 06:12:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: efi_runtime: add UEFI runtime service GetNextHighMonotonicCount interface Date: Mon, 01 Oct 2012 20:12:27 -0000 From: IvanHu X-Patchwork-Id: 188384 Message-Id: <1349158347-6243-1-git-send-email-ivan.hu@canonical.com> To: fwts-devel@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_ */