summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShakeeb <shakeebbk@in.ibm.com>2016-09-22 02:02:41 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-10-04 07:11:47 -0400
commitfcf2fc04cfa705d3beb138edfe379ab0c228aad6 (patch)
tree465e4c7bddc76b7d5b5d05e3139182565f89633f
parent7c87046da09c051b8a6b5084b227b05d4ca80a16 (diff)
downloadtalos-sbe-fcf2fc04cfa705d3beb138edfe379ab0c228aad6.tar.gz
talos-sbe-fcf2fc04cfa705d3beb138edfe379ab0c228aad6.zip
SBE plat scom error handling
Change-Id: Iffc9686fa745040a0d0f1c3a6b5f0dacc89a1c66 RTC:158016 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30078 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
-rw-r--r--src/hwpf/include/plat/plat_hw_access.H14
-rw-r--r--src/hwpf/src/plat/plat_hw_access.C55
-rw-r--r--src/sbefw/sbeFifoMsgUtils.C38
-rw-r--r--src/sbefw/sbeFifoMsgUtils.H40
-rw-r--r--src/sbefw/sbecmdcntrldmt.C6
-rw-r--r--src/sbefw/sbecmdprocessor.C13
-rw-r--r--src/sbefw/sbecmdscomaccess.C108
-rw-r--r--src/sbefw/sbescom.C28
-rw-r--r--src/sbefw/sbescom.H13
-rwxr-xr-xsrc/test/testcases/testPutGetScom.py16
10 files changed, 122 insertions, 209 deletions
diff --git a/src/hwpf/include/plat/plat_hw_access.H b/src/hwpf/include/plat/plat_hw_access.H
index cd0078f9..23637c10 100644
--- a/src/hwpf/include/plat/plat_hw_access.H
+++ b/src/hwpf/include/plat/plat_hw_access.H
@@ -140,22 +140,24 @@ namespace fapi2
///
/// @brief Platform wrapper over PK getscom_abs
///
- /// @param [in] i_addr The SCOM address
+ /// @param [in] i_addr The SCOM address
/// @param [out] o_data The data read
///
- /// @return PCB-PIB return code
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
///
- uint32_t getscom_abs_wrap(const void *i_target, const uint32_t i_addr, uint64_t *o_data);
+ fapi2::ReturnCode getscom_abs_wrap(const void *i_target,
+ const uint32_t i_addr, uint64_t *o_data);
///
/// @brief Platform wrapper over PK putscom_abs
///
/// @param [in] i_addr The SCOM address
- /// @param [in] i_data The data read
+ /// @param [in] i_data The data to write
///
- /// @return PCB-PIB return code
+ /// @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code.
///
- uint32_t putscom_abs_wrap(const void *i_target, const uint32_t i_addr, uint64_t i_data);
+ fapi2::ReturnCode putscom_abs_wrap(const void *i_target,
+ const uint32_t i_addr, uint64_t i_data);
///
/// @brief Platform wrapper to retry scom for parity/timeout errors
diff --git a/src/hwpf/src/plat/plat_hw_access.C b/src/hwpf/src/plat/plat_hw_access.C
index a6eaf91c..9ff0daa9 100644
--- a/src/hwpf/src/plat/plat_hw_access.C
+++ b/src/hwpf/src/plat/plat_hw_access.C
@@ -206,36 +206,59 @@ static uint32_t getEffectiveAddress(const plat_target_handle_t &i_target, const
return l_addr;
}
-uint32_t getscom_abs_wrap(const void *i_target, const uint32_t i_addr, uint64_t *o_data)
+fapi2::ReturnCode getscom_abs_wrap(const void *i_target,
+ const uint32_t i_addr, uint64_t *o_data)
{
- uint32_t l_rc = 0;
+ uint32_t l_pibRc = 0;
uint32_t l_addr = getEffectiveAddress(*(plat_target_handle_t*)i_target, i_addr);
FAPI_INF("getScom: address: 0x%08X", l_addr);
- l_rc = getscom_abs(l_addr, o_data);
- if( PIB_NO_ERROR != l_rc )
+ l_pibRc = getscom_abs(l_addr, o_data);
+ if( PIB_NO_ERROR != l_pibRc )
{
- l_rc = p9_pibErrRetry( l_addr, o_data, l_rc, true);
+ l_pibRc = p9_pibErrRetry( l_addr, o_data, l_pibRc, true);
}
- FAPI_INF("getScom: returned rc: 0x%08X, data HI: 0x%08X, "
- "data LO: 0x%08X", l_rc, (*o_data >> 32),
+ FAPI_INF("getScom: returned pibRc: 0x%08X, data HI: 0x%08X, "
+ "data LO: 0x%08X", l_pibRc, (*o_data >> 32),
static_cast<uint32_t>(*o_data & 0xFFFFFFFF));
- return l_rc;
+ fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
+ // Setting 64bit address in ffdc package as the parsers are
+ // hard coded to read 64bit address
+ const uint64_t ffdcAddr = l_addr;
+ PLAT_FAPI_ASSERT( PIB_NO_ERROR == l_pibRc,
+ SBE_SCOM_FAILURE().
+ set_address(ffdcAddr).
+ set_pcb_pib_rc(l_pibRc),
+ "getScom:pcb pib error");
+fapi_try_exit:
+ return fapi2::current_err;
}
-uint32_t putscom_abs_wrap(const void *i_target, const uint32_t i_addr, uint64_t i_data)
+fapi2::ReturnCode putscom_abs_wrap(const void *i_target,
+ const uint32_t i_addr, uint64_t i_data)
{
- uint32_t l_rc = 0;
- uint32_t l_addr = getEffectiveAddress(*(plat_target_handle_t*)i_target, i_addr);
+ uint32_t l_pibRc = 0;
+ uint32_t l_addr = getEffectiveAddress(*(plat_target_handle_t*)i_target,
+ i_addr);
FAPI_INF("putScom: address: 0x%08X, data HI: 0x%08X, data LO: 0x%08X",
l_addr, (i_data >> 32),
static_cast<uint32_t>(i_data & 0xFFFFFFFF));
- l_rc = putscom_abs(l_addr, i_data);
- if( PIB_NO_ERROR != l_rc )
+ l_pibRc = putscom_abs(l_addr, i_data);
+ if( PIB_NO_ERROR != l_pibRc )
{
- l_rc = p9_pibErrRetry( l_addr, &i_data, l_rc, false);
+ l_pibRc = p9_pibErrRetry( l_addr, &i_data, l_pibRc, false);
}
- FAPI_INF("putScom: returned rc: 0x%08X", l_rc);
- return l_rc;
+ FAPI_INF("putScom: returned pibRc: 0x%08X", l_pibRc);
+ fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
+ // Setting 64bit address in ffdc package as the parsers are
+ // hard coded to read 64bit address
+ const uint64_t ffdcAddr = l_addr;
+ PLAT_FAPI_ASSERT( PIB_NO_ERROR == l_pibRc,
+ SBE_SCOM_FAILURE().
+ set_address(ffdcAddr).
+ set_pcb_pib_rc(l_pibRc),
+ "putScom:pcb pib error");
+fapi_try_exit:
+ return fapi2::current_err;
}
uint32_t p9_pibErrRetry( const uint32_t i_addr, uint64_t *io_data,
diff --git a/src/sbefw/sbeFifoMsgUtils.C b/src/sbefw/sbeFifoMsgUtils.C
index 1f35bf6d..6b12482c 100644
--- a/src/sbefw/sbeFifoMsgUtils.C
+++ b/src/sbefw/sbeFifoMsgUtils.C
@@ -248,43 +248,6 @@ uint32_t sbeDownFifoEnq_mult (uint32_t &io_len,
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
-void sbeBuildMinRespHdr ( uint32_t *io_pBuf,
- uint32_t &io_curIndex,
- const uint16_t i_primStatus,
- const uint16_t i_secStatus,
- const uint32_t i_pcbpibStatus,
- const uint32_t i_startIndex )
-{
- do
- {
- if (!io_pBuf)
- {
- break;
- }
-
- io_pBuf[io_curIndex] = sbeBuildRespHeaderMagicCodeCmdClass();
- io_pBuf[++io_curIndex] = sbeBuildRespHeaderStatusWordLocal(
- i_primStatus, i_secStatus);
-
- // Pcb-Pib error is optional,
- // not needed for success case
- if ( (i_primStatus != SBE_PRI_OPERATION_SUCCESSFUL) ||
- (i_pcbpibStatus != PIB_NO_ERROR) )
- {
- io_pBuf[++io_curIndex] = i_pcbpibStatus;
- }
-
- // Somehow this compiler isn't allowing the
- // index pre-increment for the last array entry
- // directly embedded into the assignment
- ++io_curIndex;
- io_pBuf[io_curIndex] = io_curIndex - i_startIndex + 1;
-
- } while(false);
-}
-
-////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////
uint32_t sbeDownFifoSignalEot (void)
{
uint32_t l_rc = 0;
@@ -390,7 +353,6 @@ uint32_t sbeDsSendRespHdr(const sbeRespGenHdr_t &i_hdr,
{
break;
}
- SBE_INFO("sizeof(sbeFfdc_t) [%x]", sizeof(sbeFfdc_t));
}while(0);
return rc;
diff --git a/src/sbefw/sbeFifoMsgUtils.H b/src/sbefw/sbeFifoMsgUtils.H
index 436ffdb0..f652b296 100644
--- a/src/sbefw/sbeFifoMsgUtils.H
+++ b/src/sbefw/sbeFifoMsgUtils.H
@@ -98,23 +98,6 @@ extern uint32_t sbeUpFifoDeq_mult (uint32_t &io_len,
extern uint32_t sbeDownFifoEnq_mult (uint32_t &io_len,
const uint32_t *i_pData) ;
-
-/**
- * @brief sbeBuildRespHeaderMagicCodeCmdClass
- * Builds the header word containing the magic code,
- * the command class and the opcode
- *
- * @return Returns the header word in the response header
- * containing the magic code, command class and opcode
- *
- */
-extern inline uint32_t sbeBuildRespHeaderMagicCodeCmdClass (void)
-{
- return ( (0xC0DE0000) |
- (uint32_t)(g_sbeFifoCmdHdr.cmdClass << 8) |
- (uint32_t)(g_sbeFifoCmdHdr.command));
-}
-
/**
* @brief sbeBuildRespHeaderStatusWordGlobal
* Builds the status header word from global variables
@@ -146,29 +129,6 @@ extern inline uint32_t sbeBuildRespHeaderStatusWordLocal (
}
/**
- * @brief sbeBuildMinRespHdr : Builds minimum response header
- *
- * @desc This builds the buffer with the following status words
- * - Magic Bytes, Command Class, Command opcode
- * - Primary Status Code, Secondary Status Code
- * - PCB / PIB Status Code [optional]
- * - Distance to Status Header
- * @param[in/out] uint32_t *io_pBuf Buffer to be filled in
- * @param[in/out] uint32_t &io_curIndex Current Index into the buffer
- * @param[in] const uint16_t i_primStatus Primary Response Status Code
- * @param[in] const uint16_t i_secStatus Secondary Response Status Code
- * @param[in] const uint32_t i_pcbpibStatus PCB-PIB Response Status Code
- * @param[in] const uint32_t i_startIndex Starting Index into the buffer
- */
-
-void sbeBuildMinRespHdr ( uint32_t *io_pBuf,
- uint32_t &io_curIndex,
- const uint16_t i_primStatus,
- const uint16_t i_secStatus,
- const uint32_t i_pcbpibStatus,
- const uint32_t i_startIndex = 0 );
-
-/**
* @brief sbeDownFifoSignalEot : Signal EOT in Downstream FIFO
*
* @return Rc from the underlying scom utility
diff --git a/src/sbefw/sbecmdcntrldmt.C b/src/sbefw/sbecmdcntrldmt.C
index 5ade75c2..23d9ef3c 100644
--- a/src/sbefw/sbecmdcntrldmt.C
+++ b/src/sbefw/sbecmdcntrldmt.C
@@ -64,16 +64,16 @@ void sbeDmtPkExpiryCallback(void *)
#define SBE_FUNC "sbeDmtPkExpiryCallback"
SBE_INFO(SBE_FUNC" DMT Callback Timer has expired..Checkstop the system ");
g_SbeDmtTimerExpired = true;
+ ReturnCode fapiRc = FAPI2_RC_SUCCESS;
(void)SbeRegAccess::theSbeRegAccess().stateTransition(
SBE_DUMP_FAILURE_EVENT);
// check stop the system
- uint32_t l_status = PIB_NO_ERROR;
plat_target_handle_t l_hndl;
- l_status = putscom_abs_wrap(&l_hndl, PERV_N3_LOCAL_FIR_OR,
+ fapiRc = putscom_abs_wrap(&l_hndl, PERV_N3_LOCAL_FIR_OR,
N3_FIR_CORE_CHECKSTOP_BIT);
- if(PIB_NO_ERROR != l_status)
+ if(fapiRc != FAPI2_RC_SUCCESS)
{
// Scom failed
SBE_ERROR(SBE_FUNC "PutScom failed for REG PERV_N3_LOCAL_FIR");
diff --git a/src/sbefw/sbecmdprocessor.C b/src/sbefw/sbecmdprocessor.C
index 7285134d..93f8670d 100644
--- a/src/sbefw/sbecmdprocessor.C
+++ b/src/sbefw/sbecmdprocessor.C
@@ -135,8 +135,8 @@ void sbeHandleFifoResponse (const uint32_t i_rc)
}
uint32_t l_len2dequeue = 0;
- uint32_t l_dist2StatusHdr = 0;
- uint32_t l_sbeDownFifoRespBuf[4] = {0};
+ sbeRespGenHdr_t l_hdr;
+ l_hdr.init();
uint32_t l_secStatus = i_rc;
switch (i_rc)
@@ -178,14 +178,9 @@ void sbeHandleFifoResponse (const uint32_t i_rc)
"l_primStatus[0x%08X], "
"l_secStatus[0x%08X]",
l_primStatus, l_secStatus);
+ l_hdr.setStatus(l_primStatus, l_secStatus);
- sbeBuildMinRespHdr(&l_sbeDownFifoRespBuf[0],
- l_dist2StatusHdr,
- l_primStatus,
- l_secStatus,
- 0);
- l_rc = sbeDownFifoEnq_mult (++l_dist2StatusHdr,
- &l_sbeDownFifoRespBuf[0]);
+ l_rc = sbeDsSendRespHdr(l_hdr);
if (l_rc)
{
SBE_ERROR(SBE_FUNC"sbeDownFifoEnq_mult failure,"
diff --git a/src/sbefw/sbecmdscomaccess.C b/src/sbefw/sbecmdscomaccess.C
index 835dd12c..286dcc9a 100644
--- a/src/sbefw/sbecmdscomaccess.C
+++ b/src/sbefw/sbecmdscomaccess.C
@@ -68,10 +68,11 @@ uint32_t sbeGetScom (uint8_t *i_pArg)
break;
}
- uint32_t l_sbeDownFifoRespBuf[6] = {0};
- uint32_t l_pcbpibStatus = PIB_NO_ERROR;
+ sbeRespGenHdr_t l_hdr;
+ l_hdr.init();
+ sbeResponseFfdc_t l_ffdc;
uint32_t l_len2enqueue = 0;
- uint32_t l_index = 0;
+ uint32_t l_sbeDownFifoRespBuf[2] = {0};
uint64_t l_addr = ( (uint64_t)l_getScomReqMsg.hiAddr << 32) |
l_getScomReqMsg.lowAddr;
@@ -79,12 +80,13 @@ uint32_t sbeGetScom (uint8_t *i_pArg)
SBE_DEBUG(SBE_FUNC"scomAddr[0x%08X%08X]",
l_getScomReqMsg.hiAddr, l_getScomReqMsg.lowAddr);
l_rc = checkIndirectAndDoScom(true, l_addr,
- l_scomData, l_pcbpibStatus);
+ l_scomData,
+ &l_ffdc);
if (l_rc != SBE_SEC_OPERATION_SUCCESSFUL) // scom failed
{
- SBE_ERROR(SBE_FUNC"getscom failed, l_pcbpibStatus[0x%08X], "
- "scomAddr[0x%08X%08X]", l_pcbpibStatus,
+ SBE_ERROR(SBE_FUNC"getscom failed, "
+ "scomAddr[0x%08X%08X]",
l_getScomReqMsg.hiAddr, l_getScomReqMsg.lowAddr);
l_primStatus = SBE_PRI_GENERIC_EXECUTION_FAILURE;
l_secStatus = l_rc;
@@ -107,23 +109,12 @@ uint32_t sbeGetScom (uint8_t *i_pArg)
// handle the failure
break;
}
- l_index = 2;
} // end successful scom
// Build the response header packet
- uint32_t l_curIndex = l_index ;
- sbeBuildMinRespHdr(&l_sbeDownFifoRespBuf[0],
- l_curIndex,
- l_primStatus,
- l_secStatus,
- l_pcbpibStatus,
- l_index);
-
- // Now enqueue into the downstream FIFO
- l_len2enqueue = ++l_curIndex - l_index;
- l_rc = sbeDownFifoEnq_mult (l_len2enqueue,
- &l_sbeDownFifoRespBuf[l_index]);
+ l_hdr.setStatus(l_primStatus, l_secStatus);
+ l_rc = sbeDsSendRespHdr(l_hdr, &l_ffdc);
if (l_rc)
{
// will let command processor routine
@@ -169,9 +160,9 @@ uint32_t sbePutScom (uint8_t *i_pArg)
}
uint64_t l_scomData = 0;
- uint32_t l_sbeDownFifoRespBuf[4] = {0};
- uint32_t l_pcbpibStatus = PIB_NO_ERROR;
- uint32_t l_len2enqueue = 0;
+ sbeRespGenHdr_t l_hdr;
+ l_hdr.init();
+ sbeResponseFfdc_t l_ffdc;
// successfully dequeued two entries for
// scom address followed by the EOT entry
@@ -188,12 +179,10 @@ uint32_t sbePutScom (uint8_t *i_pArg)
SBE_DEBUG(SBE_FUNC"scomAddr[0x%08X%08X]",
l_putScomReqMsg.hiAddr, l_putScomReqMsg.lowAddr);
l_rc = checkIndirectAndDoScom(false, l_addr,
- l_scomData, l_pcbpibStatus);
+ l_scomData, &l_ffdc);
if (l_rc != SBE_SEC_OPERATION_SUCCESSFUL) // scom failed
{
- SBE_ERROR(SBE_FUNC"putscom failed, l_pcbpibStatus[0x%08X]",
- l_pcbpibStatus);
SBE_ERROR(SBE_FUNC"putscom failure data, "
"scomAddr[0x%08X%08X], "
"scomData[0x%08X%08X]",
@@ -207,16 +196,8 @@ uint32_t sbePutScom (uint8_t *i_pArg)
// Build the response header packet
- uint32_t l_curIndex = 0;
- sbeBuildMinRespHdr(&l_sbeDownFifoRespBuf[0],
- l_curIndex,
- l_primStatus,
- l_secStatus,
- l_pcbpibStatus);
-
- // Now enqueue into the downstream FIFO
- l_len2enqueue = ++l_curIndex;
- l_rc = sbeDownFifoEnq_mult (l_len2enqueue, &l_sbeDownFifoRespBuf[0]);
+ l_hdr.setStatus(l_primStatus, l_secStatus);
+ l_rc = sbeDsSendRespHdr(l_hdr, &l_ffdc);
if (l_rc)
{
// will let command processor routine
@@ -266,9 +247,9 @@ uint32_t sbeModifyScom (uint8_t *i_pArg)
break;
}
- uint32_t l_sbeDownFifoRespBuf[4] = {0};
- uint32_t l_pcbpibStatus = PIB_NO_ERROR;
- uint32_t l_len2enqueue = 0;
+ sbeRespGenHdr_t l_hdr;
+ l_hdr.init();
+ sbeResponseFfdc_t l_ffdc;
// Modifying Data
uint64_t l_modifyingData = l_modifyScomMsg.getModifyingData();
@@ -303,12 +284,12 @@ uint32_t sbeModifyScom (uint8_t *i_pArg)
SBE_DEBUG(SBE_FUNC"scomAddr[0x%08X%08X]",
l_modifyScomMsg.hiAddr, l_modifyScomMsg.lowAddr);
l_rc = checkIndirectAndDoScom(true, l_addr,
- l_scomData, l_pcbpibStatus);
+ l_scomData, &l_ffdc);
if (l_rc != SBE_SEC_OPERATION_SUCCESSFUL) // scom failed
{
- SBE_ERROR(SBE_FUNC"getscom failed, l_pcbpibStatus[0x%08X],"
- " ScomAddress[0x%08X %08X]", l_pcbpibStatus,
+ SBE_ERROR(SBE_FUNC"getscom failed,"
+ " ScomAddress[0x%08X %08X]",
l_modifyScomMsg.hiAddr, l_modifyScomMsg.lowAddr);
l_primStatus = SBE_PRI_GENERIC_EXECUTION_FAILURE;
l_secStatus = l_rc;
@@ -330,12 +311,12 @@ uint32_t sbeModifyScom (uint8_t *i_pArg)
// Write the modified data
l_rc = checkIndirectAndDoScom(false, l_addr,
- l_modifyingData, l_pcbpibStatus);
+ l_modifyingData, &l_ffdc);
if (l_rc != SBE_SEC_OPERATION_SUCCESSFUL) // scom failed
{
- SBE_ERROR(SBE_FUNC"putscom failed, l_pcbpibStatus[0x%08X],"
- " ScomAddress[0x%08X%08X]", l_pcbpibStatus,
+ SBE_ERROR(SBE_FUNC"putscom failed,"
+ " ScomAddress[0x%08X%08X]",
l_modifyScomMsg.hiAddr, l_modifyScomMsg.lowAddr);
SBE_ERROR(SBE_FUNC"modifyingData[0x%08X%08X]",
SBE::higher32BWord(l_modifyingData),
@@ -348,17 +329,8 @@ uint32_t sbeModifyScom (uint8_t *i_pArg)
// Build the response header packet
- uint32_t l_curIndex = 0;
- sbeBuildMinRespHdr(&l_sbeDownFifoRespBuf[0],
- l_curIndex,
- l_primStatus,
- l_secStatus,
- l_pcbpibStatus);
-
- // Now enqueue into the downstream FIFO
- l_len2enqueue = ++l_curIndex;
- l_rc = sbeDownFifoEnq_mult (l_len2enqueue,
- (uint32_t *)&l_sbeDownFifoRespBuf);
+ l_hdr.setStatus(l_primStatus, l_secStatus);
+ l_rc = sbeDsSendRespHdr(l_hdr, &l_ffdc);
if (l_rc)
{
// will let command processor routine
@@ -408,9 +380,9 @@ uint32_t sbePutScomUnderMask (uint8_t *i_pArg)
break;
}
- uint32_t l_sbeDownFifoRespBuf[4] = {0};
- uint32_t l_pcbpibStatus = PIB_NO_ERROR;
- uint32_t l_len2enqueue = 0;
+ sbeRespGenHdr_t l_hdr;
+ l_hdr.init();
+ sbeResponseFfdc_t l_ffdc;
SBE_DEBUG(SBE_FUNC"scomAddr[0x%08X%08X],"
"modifyingData[0x%08X%08X]",
@@ -432,7 +404,7 @@ uint32_t sbePutScomUnderMask (uint8_t *i_pArg)
uint64_t l_addr = ( (uint64_t) l_putScomUmaskMsg.hiAddr << 32) |
l_putScomUmaskMsg.lowAddr;
l_rc = checkIndirectAndDoScom(true, l_addr,
- l_scomData, l_pcbpibStatus);
+ l_scomData, &l_ffdc);
if (l_rc == SBE_SEC_OPERATION_SUCCESSFUL) // scom success
{
@@ -440,13 +412,13 @@ uint32_t sbePutScomUnderMask (uint8_t *i_pArg)
// Write the modified data
l_rc = checkIndirectAndDoScom(false, l_addr,
- l_scomData, l_pcbpibStatus);
+ l_scomData, &l_ffdc);
}
if (l_rc != SBE_SEC_OPERATION_SUCCESSFUL) // scom failed
{
- SBE_ERROR(SBE_FUNC"scom failed, l_pcbpibStatus[0x%08X], "
- "ScomAddress[0x%08X%08X]", l_pcbpibStatus,
+ SBE_ERROR(SBE_FUNC"scom failed, "
+ "ScomAddress[0x%08X%08X]",
l_putScomUmaskMsg.hiAddr,
l_putScomUmaskMsg.lowAddr);
SBE_ERROR(SBE_FUNC"modifyingData[0x%08X%08X]"
@@ -463,16 +435,8 @@ uint32_t sbePutScomUnderMask (uint8_t *i_pArg)
} while (false);
// Build the response header packet
- uint32_t l_curIndex = 0;
- sbeBuildMinRespHdr(&l_sbeDownFifoRespBuf[0],
- l_curIndex,
- l_primStatus,
- l_secStatus,
- l_pcbpibStatus);
-
- // Now enqueue into the downstream FIFO
- l_len2enqueue = ++l_curIndex;
- l_rc = sbeDownFifoEnq_mult (l_len2enqueue, &l_sbeDownFifoRespBuf[0]);
+ l_hdr.setStatus(l_primStatus, l_secStatus);
+ l_rc = sbeDsSendRespHdr(l_hdr, &l_ffdc);
if (l_rc)
{
// will let command processor routine
diff --git a/src/sbefw/sbescom.C b/src/sbefw/sbescom.C
index b76f51a4..634c8868 100644
--- a/src/sbefw/sbescom.C
+++ b/src/sbefw/sbescom.C
@@ -28,6 +28,7 @@
#include "sbetrace.H"
#include "plat_hw_access.H"
#include "plat_target.H"
+#include "sbescom.H"
using namespace fapi2;
/**
@@ -68,7 +69,7 @@ enum sbeScomType
uint32_t checkIndirectAndDoScom( const bool i_isRead,
const uint64_t i_addr,
uint64_t & io_data,
- uint32_t & o_pcbPibStatus )
+ sbeResponseFfdc_t *const o_ffdc)
{
#define SBE_FUNC " checkIndirectAndDoScom "
@@ -76,6 +77,7 @@ uint32_t checkIndirectAndDoScom( const bool i_isRead,
uint32_t elapsedIndScomTimeNs = 0;
uint64_t tempBuffer = io_data;
sbeScomType scomType = SBE_SCOM_TYPE_DIRECT;
+ ReturnCode fapiRc = FAPI2_RC_SUCCESS;
do
{
// If the indirect scom bit is 0, then doing a regular scom
@@ -85,12 +87,12 @@ uint32_t checkIndirectAndDoScom( const bool i_isRead,
SBE_INFO(SBE_FUNC "Performing Direct scom.");
if( i_isRead )
{
- o_pcbPibStatus = getscom_abs_wrap (&l_hndl, (uint32_t)i_addr,
+ fapiRc = getscom_abs_wrap (&l_hndl, (uint32_t)i_addr,
& io_data);
}
else
{
- o_pcbPibStatus = putscom_abs_wrap (&l_hndl, (uint32_t)i_addr,
+ fapiRc = putscom_abs_wrap (&l_hndl, (uint32_t)i_addr,
io_data);
}
break;
@@ -148,9 +150,10 @@ uint32_t checkIndirectAndDoScom( const bool i_isRead,
// perform write before the read with the new
// IO_buffer with the imbedded indirect scom addr.
- o_pcbPibStatus = putscom_abs_wrap (&l_hndl, tempAddr, tempBuffer);
+ fapiRc = putscom_abs_wrap (&l_hndl, tempAddr, tempBuffer);
- if( ( o_pcbPibStatus ) || ( scomType == SBE_SCOM_TYPE_INDIRECT_2 ))
+ if( ( fapiRc != FAPI2_RC_SUCCESS ) ||
+ ( scomType == SBE_SCOM_TYPE_INDIRECT_2 ))
{
break;
}
@@ -162,16 +165,15 @@ uint32_t checkIndirectAndDoScom( const bool i_isRead,
{
// Now perform the op requested using the passed in
// IO_Buffer to pass the read data back to caller.
- o_pcbPibStatus = getscom_abs_wrap (&l_hndl, tempAddr, &(scomout.data64));
+ fapiRc = getscom_abs_wrap (&l_hndl, tempAddr, &(scomout.data64));
- if( o_pcbPibStatus ) break;
+ if( fapiRc != FAPI2_RC_SUCCESS) break;
// if bit 32 is on indicating a complete bit
// or we saw an error, then we're done
if (scomout.piberr)
{
SBE_ERROR(SBE_FUNC "pib error reading status register");
- o_pcbPibStatus = scomout.piberr;
break;
}
if (scomout.done )
@@ -185,7 +187,7 @@ uint32_t checkIndirectAndDoScom( const bool i_isRead,
}while ( elapsedIndScomTimeNs <= MAX_INDSCOM_TIMEOUT_NS);
- if( o_pcbPibStatus ) break;
+ if( fapiRc != FAPI2_RC_SUCCESS ) break;
if( ! scomout.done)
{
SBE_ERROR(SBE_FUNC "Indirect scom timeout.");
@@ -195,9 +197,13 @@ uint32_t checkIndirectAndDoScom( const bool i_isRead,
}while(0);
- if (o_pcbPibStatus ) l_rc = SBE_SEC_PCB_PIB_ERR;
+ if (fapiRc != FAPI2_RC_SUCCESS)
+ {
+ l_rc = SBE_SEC_PCB_PIB_ERR;
+ if(o_ffdc) o_ffdc->setRc(fapiRc);
+ }
- SBE_DEBUG(SBE_FUNC "o_pcbPibStatus:%u l_rc:0x%08X", o_pcbPibStatus, l_rc);
+ SBE_DEBUG(SBE_FUNC "fapiRc:%u l_rc:0x%08X", fapiRc, l_rc);
return l_rc;
}
diff --git a/src/sbefw/sbescom.H b/src/sbefw/sbescom.H
index 802a4c88..7241634f 100644
--- a/src/sbefw/sbescom.H
+++ b/src/sbefw/sbescom.H
@@ -23,17 +23,18 @@
/* */
/* IBM_PROLOG_END_TAG */
+#include "sbeSpMsg.H"
/**
* @brief check if scom address is Indirect scom and perform scom
*
- * @param[in] i_isRead True if read operation, false otherwise
- * @param[in] i_addr scom addess
- * @param[in] io_data data for scom operation. For read, it is output operand.
- * @param[in] o_pcbPibStatus pcbpib status
+ * @param[in] i_isRead True if read operation, false otherwise
+ * @param[in] i_addr scom addess
+ * @param[in] io_data data for scom operation. For read, it is output operand.
+ * @param[out] o_ffdc ffdc object
*
- * @return seconday error code.
+ * @return seconday error code.
*/
uint32_t checkIndirectAndDoScom( const bool i_isRead,
const uint64_t i_addr,
uint64_t & io_data,
- uint32_t & o_pcbPibStatus );
+ sbeResponseFfdc_t *const o_ffdc);
diff --git a/src/test/testcases/testPutGetScom.py b/src/test/testcases/testPutGetScom.py
index a8b31cbb..6378e114 100755
--- a/src/test/testcases/testPutGetScom.py
+++ b/src/test/testcases/testPutGetScom.py
@@ -53,10 +53,7 @@ PUTSCOM_EXPDATA = [0xc0,0xde,0xa2,0x02,
0x00,0x0,0x0,0x03];
PUTSCOM_EXPDATA_INVALID = [0xc0,0xde,0xa2,0x02,
- 0x0,0xfe,0x0,0x11,
- 0x00,0x0,0x0,0x04,
- 0x00,0x0,0x0,0x04];
-
+ 0x0,0xfe,0x0,0x11]
GETSCOM_TESTDATA = [0,0,0,4,
0,0,0xA2,0x01,
0,0,0x0,0x00,
@@ -76,10 +73,7 @@ GETSCOM_EXPDATA = [0xde,0xca,0xff,0xee,
0x00,0x0,0x0,0x03];
GETSCOM_EXPDATA_INVALID = [0xc0,0xde,0xa2,0x01,
- 0x0,0xfe,0x0,0x11,
- 0x00,0x0,0x0,0x04,
- 0x00,0x0,0x0,0x04];
-
+ 0x0,0xfe,0x0,0x11]
# MAIN Test Run Starts Here...
#-------------------------------------------------
def main( ):
@@ -93,6 +87,9 @@ def main( ):
testUtil.writeUsFifo( PUTSCOM_TESTDATA_INVALID )
testUtil.writeEot( )
testUtil.readDsFifo( PUTSCOM_EXPDATA_INVALID )
+ testUtil.extractHWPFFDC( )
+ #flush out distance
+ testUtil.readDsEntryReturnVal()
testUtil.readEot( )
print ("\nStarting getscom test")
testUtil.writeUsFifo( GETSCOM_TESTDATA )
@@ -103,6 +100,9 @@ def main( ):
testUtil.writeUsFifo( GETSCOM_TESTDATA_INVALID )
testUtil.writeEot( )
testUtil.readDsFifo( GETSCOM_EXPDATA_INVALID )
+ testUtil.extractHWPFFDC( )
+ #flush out distance
+ testUtil.readDsEntryReturnVal()
testUtil.readEot( )
#-------------------------------------------------
OpenPOWER on IntegriCloud