summaryrefslogtreecommitdiffstats
path: root/src/usr/expaccess
diff options
context:
space:
mode:
authorMatt Derksen <mderkse1@us.ibm.com>2019-09-13 15:05:45 -0500
committerWilliam G Hoffa <wghoffa@us.ibm.com>2019-09-30 15:35:10 -0500
commit09016a8a7f562b83bd3003d84fa8177eaf200378 (patch)
tree5bb1f4b31e273f17669c9692b124573aeb8d7dba /src/usr/expaccess
parent56b1dbc3ce1a7c6d45dc94515d17304d622827af (diff)
downloadtalos-hostboot-09016a8a7f562b83bd3003d84fa8177eaf200378.tar.gz
talos-hostboot-09016a8a7f562b83bd3003d84fa8177eaf200378.zip
Hostboot platform support for Explorer inband commands via i2c
Inband SRAM can be accessed via scom i2c commands. To Explorer, a register address and an internal memory address are the same thing. That allows us to execute the inband command set even if the OMI link is not active. A new attribute determinds when this inband i2c is required so it can be an easy override for lab use. By default, this i2c path will not execute when OMI links are working. Change-Id: I3f18cf78d2e88e33935f1bd241ef4e2796d36d93 RTC: 208447 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/83787 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R Geddes <crgeddes@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> Reviewed-by: William G Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/expaccess')
-rw-r--r--src/usr/expaccess/test/exptest_utils.C30
-rw-r--r--src/usr/expaccess/test/exptest_utils.H6
-rw-r--r--src/usr/expaccess/test/ocmbcommtest.H146
3 files changed, 163 insertions, 19 deletions
diff --git a/src/usr/expaccess/test/exptest_utils.C b/src/usr/expaccess/test/exptest_utils.C
index 46421fc4a..01096716f 100644
--- a/src/usr/expaccess/test/exptest_utils.C
+++ b/src/usr/expaccess/test/exptest_utils.C
@@ -103,4 +103,34 @@ namespace exptest
mutex_unlock(l_mutex);
};
+ void disableInbandScomsOcmb(const TARGETING::TargetHandle_t i_ocmbTarget)
+ {
+ mutex_t* l_mutex = nullptr;
+
+ assert((i_ocmbTarget != nullptr),
+ "disableInbandScomsOcmb: target is NULL!");
+
+ // Verify that the target is of type OCMB_CHIP
+ TARGETING::ATTR_TYPE_type l_targetType =
+ i_ocmbTarget->getAttr<TARGETING::ATTR_TYPE>();
+ assert((l_targetType == TARGETING::TYPE_OCMB_CHIP),
+ "disableInbandScomsOcmb: target is not an OCMB chip!");
+
+ TS_INFO("disableInbandScomsOcmb: switching to use i2c on OCMB 0x%08x",
+ TARGETING::get_huid(i_ocmbTarget));
+
+ //don't mess with attributes without the mutex (just to be safe)
+ l_mutex = i_ocmbTarget->getHbMutexAttr<TARGETING::ATTR_IBSCOM_MUTEX>();
+ mutex_lock(l_mutex);
+
+ TARGETING::ScomSwitches l_switches =
+ i_ocmbTarget->getAttr<TARGETING::ATTR_SCOM_SWITCHES>();
+ l_switches.useInbandScom = 0;
+ l_switches.useI2cScom = 1;
+
+ // Modify attribute
+ i_ocmbTarget->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(l_switches);
+ mutex_unlock(l_mutex);
+ };
+
}
diff --git a/src/usr/expaccess/test/exptest_utils.H b/src/usr/expaccess/test/exptest_utils.H
index a62b4de71..babba0fcf 100644
--- a/src/usr/expaccess/test/exptest_utils.H
+++ b/src/usr/expaccess/test/exptest_utils.H
@@ -53,6 +53,12 @@ TARGETING::HB_MUTEX_SERIALIZE_TEST_LOCK_ATTR getTestMutex(void);
* @param[in] i_ocmbTarget The target OCMB chip
*/
void enableInbandScomsOcmb(const TARGETING::TargetHandle_t i_ocmbTarget);
+
+/**
+ * @brief Disable inband scoms on an OCMB target (use i2c instead)
+ * @param[in] i_ocmbTarget The target OCMB chip
+ */
+void disableInbandScomsOcmb(const TARGETING::TargetHandle_t i_ocmbTarget);
}
#endif
diff --git a/src/usr/expaccess/test/ocmbcommtest.H b/src/usr/expaccess/test/ocmbcommtest.H
index b804ecb1b..3c5486a1b 100644
--- a/src/usr/expaccess/test/ocmbcommtest.H
+++ b/src/usr/expaccess/test/ocmbcommtest.H
@@ -131,11 +131,13 @@ class OCMBCommTest: public CxxTest::TestSuite
}
/**
- * @brief Test the Explorer inband command/response path
+ * @brief Send and check get_properties Explorer inband command
+ * @return Number of failures
*/
- void testOcmbInbandCmdRsp( void )
+ int sendOcmbInbandCmdRsp(bool setScomI2c)
{
errlHndl_t l_errl = nullptr;
+ uint8_t failures = 0;
// Create a vector of TARGETING::Target pointers
TARGETING::TargetHandleList l_chipList;
@@ -150,19 +152,22 @@ class OCMBCommTest: public CxxTest::TestSuite
// Create a non-destructive get_properties command
buildPropertiesGetCmd(l_cmd);
- if (!iv_serializeTestMutex)
- {
- TS_FAIL("iv_serializedTestMutex is not setup, unable to continue");
- }
- else
+ for (auto & l_ocmb: l_chipList)
{
- // Inband operations can't be run at the same time
- // atomic section >>
- mutex_lock(iv_serializeTestMutex);
-
- for (auto & l_ocmb: l_chipList)
+ do
{
- FAPI_INF("testOcmbInbandCmdRsp: testing 0x%.8X OCMB", TARGETING::get_huid(l_ocmb));
+ if (setScomI2c)
+ {
+ FAPI_INF("sendOcmbInbandCmdRsp: testing 0x%.8X OCMB using I2C", TARGETING::get_huid(l_ocmb));
+ // disable inband and use i2c when possible
+ exptest::disableInbandScomsOcmb(l_ocmb);
+ }
+ else
+ {
+ FAPI_INF("sendOcmbInbandCmdRsp: testing 0x%.8X OCMB using MMIO", TARGETING::get_huid(l_ocmb));
+ // just incase some other test disabled inband scoms
+ exptest::enableInbandScomsOcmb(l_ocmb);
+ }
fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>l_fapi2_target( l_ocmb );
@@ -175,10 +180,11 @@ class OCMBCommTest: public CxxTest::TestSuite
{
TS_FAIL("Error from putCMD for 0x%.8X target",
TARGETING::get_huid(l_ocmb));
+ failures++;
break;
}
- FAPI_INF("testOcmbInbandCmdRsp: reading response");
+ FAPI_INF("sendOcmbInbandCmdRsp: reading response");
// grab the response
FAPI_INVOKE_HWP(l_errl, mss::exp::ib::getRSP, l_fapi2_target,
@@ -188,6 +194,7 @@ class OCMBCommTest: public CxxTest::TestSuite
TS_FAIL("Error from getRSP for 0x%.8X target, plid=0x%X rc=0x%X",
TARGETING::get_huid(l_ocmb),
ERRL_GETPLID_SAFE(l_errl), ERRL_GETRC_SAFE(l_errl));
+ failures++;
break;
}
@@ -199,6 +206,7 @@ class OCMBCommTest: public CxxTest::TestSuite
{
TS_FAIL("Unexpected response length 0x%.8X (expected 0x%.8X)",
l_rsp.response_length, sizeof(FW_ADAPTER_PROPERTIES_type));
+ failures++;
break;
}
@@ -213,21 +221,121 @@ class OCMBCommTest: public CxxTest::TestSuite
{
TS_FAIL("Expected chip_version to start with 0x88, found 0x%02X",
l_fw_adapter_data.chip_version[0]);
+ failures++;
}
- }
-
- // << atomic section
- mutex_unlock(iv_serializeTestMutex);
+ } while (0);
if (l_errl)
{
+ // Commit the error as this is NOT expected and
+ // needs to be investigated
errlCommit( l_errl, TARG_COMP_ID );
}
+
+ if (setScomI2c)
+ {
+ // Default the ocmb back to inband communication
+ exptest::enableInbandScomsOcmb(l_ocmb);
+ }
}
- FAPI_INF("testOcmbInbandCmdRsp: exiting");
+
+ FAPI_INF("sendOcmbInbandCmdRsp: exiting");
+ return failures;
};
/**
+ * @brief Test the Explorer inband command/response path over MMIO
+ */
+ void testOcmbInbandCmdRspOverMMIO( void )
+ {
+ if (!iv_serializeTestMutex)
+ {
+ TS_FAIL("iv_serializedTestMutex is not setup, unable to continue");
+ }
+ else
+ {
+ // Inband operations can't be run at the same time
+ // atomic section >>
+ mutex_lock(iv_serializeTestMutex);
+
+ int failures = sendOcmbInbandCmdRsp(false);
+ if (failures)
+ {
+ TS_FAIL("testOcmbInbandCmdRspOverMMIO() failed: %d", failures);
+ }
+ mutex_unlock(iv_serializeTestMutex);
+ }
+ }
+
+ /**
+ * @brief Test the Explorer inband command/response path over I2C
+ * using ATTR_FORCE_SRAM_MMIO_OVER_I2C
+ */
+ void testOcmbInbandCmdRspOverI2c_via_force( void )
+ {
+ FAPI_INF("testOcmbInbandCmdRspOverI2c_via_force: entering");
+ if (!iv_serializeTestMutex)
+ {
+ TS_FAIL("iv_serializedTestMutex is not setup, unable to continue");
+ }
+ else
+ {
+ // Inband operations can't be run at the same time
+ // atomic section >>
+ mutex_lock(iv_serializeTestMutex);
+
+ // Set FORCE_SRAM_MMIO_OVER_I2C to change to use I2C instead of MMIO
+ TARGETING::Target * l_sys = nullptr;
+ TARGETING::targetService().getTopLevelTarget(l_sys);
+ crit_assert(l_sys != nullptr);
+
+ l_sys->setAttr<TARGETING::ATTR_FORCE_SRAM_MMIO_OVER_I2C>(0x01);
+
+ int failures = sendOcmbInbandCmdRsp(false);
+ if (failures)
+ {
+ TS_FAIL("testOcmbInbandCmdRspOverI2c_via_force() failed: %d", failures);
+ }
+
+ // Restore using MMIO instead of I2C
+ l_sys->setAttr<TARGETING::ATTR_FORCE_SRAM_MMIO_OVER_I2C>(0x00);
+
+ mutex_unlock(iv_serializeTestMutex);
+ }
+ FAPI_INF("testOcmbInbandCmdRspOverI2c_via_force: exiting");
+ }
+
+ /**
+ * @brief Test the Explorer inband command/response path over I2C
+ * using scom setting to i2c
+ */
+ void testOcmbInbandCmdRspOverI2c_via_scom_switch( void )
+ {
+ FAPI_INF("testOcmbInbandCmdRspOverI2c_via_scom_switch: entering");
+ if (!iv_serializeTestMutex)
+ {
+ TS_FAIL("iv_serializedTestMutex is not setup, unable to continue");
+ }
+ else
+ {
+ // Inband operations can't be run at the same time
+ // atomic section >>
+ mutex_lock(iv_serializeTestMutex);
+
+ // Set SCOM_SWITCHES to use i2c instead of MMMIO when
+ // running the inband cmd/rsp operations
+ int failures = sendOcmbInbandCmdRsp(true);
+ if (failures)
+ {
+ TS_FAIL("testOcmbInbandCmdRspOverI2c_via_scom_switch() failed: %d", failures);
+ }
+
+ mutex_unlock(iv_serializeTestMutex);
+ }
+ FAPI_INF("testOcmbInbandCmdRspOverI2c_via_scom_switch: exiting");
+ }
+
+ /**
* @brief Constructor
*/
OCMBCommTest() : CxxTest::TestSuite()
OpenPOWER on IntegriCloud