diff options
author | Christian Geddes <crgeddes@us.ibm.com> | 2019-11-06 11:17:13 -0600 |
---|---|---|
committer | Daniel M Crowell <dcrowell@us.ibm.com> | 2019-11-07 23:34:48 -0600 |
commit | c3689a69137b76f117ac9524a8f7ec189e133b04 (patch) | |
tree | 630b37a42d7041f5c27d9ae17556654c8c779f57 /src/usr/i2c/i2cTargetPres.C | |
parent | c016e9860f3dcd56e1332ca455bad8471952c92b (diff) | |
download | blackbird-hostboot-c3689a69137b76f117ac9524a8f7ec189e133b04.tar.gz blackbird-hostboot-c3689a69137b76f117ac9524a8f7ec189e133b04.zip |
Fixes to PMIC presence detection
While performing presence detection on the PMIC targets we need
to first read the parent OCMB's SPD to see what device address
the PMIC is on. There was a bug where we were attempting to read
the parent OCMB's spd without first checking if the OCMB is
present itself. This commit adds a check to ensure we dont attempt
i2c reads on devices that are not present. Also this commit adds
a check to make sure we do not attempt presence detection on GEMINI
ocmbs
Change-Id: I999189b3b97210bb37b7ba1fdb2d86658d770e36
CQ: SW480414
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/86564
Reviewed-by: Ilya Smirnov <ismirno@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: 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/i2cTargetPres.C')
-rw-r--r-- | src/usr/i2c/i2cTargetPres.C | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/usr/i2c/i2cTargetPres.C b/src/usr/i2c/i2cTargetPres.C index 2aba61de3..c7c9421a3 100644 --- a/src/usr/i2c/i2cTargetPres.C +++ b/src/usr/i2c/i2cTargetPres.C @@ -32,7 +32,6 @@ #include <initservice/initserviceif.H> #include <errl/errlmanager.H> #include "i2c_common.H" -#include <vpd/spdenums.H> #include <fapiwrap/fapiWrapif.H> extern trace_desc_t* g_trac_i2c; @@ -269,23 +268,16 @@ errlHndl_t pmicI2CPresencePerformOp(DeviceFW::OperationType i_opType, errlHndl_t l_errl = nullptr; bool l_pmicPresent = 0; + uint8_t l_devAddr; TARGETING::Target* l_parentOcmb = TARGETING::getImmediateParentByAffinity(i_target); - - uint8_t l_spdBlob[SPD::DDIMM_DDR4_SPD_SIZE]; - size_t l_spdSize = SPD::DDIMM_DDR4_SPD_SIZE; + auto l_parentHwasState = l_parentOcmb->getAttr<TARGETING::ATTR_HWAS_STATE>(); do{ - l_errl = deviceRead(l_parentOcmb, - l_spdBlob, - l_spdSize, - DEVICE_SPD_ADDRESS(SPD::ENTIRE_SPD_WITHOUT_EFD)); - - if(l_errl) + if(! l_parentHwasState.present) { - TRACFCOMP( g_trac_i2c, ERR_MRK"pmicI2CPresencePerformOp() " - "Error reading SPD associated with PMIC 0x%.08X, failed to determine presence", - TARGETING::get_huid(i_target)); + // If the parent chip is not present, then neither is the pmic + // so just break out and return not present break; } @@ -294,13 +286,28 @@ errlHndl_t pmicI2CPresencePerformOp(DeviceFW::OperationType i_opType, // PMICs will have a different device address depending on the vendor. // Prior to doing present detection on a pmic we must first query the // device address from the parent OCMB's SPD - uint8_t l_devAddr = FAPIWRAP::get_pmic_dev_addr(reinterpret_cast<char *>(l_spdBlob), - l_relPos); + l_errl = FAPIWRAP::get_pmic_dev_addr(l_parentOcmb, + l_relPos, + l_devAddr); + if (l_errl) + { + TRACFCOMP( g_trac_i2c, ERR_MRK"pmicI2CPresencePerformOp() " + "Error attempting to read pmic device address on OCMB 0x%.08X", + TARGETING::get_huid(l_parentOcmb)); + break; + } assert(l_devAddr != 0, "Found devAddr for PMIC 0x%.08x to be 0, this cannot be. Check SPD and REL_POS on target", TARGETING::get_huid(i_target)); + if(l_devAddr == FAPIWRAP::NO_PMIC_DEV_ADDR) + { + // There is no pmic device address for this rel position on this ocmb so + // break and return not present. + break; + } + i_target->setAttr<TARGETING::ATTR_DYNAMIC_I2C_DEVICE_ADDRESS>(l_devAddr); l_errl = genericI2CTargetPresenceDetect(i_target, |