diff options
Diffstat (limited to 'lib/dimm_spd.c')
-rw-r--r-- | lib/dimm_spd.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/dimm_spd.c b/lib/dimm_spd.c index 91ae117..912b211 100644 --- a/lib/dimm_spd.c +++ b/lib/dimm_spd.c @@ -867,9 +867,11 @@ ipmi_spd_print(uint8_t *spd_data, int len) int sdram_width = 0; int mem_size = 0; int lrank_dimm; + uint32_t year; + uint32_t week; - if (len < 148) - return -1; /* we need first 91 bytes to do our thing */ + if (len < 348) + return -1; /* "Logical rank" referes to the individually addressable die * in a 3DS stack and has no meaning for monolithic or @@ -879,7 +881,7 @@ ipmi_spd_print(uint8_t *spd_data, int len) * rank per package rank. */ lrank_dimm = (spd_data[12]>>3&0x3) + 1; /* Number of Package Ranks per DIMM */ - if ((spd_data[6] & 0x3) == 0x10) { /* 3DS package Type */ + if ((spd_data[6] & 0x3) == 0x2) { /* 3DS package Type */ lrank_dimm *= ((spd_data[6]>>4)&0x3) + 1; /* Die Count */ } sdram_cap = ldexp(256,(spd_data[4]&15)); @@ -931,8 +933,8 @@ ipmi_spd_print(uint8_t *spd_data, int len) } - u_int year = (spd_data[323]>>4)*10 + spd_data[323]&15; - u_int week = (spd_data[324]>>4)*10 + spd_data[324]&15; + year = ((spd_data[323] >> 4) * 10) + (spd_data[323] & 15); + week = ((spd_data[324]>>4) * 10) + (spd_data[324] & 15); printf(" Manufacture Date : year %4d week %2d\n", 2000 + year, week); @@ -948,6 +950,9 @@ ipmi_spd_print(uint8_t *spd_data, int len) } else { + if (len < 100) { + return (-1); + } ii = (spd_data[3] & 0x0f) + (spd_data[4] & 0x0f) - 17; k = ((spd_data[5] & 0x7) + 1) * spd_data[17]; @@ -1064,7 +1069,6 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id) offset = 0; memset(spd_data, 0, fru.size); do { - int i; msg_data[0] = id; msg_data[1] = offset & 0xFF; msg_data[2] = offset >> 8; |