diff options
author | Roland Veloz <rveloz@us.ibm.com> | 2018-08-31 04:35:33 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-09-28 17:28:53 -0500 |
commit | a92f91459eb2a1c197e4f15d7341f1f501b89079 (patch) | |
tree | 0f16152b0185b5accca8ac03bf549fa160b800b7 /src/usr/targeting/test/testtargeting.H | |
parent | 5baacd28d51e361566f587c6b613ba679352d4ec (diff) | |
download | talos-hostboot-a92f91459eb2a1c197e4f15d7341f1f501b89079.tar.gz talos-hostboot-a92f91459eb2a1c197e4f15d7341f1f501b89079.zip |
Added the I2C MUX attribute and target definitions
- Defined the I2C_MUX_INFO attribute
- Defined the i2c_mux target with I2C_MUX_INFO as an attribute
- Defined the i2c_mux target to have parent 'chip'
- Added attribute fields i2cMuxSelector and i2cMuxPath to
attributes EEPROM_NV_INFO, EEPROM_SBE_BACKUP_INFO,
EEPROM_SBE_PRIMARY_INFO, EEPROM_VPD_BACKUP_INFO,
EEPROM_VPD_PRIMARY_INFO, FAPI_I2C_CONTROL_INFO,
TEMP_SENSOR_I2C_CONFIG and TPM_INFO. All these had I2C info
in them (i2cMasterPath, port, devAddr, engine, etc).
RTC:196807
CMVC-Prereq:1068716
Change-Id: Iadf4909411329c8b7b961efc2cb0789f5b96a49f
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/65540
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>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/test/testtargeting.H')
-rw-r--r-- | src/usr/targeting/test/testtargeting.H | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/src/usr/targeting/test/testtargeting.H b/src/usr/targeting/test/testtargeting.H index b0c70c188..c87d599e9 100644 --- a/src/usr/targeting/test/testtargeting.H +++ b/src/usr/targeting/test/testtargeting.H @@ -395,6 +395,107 @@ class TargetingTestSuite : public CxxTest::TestSuite TS_TRACE(EXIT_MRK "testNvTarget"); } + + + void testI2cMux() + { + TS_TRACE(ENTER_MRK "testI2cMux" ); + + TARGETING::TargetRangeFilter l_targetList( + TARGETING::targetService().begin(), + TARGETING::targetService().end(), + nullptr); + + if (l_targetList) + { + for (;l_targetList;++l_targetList) + { + auto targetClass = + l_targetList->getAttr<TARGETING::ATTR_CLASS>(); + auto targetType = l_targetList->getAttr<TARGETING::ATTR_TYPE>(); + auto targetModel = + l_targetList->getAttr<TARGETING::ATTR_MODEL>(); + if ( (TARGETING::CLASS_CHIP == targetClass) && + (TARGETING::TYPE_I2C_MUX == targetType) && + (TARGETING::MODEL_PCA9847 == targetModel) ) + { + // Mask off upper 8 bits in case of multiple nodes + uint32_t l_huid = get_huid(*l_targetList) & 0x00FFFFFF; + // Extract the type, drop instance info + l_huid = l_huid >> 16; + if (TARGETING::TYPE_I2C_MUX != l_huid) + { + TS_FAIL("testI2cMux::huid returned(0x%X), " + "expected(0x%X)", + l_huid, + TARGETING::TYPE_I2C_MUX); + } + + TARGETING::I2cMuxInfo l_i2cMuxInfo = + l_targetList->getAttr<TARGETING::ATTR_I2C_MUX_INFO>(); + + if (TARGETING::EntityPath::PATH_PHYSICAL != + l_i2cMuxInfo.i2cMasterPath.type()) + { + TS_FAIL("testI2cMux::i2cMuxPath type " + "returned(%d), expected(PHYSICAL)", + l_i2cMuxInfo.i2cMasterPath.type()); + } + + char * l_pathAsString = + l_i2cMuxInfo.i2cMasterPath.toString(); + if (0 != strcmp(l_pathAsString, + "Physical:/Sys0/Node0/Proc0")) + { + TS_FAIL("testI2cMux::i2cMuxPath path " + "returned(%s), " + "expected(Physical:/Sys0/Node0/Proc0)", + l_pathAsString); + } // end if (TARGETING + + free (l_pathAsString); + l_pathAsString = nullptr; + } // end if ( (TARGETING::CLASS_CHIP == targetClass) ... + else if ( (TARGETING::CLASS_ENC == targetClass) && + (TARGETING::TYPE_NODE == targetType) && + (TARGETING::MODEL_POWER9 == targetModel) ) + + { + TARGETING::EepromVpdPrimaryInfo l_eepromInfo = + l_targetList-> + getAttr<TARGETING::ATTR_EEPROM_VPD_PRIMARY_INFO>(); + + if (TARGETING::EntityPath::PATH_PHYSICAL != + l_eepromInfo.i2cMuxPath.type()) + { + TS_FAIL("testI2cMux::i2cMuxPath type returned(%d), " + "expected(PHYSICAL)", + l_eepromInfo.i2cMuxPath.type()); + } + + char * l_pathAsString = + l_eepromInfo.i2cMuxPath.toString(); + + if (0 != strcmp(l_pathAsString, + "Physical:/Sys0")) + { + TS_FAIL("testI2cMux::i2cMuxPath path returned(%s), " + "expected(Physical:/Sys0)", + l_pathAsString); + } + free (l_pathAsString); + l_pathAsString = nullptr; + } // end if ( (TARGETING::CLASS_ENC == targetClass) ... + } // end for (l_targetList;++l_targetList) + } // end if (l_targetList) + else + { + TS_FAIL("testI2cMux::No targets containing I2C Mux found"); + } + + TS_TRACE(EXIT_MRK "testI2cMux"); + } + }; #endif // End __TARGETING_TESTTARGETING_H |