diff options
| author | Burt P <pburt0@gmail.com> | 2019-06-29 01:31:56 -0500 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2019-06-29 17:58:52 -0700 | 
| commit | 361d0c276de3683eea64250450ed0a5ea9e251c2 (patch) | |
| tree | c75240be96f46cddfc5f7e99a1be8d1c14e3dbe5 /modules | |
| parent | d17517aec9c8cf8f4c3b76c4e64a9808db6c7027 (diff) | |
Memory Devices: dram vendor for ddr3
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/devices/dmi_memory.c | 14 | ||||
| -rw-r--r-- | modules/devices/spd-decode.c | 47 | 
2 files changed, 42 insertions, 19 deletions
| diff --git a/modules/devices/dmi_memory.c b/modules/devices/dmi_memory.c index 791b1a91..309c7a27 100644 --- a/modules/devices/dmi_memory.c +++ b/modules/devices/dmi_memory.c @@ -434,6 +434,12 @@ gchar *make_spd_section(spd_data *spd) {                  vendor_str = g_strdup_printf(" (%s, %s)",                      spd->vendor->name, spd->vendor->url );          } +        gchar *dram_vendor_str = NULL; +        if (spd->dram_vendor) { +            if (spd->dram_vendor->url) +                dram_vendor_str = g_strdup_printf(" (%s, %s)", +                    spd->dram_vendor->name, spd->dram_vendor->url ); +        }          gchar *size_str = NULL;          if (!spd->size_MiB)              size_str = g_strdup(_("(Unknown)")); @@ -445,7 +451,8 @@ gchar *make_spd_section(spd_data *spd) {                      "%s=%d.%d\n"                      "%s=%s\n"                      "%s=%s\n" -                    "%s=%s%s\n" /* vendor */ +                    "%s=[%02x%02x] %s%s\n" /* module vendor */ +                    "%s=[%02x%02x] %s%s\n" /* dram vendor */                      "%s=%s\n" /* part */                      "%s=%s\n" /* size */                      "%s", @@ -455,7 +462,10 @@ gchar *make_spd_section(spd_data *spd) {                      _("SPD Revision"), spd->spd_rev_major, spd->spd_rev_minor,                      _("Form Factor"), UNKIFNULL2(spd->form_factor),                      _("Type"), UNKIFEMPTY2(spd->type_detail), -                    _("Vendor"), UNKIFNULL2(spd->vendor_str), vendor_str ? vendor_str : "", +                    _("Module Vendor"), spd->vendor_bank, spd->vendor_index, +                        UNKIFNULL2(spd->vendor_str), vendor_str ? vendor_str : "", +                    _("DRAM Vendor"), spd->dram_vendor_bank, spd->dram_vendor_index, +                        UNKIFNULL2(spd->dram_vendor_str), dram_vendor_str ? dram_vendor_str : "",                      _("Part Number"), UNKIFEMPTY2(spd->partno),                      _("Size"), size_str,                      full_spd ? full_spd : "" diff --git a/modules/devices/spd-decode.c b/modules/devices/spd-decode.c index bd2356bd..1016259c 100644 --- a/modules/devices/spd-decode.c +++ b/modules/devices/spd-decode.c @@ -75,6 +75,11 @@ typedef struct {      const char *vendor_str;      const Vendor *vendor; +    int dram_vendor_bank; +    int dram_vendor_index; +    const char *dram_vendor_str; +    const Vendor *dram_vendor; +      char partno[32];      const char *form_factor;      char type_detail[256]; @@ -577,7 +582,7 @@ static void decode_ddr3_part_number(unsigned char *bytes, char *part_number) {      }  } -static void decode_ddr34_manufacturer(unsigned char count, unsigned char code, char **manufacturer) { +static void decode_ddr34_manufacturer(unsigned char count, unsigned char code, char **manufacturer, int *bank, int *index) {      if (!manufacturer) return;      if (code == 0x00 || code == 0xFF) { @@ -590,18 +595,18 @@ static void decode_ddr34_manufacturer(unsigned char count, unsigned char code, c          return;      } -    int bank = count & 0x7f; -    int pos = code & 0x7f; -    if (bank >= VENDORS_BANKS) { +    *bank = count & 0x7f; +    *index = code & 0x7f; +    if (*bank >= VENDORS_BANKS) {          *manufacturer = NULL;          return;      } -    *manufacturer = (char *)vendors[bank][pos - 1]; +    *manufacturer = (char *)vendors[*bank][*index - 1];  } -static void decode_ddr3_manufacturer(unsigned char *bytes, char **manufacturer) { -    decode_ddr34_manufacturer(bytes[117], bytes[118], (char **) manufacturer); +static void decode_ddr3_manufacturer(unsigned char *bytes, char **manufacturer, int *bank, int *index) { +    decode_ddr34_manufacturer(bytes[117], bytes[118], (char **) manufacturer, bank, index);  }  static void decode_module_manufacturer(unsigned char *bytes, char **manufacturer) { @@ -756,14 +761,19 @@ static void decode_ddr4_module_date(unsigned char *bytes, int spd_size, char **s                             _("Week"), bytes[324], _("Year"), bytes[323]);  } +static void decode_ddr3_dram_manufacturer(unsigned char *bytes, +                                            char **manufacturer, int *bank, int *index) { +    decode_ddr34_manufacturer(bytes[94], bytes[95], (char **) manufacturer, bank, index); +} +  static void decode_ddr4_dram_manufacturer(unsigned char *bytes, int spd_size, -                                            const char **manufacturer) { +                                            char **manufacturer, int *bank, int *index) {      if (spd_size < 351) {          *manufacturer = NULL;          return;      } -    decode_ddr34_manufacturer(bytes[350], bytes[351], (char **) manufacturer); +    decode_ddr34_manufacturer(bytes[350], bytes[351], (char **) manufacturer, bank, index);  }  static void detect_ddr4_xmp(unsigned char *bytes, int spd_size, int *majv, int *minv) { @@ -827,7 +837,6 @@ static gchar *decode_ddr4_sdram_extra(unsigned char *bytes, int spd_size) {      decode_ddr4_module_spd_timings(bytes, ddr_clock, &speed_timings);      decode_ddr4_module_date(bytes, spd_size, &manf_date);      detect_ddr4_xmp(bytes, spd_size, &xmp_majv, &xmp_minv); -    decode_ddr4_dram_manufacturer(bytes, spd_size, &dram_manf);      if (xmp_majv == -1 && xmp_minv == -1) {          xmp = NULL; @@ -845,13 +854,11 @@ static gchar *decode_ddr4_sdram_extra(unsigned char *bytes, int spd_size) {      out = g_strdup_printf("%s=%s\n"                            "%s=%s\n"                            "%s=%s\n" -                          "%s=%s\n"                            "[%s]\n"                            "%s\n"                            "%s",                            _("Voltage"), bytes[11] & 0x01 ? "1.2 V": _("(Unknown)"),                            _("Manufacturing Date"), manf_date ? manf_date : _("(Unknown)"), -                          _("DRAM Manufacturer"), dram_manf ? dram_manf : _("(Unknown)"),                            _("XMP"), xmp ? xmp : _("(Unknown)"),                            _("JEDEC Timings"), speed_timings,                            xmp_profile ? xmp_profile: ""); @@ -879,13 +886,13 @@ static void decode_ddr4_part_number(unsigned char *bytes, int spd_size, char *pa  }  static void decode_ddr4_module_manufacturer(unsigned char *bytes, int spd_size, -                                            char **manufacturer) { +                                            char **manufacturer, int *bank, int *index) {      if (spd_size < 321) {          *manufacturer = NULL;          return;      } -    decode_ddr34_manufacturer(bytes[320], bytes[321], manufacturer); +    decode_ddr34_manufacturer(bytes[320], bytes[321], manufacturer, bank, index);  }  static int decode_ram_type(unsigned char *bytes) { @@ -993,7 +1000,10 @@ static GSList *decode_dimms2(GSList *eeprom_list, gboolean use_sysfs, int max_si              s = spd_data_new();              memcpy(s->bytes, bytes, 512);              decode_ddr3_part_number(bytes, s->partno); -            decode_ddr3_manufacturer(bytes, (char**)&s->vendor_str); +            decode_ddr3_manufacturer(bytes, (char**)&s->vendor_str, +                &s->vendor_bank, &s->vendor_index); +            decode_ddr3_dram_manufacturer(bytes, (char**)&s->dram_vendor_str, +                &s->dram_vendor_bank, &s->dram_vendor_index);              decode_ddr3_module_size(bytes, &s->size_MiB);              decode_ddr3_module_type(bytes, &s->form_factor);              decode_ddr3_module_detail(bytes, s->type_detail); @@ -1002,7 +1012,10 @@ static GSList *decode_dimms2(GSList *eeprom_list, gboolean use_sysfs, int max_si              s = spd_data_new();              memcpy(s->bytes, bytes, 512);              decode_ddr4_part_number(bytes, spd_size, s->partno); -            decode_ddr4_module_manufacturer(bytes, spd_size, (char**)&s->vendor_str); +            decode_ddr4_module_manufacturer(bytes, spd_size, (char**)&s->vendor_str, +                &s->vendor_bank, &s->vendor_index); +            decode_ddr4_dram_manufacturer(bytes, spd_size, (char**)&s->dram_vendor_str, +                &s->dram_vendor_bank, &s->dram_vendor_index);              decode_ddr4_module_size(bytes, &s->size_MiB);              decode_ddr4_module_type(bytes, &s->form_factor);              decode_ddr4_module_detail(bytes, s->type_detail); @@ -1034,8 +1047,8 @@ static GSList *decode_dimms2(GSList *eeprom_list, gboolean use_sysfs, int max_si                  s->spd_rev_major = bytes[1] >> 4;                  s->spd_rev_minor = bytes[1] & 0xf;              } +            s->dram_vendor = vendor_match(s->dram_vendor_str, NULL);              dimm_list = g_slist_append(dimm_list, s); -            s->vendor = vendor_match(s->vendor_str, NULL);          }      } | 
