These patches correct dmi version print for BE SoCs and include docrev field of SMBIOS3 to dmi version var.
Ivan Khoronzhuk (2): firmware: dmi_scan: correct BE dmi version print firmware: dmi_scan: use full dmi version for SMBIOS3
drivers/firmware/dmi_scan.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-)
In case of BE the dmi version can be displayed like 8.2 instead of 2.8. This patch correct it.
Signed-off-by: Ivan Khoronzhuk ivan.khoronzhuk@linaro.org --- drivers/firmware/dmi_scan.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index c5f7b4e..657ae0c 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -469,6 +469,7 @@ static void __init dmi_format_ids(char *buf, size_t len) */ static int __init dmi_present(const u8 *buf) { + const u8 *dbuf; int smbios_ver;
if (memcmp(buf, "_SM_", 4) == 0 && @@ -492,23 +493,23 @@ static int __init dmi_present(const u8 *buf) smbios_ver = 0; }
- buf += 16; + dbuf = buf + 16;
- if (memcmp(buf, "_DMI_", 5) == 0 && dmi_checksum(buf, 15)) { - dmi_num = get_unaligned_le16(buf + 12); - dmi_len = get_unaligned_le16(buf + 6); - dmi_base = get_unaligned_le32(buf + 8); + if (memcmp(dbuf, "_DMI_", 5) == 0 && dmi_checksum(dbuf, 15)) { + dmi_num = get_unaligned_le16(dbuf + 12); + dmi_len = get_unaligned_le16(dbuf + 6); + dmi_base = get_unaligned_le32(dbuf + 8);
if (dmi_walk_early(dmi_decode) == 0) { if (smbios_ver) { dmi_ver = smbios_ver; pr_info("SMBIOS %d.%d present.\n", - dmi_ver >> 8, dmi_ver & 0xFF); + buf[6], buf[7]); } else { - dmi_ver = (buf[14] & 0xF0) << 4 | - (buf[14] & 0x0F); + dmi_ver = (dbuf[14] & 0xF0) << 4 | + (dbuf[14] & 0x0F); pr_info("Legacy DMI %d.%d present.\n", - dmi_ver >> 8, dmi_ver & 0xFF); + dbuf[14] >> 4, dbuf[14] & 0x0F); } dmi_format_ids(dmi_ids_string, sizeof(dmi_ids_string)); printk(KERN_DEBUG "DMI: %s\n", dmi_ids_string); @@ -544,8 +545,7 @@ static int __init dmi_smbios3_present(const u8 *buf) dmi_num = dmi_len / 4;
if (dmi_walk_early(dmi_decode) == 0) { - pr_info("SMBIOS %d.%d present.\n", - dmi_ver >> 8, dmi_ver & 0xFF); + pr_info("SMBIOS %d.%d present.\n", buf[7], buf[8]); dmi_format_ids(dmi_ids_string, sizeof(dmi_ids_string)); pr_debug("DMI: %s\n", dmi_ids_string); return 0;
On 20 January 2015 at 20:30, Ivan Khoronzhuk ivan.khoronzhuk@linaro.org wrote:
In case of BE the dmi version can be displayed like 8.2 instead of 2.8. This patch correct it.
Are you sure we need this? The DMI/SMBIOS version is read using get_unaligned_beXX(), which should take care of the swabbing.
Signed-off-by: Ivan Khoronzhuk ivan.khoronzhuk@linaro.org
drivers/firmware/dmi_scan.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index c5f7b4e..657ae0c 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -469,6 +469,7 @@ static void __init dmi_format_ids(char *buf, size_t len) */ static int __init dmi_present(const u8 *buf) {
const u8 *dbuf; int smbios_ver; if (memcmp(buf, "_SM_", 4) == 0 &&
@@ -492,23 +493,23 @@ static int __init dmi_present(const u8 *buf) smbios_ver = 0; }
buf += 16;
dbuf = buf + 16;
if (memcmp(buf, "_DMI_", 5) == 0 && dmi_checksum(buf, 15)) {
dmi_num = get_unaligned_le16(buf + 12);
dmi_len = get_unaligned_le16(buf + 6);
dmi_base = get_unaligned_le32(buf + 8);
if (memcmp(dbuf, "_DMI_", 5) == 0 && dmi_checksum(dbuf, 15)) {
dmi_num = get_unaligned_le16(dbuf + 12);
dmi_len = get_unaligned_le16(dbuf + 6);
dmi_base = get_unaligned_le32(dbuf + 8); if (dmi_walk_early(dmi_decode) == 0) { if (smbios_ver) { dmi_ver = smbios_ver; pr_info("SMBIOS %d.%d present.\n",
dmi_ver >> 8, dmi_ver & 0xFF);
buf[6], buf[7]); } else {
dmi_ver = (buf[14] & 0xF0) << 4 |
(buf[14] & 0x0F);
dmi_ver = (dbuf[14] & 0xF0) << 4 |
(dbuf[14] & 0x0F); pr_info("Legacy DMI %d.%d present.\n",
dmi_ver >> 8, dmi_ver & 0xFF);
dbuf[14] >> 4, dbuf[14] & 0x0F); } dmi_format_ids(dmi_ids_string, sizeof(dmi_ids_string)); printk(KERN_DEBUG "DMI: %s\n", dmi_ids_string);
@@ -544,8 +545,7 @@ static int __init dmi_smbios3_present(const u8 *buf) dmi_num = dmi_len / 4;
if (dmi_walk_early(dmi_decode) == 0) {
pr_info("SMBIOS %d.%d present.\n",
dmi_ver >> 8, dmi_ver & 0xFF);
pr_info("SMBIOS %d.%d present.\n", buf[7], buf[8]); dmi_format_ids(dmi_ids_string, sizeof(dmi_ids_string)); pr_debug("DMI: %s\n", dmi_ids_string); return 0;
-- 1.9.1
Linaro-uefi mailing list Linaro-uefi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-uefi
On 01/21/2015 10:59 AM, Ard Biesheuvel wrote:
On 20 January 2015 at 20:30, Ivan Khoronzhuk ivan.khoronzhuk@linaro.org wrote:
In case of BE the dmi version can be displayed like 8.2 instead of 2.8. This patch correct it.
Are you sure we need this? The DMI/SMBIOS version is read using get_unaligned_beXX(), which should take care of the swabbing.
Oh yes. It's not a pointer. Sorry. Ignore this patch
Signed-off-by: Ivan Khoronzhuk ivan.khoronzhuk@linaro.org
drivers/firmware/dmi_scan.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index c5f7b4e..657ae0c 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -469,6 +469,7 @@ static void __init dmi_format_ids(char *buf, size_t len) */ static int __init dmi_present(const u8 *buf) {
const u8 *dbuf; int smbios_ver; if (memcmp(buf, "_SM_", 4) == 0 &&
@@ -492,23 +493,23 @@ static int __init dmi_present(const u8 *buf) smbios_ver = 0; }
buf += 16;
dbuf = buf + 16;
if (memcmp(buf, "_DMI_", 5) == 0 && dmi_checksum(buf, 15)) {
dmi_num = get_unaligned_le16(buf + 12);
dmi_len = get_unaligned_le16(buf + 6);
dmi_base = get_unaligned_le32(buf + 8);
if (memcmp(dbuf, "_DMI_", 5) == 0 && dmi_checksum(dbuf, 15)) {
dmi_num = get_unaligned_le16(dbuf + 12);
dmi_len = get_unaligned_le16(dbuf + 6);
dmi_base = get_unaligned_le32(dbuf + 8); if (dmi_walk_early(dmi_decode) == 0) { if (smbios_ver) { dmi_ver = smbios_ver; pr_info("SMBIOS %d.%d present.\n",
dmi_ver >> 8, dmi_ver & 0xFF);
buf[6], buf[7]); } else {
dmi_ver = (buf[14] & 0xF0) << 4 |
(buf[14] & 0x0F);
dmi_ver = (dbuf[14] & 0xF0) << 4 |
(dbuf[14] & 0x0F); pr_info("Legacy DMI %d.%d present.\n",
dmi_ver >> 8, dmi_ver & 0xFF);
dbuf[14] >> 4, dbuf[14] & 0x0F); } dmi_format_ids(dmi_ids_string, sizeof(dmi_ids_string)); printk(KERN_DEBUG "DMI: %s\n", dmi_ids_string);
@@ -544,8 +545,7 @@ static int __init dmi_smbios3_present(const u8 *buf) dmi_num = dmi_len / 4;
if (dmi_walk_early(dmi_decode) == 0) {
pr_info("SMBIOS %d.%d present.\n",
dmi_ver >> 8, dmi_ver & 0xFF);
pr_info("SMBIOS %d.%d present.\n", buf[7], buf[8]); dmi_format_ids(dmi_ids_string, sizeof(dmi_ids_string)); pr_debug("DMI: %s\n", dmi_ids_string); return 0;
-- 1.9.1
Linaro-uefi mailing list Linaro-uefi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-uefi
New SMBIOS3 spec adds additional field for versioning - docrev. The docrev identifies the revision of a specification implemented in the table structures, so display SMBIOS version > 3 in format, like: 3.22.1
It's not affect on other part of code because version number is analyzed using comparing, and it's obvious that 0x000208 is less than 0x030201 for example.
Signed-off-by: Ivan Khoronzhuk ivan.khoronzhuk@linaro.org --- drivers/firmware/dmi_scan.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 657ae0c..54d52e7 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -17,7 +17,7 @@ */ static const char dmi_empty_string[] = " ";
-static u16 __initdata dmi_ver; +static u32 dmi_ver __initdata; /* * Catch too early calls to dmi_check_system(): */ @@ -526,9 +526,15 @@ static int __init dmi_present(const u8 *buf) */ static int __init dmi_smbios3_present(const u8 *buf) { + u8 ver[4]; + if (memcmp(buf, "_SM3_", 5) == 0 && buf[6] < 32 && dmi_checksum(buf, buf[6])) { - dmi_ver = get_unaligned_be16(buf + 7); + ver[0] = 0; + ver[1] = buf[7]; + ver[2] = buf[8]; + ver[3] = buf[9]; + dmi_ver = get_unaligned_be32(ver); dmi_len = get_unaligned_le32(buf + 12); dmi_base = get_unaligned_le64(buf + 16);
@@ -545,7 +551,8 @@ static int __init dmi_smbios3_present(const u8 *buf) dmi_num = dmi_len / 4;
if (dmi_walk_early(dmi_decode) == 0) { - pr_info("SMBIOS %d.%d present.\n", buf[7], buf[8]); + pr_info("SMBIOS %d.%d.%d present.\n", + ver[1], ver[2], ver[3]); dmi_format_ids(dmi_ids_string, sizeof(dmi_ids_string)); pr_debug("DMI: %s\n", dmi_ids_string); return 0;