]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Check dmi version when get system uuid
authorZhenzhong Duan <zhenzhong.duan@oracle.com>
Wed, 11 Jul 2012 04:02:57 +0000 (12:02 +0800)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Thu, 16 Aug 2012 09:12:58 +0000 (02:12 -0700)
Orabug: 14267379
As of version 2.6 of the SMBIOS specification, the first 3
fields of the UUID are supposed to be encoded on little-endian.

Also a minor fix to match variable meaning and mute checkpatch.pl

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
drivers/firmware/dmi_scan.c

index bcb1126e3d00b2357a0c5748edbd8b1b470c0423..665656d036c45cf8bb3abc4efc3e761c13122671 100644 (file)
@@ -15,6 +15,7 @@
  */
 static char dmi_empty_string[] = "        ";
 
+static u16  __initdata dmi_ver;
 /*
  * Catch too early calls to dmi_check_system():
  */
@@ -158,8 +159,10 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
                return;
 
        for (i = 0; i < 16 && (is_ff || is_00); i++) {
-               if(d[i] != 0x00) is_ff = 0;
-               if(d[i] != 0xFF) is_00 = 0;
+               if (d[i] != 0x00)
+                       is_00 = 0;
+               if (d[i] != 0xFF)
+                       is_ff = 0;
        }
 
        if (is_ff || is_00)
@@ -169,7 +172,16 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
        if (!s)
                return;
 
-       sprintf(s, "%pUB", d);
+       /*
+        * As of version 2.6 of the SMBIOS specification, the first 3
+        * fields of the UUID are supposed to be encoded on little-endian.
+        * The specification says that this is the defacto standard,
+        * update kernel code to match dmidecode data.
+       */
+       if (dmi_ver >= 0x0206)
+               sprintf(s, "%pUL", d);
+       else
+               sprintf(s, "%pUB", d);
 
         dmi_ident[slot] = s;
 }
@@ -411,6 +423,7 @@ static int __init dmi_present(const char __iomem *p)
                 * DMI version 0.0 means that the real version is taken from
                 * the SMBIOS version, which we don't know at this point.
                 */
+               dmi_ver = (buf[14] & 0xf0) << 4 | (buf[14] & 0x0f);
                if (buf[14] != 0)
                        printk(KERN_INFO "DMI %d.%d present.\n",
                               buf[14] >> 4, buf[14] & 0xF);