[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190918094323.17515-1-e.velu@criteo.com>
Date: Wed, 18 Sep 2019 11:43:19 +0200
From: Erwan Velu <erwanaliasr1@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Erwan Velu <e.velu@...teo.com>, Jean Delvare <jdelvare@...e.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Michal Marek <michal.lkml@...kovi.net>,
Mattias Jacobsson <2pi@....nu>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
Jens Wiklander <jens.wiklander@...aro.org>,
Sumit Garg <sumit.garg@...aro.org>,
Changbin Du <changbin.du@...el.com>,
Boris Brezillon <bbrezillon@...nel.org>,
"Robert P. J. Day" <rpjday@...shcourse.ca>,
linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org
Subject: [PATCH 1/3] firmware/dmi_scan: Add dmi_save_release to save releases fields
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@...teo.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
Powered by blists - more mailing lists