[PATCH] efi_runtime: add UEFI runtime service GetNextHighMonotonicCount interface

Keng-Yu Lin kengyu at canonical.com
Wed Oct 3 08:12:59 UTC 2012


On Tue, Oct 2, 2012 at 2:12 PM, Ivan Hu <ivan.hu at canonical.com> wrote:
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  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_ */
> --
> 1.7.9.5
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list