]> git.pld-linux.org Git - packages/kernel.git/blob - linux-dmi-decode-and-save-oem-string-information.patch
- added LED devices support
[packages/kernel.git] / linux-dmi-decode-and-save-oem-string-information.patch
1 Subject: DMI: Decode and save OEM String information
2 From: "Shem Multinymous" <multinymous@gmail.com>
3
4 This teaches dmi_decode() how to decode and save OEM Strings (type 11) DMI
5 information, which is currently discarded silently.  Existing code using
6 DMI is not affected.  Follows the "System Management BIOS (SMBIOS)
7 Specification" (http://www.dmtf.org/standards/smbios), and also the
8 userspace dmidecode.c code.
9
10 OEM Strings are the only safe way to identify some hardware, e.g., the
11 ThinkPad embedded controller used by the soon-to-be-submitted tp_smapi
12 driver.  This will also let us eliminate the long whitelist in the mainline
13 hdaps driver (in a future patch).
14
15 Signed-off-by: Shem Multinymous <multinymous@gmail.com>
16 Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
17 Signed-off-by: Andrew Morton <akpm@osdl.org>
18 ---
19
20  drivers/firmware/dmi_scan.c |   23 +++++++++++++++++++++++
21  include/linux/dmi.h         |    3 ++-
22  2 files changed, 25 insertions(+), 1 deletion(-)
23
24 diff -puN drivers/firmware/dmi_scan.c~dmi-decode-and-save-oem-string-information drivers/firmware/dmi_scan.c
25 --- a/drivers/firmware/dmi_scan.c~dmi-decode-and-save-oem-string-information
26 +++ a/drivers/firmware/dmi_scan.c
27 @@ -123,6 +123,26 @@ static void __init dmi_save_devices(stru
28                 dev->type = *d++ & 0x7f;
29                 dev->name = dmi_string(dm, *d);
30                 dev->device_data = NULL;
31 +               list_add(&dev->list, &dmi_devices);
32 +       }
33 +}
34 +
35 +static void __init dmi_save_oem_strings_devices(struct dmi_header *dm)
36 +{
37 +       int i, count = *(u8 *)(dm + 1);
38 +       struct dmi_device *dev;
39 +
40 +       for (i = 1; i <= count; i++) {
41 +               dev = dmi_alloc(sizeof(*dev));
42 +               if (!dev) {
43 +                       printk(KERN_ERR
44 +                          "dmi_save_oem_strings_devices: out of memory.\n");
45 +                       break;
46 +               }
47 +
48 +               dev->type = DMI_DEV_TYPE_OEM_STRING;
49 +               dev->name = dmi_string(dm, i);
50 +               dev->device_data = NULL;
51  
52                 list_add(&dev->list, &dmi_devices);
53         }
54 @@ -181,6 +201,9 @@ static void __init dmi_decode(struct dmi
55         case 10:        /* Onboard Devices Information */
56                 dmi_save_devices(dm);
57                 break;
58 +       case 11:        /* OEM Strings */
59 +               dmi_save_oem_strings_devices(dm);
60 +               break;
61         case 38:        /* IPMI Device Information */
62                 dmi_save_ipmi_device(dm);
63         }
64 diff -puN include/linux/dmi.h~dmi-decode-and-save-oem-string-information include/linux/dmi.h
65 --- a/include/linux/dmi.h~dmi-decode-and-save-oem-string-information
66 +++ a/include/linux/dmi.h
67 @@ -27,7 +27,8 @@ enum dmi_device_type {
68         DMI_DEV_TYPE_ETHERNET,
69         DMI_DEV_TYPE_TOKENRING,
70         DMI_DEV_TYPE_SOUND,
71 -       DMI_DEV_TYPE_IPMI = -1
72 +       DMI_DEV_TYPE_IPMI = -1,
73 +       DMI_DEV_TYPE_OEM_STRING = -2
74  };
75  
76  struct dmi_header {
77 _
This page took 0.026631 seconds and 3 git commands to generate.