public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] DMI: log system, BIOS, and board information
@ 2010-09-30 16:49 Bjorn Helgaas
  2010-10-04 23:19 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2010-09-30 16:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: x86, linux-kernel, Alan Cox


Put basic system information in the dmesg log.  There are lots of dmesg
logs on the web, and it would be useful if they contained this information
for debugging platform problems.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---

 drivers/firmware/dmi_scan.c |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)


diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index b3d22d6..d625e53 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -2,6 +2,7 @@
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/ctype.h>
 #include <linux/dmi.h>
 #include <linux/efi.h>
 #include <linux/bootmem.h>
@@ -361,6 +362,36 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 	}
 }
 
+static const char * __init dmi_printable_system_info(int field)
+{
+	const char *info, *p;
+
+	info = dmi_get_system_info(field);
+	if (!info)
+		return NULL;
+
+	for (p = info; *p; p++)
+		if (!isprint(*p))
+			return "<...>";
+
+	return info;
+}
+
+static void __init dmi_dump_ids(void)
+{
+	const char *board;
+
+	printk(KERN_DEBUG "DMI: system: %s %s",
+	       dmi_printable_system_info(DMI_SYS_VENDOR),
+	       dmi_printable_system_info(DMI_PRODUCT_NAME));
+	board = dmi_printable_system_info(DMI_BOARD_NAME);
+	if (board)
+		printk(KERN_CONT " (%s board)", board);
+	printk(KERN_CONT ", BIOS: %s %s\n",
+	       dmi_printable_system_info(DMI_BIOS_VERSION),
+	       dmi_printable_system_info(DMI_BIOS_DATE));
+}
+
 static int __init dmi_present(const char __iomem *p)
 {
 	u8 buf[15];
@@ -381,8 +412,10 @@ static int __init dmi_present(const char __iomem *p)
 			       buf[14] >> 4, buf[14] & 0xF);
 		else
 			printk(KERN_INFO "DMI present.\n");
-		if (dmi_walk_early(dmi_decode) == 0)
+		if (dmi_walk_early(dmi_decode) == 0) {
+			dmi_dump_ids();
 			return 0;
+		}
 	}
 	return 1;
 }


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

end of thread, other threads:[~2010-10-05 14:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30 16:49 [PATCH v2] DMI: log system, BIOS, and board information Bjorn Helgaas
2010-10-04 23:19 ` Andrew Morton
2010-10-05  2:45   ` Bjorn Helgaas
2010-10-05  2:54     ` Andrew Morton
2010-10-05 14:02       ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox