All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] dmi: save OEM defined slot information
@ 2010-05-28 12:06 ` K, Narendra
  0 siblings, 0 replies; 4+ messages in thread
From: K, Narendra @ 2010-05-28 12:06 UTC (permalink / raw)
  To: netdev@vger.kernel.org, linux-hotplug@vger.kernel.org,
	linux-pci@vger.kernel.org
  Cc: achiang@hp.com, Domsch, Matt, Hargrave, Jordan, Rose, Charles,
	Nijhawan, Vijay

Hello,

This patch from Alex Chiang exports onboard device information as defined by 
SMBIOS type 209 for HP Proliants systems.


From: Alex Chiang <achiang@hp.com>

Some legacy platforms provide onboard device information in an SMBIOS OEM-
defined field, notably HP Proliants.

This information can be used to provide information to userspace that allows
correlation between a Linux PCI device and a chassis label.

Save this information so that it can be exposed to userspace. We choose the
string "Embedded NIC %d" since there are known platforms from other vendors
(Dell) that provide a string in this format for their onboard NICs (although
theirs is provided by a Type 41 record). This consistency will help simplify
life for userspace tools.

Only support HP platforms for now. If we need support for another vendor in
the future, we can write a fancier implementation then.

This code was inspired by the implementation in the userspace dmidecode tool,
which was originally written by John Cagle.

Signed-off-by: Alex Chiang <achiang@hp.com>
---
 drivers/firmware/dmi_scan.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 7d8439b..291b876 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -311,6 +311,32 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 	dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
 }
 
+static void __init dmi_save_oem_devices(const struct dmi_header *dm) {
+	int bus, devfn, count;
+	const u8 *d = (u8 *)dm + 4;
+	char name[20];
+
+	/* Only handle HP extensions for now */
+	if (strcmp(dmi_ident[DMI_BIOS_VENDOR], "HP"))
+		return;
+
+	count = 1;
+	while ((d + 8) <= ((u8 *)dm + dm->length)) {
+		if ((*d = 0x00 && *(d + 1) = 0x00) ||
+		    (*d = 0xff && *(d + 1) = 0xff))
+			goto next;
+
+		bus = *(d + 1);
+		devfn = *d;
+		sprintf(name, "Embedded NIC %d", count);
+		dmi_save_devslot(-1, 0, bus, devfn, name);
+
+next:
+		count++;
+		d += 8;
+	}
+}
+
 /*
  *	Process a DMI table entry. Right now all we care about are the BIOS
  *	and machine entries. For 2.5 we should pull the smbus controller info
@@ -357,6 +383,9 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 	case 41:	/* Onboard Devices Extended Information */
 		dmi_save_extended_devices(dm);
 		break;
+	case 209:
+		dmi_save_oem_devices(dm);
+		break;
 	}
 }
 
-- 
1.6.5.2


With regards,
Narendra K

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

* [PATCH 2/2] dmi: save OEM defined slot information
@ 2010-05-28 12:06 ` K, Narendra
  0 siblings, 0 replies; 4+ messages in thread
From: K, Narendra @ 2010-05-28 12:06 UTC (permalink / raw)
  To: netdev@vger.kernel.org, linux-hotplug@vger.kernel.org,
	linux-pci@vger.kernel.org
  Cc: achiang@hp.com, Domsch, Matt, Hargrave, Jordan, Rose, Charles,
	Nijhawan, Vijay

Hello,

This patch from Alex Chiang exports onboard device information as defined by 
SMBIOS type 209 for HP Proliants systems.


From: Alex Chiang <achiang@hp.com>

Some legacy platforms provide onboard device information in an SMBIOS OEM-
defined field, notably HP Proliants.

This information can be used to provide information to userspace that allows
correlation between a Linux PCI device and a chassis label.

Save this information so that it can be exposed to userspace. We choose the
string "Embedded NIC %d" since there are known platforms from other vendors
(Dell) that provide a string in this format for their onboard NICs (although
theirs is provided by a Type 41 record). This consistency will help simplify
life for userspace tools.

Only support HP platforms for now. If we need support for another vendor in
the future, we can write a fancier implementation then.

This code was inspired by the implementation in the userspace dmidecode tool,
which was originally written by John Cagle.

Signed-off-by: Alex Chiang <achiang@hp.com>
---
 drivers/firmware/dmi_scan.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 7d8439b..291b876 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -311,6 +311,32 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 	dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
 }
 
+static void __init dmi_save_oem_devices(const struct dmi_header *dm) {
+	int bus, devfn, count;
+	const u8 *d = (u8 *)dm + 4;
+	char name[20];
+
+	/* Only handle HP extensions for now */
+	if (strcmp(dmi_ident[DMI_BIOS_VENDOR], "HP"))
+		return;
+
+	count = 1;
+	while ((d + 8) <= ((u8 *)dm + dm->length)) {
+		if ((*d == 0x00 && *(d + 1) == 0x00) ||
+		    (*d == 0xff && *(d + 1) == 0xff))
+			goto next;
+
+		bus = *(d + 1);
+		devfn = *d;
+		sprintf(name, "Embedded NIC %d", count);
+		dmi_save_devslot(-1, 0, bus, devfn, name);
+
+next:
+		count++;
+		d += 8;
+	}
+}
+
 /*
  *	Process a DMI table entry. Right now all we care about are the BIOS
  *	and machine entries. For 2.5 we should pull the smbus controller info
@@ -357,6 +383,9 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 	case 41:	/* Onboard Devices Extended Information */
 		dmi_save_extended_devices(dm);
 		break;
+	case 209:
+		dmi_save_oem_devices(dm);
+		break;
 	}
 }
 
-- 
1.6.5.2


With regards,
Narendra K

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

* Re: [PATCH 2/2] dmi: save OEM defined slot information
  2010-05-28 12:06 ` K, Narendra
@ 2010-05-28 15:42   ` Alex Chiang
  -1 siblings, 0 replies; 4+ messages in thread
From: Alex Chiang @ 2010-05-28 15:42 UTC (permalink / raw)
  To: K, Narendra
  Cc: netdev@vger.kernel.org, linux-hotplug@vger.kernel.org,
	linux-pci@vger.kernel.org, Domsch, Matt, Hargrave, Jordan,
	Rose, Charles, Nijhawan, Vijay

* K, Narendra <Narendra_K@dell.com>:
> 
> This patch from Alex Chiang exports onboard device information
> as defined by SMBIOS type 209 for HP Proliants systems.

Hi,

Not sure if it really matters, but I'm no longer at HP and thus
my email address below is dead.

> From: Alex Chiang <achiang@hp.com>
> 
> Some legacy platforms provide onboard device information in an
> SMBIOS OEM- defined field, notably HP Proliants.

[snip] 
 
> Signed-off-by: Alex Chiang <achiang@hp.com>

I wrote this code when I was still at HP, so I suppose they
should get the git commit "credit" for it, unless there's already
a well-known convention of what to do when an email address
changes.

Thanks,
/ac

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

* Re: [PATCH 2/2] dmi: save OEM defined slot information
@ 2010-05-28 15:42   ` Alex Chiang
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Chiang @ 2010-05-28 15:42 UTC (permalink / raw)
  To: K, Narendra
  Cc: netdev@vger.kernel.org, linux-hotplug@vger.kernel.org,
	linux-pci@vger.kernel.org, Domsch, Matt, Hargrave, Jordan,
	Rose, Charles, Nijhawan, Vijay

* K, Narendra <Narendra_K@dell.com>:
> 
> This patch from Alex Chiang exports onboard device information
> as defined by SMBIOS type 209 for HP Proliants systems.

Hi,

Not sure if it really matters, but I'm no longer at HP and thus
my email address below is dead.

> From: Alex Chiang <achiang@hp.com>
> 
> Some legacy platforms provide onboard device information in an
> SMBIOS OEM- defined field, notably HP Proliants.

[snip] 
 
> Signed-off-by: Alex Chiang <achiang@hp.com>

I wrote this code when I was still at HP, so I suppose they
should get the git commit "credit" for it, unless there's already
a well-known convention of what to do when an email address
changes.

Thanks,
/ac

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-28 12:06 [PATCH 2/2] dmi: save OEM defined slot information K, Narendra
2010-05-28 12:06 ` K, Narendra
2010-05-28 15:42 ` Alex Chiang
2010-05-28 15:42   ` Alex Chiang

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.