From patchwork Fri Sep 28 08:26:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 187733 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 2E0F72C00C4 for ; Fri, 28 Sep 2012 18:26:56 +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 1THVro-0001pN-2U; Fri, 28 Sep 2012 08:24:12 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1THVrm-0001pA-Lv for fwts-devel@lists.ubuntu.com; Fri, 28 Sep 2012 08:24:10 +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 1THVuP-00082X-1V; Fri, 28 Sep 2012 08:26:53 +0000 From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] efi_runtime: add UEFI runtime service QueryVariableInfo interface Date: Fri, 28 Sep 2012 16:26:49 +0800 Message-Id: <1348820809-4489-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 This interface is always returned EFI_UNSUPPORTED from virt_fei_query_variable_info on kernel driver efi.c because of checking the runtime_version. It seems that runtime_version value always 0, it alway returns EFI_UNSUPPORTED. Need a patch of efi.c for this interface. Signed-off-by: Ivan Hu Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- efi_runtime/efi_runtime.c | 20 ++++++++++++++++++++ efi_runtime/efi_runtime.h | 11 +++++++++++ 2 files changed, 31 insertions(+) diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c index 227a910..0e66e94 100644 --- a/efi_runtime/efi_runtime.c +++ b/efi_runtime/efi_runtime.c @@ -117,6 +117,8 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd, struct efi_getnextvariablename __user *pgetnextvariablename; unsigned long name_size; + struct efi_queryvariableinfo __user *pqueryvariableinfo; + switch (cmd) { case EFI_RUNTIME_GET_VARIABLE: pgetvariable = (struct efi_getvariable __user *)arg; @@ -261,6 +263,24 @@ static long efi_runtime_ioctl(struct file *file, unsigned int cmd, &vendor_guid, sizeof(EFI_GUID))) return -EFAULT; return 0; + + case EFI_RUNTIME_QUERY_VARIABLEINFO: + + pqueryvariableinfo = (struct efi_queryvariableinfo __user *)arg; + + if (get_user(attr, &pqueryvariableinfo->Attributes)) + return -EFAULT; + + status = efi.query_variable_info(attr, + pqueryvariableinfo->MaximumVariableStorageSize, + pqueryvariableinfo->RemainingVariableStorageSize + , pqueryvariableinfo->MaximumVariableSize); + if (put_user(status, pqueryvariableinfo->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 7387406..cc33878 100644 --- a/efi_runtime/efi_runtime.h +++ b/efi_runtime/efi_runtime.h @@ -73,6 +73,14 @@ struct efi_getnextvariablename { uint64_t *status; } __attribute__ ((packed)); +struct efi_queryvariableinfo { + uint32_t Attributes; + uint64_t *MaximumVariableStorageSize; + uint64_t *RemainingVariableStorageSize; + uint64_t *MaximumVariableSize; + uint64_t *status; +} __attribute__ ((packed)); + struct efi_gettime { EFI_TIME *Time; EFI_TIME_CAPABILITIES *Capabilities; @@ -116,4 +124,7 @@ struct efi_setwakeuptime { #define EFI_RUNTIME_GET_NEXTVARIABLENAME \ _IOWR('p', 0x07, struct efi_getnextvariablename) +#define EFI_RUNTIME_QUERY_VARIABLEINFO \ + _IOR('p', 0x08, struct efi_queryvariableinfo) + #endif /* _EFI_RUNTIME_H_ */