@@ -35,6 +35,7 @@ static struct dmi_memdev_info {
35
35
const char * bank ;
36
36
u64 size ; /* bytes */
37
37
u16 handle ;
38
+ u8 type ; /* DDR2, DDR3, DDR4 etc */
38
39
} * dmi_memdev ;
39
40
static int dmi_memdev_nr ;
40
41
@@ -391,7 +392,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v)
391
392
u64 bytes ;
392
393
u16 size ;
393
394
394
- if (dm -> type != DMI_ENTRY_MEM_DEVICE || dm -> length < 0x12 )
395
+ if (dm -> type != DMI_ENTRY_MEM_DEVICE || dm -> length < 0x13 )
395
396
return ;
396
397
if (nr >= dmi_memdev_nr ) {
397
398
pr_warn (FW_BUG "Too many DIMM entries in SMBIOS table\n" );
@@ -400,6 +401,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v)
400
401
dmi_memdev [nr ].handle = get_unaligned (& dm -> handle );
401
402
dmi_memdev [nr ].device = dmi_string (dm , d [0x10 ]);
402
403
dmi_memdev [nr ].bank = dmi_string (dm , d [0x11 ]);
404
+ dmi_memdev [nr ].type = d [0x12 ];
403
405
404
406
size = get_unaligned ((u16 * )& d [0xC ]);
405
407
if (size == 0 )
@@ -1128,3 +1130,24 @@ u64 dmi_memdev_size(u16 handle)
1128
1130
return ~0ull ;
1129
1131
}
1130
1132
EXPORT_SYMBOL_GPL (dmi_memdev_size );
1133
+
1134
+ /**
1135
+ * dmi_memdev_type - get the memory type
1136
+ * @handle: DMI structure handle
1137
+ *
1138
+ * Return the DMI memory type of the module in the slot associated with the
1139
+ * given DMI handle, or 0x0 if no such DMI handle exists.
1140
+ */
1141
+ u8 dmi_memdev_type (u16 handle )
1142
+ {
1143
+ int n ;
1144
+
1145
+ if (dmi_memdev ) {
1146
+ for (n = 0 ; n < dmi_memdev_nr ; n ++ ) {
1147
+ if (handle == dmi_memdev [n ].handle )
1148
+ return dmi_memdev [n ].type ;
1149
+ }
1150
+ }
1151
+ return 0x0 ; /* Not a valid value */
1152
+ }
1153
+ EXPORT_SYMBOL_GPL (dmi_memdev_type );
0 commit comments