From: Erwan Velu <erwanaliasr1@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: erwanaliasr1@gmail.com, Erwan Velu <e.velu@criteo.com>,
Jean Delvare <jdelvare@suse.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] firmware/dmi: Print product serial number if any
Date: Mon, 3 Oct 2022 16:24:00 +0200 [thread overview]
Message-ID: <20221003142400.1177057-1-e.velu@criteo.com> (raw)
During the boot sequence, the kernel prints a string to identify the
running host. This is pretty handy to estimate the underlying hardware
in case of early crash.
This patch add the product serial number in this reporting if any got found,
or keep the current string. In a large fleet of servers, this
information could be useful to identify the host that generated a given trace.
Test ran with the following command : qemu-system-x86_64 -kernel arch/x86/boot/bzImage --enable-kvm -m 512 -serial stdio -append 'console=ttyS0' -smbios type=1,serial=R90YT7WC
Prior the patch:
[ 0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014
With the patch:
[ 0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014, SN: R90YT7WC
Signed-off-by: Erwan Velu <e.velu@criteo.com>
---
drivers/firmware/dmi_scan.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 0eb6b617f709..601e003c67f4 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -536,6 +536,7 @@ static void __init dmi_format_ids(char *buf, size_t len)
{
int c = 0;
const char *board; /* Board Name is optional */
+ const char *product_serial; /* Product serial is optional */
c += print_filtered(buf + c, len - c,
dmi_get_system_info(DMI_SYS_VENDOR));
@@ -554,6 +555,14 @@ static void __init dmi_format_ids(char *buf, size_t len)
c += scnprintf(buf + c, len - c, " ");
c += print_filtered(buf + c, len - c,
dmi_get_system_info(DMI_BIOS_DATE));
+
+ product_serial = dmi_get_system_info(DMI_PRODUCT_SERIAL);
+ if (product_serial) {
+ if (strlen(product_serial)) {
+ c += scnprintf(buf + c, len - c, ", SN: ");
+ c += print_filtered(buf + c, len - c, product_serial);
+ }
+ }
}
/*
--
2.37.3
next reply other threads:[~2022-10-03 14:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 14:24 Erwan Velu [this message]
2022-10-12 11:59 ` Jean Delvare
2022-10-12 12:11 ` Erwan Velu
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=20221003142400.1177057-1-e.velu@criteo.com \
--to=erwanaliasr1@gmail.com \
--cc=e.velu@criteo.com \
--cc=jdelvare@suse.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®