public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] support to overwrite DMI board info
@ 2010-09-28 12:36 Alan Cox
  2010-09-29 10:10 ` Éric Piel
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2010-09-28 12:36 UTC (permalink / raw)
  To: linux-kernel, x86

From: Jiang, Chao <chao.jiang@intel.com>

support to overwrite board vendor/version/name information by editing
/boot/cmdline file. Format example:
	board_vendor="XXX company" board_version=DV3.0


Signed-off-by: Jiang, Chao <chao.jiang@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---

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


diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index b3d22d6..5763618 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -712,3 +712,40 @@ bool dmi_match(enum dmi_field f, const char *str)
 	return !strcmp(info, str);
 }
 EXPORT_SYMBOL_GPL(dmi_match);
+
+static int __init dmi_override(int slot, char *str)
+{
+	size_t len;
+	char *p;
+	if (!str)
+		return -EINVAL;
+	len = strlen(str) + 1;
+	p = dmi_alloc(len);
+	if (p != NULL)
+		strcpy(p, str);
+	else {
+		printk(KERN_ERR "dm_override: cannot allocate %Zu bytes.\n",
+					len);
+		return -ENOMEM;
+	}
+	dmi_ident[slot] = p;
+	return 0;
+}
+
+static int __init override_dmi_board_vendor(char *str)
+{
+	return dmi_override(DMI_BOARD_VENDOR, str);
+}
+early_param("board_vendor", override_dmi_board_vendor);
+
+static int __init override_dmi_board_version(char *str)
+{
+	return dmi_override(DMI_BOARD_VERSION, str);
+}
+early_param("board_version", override_dmi_board_version);
+
+static int __init override_dmi_board_name(char *str)
+{
+	return dmi_override(DMI_BOARD_NAME, str);
+}
+early_param("board_name", override_dmi_board_name);


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

* Re: [PATCH] support to overwrite DMI board info
  2010-09-28 12:36 Alan Cox
@ 2010-09-29 10:10 ` Éric Piel
  0 siblings, 0 replies; 3+ messages in thread
From: Éric Piel @ 2010-09-29 10:10 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, x86

Op 28-09-10 14:36, Alan Cox schreef:
> From: Jiang, Chao<chao.jiang@intel.com>
>
> support to overwrite board vendor/version/name information by editing
> /boot/cmdline file. Format example:
> 	board_vendor="XXX company" board_version=DV3.0
>
3 new boot parameters... How about also updating 
Documentation/kernel-parameters.txt to explain what they do without 
users having to read the git changelog?

Cheers,
Eric

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

* [PATCH] support to overwrite DMI board info
@ 2010-09-30 14:39 Alan Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2010-09-30 14:39 UTC (permalink / raw)
  To: linux-kernel, x86

From: Jiang, Chao <chao.jiang@intel.com>

support to overwrite board vendor/version/name information by editing
/boot/cmdline file. Format example:
	board_vendor="XXX company" board_version=DV3.0


Signed-off-by: Jiang, Chao <chao.jiang@intel.com>
[Added Documentation as requested]
Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 Documentation/kernel-parameters.txt |   16 +++++++++++++++
 drivers/firmware/dmi_scan.c         |   37 +++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 0 deletions(-)


diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 9139a2d..fb1b606 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -43,6 +43,7 @@ parameter is applicable:
 	AVR32	AVR32 architecture is enabled.
 	AX25	Appropriate AX.25 support is enabled.
 	BLACKFIN Blackfin architecture is enabled.
+	DMI	Desktop Management Interface is enabled
 	EDD	BIOS Enhanced Disk Drive Services (EDD) is enabled
 	EFI	EFI Partitioning (GPT) is enabled
 	EIDE	EIDE/ATAPI support is enabled.
@@ -390,6 +391,21 @@ and is between 256 and 4096 characters. It is defined in the file
 			Format: <io>,<irq>,<mode>
 			See header of drivers/net/hamradio/baycom_ser_hdx.c.
 
+	board_name=	[DMI]
+			Override reported name in firmware DMI data. Used
+			for testing and for checking board specific
+			workarounds
+
+	board_vendor=	[DMI]
+			Override reported vendor in firmware DMI data. Used
+			for testing and for checking board specific
+			workarounds
+
+	board_version=	[DMI]
+			Override reported version in firmware DMI data. Used
+			for testing and for checking board specific
+			workarounds
+
 	boot_delay=	Milliseconds to delay each printk during boot.
 			Values larger than 10 seconds (10000) are changed to
 			no delay (0).
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index b3d22d6..5763618 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -712,3 +712,40 @@ bool dmi_match(enum dmi_field f, const char *str)
 	return !strcmp(info, str);
 }
 EXPORT_SYMBOL_GPL(dmi_match);
+
+static int __init dmi_override(int slot, char *str)
+{
+	size_t len;
+	char *p;
+	if (!str)
+		return -EINVAL;
+	len = strlen(str) + 1;
+	p = dmi_alloc(len);
+	if (p != NULL)
+		strcpy(p, str);
+	else {
+		printk(KERN_ERR "dm_override: cannot allocate %Zu bytes.\n",
+					len);
+		return -ENOMEM;
+	}
+	dmi_ident[slot] = p;
+	return 0;
+}
+
+static int __init override_dmi_board_vendor(char *str)
+{
+	return dmi_override(DMI_BOARD_VENDOR, str);
+}
+early_param("board_vendor", override_dmi_board_vendor);
+
+static int __init override_dmi_board_version(char *str)
+{
+	return dmi_override(DMI_BOARD_VERSION, str);
+}
+early_param("board_version", override_dmi_board_version);
+
+static int __init override_dmi_board_name(char *str)
+{
+	return dmi_override(DMI_BOARD_NAME, str);
+}
+early_param("board_name", override_dmi_board_name);


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

end of thread, other threads:[~2010-09-30 15:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30 14:39 [PATCH] support to overwrite DMI board info Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2010-09-28 12:36 Alan Cox
2010-09-29 10:10 ` Éric Piel

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