Jinxin Ying
2014-07-08 09:57:08 UTC
Hi guys
A bit confuse when read the procedure read_fru_area code in ipmi_fru.c
Both offset and the "count returned" will be adjusted to word and byte according to the fru->access
<SNIP>
tmp = fru->access ? off >> 1 : off;
msg_data[0] = id;
msg_data[1] = (uint8_t)(tmp & 0xff);
msg_data[2] = (uint8_t)(tmp >> 8);
... ...
tmp = fru->access ? rsp->data[0] << 1 : rsp->data[0];
memcpy((frubuf + off), rsp->data + 1, tmp);
</SNIP>
Why the Count to read didn't to do the same adjust based on fru->access? I think it should have the same logic like
<SNIP>
tmp = finish - off;
if (tmp > fru_data_rqst_size)
tmp = fru_data_rqst_size;
if (fru->access) //Added
tmp >>= 1; // Added
msg_data[3] = (uint8_t)tmp;
</SNIP>
Regards
--Jinxin
A bit confuse when read the procedure read_fru_area code in ipmi_fru.c
Both offset and the "count returned" will be adjusted to word and byte according to the fru->access
<SNIP>
tmp = fru->access ? off >> 1 : off;
msg_data[0] = id;
msg_data[1] = (uint8_t)(tmp & 0xff);
msg_data[2] = (uint8_t)(tmp >> 8);
... ...
tmp = fru->access ? rsp->data[0] << 1 : rsp->data[0];
memcpy((frubuf + off), rsp->data + 1, tmp);
</SNIP>
Why the Count to read didn't to do the same adjust based on fru->access? I think it should have the same logic like
<SNIP>
tmp = finish - off;
if (tmp > fru_data_rqst_size)
tmp = fru_data_rqst_size;
if (fru->access) //Added
tmp >>= 1; // Added
msg_data[3] = (uint8_t)tmp;
</SNIP>
Regards
--Jinxin