Fix OCC response checksum calculation
The OCC checksum calculation should be ignoring overflow.
Removed redundant trace of the occActive state:
'''
Aug 23 18:38:52 rain100bmc openpower-occ-control[6515]: updateOCCActive: OCC0 active=true
Aug 23 18:38:52 rain100bmc openpower-occ-control[6515]: Status::occActive OCC0 changed to true
'''
Added trace of first 4 bytes of data for pass-through commands:
'''
Aug 23 19:19:30 rain100bmc openpower-occ-control[27848]: PassThrough::send() Sending 0x00 command to OCC0 (data len=1, data=0x20)
Aug 23 19:19:40 rain100bmc openpower-occ-control[27848]: PassThrough::send() Sending 0x40 command to OCC0 (data len=5, data=0x07001000...)
'''
Change-Id: I632b0e0af214858e15f3d5c196723dc6ffe12445
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/occ_command.cpp b/occ_command.cpp
index 5ab5e12..0b9faa1 100644
--- a/occ_command.cpp
+++ b/occ_command.cpp
@@ -211,15 +211,12 @@
const unsigned int csumIndex = response.size() - 2;
const uint32_t rspChecksum =
(response[csumIndex] << 8) + response[csumIndex + 1];
- uint32_t calcChecksum = 0;
+ // OCC checksum is the 2 byte sum of data (ignoring overflow)
+ uint16_t calcChecksum = 0;
for (unsigned int index = 0; index < csumIndex; ++index)
{
calcChecksum += response[index];
}
- while (calcChecksum > 0xFFFF)
- {
- calcChecksum = (calcChecksum & 0xFFFF) + (calcChecksum >> 16);
- }
if (calcChecksum != rspChecksum)
{
log<level::ERR>(