diff options
-rw-r--r-- | src/hwpf/include/plat/plat_hw_access.H | 14 | ||||
-rw-r--r-- | src/hwpf/src/plat/plat_hw_access.C | 36 | ||||
-rw-r--r-- | src/sbefw/sbecmdringaccess.C | 44 |
3 files changed, 40 insertions, 54 deletions
diff --git a/src/hwpf/include/plat/plat_hw_access.H b/src/hwpf/include/plat/plat_hw_access.H index 23637c10..55c84f98 100644 --- a/src/hwpf/include/plat/plat_hw_access.H +++ b/src/hwpf/include/plat/plat_hw_access.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -116,18 +116,6 @@ namespace fapi2 fapi2::ReturnCode getRing_setup(const uint32_t i_ringAddress, const fapi2::RingMode i_ringMode); - // This function read the 64 bit data from the hardware - // @param[in] i_ringAddress - absolute ring address - // @param [out]: 64 bit data - // @param [in] i_bitShiftValue - Bit shift value that needs to rotate - // @note- If the ring length is divisble by 64, then bitshift will always be - // 64, else need to store the ring_length mod 64 and send that value in the - // last iteration. - // @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. - fapi2::ReturnCode getRing_granule_data(const uint32_t i_ringAddress, - uint64_t *o_data, - const uint32_t i_bitShiftValue); - // This function verify the check word data is matching or not and will // clean up the scan region data // @param[in] i_ringAddress - absolute ring address diff --git a/src/hwpf/src/plat/plat_hw_access.C b/src/hwpf/src/plat/plat_hw_access.C index ffab1c60..8508eda1 100644 --- a/src/hwpf/src/plat/plat_hw_access.C +++ b/src/hwpf/src/plat/plat_hw_access.C @@ -103,42 +103,6 @@ ReturnCode getRing_setup(const uint32_t i_ringAddress, return l_rc; } -ReturnCode getRing_granule_data(const uint32_t i_ringAddress, - uint64_t *o_data, - const uint32_t i_bitShiftValue) -{ - fapi2::ReturnCode l_rc = FAPI2_RC_SUCCESS; - uint32_t l_chipletId = i_ringAddress & 0xFF000000; - - fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> l_proc; - - uint32_t l_scomAddress = 0x00038000; - l_scomAddress |= l_chipletId; - - do - { - fapi2::buffer<uint64_t> l_ringData; - l_rc = fapi2::getScom(l_proc, l_scomAddress, l_ringData); - if(l_rc != fapi2::FAPI2_RC_SUCCESS) - { - break; - } - *o_data = l_ringData; - - l_scomAddress = 0x00038000 | i_bitShiftValue; - l_scomAddress |= l_chipletId; - - l_rc = fapi2::getScom(l_proc, l_scomAddress, l_ringData); - if(l_rc != fapi2::FAPI2_RC_SUCCESS) - { - break; - } - } while(0); - - return l_rc; -} - - ReturnCode getRing_verifyAndcleanup(const uint32_t i_ringAddress, const RingMode i_ringMode) { diff --git a/src/sbefw/sbecmdringaccess.C b/src/sbefw/sbecmdringaccess.C index 985de100..bd3afb06 100644 --- a/src/sbefw/sbecmdringaccess.C +++ b/src/sbefw/sbecmdringaccess.C @@ -125,6 +125,7 @@ uint32_t sbeGetRing(uint8_t *i_pArg) ReturnCode l_fapiRc; uint32_t l_len = 0; uint32_t l_bitSentCnt = 0; + const uint32_t LONG_ROTATE_ADDRESS = 0x0003E000; do { @@ -169,7 +170,11 @@ uint32_t sbeGetRing(uint8_t *i_pArg) // fix for the alignment issue uint32_t l_buf[NUM_WORDS_PER_GRANULE]__attribute__ ((aligned (8))) ={0}; uint32_t l_bitShift = 0; + uint64_t l_tmpbuf = 0; l_len = NUM_WORDS_PER_GRANULE; + plat_target_handle_t l_hndl; + uint32_t l_chipletId = (uint32_t)(l_reqMsg.ringAddr) & 0xFF000000; + uint32_t l_scomAddress = 0; // Fetch the ring data in bits, each iteration will give you 64bits for(uint32_t l_cnt=0; l_cnt < l_loopCnt; l_cnt++) @@ -180,12 +185,19 @@ uint32_t sbeGetRing(uint8_t *i_pArg) } else { - l_bitShift = GETRING_GRANULE_SIZE_IN_BITS; + //For the very first call sending F's .. because in the lower + //level function.. wiil read the first 64bit data and then + //shift. Sending F's only for the first will avoid 2 scom + //operation for every getring call. + //Note-Read operation flow is SHIFT and then READ. + l_bitShift = (l_cnt == 0) ? 0x0: GETRING_GRANULE_SIZE_IN_BITS; } - // Call getRing_granule_data - read the 64 bit data from the HW - l_fapiRc = getRing_granule_data((uint32_t)(l_reqMsg.ringAddr), - (uint64_t*)&l_buf, - l_bitShift); + l_scomAddress = LONG_ROTATE_ADDRESS | l_chipletId; + l_scomAddress |= l_bitShift; + l_fapiRc = getscom_abs_wrap (&l_hndl, + l_scomAddress, + (uint64_t*)&l_buf); + if( l_fapiRc != FAPI2_RC_SUCCESS ) { SBE_ERROR(SBE_FUNC" getRing_granule_data failed. " @@ -197,6 +209,28 @@ uint32_t sbeGetRing(uint8_t *i_pArg) break; } + //this is only for the first time. + if (l_cnt == 0) + { + l_bitShift = GETRING_GRANULE_SIZE_IN_BITS; + l_scomAddress = LONG_ROTATE_ADDRESS | l_chipletId; + l_scomAddress |= l_bitShift; + l_fapiRc = getscom_abs_wrap (&l_hndl, + l_scomAddress, + &l_tmpbuf); + + if( l_fapiRc != FAPI2_RC_SUCCESS ) + { + SBE_ERROR(SBE_FUNC" getRing_granule_data failed. " + "RingAddress:0x%08X RingMode:0x%04x", + l_reqMsg.ringAddr, l_ringMode); + respHdr.setStatus( SBE_PRI_GENERIC_EXECUTION_FAILURE, + SBE_SEC_GENERIC_FAILURE_IN_EXECUTION); + l_ffdc.setRc(l_fapiRc); + break; + } + } + // Send it to DS Fifo // If this is the last iteration in the loop, let the full 64bit // go, even for 1bit of remaining length. The length passed to |