[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmidecode] [PATCH 04/10] dmidecode: Don't assume 8-bit processor family
From: |
Jean Delvare |
Subject: |
[dmidecode] [PATCH 04/10] dmidecode: Don't assume 8-bit processor family in dmi_processor_id |
Date: |
Mon, 10 Apr 2017 11:55:11 +0200 |
The processor family code can be 16-bit since SMBIOS version 2.6, add
support for this possibility to function dmi_processor_id.
Signed-off-by: Jean Delvare <address@hidden>
---
dmidecode.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
--- dmidecode.orig/dmidecode.c 2017-04-07 10:52:51.315106242 +0200
+++ dmidecode/dmidecode.c 2017-04-07 10:52:53.382127310 +0200
@@ -972,7 +972,7 @@ static const char *dmi_processor_family(
}
}
-static void dmi_processor_id(u8 type, const u8 *p, const char *version, const
char *prefix)
+static void dmi_processor_id(const struct dmi_header *h, const char *prefix)
{
/* Intel AP-485 revision 36, table 2-4 */
static const char *flags[32] = {
@@ -1009,13 +1009,14 @@ static void dmi_processor_id(u8 type, co
NULL, /* 30 */
"PBE (Pending break enabled)" /* 31 */
};
- /*
- * Extra flags are now returned in the ECX register when one calls
- * the CPUID instruction. Their meaning is explained in table 3-5, but
- * DMI doesn't support this yet.
- */
+ const u8 *data = h->data;
+ const u8 *p = data + 0x08;
u32 eax, edx;
int sig = 0;
+ u16 type;
+
+ type = (data[0x06] == 0xFE && h->length >= 0x2A) ?
+ WORD(data + 0x28) : data[0x06];
/*
* This might help learn about new processors supporting the
@@ -1075,6 +1076,7 @@ static void dmi_processor_id(u8 type, co
sig = 2;
else if (type == 0x01 || type == 0x02)
{
+ const char *version = dmi_string(h, data[0x10]);
/*
* Some X86-class CPU have family "Other" or "Unknown". In this
case,
* we use the version string to determine if they are known to
@@ -1095,6 +1097,11 @@ static void dmi_processor_id(u8 type, co
else /* not X86-class */
return;
+ /*
+ * Extra flags are now returned in the ECX register when one calls
+ * the CPUID instruction. Their meaning is explained in table 3-5, but
+ * DMI doesn't support this yet.
+ */
eax = DWORD(p);
edx = DWORD(p + 4);
switch (sig)
@@ -3426,7 +3433,7 @@ static void dmi_decode(const struct dmi_
dmi_processor_family(h, ver));
printf("\tManufacturer: %s\n",
dmi_string(h, data[0x07]));
- dmi_processor_id(data[0x06], data + 0x08, dmi_string(h,
data[0x10]), "\t");
+ dmi_processor_id(h, "\t");
printf("\tVersion: %s\n",
dmi_string(h, data[0x10]));
printf("\tVoltage:");
--
Jean Delvare
SUSE L3 Support
- [dmidecode] [PATCH 00/10] dmidecode: Add support for SMBIOS version 3.1.0, Jean Delvare, 2017/04/10
- [dmidecode] [PATCH 01/10] dmidecode: Add support for extended BIOS ROM size, Jean Delvare, 2017/04/10
- [dmidecode] [PATCH 02/10] dmidecode: Add new enumerated values for chassis types, Jean Delvare, 2017/04/10
- [dmidecode] [PATCH 03/10] dmidecode: Add new enumerated values for processors, Jean Delvare, 2017/04/10
- [dmidecode] [PATCH 04/10] dmidecode: Don't assume 8-bit processor family in dmi_processor_id,
Jean Delvare <=
- [dmidecode] [PATCH 05/10] dmidecode: Decode the MIDR register on ARM processors, Jean Delvare, 2017/04/10
- [dmidecode] [PATCH 06/10] dmidecode: Add support for large cache sizes, Jean Delvare, 2017/04/10
- [dmidecode] [PATCH 07/10] dmidecode: Add Mini PCIe system slot enumerated values, Jean Delvare, 2017/04/10
- [dmidecode] [PATCH 08/10] dmidecode: Clarify the memory speed unit, Jean Delvare, 2017/04/10
- [dmidecode] [PATCH 09/10] dmidecode: Add support for structure type 43 (TPM Device), Jean Delvare, 2017/04/10
- [dmidecode] [PATCH 10/10] dmidecode: SMBIOS 3.1.0 is fully supported now, Jean Delvare, 2017/04/10