Skip to content

Commit 29e626f

Browse files
jah63jdelvare
authored andcommitted
dmidecode: Extensions to Memory Device (Type 17)
The DSP0134 v3.2.0 extended the Memory Device (Type 17) structure starting at offset 28h continuing to 4Ch to reflect persistent memory. Signed-off-by: Jerry Hoemann <[email protected]> Signed-off-by: Jean Delvare <[email protected]>
1 parent aec8399 commit 29e626f

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

dmidecode.c

+110
Original file line numberDiff line numberDiff line change
@@ -2507,6 +2507,79 @@ static void dmi_memory_device_speed(u16 code)
25072507
printf(" %u MT/s", code);
25082508
}
25092509

2510+
static void dmi_memory_technology(u8 code)
2511+
{
2512+
/* 7.18.6 */
2513+
static const char * const technology[] = {
2514+
"Other", /* 0x01 */
2515+
"Unknown",
2516+
"DRAM",
2517+
"NVDIMM-N",
2518+
"NVDIMM-F",
2519+
"NVDIMM-P",
2520+
"Intel persistent memory" /* 0x07 */
2521+
};
2522+
if (code >= 0x01 && code <= 0x07)
2523+
printf(" %s", technology[code - 0x01]);
2524+
else
2525+
printf(" %s", out_of_spec);
2526+
}
2527+
2528+
static void dmi_memory_operating_mode_capability(u16 code)
2529+
{
2530+
/* 7.18.7 */
2531+
static const char * const mode[] = {
2532+
"Other", /* 1 */
2533+
"Unknown",
2534+
"Volatile memory",
2535+
"Byte-accessible persistent memory",
2536+
"Block-accessible persistent memory" /* 5 */
2537+
};
2538+
2539+
if ((code & 0xFFFE) == 0)
2540+
printf(" None");
2541+
else {
2542+
int i;
2543+
2544+
for (i = 1; i <= 5; i++)
2545+
if (code & (1 << i))
2546+
printf(" %s", mode[i - 1]);
2547+
}
2548+
}
2549+
2550+
static void dmi_memory_manufacturer_id(u16 code)
2551+
{
2552+
/* 7.18.8 */
2553+
/* 7.18.10 */
2554+
/* LSB is 7-bit Odd Parity number of continuation codes */
2555+
if (code == 0)
2556+
printf(" Unknown");
2557+
else
2558+
printf(" Bank %d, Hex 0x%02X", (code & 0x7F) + 1, code >> 8);
2559+
}
2560+
2561+
static void dmi_memory_product_id(u16 code)
2562+
{
2563+
/* 7.18.9 */
2564+
/* 7.18.11 */
2565+
if (code == 0)
2566+
printf(" Unknown");
2567+
else
2568+
printf(" 0x%04X", code);
2569+
}
2570+
2571+
static void dmi_memory_size(u64 code)
2572+
{
2573+
/* 7.18.12 */
2574+
/* 7.18.13 */
2575+
if (code.h == 0xFFFFFFFF && code.l == 0xFFFFFFFF)
2576+
printf(" Unknown");
2577+
else if (code.h == 0x0 && code.l == 0x0)
2578+
printf(" None");
2579+
else
2580+
dmi_print_memory_size(code, 0);
2581+
}
2582+
25102583
/*
25112584
* 7.19 32-bit Memory Error Information (Type 18)
25122585
*/
@@ -3907,6 +3980,43 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
39073980
printf("\tConfigured Voltage:");
39083981
dmi_memory_voltage_value(WORD(data + 0x26));
39093982
printf("\n");
3983+
if (h->length < 0x34) break;
3984+
printf("\tMemory Technology:");
3985+
dmi_memory_technology(data[0x28]);
3986+
printf("\n");
3987+
printf("\tMemory Operating Mode Capability:");
3988+
dmi_memory_operating_mode_capability(WORD(data + 0x29));
3989+
printf("\n");
3990+
printf("\tFirmware Version: %s\n",
3991+
dmi_string(h, data[0x2B]));
3992+
printf("\tModule Manufacturer ID:");
3993+
dmi_memory_manufacturer_id(WORD(data + 0x2C));
3994+
printf("\n");
3995+
printf("\tModule Product ID:");
3996+
dmi_memory_product_id(WORD(data + 0x2E));
3997+
printf("\n");
3998+
printf("\tMemory Subsystem Controller Manufacturer ID:");
3999+
dmi_memory_manufacturer_id(WORD(data + 0x30));
4000+
printf("\n");
4001+
printf("\tMemory Subsystem Controller Product ID:");
4002+
dmi_memory_product_id(WORD(data + 0x32));
4003+
printf("\n");
4004+
if (h->length < 0x3C) break;
4005+
printf("\tNon-Volatile Size:");
4006+
dmi_memory_size(QWORD(data + 0x34));
4007+
printf("\n");
4008+
if (h->length < 0x44) break;
4009+
printf("\tVolatile Size:");
4010+
dmi_memory_size(QWORD(data + 0x3C));
4011+
printf("\n");
4012+
if (h->length < 0x4C) break;
4013+
printf("\tCache Size:");
4014+
dmi_memory_size(QWORD(data + 0x44));
4015+
printf("\n");
4016+
if (h->length < 0x54) break;
4017+
printf("\tLogical Size:");
4018+
dmi_memory_size(QWORD(data + 0x4C));
4019+
printf("\n");
39104020
break;
39114021

39124022
case 18: /* 7.19 32-bit Memory Error Information */

0 commit comments

Comments
 (0)