linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] firmware: dmi: Avoid (some) empty names in kernel log
@ 2021-07-06  5:26 Maciej W. Rozycki
  2021-07-06  5:27 ` [PATCH 1/2] firmware: dmi: Prevent empty board name from being logged Maciej W. Rozycki
  2021-07-06  5:27 ` [PATCH 2/2] firmware: dmi: Log board vendor if no system vendor has been given Maciej W. Rozycki
  0 siblings, 2 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2021-07-06  5:26 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-kernel

Hi,

 I've noticed one of my systems shows this output in the kernel log:

Legacy DMI 2.0 present.
DMI:  /i430HX, BIOS 4.51 PG 05/13/98

which leaves something to desire.  While the contents of /sys/firmware/dmi 
remain the main source of DMI data, along with output from `dmidecode', 
the summary from the kernel log is often readily available with various 
reports, making it a point of easy reference.  Therefore I think empty 
names are best avoided if possible.

 The system in question is a Tyan Tomcat IV S1564D mainboard, which has 
its System Information all empty, not unreasonably as it was sold as a 
bare board for field integration rather that a complete system.  It does 
have the manufacturer correctly recorded with Base Board Information 
though.

 I have therefore made this mini patch series, with 2/2 printing the board 
manufacturer if none has been given for the system, and including 1/2 as 
well to prevent a trailing slash with an empty board name, following my 
observation made with an unrelated issue where the reporter included a log 
with just "/" shown as the system name.

 See individual change descriptions for further details.

 Please apply.

  Maciej

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

* [PATCH 1/2] firmware: dmi: Prevent empty board name from being logged
  2021-07-06  5:26 [PATCH 0/2] firmware: dmi: Avoid (some) empty names in kernel log Maciej W. Rozycki
@ 2021-07-06  5:27 ` Maciej W. Rozycki
  2021-07-06  5:27 ` [PATCH 2/2] firmware: dmi: Log board vendor if no system vendor has been given Maciej W. Rozycki
  1 sibling, 0 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2021-07-06  5:27 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-kernel

Some systems do provide DMI entries for Base Board Information, however 
the strings supplied are null, e.g:

Legacy DMI 2.0 present.
DMI: /, BIOS 4.51 PG 09/11/97

Do not log the slash along with the empty board name in that case as it 
carries no real information.  If it's important to tell an inexistent 
and an empty board name apart, then all DMI information can be retrieved 
from sysfs and/or with `dmidecode'.

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
---
 drivers/firmware/dmi_scan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-macro-ide-tty/drivers/firmware/dmi_scan.c
===================================================================
--- linux-macro-ide-tty.orig/drivers/firmware/dmi_scan.c
+++ linux-macro-ide-tty/drivers/firmware/dmi_scan.c
@@ -544,7 +544,7 @@ static void __init dmi_format_ids(char *
 			    dmi_get_system_info(DMI_PRODUCT_NAME));
 
 	board = dmi_get_system_info(DMI_BOARD_NAME);
-	if (board) {
+	if (board && *board) {
 		c += scnprintf(buf + c, len - c, "/");
 		c += print_filtered(buf + c, len - c, board);
 	}

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

* [PATCH 2/2] firmware: dmi: Log board vendor if no system vendor has been given
  2021-07-06  5:26 [PATCH 0/2] firmware: dmi: Avoid (some) empty names in kernel log Maciej W. Rozycki
  2021-07-06  5:27 ` [PATCH 1/2] firmware: dmi: Prevent empty board name from being logged Maciej W. Rozycki
@ 2021-07-06  5:27 ` Maciej W. Rozycki
  1 sibling, 0 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2021-07-06  5:27 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-kernel

Some systems do not provide any names with System Information, e.g. the 
Tyan Tomcat IV S1564D mainboard reports:

Legacy DMI 2.0 present.
DMI:  /i430HX, BIOS 4.51 PG 05/13/98

This is not unreasonable given that it was retailed as a bare mainboard 
rather that a complete system, so no information could have been known 
about the integrator.  It does have the manufacturer correctly recorded 
with Base Board Information though:

Handle 0x0001
	DMI type 1, 8 bytes.
	System Information
		Manufacturer:
		Product Name:
		Version:
		Serial Number:
Handle 0x0002
	DMI type 2, 8 bytes.
	Base Board Information
		Manufacturer: Tyan Computer Corp
		Product Name: i430HX
		Version:
		Serial Number:

Resort to logging the board manufacturer then if none has been given for 
the system.  Also refrain from including the separating slash if no name 
has been given for the system.

Output is now:

Legacy DMI 2.0 present.
DMI: Tyan Computer Corp i430HX, BIOS 4.51 PG 05/13/98

for said board, surely more informative (of course a better name could 
have been chosen for the product than just "i430HX", but there you go).

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
---
 drivers/firmware/dmi_scan.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

linux-dmi-board-vendor.diff
Index: linux-macro-ide-tty/drivers/firmware/dmi_scan.c
===================================================================
--- linux-macro-ide-tty.orig/drivers/firmware/dmi_scan.c
+++ linux-macro-ide-tty/drivers/firmware/dmi_scan.c
@@ -535,17 +535,23 @@ static int __init print_filtered(char *b
 static void __init dmi_format_ids(char *buf, size_t len)
 {
 	int c = 0;
+	const char *vendor;
 	const char *board;	/* Board Name is optional */
+	const char *name;
 
-	c += print_filtered(buf + c, len - c,
-			    dmi_get_system_info(DMI_SYS_VENDOR));
+	vendor = dmi_get_system_info(DMI_SYS_VENDOR);
+	if (!vendor || !*vendor)
+		vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
+	c += print_filtered(buf + c, len - c, vendor);
 	c += scnprintf(buf + c, len - c, " ");
-	c += print_filtered(buf + c, len - c,
-			    dmi_get_system_info(DMI_PRODUCT_NAME));
+
+	name = dmi_get_system_info(DMI_PRODUCT_NAME);
+	c += print_filtered(buf + c, len - c, name);
 
 	board = dmi_get_system_info(DMI_BOARD_NAME);
 	if (board && *board) {
-		c += scnprintf(buf + c, len - c, "/");
+		if (name && *name)
+			c += scnprintf(buf + c, len - c, "/");
 		c += print_filtered(buf + c, len - c, board);
 	}
 	c += scnprintf(buf + c, len - c, ", BIOS ");

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

end of thread, other threads:[~2021-07-06  5:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06  5:26 [PATCH 0/2] firmware: dmi: Avoid (some) empty names in kernel log Maciej W. Rozycki
2021-07-06  5:27 ` [PATCH 1/2] firmware: dmi: Prevent empty board name from being logged Maciej W. Rozycki
2021-07-06  5:27 ` [PATCH 2/2] firmware: dmi: Log board vendor if no system vendor has been given Maciej W. Rozycki

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).