Skip to content

Commit

Permalink
Update to 3c111e4f with SMBIOS 3.3 improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Dec 26, 2020
1 parent f933359 commit 1c9b2bb
Show file tree
Hide file tree
Showing 12 changed files with 222 additions and 87 deletions.
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
Expand Down Expand Up @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
Expand Down Expand Up @@ -225,7 +225,7 @@ impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
Expand Down
18 changes: 18 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
Version 3.3 (Wed Oct 14 2020)
- [BUILD] Allow overriding build settings from the environment.
- [COMPATIBILITY] Document how the UUID fields are interpreted.
- [PORTABILITY] Don't use memcpy on /dev/mem on arm64.
- [PORTABILITY] Only scan /dev/mem for entry point on x86.
- Support for SMBIOS 3.3.0. This includes new processor names, new port
connector types, and new memory device form factors, types and
technologies.
- Add bios-revision, firmware-revision and system-sku-number to -s option.
- Use the most appropriate unit for cache size.
- Decode system slot base bus width and peers.
- Important bug fixes:
Fix Redfish Hostname print length
Fix formatting of TPM table output
Fix System Slot Information for PCIe SSD
Don't choke on invalid processor voltage
- Use the most appropriate unit for cache size.

Version 3.2 (Wed Sep 14 2018)
- [COMPATIBILITY] The UUID is now displayed using lowercase letters, per
RFC 4122 (#53569). You must ensure that any code parsing it is
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dmidecode

This dmidecode version supports Apple-specific table decoding as well
as native macOS SMBIOS reading through I/O Registry. Synced with
[upstream](http://git.savannah.gnu.org/cgit/dmidecode.git) up to 5b3c8e99.
[upstream](http://git.savannah.gnu.org/cgit/dmidecode.git) up to 3c111e4f.

**INTRODUCTION**

Expand Down
102 changes: 71 additions & 31 deletions dmidecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
#define out_of_spec "<OUT OF SPEC>"
static const char *bad_index = "<BAD INDEX>";

#define SUPPORTED_SMBIOS_VER 0x030200
#define SUPPORTED_SMBIOS_VER 0x030300

#define FLAG_NO_FILE_OFFSET (1 << 0)
#define FLAG_STOP_AT_EOT (1 << 1)
Expand Down Expand Up @@ -814,7 +814,6 @@ static const char *dmi_processor_family(const struct dmi_header *h, u16 ver)
{ 0x3D, "Opteron 6200" },
{ 0x3E, "Opteron 4200" },
{ 0x3F, "FX" },

{ 0x40, "MIPS" },
{ 0x41, "MIPS R4000" },
{ 0x42, "MIPS R4200" },
Expand All @@ -831,7 +830,6 @@ static const char *dmi_processor_family(const struct dmi_header *h, u16 ver)
{ 0x4D, "Opteron 6300" },
{ 0x4E, "Opteron 3300" },
{ 0x4F, "FirePro" },

{ 0x50, "SPARC" },
{ 0x51, "SuperSPARC" },
{ 0x52, "MicroSPARC II" },
Expand Down Expand Up @@ -1000,6 +998,7 @@ static const char *dmi_processor_family(const struct dmi_header *h, u16 ver)

code = (data[0x06] == 0xFE && h->length >= 0x2A) ?
WORD(data + 0x28) : data[0x06];

/* Special case for ambiguous value 0xBE */
if (code == 0xBE)
{
Expand Down Expand Up @@ -1108,7 +1107,7 @@ static void dmi_processor_id(const struct dmi_header *h)
u16 dx = WORD(p);
/*
* Not all 80486 CPU support the CPUID instruction, we have to find
* wether the one we have here does or not. Note that this trick
* whether the one we have here does or not. Note that this trick
* works only because we know that 80486 must be little-endian.
*/
if ((dx & 0x0F00) == 0x0400
Expand Down Expand Up @@ -1356,10 +1355,12 @@ static const char *dmi_processor_upgrade(u8 code)
"Socket LGA2066",
"Socket BGA1392",
"Socket BGA1510",
"Socket BGA1528" /* 0x3C */
"Socket BGA1528",
"Socket LGA4189",
"Socket LGA1200" /* 0x3E */
};

if (code >= 0x01 && code <= 0x3C)
if (code >= 0x01 && code <= 0x3E)
return upgrade[code - 0x01];
return out_of_spec;
}
Expand Down Expand Up @@ -1387,7 +1388,9 @@ static void dmi_processor_characteristics(const char *attr, u16 code)
"Hardware Thread",
"Execute Protection",
"Enhanced Virtualization",
"Power/Performance Control" /* 7 */
"Power/Performance Control",
"128-bit Capable",
"Arm64 SoC ID" /* 9 */
};

if ((code & 0x00FC) == 0)
Expand All @@ -1397,7 +1400,7 @@ static void dmi_processor_characteristics(const char *attr, u16 code)
int i;

pr_list_start(attr, NULL);
for (i = 2; i <= 7; i++)
for (i = 2; i <= 9; i++)
if (code & (1 << i))
pr_list_item("%s", characteristics[i - 2]);
pr_list_end();
Expand Down Expand Up @@ -1932,11 +1935,16 @@ static const char *dmi_slot_type(u8 code)
"MXM Type IV",
"MXM 3.0 Type A",
"MXM 3.0 Type B",
"PCI Express 2 SFF-8639",
"PCI Express 3 SFF-8639",
"PCI Express 2 SFF-8639 (U.2)",
"PCI Express 3 SFF-8639 (U.2)",
"PCI Express Mini 52-pin with bottom-side keep-outs",
"PCI Express Mini 52-pin without bottom-side keep-outs",
"PCI Express Mini 76-pin" /* 0x23 */
"PCI Express Mini 76-pin",
"PCI Express 4 SFF-8639 (U.2)",
"PCI Express 5 SFF-8639 (U.2)",
"OCP NIC 3.0 Small Form Factor (SFF)",
"OCP NIC 3.0 Large Form Factor (LFF)",
"OCP NIC Prior to 3.0" /* 0x28 */
};
static const char *type_0x30[] = {
"CXL FLexbus 1.0" /* 0x30 */
Expand Down Expand Up @@ -1971,18 +1979,27 @@ static const char *dmi_slot_type(u8 code)
"PCI Express 4 x2",
"PCI Express 4 x4",
"PCI Express 4 x8",
"PCI Express 4 x16" /* 0xBD */
"PCI Express 4 x16",
"PCI Express 5",
"PCI Express 5 x1",
"PCI Express 5 x2",
"PCI Express 5 x4",
"PCI Express 5 x8",
"PCI Express 5 x16",
"PCI Express 6+",
"EDSFF E1",
"EDSFF E3" /* 0xC6 */
};
/*
* Note to developers: when adding entries to these lists, check if
* function dmi_slot_id below needs updating too.
*/

if (code >= 0x01 && code <= 0x23)
if (code >= 0x01 && code <= 0x28)
return type[code - 0x01];
if (code == 0x30)
return type_0x30[code - 0x30];
if (code >= 0xA0 && code <= 0xBD)
if (code >= 0xA0 && code <= 0xC6)
return type_0xA0[code - 0xA0];
return out_of_spec;
}
Expand Down Expand Up @@ -2117,7 +2134,10 @@ static void dmi_slot_characteristics(const char *attr, u8 code1, u8 code2)
"PME signal is supported", /* 0 */
"Hot-plug devices are supported",
"SMBus signal is supported",
"PCIe slot bifurcation is supported" /* 3 */
"PCIe slot bifurcation is supported",
"Async/surprise removal is supported",
"Flexbus slot, CXL 1.0 capable",
"Flexbus slot, CXL 2.0 capable" /* 6 */
};

if (code1 & (1 << 0))
Expand All @@ -2132,7 +2152,7 @@ static void dmi_slot_characteristics(const char *attr, u8 code1, u8 code2)
for (i = 1; i <= 7; i++)
if (code1 & (1 << i))
pr_list_item("%s", characteristics1[i - 1]);
for (i = 0; i <= 3; i++)
for (i = 0; i <= 6; i++)
if (code2 & (1 << i))
pr_list_item("%s", characteristics2[i]);
pr_list_end();
Expand Down Expand Up @@ -2640,10 +2660,12 @@ static const char *dmi_memory_device_type(u8 code)
"LPDDR4",
"Logical non-volatile device",
"HBM",
"HBM2" /* 0x21 */
"HBM2",
"DDR5",
"LPDDR5" /* 0x23 */
};

if (code >= 0x01 && code <= 0x21)
if (code >= 0x01 && code <= 0x23)
return type[code - 0x01];
return out_of_spec;
}
Expand Down Expand Up @@ -2685,12 +2707,22 @@ static void dmi_memory_device_type_detail(u16 code)
}
}

static void dmi_memory_device_speed(const char *attr, u16 code)
static void dmi_memory_device_speed(const char *attr, u16 code1, u32 code2)
{
if (code == 0)
pr_attr(attr, "Unknown");
if (code1 == 0xFFFF)
{
if (code2 == 0)
pr_attr(attr, "Unknown");
else
pr_attr(attr, "%lu MT/s", code2);
}
else
pr_attr(attr, "%u MT/s", code);
{
if (code1 == 0)
pr_attr(attr, "Unknown");
else
pr_attr(attr, "%u MT/s", code1);
}
}

static void dmi_memory_technology(u8 code)
Expand Down Expand Up @@ -3708,16 +3740,16 @@ static void dmi_parse_protocol_record(u8 *rec)
* convenience. It could get passed from the SMBIOS
* header, but that's a lot of passing of pointers just
* to get that info, and the only thing it is used for is
* to determine the endianess of the field. Since we only
* to determine the endianness of the field. Since we only
* do this parsing on versions of SMBIOS after 3.1.1, and the
* endianess of the field is always little after version 2.6.0
* endianness of the field is always little after version 2.6.0
* we can just pick a sufficiently recent version here.
*/
dmi_system_uuid(pr_subattr, "Service UUID", &rdata[0], 0x311);

/*
* DSP0270: 8.6: Redfish Over IP Host IP Assignment Type
* Note, using decimal indicies here, as the DSP0270
* Note, using decimal indices here, as the DSP0270
* uses decimal, so as to make it more comparable
*/
assign_val = rdata[16];
Expand Down Expand Up @@ -4452,7 +4484,12 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
dmi_memory_device_type(data[0x12]));
dmi_memory_device_type_detail(WORD(data + 0x13));
if (h->length < 0x17) break;
dmi_memory_device_speed("Speed", WORD(data + 0x15));
/* If no module is present, the remaining fields are irrelevant */
if (WORD(data + 0x0C) == 0)
break;
dmi_memory_device_speed("Speed", WORD(data + 0x15),
h->length >= 0x5C ?
DWORD(data + 0x54) : 0);
if (h->length < 0x1B) break;
pr_attr("Manufacturer", "%s",
dmi_string(h, data[0x17]));
Expand All @@ -4469,7 +4506,9 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
pr_attr("Rank", "%u", data[0x1B] & 0x0F);
if (h->length < 0x22) break;
dmi_memory_device_speed("Configured Memory Speed",
WORD(data + 0x20));
WORD(data + 0x20),
h->length >= 0x5C ?
DWORD(data + 0x58) : 0);
if (h->length < 0x28) break;
dmi_memory_voltage_value("Minimum Voltage",
WORD(data + 0x22));
Expand Down Expand Up @@ -5219,7 +5258,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
/* In quiet mode, stop decoding at end of table marker */
if ((opt.flags & FLAG_QUIET) && h.type == 127)
break;

if (display
&& (!(opt.flags & FLAG_QUIET) || (opt.flags & FLAG_DUMP)))
pr_handle(&h);
Expand Down Expand Up @@ -5251,8 +5290,9 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
}

/* assign vendor for vendor-specific decodes later */
if (h.type == 1 && h.length >= 5)
dmi_set_vendor(dmi_string(&h, data[0x04]));
if (h.type == 1 && h.length >= 6)
dmi_set_vendor(_dmi_string(&h, data[0x04], 0),
_dmi_string(&h, data[0x05], 0));

/* Fixup a common mistake */
if (h.type == 34)
Expand Down Expand Up @@ -5323,7 +5363,7 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
}
pr_sep();
}

if ((flags & FLAG_NO_FILE_OFFSET) || (opt.flags & FLAG_FROM_DUMP))
{
/*
Expand Down
2 changes: 1 addition & 1 deletion dmidecode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
12ECFB3A1852EADE0028E3A9 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1130;
LastUpgradeCheck = 1230;
};
buildConfigurationList = 12ECFB3D1852EADE0028E3A9 /* Build configuration list for PBXProject "dmidecode" */;
compatibilityVersion = "Xcode 3.2";
Expand Down
Loading

0 comments on commit 1c9b2bb

Please sign in to comment.