From a92f91459eb2a1c197e4f15d7341f1f501b89079 Mon Sep 17 00:00:00 2001 From: Roland Veloz Date: Fri, 31 Aug 2018 04:35:33 -0500 Subject: 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 Tested-by: Jenkins OP Build CI Tested-by: FSP CI Jenkins Reviewed-by: Nicholas E. Bofferding Tested-by: Jenkins OP HW Reviewed-by: Daniel M. Crowell --- src/usr/targeting/test/testtargeting.H | 101 +++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) (limited to 'src/usr/targeting/test/testtargeting.H') 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(); + auto targetType = l_targetList->getAttr(); + auto targetModel = + l_targetList->getAttr(); + 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(); + + 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(); + + 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 -- cgit v1.2.1