Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1185918

[RFC PATCH 07/16] efi: Public the function of transferring EFI status to kernel error

From "Lee, Chun-Yi" <joeyli.kernel@gmail.com>
Newsgroups linux.kernel
Subject [RFC PATCH 07/16] efi: Public the function of transferring EFI status to kernel error
Date 2015-07-16 16:40 +0200
Message-ID <pMSun-13y-29@gated-at.bofh.it> (permalink)
References <pMSkF-Sa-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Moved the function of transferring EFI status to kernel error for
later used by EFI stub.

Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
 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);
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 00/16] Signature verification of hibernate snapshot "Lee, Chun-Yi" <joeyli.kernel@gmail.com> - 2015-07-16 16:30 +0200
  [RFC PATCH 12/16] PM / hibernate: Forward signature verifying result and key to image kernel "Lee, Chun-Yi" <joeyli.kernel@gmail.com> - 2015-07-16 16:30 +0200
  [RFC PATCH 15/16] PM / hibernate: Bypass verification logic on legacy BIOS "Lee, Chun-Yi" <joeyli.kernel@gmail.com> - 2015-07-16 16:30 +0200
  [RFC PATCH 16/16] PM / hibernate: Document signature verification of hibernate snapshot "Lee, Chun-Yi" <joeyli.kernel@gmail.com> - 2015-07-16 16:30 +0200
  [RFC PATCH 13/16] PM / hibernate: Add configuration to enforce signature verification "Lee, Chun-Yi" <joeyli.kernel@gmail.com> - 2015-07-16 16:30 +0200
  [RFC PATCH 08/16] x86/efi: Carrying swsusp key by setup data "Lee, Chun-Yi" <joeyli.kernel@gmail.com> - 2015-07-16 16:30 +0200
  [RFC PATCH 07/16] efi: Public the function of transferring EFI status to kernel error "Lee, Chun-Yi" <joeyli.kernel@gmail.com> - 2015-07-16 16:40 +0200
  [RFC PATCH 03/16] x86/boot: Public getting random boot function "Lee, Chun-Yi" <joeyli.kernel@gmail.com> - 2015-07-16 16:40 +0200
  [RFC PATCH 05/16] x86/efi: Get entropy through EFI random number generator protocol "Lee, Chun-Yi" <joeyli.kernel@gmail.com> - 2015-07-16 16:40 +0200

csiph-web