aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorZhenzhong Duan <zhenzhong.duan@oracle.com>2012-12-20 18:05:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-20 20:40:19 -0500
commitf1d8e614d74b09531b9a85e812485340f3df7b1c (patch)
tree14fb8e41dafbd1923835e0f7aaf3e7a71261d76a /drivers/firmware
parent038b358e5592eff9be175cf6601042ecc8b28179 (diff)
drivers/firmware/dmi_scan.c: check dmi version when get system uuid
As of version 2.6 of the SMBIOS specification, the first 3 fields of the UUID are supposed to be little-endian encoded. Also a minor fix to match variable meaning and mute checkpatch.pl [akpm@linux-foundation.org: tweak code comment] Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com> Cc: Feng Jin <joe.jin@oracle.com> Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/dmi_scan.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index b298158cb922..3714e3c03df6 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -16,6 +16,7 @@
16 */ 16 */
17static char dmi_empty_string[] = " "; 17static char dmi_empty_string[] = " ";
18 18
19static u16 __initdata dmi_ver;
19/* 20/*
20 * Catch too early calls to dmi_check_system(): 21 * Catch too early calls to dmi_check_system():
21 */ 22 */
@@ -161,8 +162,10 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
161 return; 162 return;
162 163
163 for (i = 0; i < 16 && (is_ff || is_00); i++) { 164 for (i = 0; i < 16 && (is_ff || is_00); i++) {
164 if(d[i] != 0x00) is_ff = 0; 165 if (d[i] != 0x00)
165 if(d[i] != 0xFF) is_00 = 0; 166 is_00 = 0;
167 if (d[i] != 0xFF)
168 is_ff = 0;
166 } 169 }
167 170
168 if (is_ff || is_00) 171 if (is_ff || is_00)
@@ -172,7 +175,15 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
172 if (!s) 175 if (!s)
173 return; 176 return;
174 177
175 sprintf(s, "%pUB", d); 178 /*
179 * As of version 2.6 of the SMBIOS specification, the first 3 fields of
180 * the UUID are supposed to be little-endian encoded. The specification
181 * says that this is the defacto standard.
182 */
183 if (dmi_ver >= 0x0206)
184 sprintf(s, "%pUL", d);
185 else
186 sprintf(s, "%pUB", d);
176 187
177 dmi_ident[slot] = s; 188 dmi_ident[slot] = s;
178} 189}
@@ -414,6 +425,7 @@ static int __init dmi_present(const char __iomem *p)
414 * DMI version 0.0 means that the real version is taken from 425 * DMI version 0.0 means that the real version is taken from
415 * the SMBIOS version, which we don't know at this point. 426 * the SMBIOS version, which we don't know at this point.
416 */ 427 */
428 dmi_ver = (buf[14] & 0xf0) << 4 | (buf[14] & 0x0f);
417 if (buf[14] != 0) 429 if (buf[14] != 0)
418 printk(KERN_INFO "DMI %d.%d present.\n", 430 printk(KERN_INFO "DMI %d.%d present.\n",
419 buf[14] >> 4, buf[14] & 0xF); 431 buf[14] >> 4, buf[14] & 0xF);