All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH 3/3] efi: Format EFI version prints the way the standard says.
Date: Tue,  6 Sep 2016 11:51:11 -0400	[thread overview]
Message-ID: <1473177071-11791-3-git-send-email-pjones@redhat.com> (raw)
In-Reply-To: <1473177071-11791-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

We print "EFI v2.xx.yy vendor blahblah" at several places.  Make them
conform to the standard format.

This leaves 2 checkpatch warnings in arch/ia64/kernel/efi.c intact; the
old code would have produced them, and they match the nearby code in the
functions.

Signed-off-by: Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 arch/ia64/kernel/efi.c          | 14 ++++++--------
 arch/x86/platform/efi/efi.c     | 21 +++++++++++++--------
 drivers/firmware/efi/arm-init.c | 13 ++++++-------
 drivers/firmware/efi/efi.c      | 13 ++++++++++---
 include/linux/efi.h             |  2 ++
 5 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 2af99a8..f0244bf 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -473,7 +473,7 @@ efi_init (void)
 	void *efi_map_start, *efi_map_end;
 	efi_char16_t *c16;
 	u64 efi_desc_size;
-	char *cp, vendor[100] = "unknown";
+	char *cp, vendor[100] = "unknown", version[] = "65535.255.255";
 	int i;
 
 	set_bit(EFI_BOOT, &efi.flags);
@@ -516,11 +516,11 @@ efi_init (void)
 
 	efi.spec_version = efi.systab->hdr.version;
 
+	efi_spec_version_format(version);
+
 	if ((efi.systab->hdr.revision >> 16) == 0)
-		printk(KERN_WARNING "Warning: EFI system table version "
-		       "%d.%02d, expected 1.00 or greater\n",
-		       efi.systab->hdr.revision >> 16,
-		       efi.systab->hdr.revision & 0xffff);
+		printk(KERN_WARNING "Warning: EFI system table version %s, expected 1.00 or greater\n",
+		       version);
 
 	/* Show what we know for posterity */
 	c16 = __va(efi.systab->fw_vendor);
@@ -530,9 +530,7 @@ efi_init (void)
 		vendor[i] = '\0';
 	}
 
-	printk(KERN_INFO "EFI v%u.%.02u by %s:",
-	       efi.systab->hdr.revision >> 16,
-	       efi.systab->hdr.revision & 0xffff, vendor);
+	printk(KERN_INFO "EFI v%s by %s\n", version, vendor);
 
 	palo_phys      = EFI_INVALID_TABLE_ADDR;
 
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 51c091e..9ca379b 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -328,10 +328,14 @@ static int __init efi_systab_init(void *phys)
 
 	efi.spec_version = efi.systab->hdr.revision;
 
-	if ((efi.systab->hdr.revision >> 16) == 0)
-		pr_err("Warning: System table version %d.%02d, expected 1.00 or greater!\n",
-		       efi.systab->hdr.revision >> 16,
-		       efi.systab->hdr.revision & 0xffff);
+	if ((efi.systab->hdr.revision >> 16) == 0) {
+		char version[] = "65535.255.255";
+
+		efi_spec_version_format(version);
+
+		pr_err("Warning: System table version %s, expected 1.00 or greater!\n",
+		       version);
+	}
 
 	return 0;
 }
@@ -447,7 +451,7 @@ static int __init efi_memmap_init(void)
 void __init efi_init(void)
 {
 	efi_char16_t *c16;
-	char vendor[100] = "unknown";
+	char vendor[100] = "unknown", version[] = "65535.255.255";
 	int i = 0;
 	void *tmp;
 
@@ -474,6 +478,7 @@ void __init efi_init(void)
 	/*
 	 * Show what we know for posterity
 	 */
+
 	c16 = tmp = early_memremap(efi.systab->fw_vendor, 2);
 	if (c16) {
 		for (i = 0; i < sizeof(vendor) - 1 && *c16; ++i)
@@ -483,9 +488,9 @@ void __init efi_init(void)
 		pr_err("Could not map the firmware vendor!\n");
 	early_memunmap(tmp, 2);
 
-	pr_info("EFI v%u.%.02u by %s\n",
-		efi.systab->hdr.revision >> 16,
-		efi.systab->hdr.revision & 0xffff, vendor);
+	efi_spec_version_format(version);
+
+	pr_info("EFI v%s by %s\n", version, vendor);
 
 	if (efi_reuse_config(efi.systab->tables, efi.systab->nr_tables))
 		return;
diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
index 8f4aeba..2be0e5a 100644
--- a/drivers/firmware/efi/arm-init.c
+++ b/drivers/firmware/efi/arm-init.c
@@ -90,7 +90,7 @@ static int __init uefi_init(void)
 	efi_char16_t *c16;
 	void *config_tables;
 	size_t table_size;
-	char vendor[100] = "unknown";
+	char vendor[100] = "unknown", version[] = "65535.255.255";
 	int i, retval;
 
 	efi.systab = early_memremap_ro(efi_system_table,
@@ -115,10 +115,11 @@ static int __init uefi_init(void)
 
 	efi.spec_version = efi.systab->hdr.revision;
 
+	efi_spec_version_format(version);
+
 	if ((efi.systab->hdr.revision >> 16) < 2)
-		pr_warn("Warning: EFI system table version %d.%02d, expected 2.00 or greater\n",
-			efi.systab->hdr.revision >> 16,
-			efi.systab->hdr.revision & 0xffff);
+		pr_warn("Warning: EFI system table version %s, expected 1.00 or greater\n",
+			version);
 
 	/* Show what we know for posterity */
 	c16 = early_memremap_ro(efi_to_phys(efi.systab->fw_vendor),
@@ -130,9 +131,7 @@ static int __init uefi_init(void)
 		early_memunmap(c16, sizeof(vendor) * sizeof(efi_char16_t));
 	}
 
-	pr_info("EFI v%u.%.02u by %s\n",
-		efi.systab->hdr.revision >> 16,
-		efi.systab->hdr.revision & 0xffff, vendor);
+	pr_info("EFI v%s by %s\n", version, vendor);
 
 	table_size = sizeof(efi_config_table_64_t) * efi.systab->nr_tables;
 	config_tables = early_memremap_ro(efi_to_phys(efi.systab->tables),
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index c7cdd3f..a18b71f 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -141,9 +141,7 @@ static ssize_t fw_platform_size_show(struct kobject *kobj,
 	return sprintf(buf, "%d\n", efi_enabled(EFI_64BIT) ? 64 : 32);
 }
 
-static ssize_t spec_version_show(struct kobject *kobj,
-				 struct kobj_attribute *attr,
-				 char *buf)
+ssize_t efi_spec_version_format(char *buf)
 {
 	u16 major, minor;
 	ssize_t rc;
@@ -205,6 +203,15 @@ static ssize_t spec_version_show(struct kobject *kobj,
 	return rc;
 }
 
+static ssize_t spec_version_show(struct kobject *kobj,
+				 struct kobj_attribute *attr,
+				 char *buf)
+{
+	char version[] = "65535.255.255";
+
+	return efi_spec_version_format(version);
+}
+
 static struct kobj_attribute efi_attr_fw_vendor = __ATTR_RO(fw_vendor);
 static struct kobj_attribute efi_attr_runtime = __ATTR_RO(runtime);
 static struct kobj_attribute efi_attr_config_table = __ATTR_RO(config_table);
diff --git a/include/linux/efi.h b/include/linux/efi.h
index c6a3126..d2d5c13 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -535,6 +535,8 @@ typedef efi_status_t efi_query_variable_store_t(u32 attributes,
 
 void efi_native_runtime_setup(void);
 
+ssize_t efi_spec_version_format(char *buf);
+
 /*
  * EFI Configuration Table and GUID definitions
  *
-- 
2.7.4

  parent reply	other threads:[~2016-09-06 15:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 16:13 [PATCH 1/2] efi: don't call the system table version the runtime services version Peter Jones
     [not found] ` <1471968832-19847-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-08-23 16:13   ` [PATCH 2/2] efi: add firmware version information to sysfs Peter Jones
     [not found]     ` <1471968832-19847-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-08-24 10:30       ` Lukas Wunner
     [not found]         ` <20160824103021.GA22888-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-09-02 18:57           ` Peter Jones
     [not found]             ` <20160902185758.GB9082-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-02 20:57               ` [PATCH 1/3] efi: don't call the system table version the runtime services version Peter Jones
     [not found]                 ` <1472849873-32041-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-02 20:57                   ` [PATCH 2/3] efi: add firmware version information to sysfs Peter Jones
     [not found]                     ` <1472849873-32041-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-05 12:00                       ` Lukas Wunner
     [not found]                         ` <20160905120006.GA27048-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-09-06 15:35                           ` Peter Jones
2016-09-06 15:51                           ` [PATCH 1/3] efi: don't call the system table version the runtime services version Peter Jones
     [not found]                             ` <1473177071-11791-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-06 15:51                               ` [PATCH 2/3] efi: add firmware version information to sysfs Peter Jones
     [not found]                                 ` <1473177071-11791-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-07 12:23                                   ` Lukas Wunner
     [not found]                                     ` <20160907122339.GB28333-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-09-07 14:56                                       ` [PATCH 1/3] efi: don't call the system table version the runtime services version Peter Jones
     [not found]                                         ` <1473260186-4500-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-07 14:56                                           ` [PATCH 2/3] efi: add firmware version information to sysfs Peter Jones
     [not found]                                             ` <1473260186-4500-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-13 13:24                                               ` Matt Fleming
2016-09-07 14:56                                           ` [PATCH 3/3] efi: Format EFI version prints the way the standard says Peter Jones
     [not found]                                             ` <1473260186-4500-3-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-15  9:18                                               ` Matt Fleming
     [not found]                                                 ` <20160915091822.GA16797-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-09-15 13:13                                                   ` Peter Jones
     [not found]                                                     ` <20160915131305.5mhdpc6vql5nv2gw-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-16  9:40                                                       ` Matt Fleming
     [not found]                                                         ` <20160916094006.GD16797-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-09-16 14:42                                                           ` Peter Jones
2016-09-13 12:32                                           ` [PATCH 1/3] efi: don't call the system table version the runtime services version Matt Fleming
2016-09-06 15:51                               ` Peter Jones [this message]
     [not found]                                 ` <1473177071-11791-3-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-09-07 12:21                                   ` [PATCH 3/3] efi: Format EFI version prints the way the standard says Lukas Wunner
2016-09-02 20:57                   ` Peter Jones

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=1473177071-11791-3-git-send-email-pjones@redhat.com \
    --to=pjones-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.