All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] firmware/dmi_scan: Add dmi_save_release to save releases fields
@ 2019-09-18  9:43 ` Erwan Velu
  0 siblings, 0 replies; 22+ messages in thread
From: Erwan Velu @ 2019-09-18  9:43 UTC (permalink / raw)
  Cc: Erwan Velu, Jean Delvare, Masahiro Yamada, Michal Marek,
	Mattias Jacobsson, Andy Shevchenko, Mauro Carvalho Chehab,
	Jens Wiklander, Sumit Garg, Changbin Du, Boris Brezillon,
	Robert P. J. Day, linux-kernel, linux-kbuild

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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2020-02-07  8:40 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18  9:43 [PATCH 1/3] firmware/dmi_scan: Add dmi_save_release to save releases fields Erwan Velu
2019-09-18  9:43 ` Erwan Velu
2019-09-18  9:43 ` [PATCH 2/3] firmware/dmi: Report DMI Bios release Erwan Velu
2019-09-18  9:43   ` Erwan Velu
2019-10-21 14:53   ` Jean Delvare
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-09-18  9:43   ` Erwan Velu
2019-10-21 14:55   ` Jean Delvare
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-10-21 14:32   ` 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   ` Erwan Velu
2019-11-27 15:07   ` [PATCH 2/2] firmware/dmi: Report DMI Embedded Firmware release Erwan Velu
2019-11-27 15:07     ` 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

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.