ACK: [PATCH] efi_runtime: add UEFI runtime service QueryCapsuleCapabilities interface
Alex Hung
alex.hung at canonical.com
Thu Jan 31 09:31:16 UTC 2013
On 01/28/2013 04:43 PM, Ivan Hu wrote:
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
> efi_runtime/efi_runtime.c | 21 +++++++++++++++++++++
> efi_runtime/efi_runtime.h | 24 ++++++++++++++++++++++++
> 2 files changed, 45 insertions(+)
>
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index 4c34f10..9440aae 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -121,6 +121,8 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd,
>
> struct efi_getnexthighmonotoniccount __user *pgetnexthighmonotoniccount;
>
> + struct efi_querycapsulecapabilities __user *pquerycapsulecapabilities;
> +
> switch (cmd) {
> case EFI_RUNTIME_GET_VARIABLE:
> pgetvariable = (struct efi_getvariable __user *)arg;
> @@ -297,6 +299,25 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd,
> return -EINVAL;
>
> return 0;
> +
> + case EFI_RUNTIME_QUERY_CAPSULECAPABILITIES:
> +
> + pquerycapsulecapabilities = (struct
> + efi_querycapsulecapabilities __user *)arg;
> +
> + status = efi.query_capsule_caps(
> + (efi_capsule_header_t **)
> + pquerycapsulecapabilities->CapsuleHeaderArray,
> + pquerycapsulecapabilities->CapsuleCount,
> + pquerycapsulecapabilities->MaximumCapsuleSize,
> + (int *)pquerycapsulecapabilities->ResetType);
> +
> + if (put_user(status, pquerycapsulecapabilities->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 ad62aa7..c516bba 100644
> --- a/efi_runtime/efi_runtime.h
> +++ b/efi_runtime/efi_runtime.h
> @@ -21,6 +21,12 @@
> #ifndef _EFI_RUNTIME_H_
> #define _EFI_RUNTIME_H_
>
> +typedef enum {
> + EfiResetCold,
> + EfiResetWarm,
> + EfiResetShutdown
> +} EFI_RESET_TYPE;
> +
> typedef struct {
> uint32_t Data1;
> uint16_t Data2;
> @@ -48,6 +54,13 @@ typedef struct {
> uint8_t SetsToZero;
> } __attribute__ ((packed)) EFI_TIME_CAPABILITIES;
>
> +typedef struct {
> + EFI_GUID CapsuleGuid;
> + uint32_t HeaderSize;
> + uint32_t Flags;
> + uint32_t CapsuleImageSize;
> +} __attribute__ ((packed)) EFI_CAPSULE_HEADER;
> +
> struct efi_getvariable {
> uint16_t *VariableName;
> EFI_GUID *VendorGuid;
> @@ -110,6 +123,14 @@ struct efi_getnexthighmonotoniccount {
> uint64_t *status;
> } __attribute__ ((packed));
>
> +struct efi_querycapsulecapabilities {
> + EFI_CAPSULE_HEADER **CapsuleHeaderArray;
> + uint64_t CapsuleCount;
> + uint64_t *MaximumCapsuleSize;
> + EFI_RESET_TYPE *ResetType;
> + 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)
> @@ -135,4 +156,7 @@ struct efi_getnexthighmonotoniccount {
> #define EFI_RUNTIME_GET_NEXTHIGHMONOTONICCOUNT \
> _IOR('p', 0x09, struct efi_getnexthighmonotoniccount)
>
> +#define EFI_RUNTIME_QUERY_CAPSULECAPABILITIES \
> + _IOR('p', 0x0A, struct efi_querycapsulecapabilities)
> +
> #endif /* _EFI_RUNTIME_H_ */
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list