linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erwan Velu <erwanaliasr1@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Erwan Velu <e.velu@criteo.com>, Jean Delvare <jdelvare@suse.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Mattias Jacobsson <2pi@mok.nu>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Jens Wiklander <jens.wiklander@linaro.org>,
	Sumit Garg <sumit.garg@linaro.org>,
	Changbin Du <changbin.du@intel.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	"Robert P. J. Day" <rpjday@crashcourse.ca>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: [PATCH 1/3] firmware/dmi_scan: Add dmi_save_release to save releases fields
Date: Wed, 18 Sep 2019 11:43:19 +0200	[thread overview]
Message-ID: <20190918094323.17515-1-e.velu@criteo.com> (raw)

In DMI type 0, there is several fields that encodes a release.
The dmi_save_release() function have the logic to check if the field is valid.
If so, it reports the actual value.

Signed-off-by: Erwan Velu <e.velu@criteo.com>
---
 drivers/firmware/dmi_scan.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 35ed56b9c34f..202bd2c69d0f 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -181,6 +181,32 @@ static void __init dmi_save_ident(const struct dmi_header *dm, int slot,
 	dmi_ident[slot] = p;
 }
 
+static void __init dmi_save_release(const struct dmi_header *dm, int slot,
+		int index)
+{
+	const u8 *d;
+	char *s;
+
+	// If the table doesn't have the field, let's return
+	if (dmi_ident[slot] || dm->length < index)
+		return;
+
+	d = (u8 *) dm + index;
+
+	// As per the specification,
+	// if the system doesn't have the field, the value is FF
+	if (d[0] == 0xFF)
+		return;
+
+	s = dmi_alloc(4);
+	if (!s)
+		return;
+
+	sprintf(s, "%u", d[0]);
+
+	dmi_ident[slot] = s;
+}
+
 static void __init dmi_save_uuid(const struct dmi_header *dm, int slot,
 		int index)
 {
-- 
2.21.0


             reply	other threads:[~2019-09-18  9:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18  9:43 Erwan Velu [this message]
2019-09-18  9:43 ` [PATCH 2/3] firmware/dmi: Report DMI Bios release Erwan Velu
2019-10-21 14:53   ` Jean Delvare
2019-11-27 15:05     ` Erwan Velu
2019-09-18  9:43 ` [PATCH 3/3] firmware/dmi: Report DMI Embedded Firmware release Erwan Velu
2019-10-21 14:55   ` Jean Delvare
2019-10-21 14:32 ` [PATCH 1/3] firmware/dmi_scan: Add dmi_save_release to save releases fields Jean Delvare
2019-11-27 15:04   ` Erwan Velu
2019-11-27 15:07 ` [PATCH 1/2] firmware/dmi: Report DMI Bios release Erwan Velu
2019-11-27 15:07   ` [PATCH 2/2] firmware/dmi: Report DMI Embedded Firmware release Erwan Velu
2020-02-06 12:24     ` Jean Delvare
2020-02-06 12:25       ` Erwan Velu
2020-02-07  8:38       ` Erwan Velu
2020-02-06 12:16   ` [PATCH 1/2] firmware/dmi: Report DMI Bios release Jean Delvare

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=20190918094323.17515-1-e.velu@criteo.com \
    --to=erwanaliasr1@gmail.com \
    --cc=2pi@mok.nu \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bbrezillon@kernel.org \
    --cc=changbin.du@intel.com \
    --cc=e.velu@criteo.com \
    --cc=jdelvare@suse.com \
    --cc=jens.wiklander@linaro.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab+samsung@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=rpjday@crashcourse.ca \
    --cc=sumit.garg@linaro.org \
    --cc=yamada.masahiro@socionext.com \
    /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).