diff options
author | Zdenek Styblik <stybla@turnovfree.net> | 2014-03-23 07:37:58 +0100 |
---|---|---|
committer | Zdenek Styblik <stybla@turnovfree.net> | 2014-03-23 07:37:58 +0100 |
commit | 02e4a0361c86cf5be229e8147ed0d826231c0388 (patch) | |
tree | c1d90628f55b3d6caee48daf3642d29308a0d047 | |
parent | ca5cc560f60ebe601b5219699f56f99938895b4b (diff) | |
download | ipmitool-02e4a0361c86cf5be229e8147ed0d826231c0388.tar.gz |
ID:296 - Fix PSD size decoding
Commit replaces size decoding code with code ported from "decode-dimms" Perl
script found in i2c-tools 3.0.3. Former code has reported incorrect size of DDR2
modules.
Patch-by: Alexander Amelkin
-rw-r--r-- | lib/dimm_spd.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/dimm_spd.c b/lib/dimm_spd.c index 1ec5419..1f27de2 100644 --- a/lib/dimm_spd.c +++ b/lib/dimm_spd.c @@ -719,7 +719,8 @@ const struct valstr jedec_id5_vals[] = { int ipmi_spd_print(uint8_t *spd_data, int len) { - int size; + int k = 0; + int ii = 0; if (len < 92) return -1; /* we need first 91 bytes to do our thing */ @@ -802,8 +803,15 @@ ipmi_spd_print(uint8_t *spd_data, int len) } else { - size = spd_data[5] * (spd_data[31] << 2); - printf(" Memory Size : %d MB\n", size); + ii = (spd_data[3] & 0x0f) + (spd_data[4] & 0x0f) - 17; + k = ((spd_data[5] & 0x7) + 1) * spd_data[17]; + + if(ii > 0 && ii <= 12 && k > 0) { + printf(" Memory Size : %d MB\n", ((1 << ii) * k)); + } else { + printf(" Memory Size INVALID: %d, %d, %d, %d\n", spd_data[3], + spd_data[4], spd_data[5], spd_data[17]); + } printf(" Voltage Intf : %s\n", val2str(spd_data[8], spd_voltage_vals)); printf(" Error Detect/Cor : %s\n", |