diff options
author | Jaymes Wilks <mjwilks@us.ibm.com> | 2018-07-03 01:01:55 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-07-13 11:02:07 -0400 |
commit | ae718b725e8c4b261f7e5783b2401fb589411edc (patch) | |
tree | e07e69fe02d76eb1ed45613765d3c0327f250b76 /src/usr/i2c | |
parent | 8948f0196ab1bfdc6e2c4d45c2e77f9e430c4811 (diff) | |
download | talos-hostboot-ae718b725e8c4b261f7e5783b2401fb589411edc.tar.gz talos-hostboot-ae718b725e8c4b261f7e5783b2401fb589411edc.zip |
Callout non-functional TPM before processor on I2C
Fixes all potential paths where a processor callout may proceed
a TPM callout.
Change-Id: I90864032a9c1c25d087eb02ec616ddcdfe427f50
CQ:SW431571
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61787
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/i2c')
-rwxr-xr-x | src/usr/i2c/i2c.C | 147 | ||||
-rwxr-xr-x | src/usr/i2c/i2c.H | 17 |
2 files changed, 79 insertions, 85 deletions
diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C index 9c273626f..eb8bb2a17 100755 --- a/src/usr/i2c/i2c.C +++ b/src/usr/i2c/i2c.C @@ -1473,14 +1473,7 @@ errlHndl_t i2cRead ( TARGETING::Target * i_target, i_target), I2C_SET_USER_DATA_2(i_args)); - // For now limited in what we can call out: - // Could be an issue with Processor or its bus - // -- both on the same FRU - // @todo RTC 94872 - update this callout - err->addHwCallout( i_target, - HWAS::SRCI_PRIORITY_HIGH, - HWAS::NO_DECONFIG, - HWAS::GARD_NULL ); + addHwCalloutsI2c(err, i_target, i_args); // Or HB code failed to do the procedure correctly err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, @@ -1930,51 +1923,7 @@ errlHndl_t i2cWaitForCmdComp ( TARGETING::Target * i_target, i_target), I2C_SET_USER_DATA_2(i_args)); - // Attempt to find a target representing the device that - // failed to respond, and call it out as the most likely - // problem. For now, we only support TPM reverse lookup; - // TODO RTC 94872 will implement generic support for other - // devices. - - // Loop thru TPMs in the system and match physical path, - // engine, and port to the i2c master - auto l_devFound = false; - const auto l_physPath = i_target->getAttr< - TARGETING::ATTR_PHYS_PATH>(); - TARGETING::TargetHandleList allTpms; - TARGETING::getAllChips( allTpms, TARGETING::TYPE_TPM, false ); - for(const auto &tpm: allTpms) - { - const auto l_tpmInfo = tpm->getAttr< - TARGETING::ATTR_TPM_INFO>(); - - if (l_tpmInfo.i2cMasterPath == l_physPath && - l_tpmInfo.engine == i_args.engine && - l_tpmInfo.port == i_args.port) - { - TRACFCOMP(g_trac_i2c, - "Unresponsive TPM found: " - "Engine=%d, masterPort=%d " - "huid for its i2c master is 0x%.8X", - l_tpmInfo.engine, - l_tpmInfo.port, - TARGETING::get_huid(i_target)); - err->addHwCallout(tpm, - HWAS::SRCI_PRIORITY_HIGH, - HWAS::NO_DECONFIG, - HWAS::GARD_NULL); - l_devFound = true; - break; - } - } - - // Could also be an issue with Processor or its bus - // -- both on the same FRU - err->addHwCallout( i_target, - l_devFound? HWAS::SRCI_PRIORITY_MED: - HWAS::SRCI_PRIORITY_HIGH, - HWAS::NO_DECONFIG, - HWAS::GARD_NULL ); + addHwCalloutsI2c(err, i_target, i_args); // Or HB code failed to do the procedure correctly err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, @@ -2176,14 +2125,7 @@ errlHndl_t i2cCheckForErrors ( TARGETING::Target * i_target, i_target), I2C_SET_USER_DATA_2(i_args)); - // For now limited in what we can call out: - // Could be an issue with Processor or its bus - // -- both on the same FRU - // @todo RTC 94872 - update this callout - err->addHwCallout( i_target, - HWAS::SRCI_PRIORITY_HIGH, - HWAS::NO_DECONFIG, - HWAS::GARD_NULL ); + addHwCalloutsI2c(err, i_target, i_args); // Or HB code failed to do the procedure correctly err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, @@ -2225,14 +2167,7 @@ errlHndl_t i2cCheckForErrors ( TARGETING::Target * i_target, i_target), I2C_SET_USER_DATA_2(i_args)); - // For now limited in what we can call out: - // Could be an issue with Processor or its bus - // -- both on the same FRU - // @todo RTC 94872 - update this callout - err->addHwCallout( i_target, - HWAS::SRCI_PRIORITY_HIGH, - HWAS::NO_DECONFIG, - HWAS::GARD_NULL ); + addHwCalloutsI2c(err, i_target, i_args); // Or HB code failed to do the procedure correctly err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, @@ -2273,14 +2208,7 @@ errlHndl_t i2cCheckForErrors ( TARGETING::Target * i_target, i_target), I2C_SET_USER_DATA_2(i_args)); - // For now limited in what we can call out: - // Could be an issue with Processor or its bus - // -- both on the same FRU - // @todo RTC 94872 - update this callout - err->addHwCallout( i_target, - HWAS::SRCI_PRIORITY_HIGH, - HWAS::NO_DECONFIG, - HWAS::GARD_NULL ); + addHwCalloutsI2c(err, i_target, i_args); // Or HB code failed to do the procedure correctly err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, @@ -2385,14 +2313,7 @@ errlHndl_t i2cWaitForFifoSpace ( TARGETING::Target * i_target, i_target), I2C_SET_USER_DATA_2(i_args)); - // For now limited in what we can call out: - // Could be an issue with Processor or its bus - // -- both on the same FRU - // @todo RTC 94872 - update this callout - err->addHwCallout( i_target, - HWAS::SRCI_PRIORITY_HIGH, - HWAS::NO_DECONFIG, - HWAS::GARD_NULL ); + addHwCalloutsI2c(err, i_target, i_args); // Or HB code failed to do the procedure correctly err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, @@ -4462,4 +4383,60 @@ void setLogicalFsiEnginePort(size_t &io_logical_engine, size_t &io_logical_port) } } +void addHwCalloutsI2c(errlHndl_t i_err, + TARGETING::Target * i_target, + const misc_args_t & i_args) +{ + assert(i_err != nullptr, "Bug! The supplied error log is nullptr."); + assert(i_target != nullptr, "Bug! The supplied target is nullptr."); + + // Attempt to find a target representing the device that + // failed to respond, and call it out as the most likely + // problem. For now, we only support TPM reverse lookup; + // TODO RTC 94872 will implement generic support for other + // devices. + + // Loop thru TPMs in the system and match physical path, + // engine, and port to the i2c master + auto l_devFound = false; + const auto l_physPath = i_target->getAttr< + TARGETING::ATTR_PHYS_PATH>(); + TARGETING::TargetHandleList allTpms; + TARGETING::getAllChips( allTpms, TARGETING::TYPE_TPM, false ); + for(const auto &tpm: allTpms) + { + const auto l_tpmInfo = tpm->getAttr< + TARGETING::ATTR_TPM_INFO>(); + + if (l_tpmInfo.i2cMasterPath == l_physPath && + l_tpmInfo.engine == i_args.engine && + l_tpmInfo.port == i_args.port && + l_tpmInfo.devAddrLocality0 == i_args.devAddr) + { + TRACFCOMP(g_trac_i2c, + "Unresponsive TPM found: " + "Engine=%d, masterPort=%d " + "huid for its i2c master is 0x%.8X", + l_tpmInfo.engine, + l_tpmInfo.port, + TARGETING::get_huid(i_target)); + i_err->addHwCallout(tpm, + HWAS::SRCI_PRIORITY_HIGH, + HWAS::NO_DECONFIG, + HWAS::GARD_NULL); + l_devFound = true; + break; + } + } + + // Could also be an issue with Processor or its bus + // -- both on the same FRU + i_err->addHwCallout( i_target, + l_devFound? HWAS::SRCI_PRIORITY_MED: + HWAS::SRCI_PRIORITY_HIGH, + HWAS::NO_DECONFIG, + HWAS::GARD_NULL ); + +} + }; // end namespace I2C diff --git a/src/usr/i2c/i2c.H b/src/usr/i2c/i2c.H index d2ba23009..1f843d928 100755 --- a/src/usr/i2c/i2c.H +++ b/src/usr/i2c/i2c.H @@ -944,6 +944,23 @@ errlHndl_t i2cRegisterOp ( DeviceFW::OperationType i_opType, void setLogicalFsiEnginePort(size_t &io_logical_engine, size_t &io_logical_port); +/** + * @brief This function handles adding hw callouts to error logs that may arise + * during communications over the I2C bus. Within the i2c code, it is + * preferable to use this function over adding hw callouts directly to + * make sure all paths are handled correctly. + * + * @param[in] i_err - error log to add callouts to. Must not be nullptr. + * @param[in] i_target - I2C Master Target device. Must not be nullptr. + * @param[in] i_args - miscellaneous args struct containing the port, engine, + * devAddr necessary to find associated I2c devices. + * + * @return void + */ +void addHwCalloutsI2c(errlHndl_t i_err, + TARGETING::Target * i_target, + const misc_args_t & i_args); + }; // end I2C namespace #endif // __I2C_H |