diff options
author | Prasad Bg Ranganath <prasadbgr@in.ibm.com> | 2017-05-04 01:47:40 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2017-06-01 09:29:14 -0400 |
commit | d1cce79a12c738b4d7775745fea4072c25b66688 (patch) | |
tree | dc77bde6ccbde7f5668ab178de06f32b4f5bdb15 /src | |
parent | b1d1e9ae2489d0d3ac3be3ce115c71a3be19d9ad (diff) | |
download | talos-sbe-d1cce79a12c738b4d7775745fea4072c25b66688.tar.gz talos-sbe-d1cce79a12c738b4d7775745fea4072c25b66688.zip |
SBE:putring changes of accessing the RS4 data for optimization
Change-Id: Ie4e920fa51cf94bd7b8034c156d953806c5d6b0c
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40055
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Reviewed-by: Shakeeb A. Pasha B K <shakeebbk@in.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40189
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/import/chips/p9/utils/p9_putRingUtils.C | 89 | ||||
-rw-r--r-- | src/import/chips/p9/utils/p9_putRingUtils.H | 39 |
2 files changed, 71 insertions, 57 deletions
diff --git a/src/import/chips/p9/utils/p9_putRingUtils.C b/src/import/chips/p9/utils/p9_putRingUtils.C index 8c82e7e1..499cd8c8 100644 --- a/src/import/chips/p9/utils/p9_putRingUtils.C +++ b/src/import/chips/p9/utils/p9_putRingUtils.C @@ -37,36 +37,7 @@ using namespace RING_TYPES; namespace RS4 { -// -// Function Definitions -// -/// -/// @brief Return a big-endian-indexed nibble from a byte string -/// @param[in] i_rs4Str The RS4 scan string -/// @param[in] i_nibbleIndx Index into i_rs4Str that need to converted -/// into a nibble -/// @return big-endian-indexed nibble -/// -uint8_t rs4_get_nibble(const uint8_t* i_rs4Str, const uint32_t i_nibbleIndx) -{ - uint8_t l_byte; - uint8_t l_nibble; - - l_byte = i_rs4Str[i_nibbleIndx / 2]; - - - if(i_nibbleIndx % 2) - { - l_nibble = (l_byte & 0x0f); - } - else - { - l_nibble = (l_byte >> 4); - } - - return l_nibble; -} /// /// @brief Return verbatim data from the RS4 string @@ -86,24 +57,32 @@ uint64_t rs4_get_verbatim(const uint8_t* i_rs4Str, uint64_t l_doubleWord = 0; uint32_t l_index = i_nibbleIndx; + rs4_data_t l_rs4_data; + const uint32_t* l_data = NULL; + uint32_t l_cnt = 0; + uint32_t l_offset = 0; - for(uint8_t i = 1; i <= i_nibbleCount; i++, l_index++) + + for(uint8_t i = 1; i <= i_nibbleCount; i++) { - l_byte = i_rs4Str[l_index / 2]; + l_cnt = l_index >> 1; - if(l_index % 2) - { - l_nibble = (l_byte & 0x0f); - } - else + if ( !(l_index % 8) || (i == 1)) { - l_nibble = (l_byte >> 4); + l_offset = l_cnt - (l_cnt % 4); + l_data = reinterpret_cast<uint32_t*> (const_cast<uint8_t*>(i_rs4Str) + l_offset); + l_rs4_data.iv_data = *l_data; } + l_byte = l_rs4_data.fields.val[l_cnt % 4]; + + l_nibble = (l_index % 2) ? (l_byte & 0x0f) : (l_byte >> 4); + uint64_t l_tempDblWord = l_nibble; l_tempDblWord <<= (64 - (4 * i)); l_doubleWord |= l_tempDblWord; + l_index++; } return l_doubleWord; @@ -123,15 +102,32 @@ uint64_t stop_decode(const uint8_t* i_rs4Str, uint64_t l_numNibblesParsed = 0; // No.of nibbles that make up the stop-code uint64_t l_numNonZeroNibbles = 0; uint8_t l_nibble; + uint8_t l_byte; + rs4_data_t l_rs4_data; + const uint32_t* l_data = NULL; + uint32_t l_cnt = 0; + uint32_t l_offset = 0; do { - l_nibble = rs4_get_nibble(i_rs4Str, i_nibbleIndx); + l_cnt = i_nibbleIndx >> 1; + + if ( !(i_nibbleIndx % 8) || (l_numNibblesParsed == 0)) + { + l_offset = l_cnt - (l_cnt % 4); + l_data = reinterpret_cast<uint32_t*> (const_cast<uint8_t*>(i_rs4Str) + l_offset); + + l_rs4_data.iv_data = *l_data; + } + + l_byte = l_rs4_data.fields.val[l_cnt % 4]; + l_nibble = (i_nibbleIndx % 2) ? (l_byte & 0x0f) : (l_byte >> 4); l_numNonZeroNibbles = (l_numNonZeroNibbles * 8) + (l_nibble & 0x07); i_nibbleIndx++; l_numNibblesParsed++; + } while((l_nibble & 0x08) == 0); @@ -496,18 +492,21 @@ fapi2::ReturnCode writeHeader(const fapi2::Target<fapi2::TARGET_TYPE_ALL>& return l_rc; } - /// @brief Function to reader the header data from the ring and verify it. /// @param[in] i_target Chiplet Target of Scan /// @param[in] i_header The header data that is expected. // @param[in] i_chipletId data from RS4 // @param[in] i_ringMode different ring mode operations +// @param[in] i_bitsDecoded number of bits rotated and scanned +// @param[in] i_ringId ring Id that we scanned /// @return FAPI2_RC_SUCCESS if success, else error code. fapi2::ReturnCode verifyHeader(const fapi2::Target<fapi2::TARGET_TYPE_ALL>& i_target, const uint64_t i_header, const uint8_t i_chipletId, - const fapi2::RingMode i_ringMode) + const fapi2::RingMode i_ringMode, + const uint32_t i_bitsDecoded, + const uint16_t i_ringId) { fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS; @@ -1105,8 +1104,7 @@ fapi2::ReturnCode rs4DecompressionSvc( { FAPI_INF(">> rs4DecompressionSvc"); CompressedScanData* l_rs4Header = (CompressedScanData*) i_rs4; - const uint8_t* l_rs4Str = (i_rs4 + sizeof(CompressedScanData)); - + const uint8_t* l_rs4Str = (i_rs4 + sizeof(CompressedScanData)); opType_t l_opType = ROTATE; uint64_t l_nibbleIndx = 0; uint64_t l_bitsDecoded = 0; @@ -1247,11 +1245,9 @@ fapi2::ReturnCode rs4DecompressionSvc( if(0xF == l_scanCount) // We are parsing RS4 for override rings { i_applyOverride = true; - uint8_t l_careMask = - rs4_get_nibble(l_rs4Str, l_nibbleIndx); + uint8_t l_careMask = rs4_get_nibble(l_rs4Str, l_nibbleIndx); l_nibbleIndx++; - uint8_t l_spyData = - rs4_get_nibble(l_rs4Str, l_nibbleIndx); + uint8_t l_spyData = rs4_get_nibble(l_rs4Str, l_nibbleIndx); l_nibbleIndx++; for(uint8_t i = 0; i < 4; i++) @@ -1410,7 +1406,6 @@ fapi2::ReturnCode rs4DecompressionSvc( { // scan them into the ring uint8_t l_data = rs4_get_nibble(l_rs4Str, l_nibbleIndx); - l_nibbleIndx += 1; for(uint8_t i = 0; i < l_nibble; i++) diff --git a/src/import/chips/p9/utils/p9_putRingUtils.H b/src/import/chips/p9/utils/p9_putRingUtils.H index 9c3c91bd..fdd6b752 100644 --- a/src/import/chips/p9/utils/p9_putRingUtils.H +++ b/src/import/chips/p9/utils/p9_putRingUtils.H @@ -58,15 +58,6 @@ uint64_t stop_decode(const uint8_t* i_rs4Str, uint64_t& o_numRotate); /// -/// @brief Return a big-endian-indexed nibble from a byte string -/// @param[in] i_rs4Str The RS4 scan string -/// @param[in] i_nibbleIndx Index into i_rs4Str that need to converted -/// into a nibble -/// @return big-endian-indexed nibble -/// -uint8_t rs4_get_nibble(const uint8_t* i_rs4Str, const uint32_t i_nibbleIndx); - -/// /// @brief Return verbatim data from the RS4 string /// @param[in] i_rs4Str The RS4 scan string /// @param[in] i_nibbleIndx Index into i_rs4Str that need to converted @@ -79,6 +70,20 @@ uint64_t rs4_get_verbatim(const uint8_t* i_rs4Str, const uint32_t i_nibbleIndx, const uint8_t i_nibbleCount); +/// +/// @brief Return a big-endian-indexed nibble from a byte string +/// @param[in] i_rs4Str The RS4 scan string +/// @param[in] i_nibbleIndx Index into i_rs4Str that need to converted +/// into a nibble +/// @return big-endian-indexed nibble +/// +inline uint8_t rs4_get_nibble(const uint8_t* i_rs4Str, const uint32_t i_nibbleIndx) +{ + uint8_t l_byte = i_rs4Str[i_nibbleIndx >> 1]; + + return ((i_nibbleIndx % 2) ? (l_byte & 0x0f) : (l_byte >> 4)); +} + }; // end of RS4 namespace using namespace RS4; @@ -94,6 +99,14 @@ struct restoreOpcgRegisters fapi2::buffer<uint64_t> l_opcgCapt2; fapi2::buffer<uint64_t> l_opcgCapt3; }; +typedef union __attribute__((__packed__)) rs4_data +{ + uint32_t iv_data; + struct + { + uint8_t val[4]; + } fields; +} rs4_data_t; #define SIXTYFOUR_BIT_HEADER 64 @@ -164,12 +177,18 @@ fapi2::ReturnCode writeHeader(const fapi2::Target<fapi2::TARGET_TYPE_ALL>& /// @param[in] i_header The header data that is expected. // @param[in] i_chipletId data from RS4 // @param[in] i_ringMode differnet ring mode operations +// @param[in] i_bitsDecoded number of bits rotated and scanned +// @param[in] i_ringId ring Id that we scanned /// @return FAPI2_RC_SUCCESS if success, else error code. fapi2::ReturnCode verifyHeader(const fapi2::Target<fapi2::TARGET_TYPE_ALL>& i_target, const uint64_t i_header, const uint8_t i_chipletId, - const fapi2::RingMode i_ringMode); + const fapi2::RingMode i_ringMode, + const uint32_t i_bitsDecoded = 0, + const uint16_t i_ringId = 0); + + /// @brief Function to decompress the RS4 and apply the Ring data |