diff options
| author | Matt Derksen <mderkse1@us.ibm.com> | 2019-05-01 12:30:54 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-06-24 10:29:27 -0500 |
| commit | 2c86bbc37ee8d0a2c0da169ace605dde319c898a (patch) | |
| tree | 10bb64bd91068566c077436a2785ed83f84c5288 /src/usr/expaccess/test | |
| parent | 1ac1e9584462a41e204ffaae13f086b0a22c6cf8 (diff) | |
| download | talos-hostboot-2c86bbc37ee8d0a2c0da169ace605dde319c898a.tar.gz talos-hostboot-2c86bbc37ee8d0a2c0da169ace605dde319c898a.zip | |
Run exp tests in Axone and make generic Load utility
Removed CONFIG_AXONE_BRING_UP from expscomtest.H
Added common load utility for loading/unloading needed
modules for testcases. Added a mutex to avoid inband
command/response contention between testcases.
Change-Id: Ia96991983be18fab840b59b8dc7dd1383ecc4abc
RTC:201738
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/76818
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: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Roland Veloz <rveloz@us.ibm.com>
Reviewed-by: Glenn Miles <milesg@ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/expaccess/test')
| -rw-r--r-- | src/usr/expaccess/test/expscomtest.H | 253 | ||||
| -rw-r--r-- | src/usr/expaccess/test/exptest_utils.C | 96 | ||||
| -rw-r--r-- | src/usr/expaccess/test/exptest_utils.H | 62 | ||||
| -rw-r--r-- | src/usr/expaccess/test/makefile | 7 | ||||
| -rw-r--r-- | src/usr/expaccess/test/ocmbcommtest.H | 181 |
5 files changed, 391 insertions, 208 deletions
diff --git a/src/usr/expaccess/test/expscomtest.H b/src/usr/expaccess/test/expscomtest.H index c943ca7ba..366f50ca2 100644 --- a/src/usr/expaccess/test/expscomtest.H +++ b/src/usr/expaccess/test/expscomtest.H @@ -41,6 +41,7 @@ #include <fapi2_hwp_executor.H> #include <fapi2/hw_access.H> #include <lib/shared/exp_consts.H> +#include "exptest_utils.H" extern trace_desc_t* g_trac_expscom; @@ -107,6 +108,10 @@ private: return fapi2::getScom(i_target,i_address,o_data); } + // use this to keep track of if we need to unload any + // modules loaded by this testcase + bool mss_module_loaded; + TARGETING::HB_MUTEX_SERIALIZE_TEST_LOCK_ATTR iv_serializeTestMutex; public: /** @@ -128,11 +133,12 @@ public: TargetHandleList l_explorerList; do{ -// Causing a data storage exception in c_str... -#ifdef CONFIG_AXONE_BRING_UP -TRACFCOMP( g_trac_expscom,"skipping testExpscomI2c"); -break; -#endif + if (!iv_serializeTestMutex) + { + TS_FAIL("iv_serializedTestMutex is not setup"); + break; + } + // Get the system's OCMB chips, we will use these as test targets getAllChips( l_explorerList, TYPE_OCMB_CHIP, @@ -144,7 +150,6 @@ break; break; } - // We will use the first and last targets for these scom tests auto l_firstExpChip = l_explorerList.front(); auto l_lastExpChip = l_explorerList.back(); @@ -157,6 +162,10 @@ break; auto first_ocmb_info = l_firstExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>(); auto last_ocmb_info = l_lastExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>(); + // Inband operations can't be run at the same time + // atomic section >> + mutex_lock(iv_serializeTestMutex); + // This goal of this tests is to make sure I2C scom to OCMB is working so force // scom to go over I2C path for these targets l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceI2CScom); @@ -178,7 +187,6 @@ break; // Otherwise we know this is a native OCMB address and it is only 32 bits l_scom_buffer.insert<32,32,0,uint32_t>(l_testEntry.data); } - FAPI_INVOKE_HWP(l_err, put_scom, l_firstExpChip_fapi, l_testEntry.addr, @@ -258,6 +266,9 @@ break; // Set ATTR_SCOM_SWITCHES back to their original values l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(first_ocmb_info); l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(last_ocmb_info); + + // << atomic section + mutex_unlock(iv_serializeTestMutex); }while(0); TRACFCOMP( g_trac_expscom, "<< Exit testExpscomI2c"); @@ -283,12 +294,11 @@ break; TargetHandleList l_explorerList; do{ -// Causing a data storage exception in c_str... -#ifdef CONFIG_AXONE_BRING_UP -TRACFCOMP( g_trac_expscom,"skipping testExpscomI2cPlatformPlatform"); -break; -#endif - + if (!iv_serializeTestMutex) + { + TS_FAIL("iv_serializedTestMutex is not setup"); + break; + } getAllChips( l_explorerList, TYPE_OCMB_CHIP, true ); // true: return functional OCMBs @@ -296,7 +306,7 @@ break; if(l_explorerList.size() == 0 ) { - TRACFCOMP( g_trac_expscom, "No OCMB targets found, skipping testExpscomI2cPlatformPlatform"); + TRACFCOMP( g_trac_expscom, "No OCMB targets found, skipping testExpscomI2cPlatform"); break; } @@ -308,6 +318,10 @@ break; auto first_ocmb_info = l_firstExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>(); auto last_ocmb_info = l_lastExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>(); + // Inband operations can't be run at the same time + // atomic section >> + mutex_lock(iv_serializeTestMutex); + // This goal of this tests is to make sure I2C scom to OCMB is working so force // scom to go over I2C path for these targets l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceI2CScom); @@ -316,97 +330,101 @@ break; // Loop through table for first and last OCMB targets for( uint32_t l_num=0; l_num < g_expscomAddrTableSz; l_num++) { - // Read the test entry info from the global table at the top of this file - testExpscomAddrData l_testEntry = g_expscomAddrTable[l_num]; - - if(l_testEntry.addr & mss::exp::i2c::IBM_SCOM_INDICATOR) - { - // If this is an IBM address then we expect 64 bits of data - l_scom_buffer.insert<0,64,0,uint64_t>(l_testEntry.data); - } - else - { - // Otherwise we know this is a native OCMB address and it is only 32 bits - l_scom_buffer.insert<32,32,0,uint32_t>(l_testEntry.data); - } - l_err = deviceWrite(l_firstExpChip, - &l_scom_buffer, - l_scomSize, - DEVICE_SCOM_ADDRESS( l_testEntry.addr)); - l_tests++; - if(l_err) - { - FAIL_TEST_ERRL(l_firstExpChip, + // Read the test entry info from the global table at the top of this file + testExpscomAddrData l_testEntry = g_expscomAddrTable[l_num]; + + if(l_testEntry.addr & mss::exp::i2c::IBM_SCOM_INDICATOR) + { + // If this is an IBM address then we expect 64 bits of data + l_scom_buffer.insert<0,64,0,uint64_t>(l_testEntry.data); + } + else + { + // Otherwise we know this is a native OCMB address and it is only 32 bits + l_scom_buffer.insert<32,32,0,uint32_t>(l_testEntry.data); + } + l_err = deviceWrite(l_firstExpChip, + &l_scom_buffer, + l_scomSize, + DEVICE_SCOM_ADDRESS( l_testEntry.addr)); + l_tests++; + if(l_err) + { + FAIL_TEST_ERRL(l_firstExpChip, + "testExpscomI2cPlatform>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X"); + + } + + l_err = deviceWrite(l_lastExpChip, + &l_scom_buffer, + l_scomSize, + DEVICE_SCOM_ADDRESS( l_testEntry.addr)); + l_tests++; + if(l_err) + { + FAIL_TEST_ERRL(l_firstExpChip, "testExpscomI2cPlatform>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X"); - } - - l_err = deviceWrite(l_lastExpChip, - &l_scom_buffer, - l_scomSize, - DEVICE_SCOM_ADDRESS( l_testEntry.addr)); - l_tests++; - if(l_err) - { - FAIL_TEST_ERRL(l_firstExpChip, - "testExpscomI2cPlatform>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X"); - - } - // Flush scom buffers so it doesnt mess up next test - l_scom_buffer.flush<0>(); - - // getScom to first OCMB over i2c - l_err = deviceRead(l_firstExpChip, - &l_scom_buffer(), - l_scomSize, - DEVICE_SCOM_ADDRESS( l_testEntry.addr)); - l_tests++; - if(l_err) - { - FAIL_TEST_ERRL(l_firstExpChip, - "testExpscomI2cPlatform>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X") - } - - l_tests++; - if(l_scom_buffer() != l_testEntry.data) - { - l_fails++; - TS_FAIL("testExpscomI2cPlatform>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X", - l_testEntry.data, - l_scom_buffer(), - get_huid(l_firstExpChip)); - } - - - // Flush scom buffers so it doesnt mess up next test - l_scom_buffer.flush<0>(); - - // getScom to last OCMB over i2c - l_err = deviceRead(l_lastExpChip, - &l_scom_buffer(), - l_scomSize, - DEVICE_SCOM_ADDRESS( l_testEntry.addr)); - l_tests++; - if(l_err) - { - FAIL_TEST_ERRL(l_firstExpChip, - "testExpscomI2cPlatform>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X") - } - - l_tests++; - if(l_scom_buffer() != l_testEntry.data) - { - l_fails++; - TS_FAIL("testExpscomI2cPlatform>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X", - l_testEntry.data, - l_scom_buffer(), - get_huid(l_firstExpChip)); - } + } + // Flush scom buffers so it doesnt mess up next test + l_scom_buffer.flush<0>(); + + // getScom to first OCMB over i2c + l_err = deviceRead(l_firstExpChip, + &l_scom_buffer(), + l_scomSize, + DEVICE_SCOM_ADDRESS( l_testEntry.addr)); + l_tests++; + if(l_err) + { + FAIL_TEST_ERRL(l_firstExpChip, + "testExpscomI2cPlatform>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X") + } + + l_tests++; + if(l_scom_buffer() != l_testEntry.data) + { + l_fails++; + TS_FAIL("testExpscomI2cPlatform>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X", + l_testEntry.data, + l_scom_buffer(), + get_huid(l_firstExpChip)); + } + + + // Flush scom buffers so it doesnt mess up next test + l_scom_buffer.flush<0>(); + + // getScom to last OCMB over i2c + l_err = deviceRead(l_lastExpChip, + &l_scom_buffer(), + l_scomSize, + DEVICE_SCOM_ADDRESS( l_testEntry.addr)); + l_tests++; + if(l_err) + { + FAIL_TEST_ERRL(l_firstExpChip, + "testExpscomI2cPlatform>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X") + } + + l_tests++; + if(l_scom_buffer() != l_testEntry.data) + { + l_fails++; + TS_FAIL("testExpscomI2cPlatform>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X", + l_testEntry.data, + l_scom_buffer(), + get_huid(l_firstExpChip)); + } } // Set ATTR_SCOM_SWITCHES back to their original values l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(first_ocmb_info); l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(last_ocmb_info); + + // << atomic section + mutex_unlock(iv_serializeTestMutex); + }while(0); TRACFCOMP( g_trac_expscom, "<< Exit testExpscomI2cPlatform"); @@ -711,6 +729,45 @@ break; // return; // } + /** + * @brief Constructor + */ + expscomTest() : CxxTest::TestSuite() + { + mss_module_loaded = false; + + // All modules are loaded by runtime, + // so testcase loading of modules is not required +#ifndef __HOSTBOOT_RUNTIME + errlHndl_t err = nullptr; + + err = exptest::loadModule(mss_module_loaded, exptest::MSS_LIBRARY_NAME); + if(err) + { + TS_FAIL("expscomTest() - Constuctor: failed to load MSS module"); + errlCommit( err, 0x10 ); + } +#endif + iv_serializeTestMutex = exptest::getTestMutex(); + }; + + + /** + * @brief Destructor + */ + ~expscomTest() + { + errlHndl_t err = nullptr; + if (mss_module_loaded) + { + err = exptest::unloadModule(exptest::MSS_LIBRARY_NAME); + if(err) + { + TS_FAIL("~expscomTest() - Destructor: failed to unload MSS module"); + errlCommit( err, 0x10 ); + } + } + }; }; diff --git a/src/usr/expaccess/test/exptest_utils.C b/src/usr/expaccess/test/exptest_utils.C new file mode 100644 index 000000000..c063a68ea --- /dev/null +++ b/src/usr/expaccess/test/exptest_utils.C @@ -0,0 +1,96 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/expaccess/test/exptest_utils.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#include <fapi2.H> +#include <cxxtest/TestSuite.H> +#include "exptest_utils.H" + +namespace exptest +{ + errlHndl_t loadModule(bool & o_module_loaded, const char * i_modName) + { + errlHndl_t err = NULL; + o_module_loaded = false; + + // VFS functions only compilable in non-runtime environment + #ifndef __HOSTBOOT_RUNTIME + if(!VFS::module_is_loaded(i_modName)) + { + err = VFS::module_load(i_modName); + if(err) + { + TS_FAIL("loadModule() - %s load failed", i_modName ); + } + else + { + o_module_loaded = true; + FAPI_INF("loadModule: %s loaded", i_modName); + } + } + #endif + return err; + } + + errlHndl_t unloadModule(const char * i_modName) + { + errlHndl_t err = NULL; + + // VFS function only compilable in non-runtime environment + #ifndef __HOSTBOOT_RUNTIME + err = VFS::module_unload(i_modName); + if(err) + { + TS_FAIL("unloadModule() - %s unload failed", i_modName ); + } + else + { + FAPI_INF("unloadModule: %s unloaded", i_modName); + } + #endif + return err; + } + + TARGETING::HB_MUTEX_SERIALIZE_TEST_LOCK_ATTR getTestMutex(void) + { + TARGETING::HB_MUTEX_SERIALIZE_TEST_LOCK_ATTR pMutex = nullptr; + + // Get a reference to the target service + TARGETING::TargetService& l_targetService = TARGETING::targetService(); + + // Get the system target containing the test mutex + TARGETING::Target* l_pTarget = NULL; + (void) l_targetService.getTopLevelTarget(l_pTarget); + if (l_pTarget == nullptr) + { + TS_INFO("getTestMutex: Top level target handle is NULL"); + } + else + { + // use the chip-specific mutex attribute + pMutex = l_pTarget->getHbMutexAttr + <TARGETING::ATTR_HB_MUTEX_SERIALIZE_TEST_LOCK>(); + } + return pMutex; + } +} diff --git a/src/usr/expaccess/test/exptest_utils.H b/src/usr/expaccess/test/exptest_utils.H new file mode 100644 index 000000000..e6d6de72c --- /dev/null +++ b/src/usr/expaccess/test/exptest_utils.H @@ -0,0 +1,62 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/expaccess/test/exptest_utils.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef EXPTEST_UTILS_H_ +#define EXPTEST_UTILS_H_ + +#ifndef __HOSTBOOT_RUNTIME +#include <vfs/vfs.H> // module_is_loaded & module_load +#endif + +namespace exptest +{ + +// Need this module for mss::c_str call in HWP failure path traces +const char MSS_LIBRARY_NAME[17] = "libisteps_mss.so"; + +/** + * @brief Generic function to load a module + * @param o_module_loaded - returns true if module is loaded by this function + * @param i_modName - module name to load + * @return error handle if module_load call fails + */ +errlHndl_t loadModule(bool & o_module_loaded, const char * i_modName); + +/** + * @brief Generic function to unload a module + * @param i_modName - module name to load + * @return error handle if module_unload call fails + * + */ +errlHndl_t unloadModule(const char * i_modName); + +/** + * @brief Get the mutex pointer for syncronizing tests + * @return pointer to mutex, nullptr if not found + */ +TARGETING::HB_MUTEX_SERIALIZE_TEST_LOCK_ATTR getTestMutex(void); + +} + +#endif diff --git a/src/usr/expaccess/test/makefile b/src/usr/expaccess/test/makefile index 461a908c8..41706b719 100644 --- a/src/usr/expaccess/test/makefile +++ b/src/usr/expaccess/test/makefile @@ -28,7 +28,8 @@ MODULE = testexpaccess include test.mk -#TODO RTC:196806 re-enable mmio communication tests when mmio works -TESTS = expscomtest.H +OBJS += exptest_utils.o -include ${ROOTPATH}/config.mk
\ No newline at end of file +TESTS = *.H + +include ${ROOTPATH}/config.mk diff --git a/src/usr/expaccess/test/ocmbcommtest.H b/src/usr/expaccess/test/ocmbcommtest.H index 94d298032..f2718b6bb 100644 --- a/src/usr/expaccess/test/ocmbcommtest.H +++ b/src/usr/expaccess/test/ocmbcommtest.H @@ -33,13 +33,13 @@ #include <errl/errlmanager.H> #include <errl/errlentry.H> #include <fapi2.H> -#ifndef __HOSTBOOT_RUNTIME -#include <vfs/vfs.H> // module_is_loaded & module_load -#endif + #include <plat_hwp_invoker.H> #include <exp_inband.H> #include <exp_data_structs.H> #include <generic/memory/lib/utils/endian_utils.H> +#include "exptest_utils.H" + // EXP_FW_ADAPTER_PROPERTIES_GET data response format #define FW_ADAPTER_MAX_FW_IMAGE 4 @@ -67,64 +67,6 @@ typedef struct } FW_ADAPTER_PROPERTIES_type; -// Need this module for mss::c_str call in HWP failure path traces -const char MSS_LIBRARY_NAME[17] = "libisteps_mss.so"; - -/** - * @brief Generic function to load a module - * @param o_module_loaded - returns true if module is loaded by this function - * @param i_modName - module name to load - * @return error handle if module_load call fails - */ -errlHndl_t loadModule(bool & o_module_loaded, const char * i_modName) -{ - errlHndl_t err = NULL; - o_module_loaded = false; - -// VFS functions only compilable in non-runtime environment -#ifndef __HOSTBOOT_RUNTIME - if(!VFS::module_is_loaded(i_modName)) - { - err = VFS::module_load(i_modName); - if(err) - { - TS_FAIL("loadModule() - %s load failed", i_modName ); - } - else - { - o_module_loaded = true; - FAPI_INF("loadModule: %s loaded", i_modName); - } - } -#endif - return err; -} - -/** - * @brief Generic function to unload a module - * @param i_modName - module name to load - * @return error handle if module_unload call fails - */ -errlHndl_t unloadModule(const char * i_modName) -{ - errlHndl_t err = NULL; - -// VFS function only compilable in non-runtime environment -#ifndef __HOSTBOOT_RUNTIME - err = VFS::module_unload(i_modName); - if(err) - { - TS_FAIL("unloadExplorerModule() - %s unload failed", i_modName ); - } - else - { - FAPI_INF("unloadModule: %s unloaded", i_modName); - } -#endif - return err; -} - - class OCMBCommTest: public CxxTest::TestSuite { public: @@ -208,58 +150,80 @@ class OCMBCommTest: public CxxTest::TestSuite // Create a non-destructive get_properties command buildPropertiesGetCmd(l_cmd); - for (auto & l_ocmb: l_chipList) + if (!iv_serializeTestMutex) { - FAPI_INF("testOcmbInbandCmdRsp: testing 0x%.8X OCMB", TARGETING::get_huid(l_ocmb)); - - fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>l_fapi2_target( l_ocmb ); - - // send the command - FAPI_INVOKE_HWP(l_errl, mss::exp::ib::putCMD, l_fapi2_target, - l_cmd); - if (l_errl) - { - TS_FAIL("Error from putCMD for 0x%.8X target", - TARGETING::get_huid(l_ocmb)); - break; - } - - // grab the response - FAPI_INVOKE_HWP(l_errl, mss::exp::ib::getRSP, l_fapi2_target, - l_rsp, l_rsp_data); - if (l_errl) - { - TS_FAIL("Error from getRSP for 0x%.8X target", - TARGETING::get_huid(l_ocmb)); - break; - } + 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); - // Check for a valid data response length - if (l_rsp.response_length != sizeof(FW_ADAPTER_PROPERTIES_type)) + for (auto & l_ocmb: l_chipList) { - TS_FAIL("Unexpected response length 0x%.8X (expected 0x%.8X)", - l_rsp.response_length, sizeof(FW_ADAPTER_PROPERTIES_type)); - break; + FAPI_INF("testOcmbInbandCmdRsp: testing 0x%.8X OCMB", TARGETING::get_huid(l_ocmb)); + + fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>l_fapi2_target( l_ocmb ); + + TRACFBIN(g_trac_expscom, "l_cmd: ", &l_cmd, sizeof(host_fw_command_struct)); + + // send the command + FAPI_INVOKE_HWP(l_errl, mss::exp::ib::putCMD, l_fapi2_target, + l_cmd); + if (l_errl) + { + TS_FAIL("Error from putCMD for 0x%.8X target", + TARGETING::get_huid(l_ocmb)); + break; + } + + FAPI_INF("testOcmbInbandCmdRsp: reading response"); + + // grab the response + FAPI_INVOKE_HWP(l_errl, mss::exp::ib::getRSP, l_fapi2_target, + l_rsp, l_rsp_data); + if (l_errl) + { + 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)); + break; + } + + TRACFBIN(g_trac_expscom, "l_rsp: ", &l_rsp, sizeof(host_fw_response_struct)); + TRACFBIN(g_trac_expscom, "l_rsp_data: ", l_rsp_data.data(), l_rsp_data.size()); + + // Check for a valid data response length + if (l_rsp.response_length != sizeof(FW_ADAPTER_PROPERTIES_type)) + { + TS_FAIL("Unexpected response length 0x%.8X (expected 0x%.8X)", + l_rsp.response_length, sizeof(FW_ADAPTER_PROPERTIES_type)); + break; + } + + // Now convert the little endian response data into big endian + FW_ADAPTER_PROPERTIES_type l_fw_adapter_data; + fw_adapter_properties_struct_from_little_endian(l_fw_adapter_data, + l_rsp_data); + + // Check for some expected response values + // Simics should return 0x88 as the first byte of chip_version + if (l_fw_adapter_data.chip_version[0] != 0x88 ) + { + TS_FAIL("Expected chip_version to start with 0x88, found 0x%02X", + l_fw_adapter_data.chip_version[0]); + } } - // Now convert the little endian response data into big endian - FW_ADAPTER_PROPERTIES_type l_fw_adapter_data; - fw_adapter_properties_struct_from_little_endian(l_fw_adapter_data, - l_rsp_data); + // << atomic section + mutex_unlock(iv_serializeTestMutex); - // Check for some expected response values - // Simics should return 0x10 as the first byte of chip_version - if (l_fw_adapter_data.chip_version[0] != 0x10 ) + if (l_errl) { - TS_FAIL("Expected chip_version to start with 0x10, found 0x%02X", - l_fw_adapter_data.chip_version[0]); + errlCommit( l_errl, TARG_COMP_ID ); } } - - if (l_errl) - { - errlCommit( l_errl, TARG_COMP_ID ); - } FAPI_INF("testOcmbInbandCmdRsp: exiting"); }; @@ -275,16 +239,16 @@ class OCMBCommTest: public CxxTest::TestSuite #ifndef __HOSTBOOT_RUNTIME errlHndl_t err = nullptr; - err = loadModule(mss_module_loaded, MSS_LIBRARY_NAME); + err = exptest::loadModule(mss_module_loaded, exptest::MSS_LIBRARY_NAME); if(err) { TS_FAIL("OCMBCommTest() - Constuctor: failed to load MSS module"); errlCommit( err, TARG_COMP_ID ); } #endif + iv_serializeTestMutex = exptest::getTestMutex(); }; - /** * @brief Destructor */ @@ -293,7 +257,7 @@ class OCMBCommTest: public CxxTest::TestSuite errlHndl_t err = nullptr; if (mss_module_loaded) { - err = unloadModule(MSS_LIBRARY_NAME); + err = exptest::unloadModule(exptest::MSS_LIBRARY_NAME); if(err) { TS_FAIL("~OCMBCommTest() - Destructor: failed to unload MSS module"); @@ -307,6 +271,9 @@ class OCMBCommTest: public CxxTest::TestSuite // modules loaded by this testcase bool mss_module_loaded; + // This is used for tests that need to not run operations at the same time + TARGETING::HB_MUTEX_SERIALIZE_TEST_LOCK_ATTR iv_serializeTestMutex; + }; #endif |

