summaryrefslogtreecommitdiffstats
path: root/src/usr/i2c/i2c.C
diff options
context:
space:
mode:
authorMatthew Raybuck <matthew.raybuck@ibm.com>2019-03-28 10:41:20 -0500
committerNicholas E. Bofferding <bofferdn@us.ibm.com>2019-03-29 22:24:18 -0500
commitb445b93fc21ee80515090087e063fd74b8d508a3 (patch)
tree8d16ef93fb3327fb07e607727030d414229a5821 /src/usr/i2c/i2c.C
parenta98d9a843a71d635456674bc55062552ecaa2cbc (diff)
downloadtalos-hostboot-b445b93fc21ee80515090087e063fd74b8d508a3.tar.gz
talos-hostboot-b445b93fc21ee80515090087e063fd74b8d508a3.zip
Handle bad PEC from UCD device op
The current UCD code doesn't have any error handling for a bad PEC byte instead it is just ignored. This will add the necessary error handling to the retry code for bad PEC bytes. Change-Id: I8d9960a203b5864812bcaa0019087bb3dcff0c53 RTC:205982 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/75174 Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Diffstat (limited to 'src/usr/i2c/i2c.C')
-rwxr-xr-xsrc/usr/i2c/i2c.C72
1 files changed, 68 insertions, 4 deletions
diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C
index 88233dadb..850f841cd 100755
--- a/src/usr/i2c/i2c.C
+++ b/src/usr/i2c/i2c.C
@@ -214,6 +214,61 @@ DEVICE_REGISTER_ROUTE( DeviceFW::WILDCARD,
TARGETING::TYPE_MEMBUF,
i2cPerformOp );
+/*
+ * @brief A helper function for i2cCommonOp that commonizes error handling
+ * for a bad PEC byte for a power sequencer.
+ *
+ * @param[in] i_expectedPec The value of the expected PEC byte.
+ *
+ * @param[in] i_actualPec The value of the actual PEC byte.
+ *
+ * @param[in] i_i2cMaster The i2c master for the power sequencer.
+ *
+ * @param[in] i_args The i2c info for the power sequencer.
+ *
+ * @return errlHndl_t A pointer to an error log.
+ */
+errlHndl_t badPecByteError(const uint8_t i_expectedPec,
+ const uint8_t i_actualPec,
+ const TARGETING::TargetHandle_t& i_i2cMaster,
+ const misc_args_t i_args)
+{
+ /*@
+ * @errortype
+ * @severity ERRL_SEV_PREDICTIVE
+ * @moduleid I2C_BAD_PEC_BYTE_ERROR
+ * @reasoncode I2C_BAD_PEC_BYTE
+ * @devdesc A bad PEC byte was found during the
+ * device operation.
+ * @custdesc Unexpected firmware error
+ * @userdata1[00:31] Expected PEC byte
+ * @userdata1[32:63] Actual PEC byte
+ */
+ errlHndl_t err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_PREDICTIVE,
+ I2C_BAD_PEC_BYTE_ERROR,
+ I2C_BAD_PEC_BYTE,
+ TWO_UINT32_TO_UINT64(
+ i_expectedPec,
+ i_actualPec));
+
+ // Add a callout for the I2C master.
+ err->addI2cDeviceCallout(i_i2cMaster,
+ i_args.engine,
+ i_args.port,
+ i_args.devAddr,
+ HWAS::SRCI_PRIORITY_HIGH);
+
+ // Add a callout for hostboot code.
+ err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
+ HWAS::SRCI_PRIORITY_LOW);
+
+ err->collectTrace(I2C_COMP_NAME);
+
+ return err;
+
+}
+
+
/**
*
* @brief A useful utility to dump (trace out) the TARGETING::FapiI2cControlInfo
@@ -1758,8 +1813,12 @@ errlHndl_t i2cCommonOp( DeviceFW::OperationType i_opType,
"but received 0x%02X. # PEC bytes = %d",
expectedPec,readByteOrWord.pec,pecBytes);
- // @TODO RTC 201990 support bad PEC handling
- // Right now just ignore it
+ err = badPecByteError(expectedPec,
+ readByteOrWord.pec,
+ i_target,
+ i_args);
+
+ break;
}
}
@@ -1927,6 +1986,7 @@ errlHndl_t i2cCommonOp( DeviceFW::OperationType i_opType,
+ blockRead.blockCount;
const auto expectedPec = I2C::SMBUS::calculatePec(
reinterpret_cast<uint8_t*>(&blockRead),pecBytes);
+
if(blockRead.pec != expectedPec)
{
TRACFCOMP(g_trac_i2c, ERR_MRK
@@ -1934,8 +1994,12 @@ errlHndl_t i2cCommonOp( DeviceFW::OperationType i_opType,
"but received 0x%02X. # PEC bytes = %d",
expectedPec,blockRead.pec,pecBytes);
- // @TODO RTC 201990 support bad PEC handling
- // Right now just ignore it
+ err = badPecByteError(expectedPec,
+ blockRead.pec,
+ i_target,
+ i_args);
+
+ break;
}
}
OpenPOWER on IntegriCloud