diff options
author | Thi Tran <thi@us.ibm.com> | 2011-10-05 13:52:52 -0500 |
---|---|---|
committer | Thi N. Tran <thi@us.ibm.com> | 2011-10-10 10:42:23 -0500 |
commit | 4de170997eee6244b2091bb8bf065ae2da1396d7 (patch) | |
tree | 99275148dda9cb03afe005b86ec42746ded135a4 /src/usr/ecmddatabuffer | |
parent | 9de4a404823c4315d90992d5d08a7fe1794a74c3 (diff) | |
download | talos-hostboot-4de170997eee6244b2091bb8bf065ae2da1396d7.tar.gz talos-hostboot-4de170997eee6244b2091bb8bf065ae2da1396d7.zip |
Added putScomUnderMask/get/put/modifyCfamRegister interfaces
Updated with review comments from set 1
Updated with review comments from set 3
Change-Id: Iaea4c37fe130cb04e99ebdea872ff4c690156f4d
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/424
Tested-by: Jenkins Server
Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
Diffstat (limited to 'src/usr/ecmddatabuffer')
-rwxr-xr-x | src/usr/ecmddatabuffer/ecmdDataBuffer.C | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/usr/ecmddatabuffer/ecmdDataBuffer.C b/src/usr/ecmddatabuffer/ecmdDataBuffer.C index 4041a3bcb..4b0323137 100755 --- a/src/usr/ecmddatabuffer/ecmdDataBuffer.C +++ b/src/usr/ecmddatabuffer/ecmdDataBuffer.C @@ -235,3 +235,42 @@ uint64_t ecmdDataBufferBase::getDoubleWord(uint32_t i_doublewordoffset) const return ret; } +uint32_t ecmdDataBufferBase::setWord(uint32_t i_wordOffset, uint32_t i_value) +{ + uint32_t rc = ECMD_DBUF_SUCCESS; + + if (i_wordOffset >= getWordLength()) + { + TRACFCOMP(g_trac_ecmd, "**** ERROR : ecmdDataBuffer::setWord: wordoffset %d >= NumWords (%d)", i_wordOffset, getWordLength()); + return (ECMD_DBUF_BUFFER_OVERFLOW); + } + + // Create mask if part of this word is not in the valid part of the ecmdDataBuffer + if (((i_wordOffset + 1) == getWordLength()) && (iv_NumBits % 32)) + { + /* Create my mask */ + uint32_t bitMask = 0xFFFFFFFF; + /* Shift it left by the amount of unused bits */ + bitMask <<= ((32 * getWordLength()) - iv_NumBits); + /* Clear the unused bits */ + i_value &= bitMask; + } + + iv_Data[i_wordOffset] = i_value; + + return rc; +} + +uint32_t ecmdDataBufferBase::getWord(uint32_t i_wordOffset) const +{ + if (i_wordOffset >= getWordLength()) + { + TRACFCOMP(g_trac_ecmd,"**** ERROR : ecmdDataBuffer::getWord: i_wordOffset %d >= NumWords (%d)", + i_wordOffset, getWordLength()); + return 0; + } + + return this->iv_Data[i_wordOffset]; +} + + |