patched up to commit df9ebd5ffbe

Signed-off-by: Anton Arapov <arapov@gmail.com>
This commit is contained in:
Anton Arapov 2017-02-02 14:10:06 +01:00
parent 32682d39c9
commit 2202f10ab1
3 changed files with 192 additions and 1 deletions

View File

@ -0,0 +1,87 @@
From 12fbde92a26da61eda9f2ff0ba3c316779163f10 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 20 Jan 2017 10:57:12 +0100
Subject: [PATCH 18/19] Only decode one DMI table
Since version 3.0.0 of the SMBIOS specification, there can be
multiple entry points in memory, pointing to one or two DMI tables.
If both a 32-bit ("_SM_") entry point and a 64-bit ("_SM3_") entry
point are present, the specification requires that the latter points
to a table which is a super-set of the table pointed to by the
former. Therefore it makes no sense to decode both.
Per specification, look for a 64-bit ("_SM3_") entry point first, and
if we can't find any, look for a 32-bit ("_SM_" or "_DMI_") entry
point.
This fixes bug #50022:
https://savannah.nongnu.org/bugs/?50022
---
CHANGELOG | 6 ++++++
dmidecode.c | 19 ++++++++++++++-----
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index ac748b0..67aef99 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,9 @@
+2017-01-20 Jean Delvare <jdelvare@suse.de>
+
+ * dmidecode.c: Only decode one DMI table.
+ This fixes Savannah bug #50022:
+ https://savannah.nongnu.org/bugs/?50022
+
2016-09-22 Jean Delvare <jdelvare@suse.de>
* README: Explain that we can no longer support Cygwin.
diff --git a/dmidecode.c b/dmidecode.c
index 3993592..4b46a13 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4925,28 +4925,37 @@ memory_scan:
goto exit_free;
}
- for (fp = 0; fp <= 0xFFF0; fp += 16)
+ /* Look for a 64-bit entry point first */
+ for (fp = 0; fp <= 0xFFE0; fp += 16)
{
- if (memcmp(buf + fp, "_SM3_", 5) == 0 && fp <= 0xFFE0)
+ if (memcmp(buf + fp, "_SM3_", 5) == 0)
{
if (smbios3_decode(buf + fp, opt.devmem, 0))
{
found++;
- fp += 16;
+ goto done;
}
}
- else if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0)
+ }
+
+ /* If none found, look for a 32-bit entry point */
+ for (fp = 0; fp <= 0xFFF0; fp += 16)
+ {
+ if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0)
{
if (smbios_decode(buf + fp, opt.devmem, 0))
{
found++;
- fp += 16;
+ goto done;
}
}
else if (memcmp(buf + fp, "_DMI_", 5) == 0)
{
if (legacy_decode(buf + fp, opt.devmem, 0))
+ {
found++;
+ goto done;
+ }
}
}
--
2.9.3

View File

@ -0,0 +1,96 @@
From adbd050d70b6173dd6880b21fd6f995af5ea79d2 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 20 Jan 2017 17:26:02 +0100
Subject: [PATCH 19/19] biosdecode: Decode Intel Multiprocessor entry point
Decode the entry point defined in the Intel Multiprocessor
specification.
---
CHANGELOG | 5 +++++
biosdecode.c | 34 +++++++++++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG b/CHANGELOG
index 67aef99..26a8f35 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,10 @@
2017-01-20 Jean Delvare <jdelvare@suse.de>
+ * biosdecode.c: Decode the entry point defined in the Intel
+ Multiprocessor specification.
+
+2017-01-20 Jean Delvare <jdelvare@suse.de>
+
* dmidecode.c: Only decode one DMI table.
This fixes Savannah bug #50022:
https://savannah.nongnu.org/bugs/?50022
diff --git a/biosdecode.c b/biosdecode.c
index 3bbfe28..ad3d4bc 100644
--- a/biosdecode.c
+++ b/biosdecode.c
@@ -2,7 +2,7 @@
* BIOS Decode
*
* Copyright (C) 2000-2002 Alan Cox <alan@redhat.com>
- * Copyright (C) 2002-2015 Jean Delvare <jdelvare@suse.de>
+ * Copyright (C) 2002-2017 Jean Delvare <jdelvare@suse.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -52,6 +52,9 @@
* - Fujitsu application panel technical details
* As of July 23rd, 2004
* http://apanel.sourceforge.net/tech.php
+ * - Intel Multiprocessor Specification
+ * Version 1.4
+ * http://www.intel.com/design/archives/processors/pro/docs/242016.htm
*/
#include <stdio.h>
@@ -546,6 +549,34 @@ static int fjkeyinf_decode(const u8 *p, size_t len)
}
/*
+ * Intel Multiprocessor
+ */
+
+static size_t mp_length(const u8 *p)
+{
+ return 16 * p[8];
+}
+
+static int mp_decode(const u8 *p, size_t len)
+{
+ if (!checksum(p, len))
+ return 0;
+
+ printf("Intel Multiprocessor present.\n");
+ printf("\tSpecification Revision: %s\n",
+ p[9] == 0x01 ? "1.1" : p[9] == 0x04 ? "1.4" : "Invalid");
+ if (p[11])
+ printf("\tDefault Configuration: #%d\n", p[11]);
+ else
+ printf("\tConfiguration Table Address: 0x%08X\n",
+ DWORD(p + 4));
+ printf("\tMode: %s\n", p[12] & (1 << 7) ?
+ "IMCR and PIC" : "Virtual Wire");
+
+ return 1;
+}
+
+/*
* Main
*/
@@ -562,6 +593,7 @@ static struct bios_entry bios_entries[] = {
{ "32OS", 0, 0xE0000, 0xFFFFF, compaq_length, compaq_decode },
{ "\252\125VPD", 0, 0xF0000, 0xFFFFF, vpd_length, vpd_decode },
{ "FJKEYINF", 0, 0xF0000, 0xFFFFF, fjkeyinf_length, fjkeyinf_decode },
+ { "_MP_", 0, 0xE0000, 0xFFFFF, mp_length, mp_decode },
{ NULL, 0, 0, 0, NULL, NULL }
};
--
2.9.3

View File

@ -1,7 +1,7 @@
Summary: Tool to analyse BIOS DMI data
Name: dmidecode
Version: 3.0
Release: 6%{?dist}
Release: 7%{?dist}
Epoch: 1
Group: System Environment/Base
License: GPLv2+
@ -24,6 +24,9 @@ Patch14: 0014-dmidecode-Move-error-messages-to-stderr.patch
Patch15: 0015-Clarify-a-comment-in-dmi_memory_device_extended_size.patch
Patch16: 0016-Prevent-static-code-analyzer-confusion.patch
Patch17: 0017-Cygwin-is-no-longer-supported.patch
Patch18: 0018-Only-decode-one-DMI-table.patch
Patch19: 0019-biosdecode-Decode-Intel-Multiprocessor-entry-point.patch
BuildRequires: automake autoconf
ExclusiveArch: %{ix86} x86_64 ia64 aarch64
@ -57,6 +60,8 @@ I/O ports (e.g. serial, parallel, USB).
%patch15 -p1 -b .clarify_comment
%patch16 -p1 -b .no_confusion
%patch17 -p1 -b .no_cygwin
%patch18 -p1 -b .one_dmi
%patch19 -p1 -b .entry_intel
%build
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"
@ -77,6 +82,9 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install-
%{_mandir}/man8/*
%changelog
* Thu Feb 02 2016 Anton Arapov <aarapov@redhat.com> - 1:3.0-7
- patched up to commit adbd050d70b
* Tue Oct 18 2016 Anton Arapov <aarapov@redhat.com> - 1:3.0-6
- patched up to commit df9ebd5ffbe