From: Matt Fleming <matt@codeblueprint.co.uk>
To: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: joeyli <jlee@suse.com>, Matt Fleming <matt@codeblueprint.co.uk>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Kweh Hock Leong <hock.leong.kweh@intel.com>,
Borislav Petkov <bp@alien8.de>
Subject: [PATCH 1/4] efi: Move efi_status_to_err() to drivers/firmware/efi/
Date: Thu, 17 Mar 2016 12:57:08 +0000 [thread overview]
Message-ID: <1458219431-24741-2-git-send-email-matt@codeblueprint.co.uk> (raw)
In-Reply-To: <1458219431-24741-1-git-send-email-matt@codeblueprint.co.uk>
Move efi_status_to_err() to the architecture independent code as it's
generally useful in all bits of EFI code where there is a need to
convert an efi_status_t to a kernel error value.
Cc: Kweh Hock Leong <hock.leong.kweh@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
drivers/firmware/efi/efi.c | 33 +++++++++++++++++++++++++++++++++
drivers/firmware/efi/vars.c | 33 ---------------------------------
include/linux/efi.h | 2 ++
3 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 3a69ed5ecfcb..b73222a52a9d 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -637,3 +637,36 @@ u64 __weak efi_mem_attributes(unsigned long phys_addr)
}
return 0;
}
+
+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;
+}
diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
index 0ac594c0a234..4911d5697844 100644
--- a/drivers/firmware/efi/vars.c
+++ b/drivers/firmware/efi/vars.c
@@ -314,39 +314,6 @@ check_var_size_nonblocking(u32 attributes, unsigned long size)
return fops->query_variable_store(attributes, size, true);
}
-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 c55c452b991a..9c8aae0e3b51 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1023,6 +1023,8 @@ static inline void
efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
#endif
+extern int efi_status_to_err(efi_status_t status);
+
/*
* Variable Attributes
*/
--
2.6.2
next prev parent reply other threads:[~2016-03-17 12:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 12:57 [PATCH 0/4] EFI capsule update support Matt Fleming
2016-03-17 12:57 ` Matt Fleming [this message]
2016-03-21 9:43 ` [PATCH 1/4] efi: Move efi_status_to_err() to drivers/firmware/efi/ Ard Biesheuvel
2016-03-17 12:57 ` [PATCH 2/4] efi: Capsule update support Matt Fleming
2016-03-21 10:19 ` Ard Biesheuvel
2016-03-21 20:31 ` Matt Fleming
2016-03-29 12:26 ` Matt Fleming
2016-03-29 13:50 ` Ard Biesheuvel
2016-04-05 10:09 ` Matt Fleming
2016-03-17 12:57 ` [PATCH 3/4] x86/efi: Force EFI reboot to process pending capsules Matt Fleming
2016-03-17 12:57 ` [PATCH 4/4] efi: A misc char interface to update EFI firmware Matt Fleming
2016-04-01 2:48 ` deckard
2016-04-05 9:48 ` Matt Fleming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458219431-24741-2-git-send-email-matt@codeblueprint.co.uk \
--to=matt@codeblueprint.co.uk \
--cc=ard.biesheuvel@linaro.org \
--cc=bp@alien8.de \
--cc=hock.leong.kweh@intel.com \
--cc=jlee@suse.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).