Home Home > GIT Browse > vanilla
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2013-04-24 18:03:34 +0200
committerJiri Kosina <jkosina@suse.cz>2013-04-25 14:25:38 +0200
commitd7ec0db23280885cf75e9e5713c88826508083bb (patch)
treec72faf9738d81707f8e712622a2d05e00751faff
parentd43c92d71244f76a97f48ce09fd3982621edd4b1 (diff)
- patches.kernel.org/revert-dmi_scan-changes-1.patch:rpm-3.0.74-0.6.6
Revert "dmi_scan: fix missing check for _DMI_ signature in smbios_present()". - patches.kernel.org/revert-dmi_scan-changes-2.patch: Revert "drivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists". - patches.kernel.org/revert-dmi_scan-changes-3.patch: Revert "drivers/firmware/dmi_scan.c: check dmi version when get system uuid". suse-commit: 395d7341e4701d73c2405a0a2590ab3e54b9b35d
-rw-r--r--drivers/firmware/dmi_scan.c77
1 files changed, 17 insertions, 60 deletions
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index fcd3b9e3b2ce..f1e0293b31e3 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -16,7 +16,6 @@
*/
static char dmi_empty_string[] = " ";
-static u16 __initdata dmi_ver;
/*
* Catch too early calls to dmi_check_system():
*/
@@ -119,12 +118,12 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
return 0;
}
-static int __init dmi_checksum(const u8 *buf, u8 len)
+static int __init dmi_checksum(const u8 *buf)
{
u8 sum = 0;
int a;
- for (a = 0; a < len; a++)
+ for (a = 0; a < 15; a++)
sum += buf[a];
return sum == 0;
@@ -162,10 +161,8 @@ 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_00 = 0;
- if (d[i] != 0xFF)
- is_ff = 0;
+ if(d[i] != 0x00) is_ff = 0;
+ if(d[i] != 0xFF) is_00 = 0;
}
if (is_ff || is_00)
@@ -175,15 +172,7 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
if (!s)
return;
- /*
- * As of version 2.6 of the SMBIOS specification, the first 3 fields of
- * the UUID are supposed to be little-endian encoded. The specification
- * says that this is the defacto standard.
- */
- if (dmi_ver >= 0x0206)
- sprintf(s, "%pUL", d);
- else
- sprintf(s, "%pUB", d);
+ sprintf(s, "%pUB", d);
dmi_ident[slot] = s;
}
@@ -415,53 +404,26 @@ static int __init dmi_present(const char __iomem *p)
u8 buf[15];
memcpy_fromio(buf, p, 15);
- if (dmi_checksum(buf, 15)) {
+ if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) {
dmi_num = (buf[13] << 8) | buf[12];
dmi_len = (buf[7] << 8) | buf[6];
dmi_base = (buf[11] << 24) | (buf[10] << 16) |
(buf[9] << 8) | buf[8];
+ /*
+ * DMI version 0.0 means that the real version is taken from
+ * the SMBIOS version, which we don't know at this point.
+ */
+ if (buf[14] != 0)
+ printk(KERN_INFO "DMI %d.%d present.\n",
+ buf[14] >> 4, buf[14] & 0xF);
+ else
+ printk(KERN_INFO "DMI present.\n");
if (dmi_walk_early(dmi_decode) == 0) {
- if (dmi_ver)
- pr_info("SMBIOS %d.%d present.\n",
- dmi_ver >> 8, dmi_ver & 0xFF);
- else {
- dmi_ver = (buf[14] & 0xF0) << 4 |
- (buf[14] & 0x0F);
- pr_info("Legacy DMI %d.%d present.\n",
- dmi_ver >> 8, dmi_ver & 0xFF);
- }
dmi_dump_ids();
return 0;
}
}
- dmi_ver = 0;
- return 1;
-}
-
-static int __init smbios_present(const char __iomem *p)
-{
- u8 buf[32];
-
- memcpy_fromio(buf, p, 32);
- if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) {
- dmi_ver = (buf[6] << 8) + buf[7];
-
- /* Some BIOS report weird SMBIOS version, fix that up */
- switch (dmi_ver) {
- case 0x021F:
- case 0x0221:
- pr_debug("SMBIOS version fixup(2.%d->2.%d)\n",
- dmi_ver & 0xFF, 3);
- dmi_ver = 0x0203;
- break;
- case 0x0233:
- pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", 51, 6);
- dmi_ver = 0x0206;
- break;
- }
- return memcmp(p + 16, "_DMI_", 5) || dmi_present(p + 16);
- }
return 1;
}
@@ -482,7 +444,7 @@ void __init dmi_scan_machine(void)
if (p == NULL)
goto error;
- rc = smbios_present(p);
+ rc = dmi_present(p + 0x10); /* offset of _DMI_ string */
dmi_iounmap(p, 32);
if (!rc) {
dmi_available = 1;
@@ -500,12 +462,7 @@ void __init dmi_scan_machine(void)
goto error;
for (q = p; q < p + 0x10000; q += 16) {
- if (memcmp(q, "_SM_", 4) == 0 && q - p <= 0xFFE0)
- rc = smbios_present(q);
- else if (memcmp(q, "_DMI_", 5) == 0)
- rc = dmi_present(q);
- else
- continue;
+ rc = dmi_present(q);
if (!rc) {
dmi_available = 1;
dmi_iounmap(p, 0x10000);