From patchwork Thu Jul 16 14:25:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yi Lee X-Patchwork-Id: 6807521 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 257319F380 for ; Thu, 16 Jul 2015 14:30:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3878D20702 for ; Thu, 16 Jul 2015 14:30:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B546206EB for ; Thu, 16 Jul 2015 14:30:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756081AbbGPOaJ (ORCPT ); Thu, 16 Jul 2015 10:30:09 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:35639 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755844AbbGPO1E (ORCPT ); Thu, 16 Jul 2015 10:27:04 -0400 Received: by pdrg1 with SMTP id g1so45169954pdr.2; Thu, 16 Jul 2015 07:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rqrSHdq+O44M2uyQY7shuS8ZJFHxfK/LxgNeKRhRVNM=; b=FUK1qfHO9L2Ql7e2c4Tgm3k/4TDe7GynFiNK+yMsTY6YlYffBD1T2cfgi39AuQPHf6 BSzz/WDsX5HIuGyQc+qG+Qgp38MtzH8TE/62Dn6ocX3HEq6tQVoms5JN26cb9FL2ICLF V7mHNAzADbfQSsvndMhi6o8ZdmHL4ZO2gBBn5IuFZnEY7q+2TJUHJCar0y+ZBgVycTQC rQMTbVZNuNNjgm/ElwtI9diESIwHAtIowDNcDRflZsinuZXUaqgRhDLweZdfDsLXy6wL aca03OkpnlN4v3zdqU8JwWSUt8R9b+ATaYWMW0upkrDwUVE1sIWOHXo/No2y6zcJ+FNd BGsw== X-Received: by 10.70.37.43 with SMTP id v11mr19256798pdj.89.1437056823820; Thu, 16 Jul 2015 07:27:03 -0700 (PDT) Received: from linux-rxt1.site.site ([124.11.22.254]) by smtp.gmail.com with ESMTPSA id r4sm8219910pap.8.2015.07.16.07.27.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 07:27:03 -0700 (PDT) From: "Lee, Chun-Yi" X-Google-Original-From: "Lee, Chun-Yi" To: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Matthew Garrett , Len Brown , Pavel Machek , Josh Boyer , Vojtech Pavlik , Matt Fleming , Jiri Kosina , "H. Peter Anvin" , "Lee, Chun-Yi" Subject: [RFC PATCH 07/16] efi: Public the function of transferring EFI status to kernel error Date: Thu, 16 Jul 2015 22:25:21 +0800 Message-Id: <1437056730-15247-8-git-send-email-jlee@suse.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1437056730-15247-1-git-send-email-jlee@suse.com> References: <1437056730-15247-1-git-send-email-jlee@suse.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Moved the function of transferring EFI status to kernel error for later used by EFI stub. Signed-off-by: Lee, Chun-Yi --- drivers/firmware/efi/vars.c | 33 --------------------------------- include/linux/efi.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c index 70a0fb1..f5ede94 100644 --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c @@ -237,39 +237,6 @@ check_var_size(u32 attributes, unsigned long size) return fops->query_variable_store(attributes, size); } -static int efi_status_to_err(efi_status_t status) -{ - int err; - - switch (status) { - case EFI_SUCCESS: - err = 0; - break; - case EFI_INVALID_PARAMETER: - err = -EINVAL; - break; - case EFI_OUT_OF_RESOURCES: - err = -ENOSPC; - break; - case EFI_DEVICE_ERROR: - err = -EIO; - break; - case EFI_WRITE_PROTECTED: - err = -EROFS; - break; - case EFI_SECURITY_VIOLATION: - err = -EACCES; - break; - case EFI_NOT_FOUND: - err = -ENOENT; - break; - default: - err = -EINVAL; - } - - return err; -} - static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor, struct list_head *head) { diff --git a/include/linux/efi.h b/include/linux/efi.h index a628f83..9239f32 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -907,6 +907,39 @@ static inline char *efi_status_to_str(efi_status_t status) return str; } +static inline int efi_status_to_err(efi_status_t status) +{ + int err; + + switch (status) { + case EFI_SUCCESS: + err = 0; + break; + case EFI_INVALID_PARAMETER: + err = -EINVAL; + break; + case EFI_OUT_OF_RESOURCES: + err = -ENOSPC; + break; + case EFI_DEVICE_ERROR: + err = -EIO; + break; + case EFI_WRITE_PROTECTED: + err = -EROFS; + break; + case EFI_SECURITY_VIOLATION: + err = -EACCES; + break; + case EFI_NOT_FOUND: + err = -ENOENT; + break; + default: + err = -EINVAL; + } + + return err; +} + extern void efi_init (void); extern void *efi_get_pal_addr (void); extern void efi_map_pal_code (void);