diff options
author | Roland Veloz <rveloz@us.ibm.com> | 2018-09-26 00:51:53 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-12-06 19:18:15 -0600 |
commit | b63c84765363b7bf4eea4a19d4cf5bba2533b63b (patch) | |
tree | a9e19493bf958bc47233af466f3106ecc4f2e22f /src/usr/hwas/common/hwas.C | |
parent | 082f9363ee8ea21647959637cf05a102fec4d24e (diff) | |
download | talos-hostboot-b63c84765363b7bf4eea4a19d4cf5bba2533b63b.tar.gz talos-hostboot-b63c84765363b7bf4eea4a19d4cf5bba2533b63b.zip |
Driver changes to support i2c mux
- Updated data structures gpioAddr_t, eeprom_addr_t, misc_args_t, nvdimm_addr_t
and tpm_info_t with I2C MUX data members. Also added constructors to these
structures to default there data members with the correct default info.
- Updated macros DEVICE_I2C_PARMS, DEVICE_I2C_ADDRESS and
DEVICE_I2C_ADDRESS_OFFSET to take the I2C MUX bus selector parameter and the
I2C MUX entity path.
- Added method i2cAccessMux to file i2c.H/.C that will setup the call for the
I2C MUX. Method i2cCommonOP calls i2cAccessMux which then calls i2cCommonOp
with appropriate parameters for the I2C MUX: i2cCommonOP -> i2cAccessMux
-> i2cCommonOP.
- Updated i2ctest.H with new I2C MUX params to get it to pass.
RTC:191352
Change-Id: I6a70860eb2286bbd23d6157d72351b8adfa21aac
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/66651
Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com>
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>
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/hwas/common/hwas.C')
-rw-r--r-- | src/usr/hwas/common/hwas.C | 74 |
1 files changed, 69 insertions, 5 deletions
diff --git a/src/usr/hwas/common/hwas.C b/src/usr/hwas/common/hwas.C index 3939cc06c..d8530ad98 100644 --- a/src/usr/hwas/common/hwas.C +++ b/src/usr/hwas/common/hwas.C @@ -582,6 +582,57 @@ errlHndl_t check_current_proc_mem_to_use_is_still_valid (bool o_match) return l_err; } +/** + * @brief Do presence detect on only MUX targets and enable HWAS state + * + * @param[in] i_sysTarget the top level target (CLASS_SYS) + * @return errlHndl_t return nullptr if no error, + * else return a handle to an error entry + * + */ +errlHndl_t discoverMuxTargetsAndEnable(const Target &i_sysTarget) +{ + HWAS_DBG(ENTER_MRK"discoverMuxTargetsAndEnable"); + + errlHndl_t l_err{nullptr}; + + do + { + // Only get MUX targets + const PredicateCTM l_muxPred(CLASS_CHIP, TYPE_I2C_MUX); + TARGETING::PredicatePostfixExpr l_muxPredExpr; + l_muxPredExpr.push(&l_muxPred); + TargetHandleList l_pMuxCheckPres; + targetService().getAssociated( l_pMuxCheckPres, (&i_sysTarget), + TargetService::CHILD, TargetService::ALL, &l_muxPredExpr); + + // Do the presence detect on only MUX targets + l_err = platPresenceDetect(l_pMuxCheckPres); + + // If an issue with platPresenceDetect, then exit, returning + // error back to caller + if (nullptr != l_err) + { + break; + } + + // Enable the HWAS State for the MUXes + const bool l_present(true); + const bool l_functional(true); + const uint32_t l_errlEid(0); + for (TargetHandle_t pTarget : l_pMuxCheckPres) + { + // set HWAS state to show MUX is present and functional + enableHwasState(pTarget, l_present, l_functional, l_errlEid); + } + } while (0); + + HWAS_DBG(EXIT_MRK"discoverMuxTargetsAndEnable exit with %s", + (nullptr == l_err ? "no error" : "error")); + + return l_err; +} + errlHndl_t discoverTargets() { HWAS_DBG("discoverTargets entry"); @@ -635,7 +686,17 @@ errlHndl_t discoverTargets() HWAS_DBG("pSys %.8X - marked present", pSys->getAttr<ATTR_HUID>()); - // find list of all we need to call platPresenceDetect against + // Certain targets have dependencies on the MUX, so it is best to + // presence detect and enable the MUX before moving on to these targets. + // Please take this into consideration if code needs to be rearranged + // in the future. + errl = discoverMuxTargetsAndEnable(*pSys); + + if (errl != NULL) + { + break; // break out of the do/while so that we can return + } + PredicateCTM predEnc(CLASS_ENC); PredicateCTM predChip(CLASS_CHIP); PredicateCTM predDimm(CLASS_LOGICAL_CARD, TYPE_DIMM); @@ -698,10 +759,13 @@ errlHndl_t discoverTargets() uint16_t pgData[VPD_CP00_PG_DATA_ENTRIES]; bzero(pgData, sizeof(pgData)); + // Cache the target type + auto l_targetType = pTarget->getAttr<ATTR_TYPE>(); if( (pTarget->getAttr<ATTR_CLASS>() == CLASS_CHIP) && - (pTarget->getAttr<ATTR_TYPE>() != TYPE_TPM) && - (pTarget->getAttr<ATTR_TYPE>() != TYPE_SP) && - (pTarget->getAttr<ATTR_TYPE>() != TYPE_BMC) ) + (l_targetType != TYPE_TPM) && + (l_targetType != TYPE_SP) && + (l_targetType != TYPE_BMC) && + (l_targetType != TYPE_I2C_MUX) ) { // read Chip ID/EC data from these physical chips errl = platReadIDEC(pTarget); @@ -720,7 +784,7 @@ errlHndl_t discoverTargets() errlCommit(errl, HWAS_COMP_ID); // errl is now NULL } - else if (pTarget->getAttr<ATTR_TYPE>() == TYPE_PROC) + else if (l_targetType == TYPE_PROC) { // read partialGood vector from these as well. errl = platReadPartialGood(pTarget, pgData); |