aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Čerman <ondrej.cerman@gmail.com>2019-06-19 22:41:06 +0200
committerLeandro A. F. Pereira <leandro@hardinfo.org>2019-06-19 15:39:39 -0700
commite34bd5af3cccfa78b0ca4a9f6fd31aeec59b7b9d (patch)
treec68cd47bf81daea5d39564196ee5757e89b1b80b
parentb89aa537b49ab1d6cfb18bcb02287318e8d9c059 (diff)
devices/spd: Added DDR3 Module manufacturer
-rw-r--r--modules/devices/spd-decode.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/modules/devices/spd-decode.c b/modules/devices/spd-decode.c
index c734ea63..5f863d49 100644
--- a/modules/devices/spd-decode.c
+++ b/modules/devices/spd-decode.c
@@ -1342,11 +1342,32 @@ static void decode_ddr3_part_number(unsigned char *bytes, char *part_number) {
}
}
-static void decode_ddr3_manufacturer(unsigned char *bytes, char **manufacturer) {
- char *out = "Unknown";
-end:
- if (manufacturer) { *manufacturer = out; }
+static void decode_ddr34_manufacturer(unsigned char count, unsigned char code, char **manufacturer) {
+ if (!manufacturer) return;
+
+ if (code == 0x00 || code == 0xFF) {
+ *manufacturer = _("Unknown");
+ return;
+ }
+
+ if (parity(count) != 1 || parity(code) != 1) {
+ *manufacturer = _("Invalid");
+ return;
+ }
+
+ int bank = count & 0x7f;
+ int pos = code & 0x7f;
+ if (bank >= VENDORS_BANKS || (bank == VENDORS_BANKS - 1 && pos > VENDORS_LAST_BANK_SIZE)) {
+ *manufacturer = _("Unknown");
+ return;
+ }
+
+ *manufacturer = (char *)vendors[bank][pos - 1];
+}
+
+static void decode_ddr3_manufacturer(unsigned char *bytes, char **manufacturer) {
+ decode_ddr34_manufacturer(bytes[117], bytes[118], (char **) manufacturer);
}
static void decode_module_manufacturer(unsigned char *bytes, char **manufacturer) {
@@ -1395,29 +1416,6 @@ static char *print_spd_timings(int speed, float cas, float trcd, float trp, floa
ceil(trp / ctime - 0.025), ceil(tras / ctime - 0.025));
}
-static void decode_ddr4_manufacturer(unsigned char count, unsigned char code, char **manufacturer) {
- if (!manufacturer) return;
-
- if (code == 0x00 || code == 0xFF) {
- *manufacturer = _("Unknown");
- return;
- }
-
- if (parity(count) != 1 || parity(code) != 1) {
- *manufacturer = _("Invalid");
- return;
- }
-
- int bank = count & 0x7f;
- int pos = code & 0x7f;
- if (bank >= VENDORS_BANKS || (bank == VENDORS_BANKS - 1 && pos > VENDORS_LAST_BANK_SIZE)) {
- *manufacturer = _("Unknown");
- return;
- }
-
- *manufacturer = (char *)vendors[bank][pos - 1];
-}
-
static void decode_ddr4_module_type(unsigned char *bytes, const char **type) {
switch (bytes[3]) {
case 0x01: *type = "RDIMM (Registered DIMM)"; break;
@@ -1531,7 +1529,7 @@ static void decode_ddr4_dram_manufacturer(unsigned char *bytes, int spd_size,
return;
}
- decode_ddr4_manufacturer(bytes[350], bytes[351], (char **) manufacturer);
+ decode_ddr34_manufacturer(bytes[350], bytes[351], (char **) manufacturer);
}
static void detect_ddr4_xmp(unsigned char *bytes, int spd_size, int *majv, int *minv) {
@@ -1652,7 +1650,7 @@ static void decode_ddr4_module_manufacturer(unsigned char *bytes, int spd_size,
return;
}
- decode_ddr4_manufacturer(bytes[320], bytes[321], manufacturer);
+ decode_ddr34_manufacturer(bytes[320], bytes[321], manufacturer);
}
static int decode_ram_type(unsigned char *bytes) {