From patchwork Mon Mar 8 17:38:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Chiang X-Patchwork-Id: 84108 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o28HclUY002701 for ; Mon, 8 Mar 2010 17:38:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754557Ab0CHRik (ORCPT ); Mon, 8 Mar 2010 12:38:40 -0500 Received: from g1t0029.austin.hp.com ([15.216.28.36]:1517 "EHLO g1t0029.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754382Ab0CHRij (ORCPT ); Mon, 8 Mar 2010 12:38:39 -0500 Received: from g1t0039.austin.hp.com (g1t0039.austin.hp.com [16.236.32.45]) by g1t0029.austin.hp.com (Postfix) with ESMTP id 47598380C3; Mon, 8 Mar 2010 17:38:39 +0000 (UTC) Received: from ldl (ldl.fc.hp.com [15.11.146.30]) by g1t0039.austin.hp.com (Postfix) with ESMTP id 1DFE734104; Mon, 8 Mar 2010 17:38:39 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id E1F1ACF0014; Mon, 8 Mar 2010 10:38:38 -0700 (MST) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SLiUJu9yZATN; Mon, 8 Mar 2010 10:38:38 -0700 (MST) Received: by ldl (Postfix, from userid 17609) id C9D68CF0009; Mon, 8 Mar 2010 10:38:38 -0700 (MST) Date: Mon, 8 Mar 2010 10:38:38 -0700 From: Alex Chiang To: Narendra K Cc: matt_domsch@dell.com, netdev@vger.kernel.org, linux-hotplug@vger.kernel.org, linux-pci@vger.kernel.org, jordan_hargrave@dell.com, sandeep_k_shandilya@dell.com, charles_rose@dell.com, shyam_iyer@dell.com Subject: Re: [PATCH] Export smbios strings associated with onboard devices to sysfs Message-ID: <20100308173838.GC20953@ldl.fc.hp.com> References: <20100225202941.GA19404@mock.linuxdev.us.dell.com> <20100225204905.GC20147@mdomsch-pws380.aus.amer.dell.com> <20100302173302.GA20936@mock.linuxdev.us.dell.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100302173302.GA20936@mock.linuxdev.us.dell.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 08 Mar 2010 17:38:47 +0000 (UTC) diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 5a81a8b..cb2a57a 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -314,6 +314,33 @@ 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 @@ -360,6 +387,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; } }