From patchwork Fri May 28 12:06:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narendra K X-Patchwork-Id: 53904 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 30DFDB7D20 for ; Sat, 29 May 2010 00:09:29 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757273Ab0E1OJX (ORCPT ); Fri, 28 May 2010 10:09:23 -0400 Received: from ausxippc101.us.dell.com ([143.166.85.207]:5421 "EHLO ausxippc101.us.dell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755533Ab0E1OJW convert rfc822-to-8bit (ORCPT ); Fri, 28 May 2010 10:09:22 -0400 X-LoopCount1: from 10.9.160.253 From: "K, Narendra" 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" Date: Fri, 28 May 2010 07:06:45 -0500 Subject: [PATCH 2/2] dmi: save OEM defined slot information Thread-Topic: [PATCH 2/2] dmi: save OEM defined slot information Thread-Index: Acr+XsCiypeE0bzfSISjQe6XAoYdbw== Message-ID: <20100528120644.GB24114@littleblue.us.dell.com> Accept-Language: en-US Content-Language: en-US X-MS-Exchange-Organization-AuthAs: Internal X-MS-Exchange-Organization-AuthMechanism: 0b X-MS-Exchange-Organization-AuthSource: AUSX7HPC101.AMER.DELL.COM X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originalarrivaltime: 28 May 2010 12:06:46.0183 (UTC) FILETIME=[3E76BB70:01CAFE5E] x-loopcount0: from 10.9.160.253 user-agent: Mutt/1.4.2.2i MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hello, This patch from Alex Chiang exports onboard device information as defined by SMBIOS type 209 for HP Proliants systems. From: Alex Chiang 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 --- 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; } }