diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2012-02-02 13:32:17 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-02-07 08:28:08 -0600 |
commit | 29f47aee84ded4c6e59da561c2e9b6257590b31d (patch) | |
tree | 0ab3d67195aba2ee4f267973fa07c10f7a4c9883 /src | |
parent | 0e66c9caeba7e05a805e027f0d2aee91467b9174 (diff) | |
download | talos-hostboot-29f47aee84ded4c6e59da561c2e9b6257590b31d.tar.gz talos-hostboot-29f47aee84ded4c6e59da561c2e9b6257590b31d.zip |
RTC 35711 - Wrapper for VPO-mode attribute check
The same code was in a dozen places so I added a wrapper function.
Change-Id: I5b1d34e0f94b91289960c73670199ff22f4c6860
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/643
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/targeting/util.H | 50 | ||||
-rw-r--r-- | src/usr/fsi/fsidd.C | 10 | ||||
-rw-r--r-- | src/usr/fsi/test/fsiddtest.H | 21 | ||||
-rw-r--r-- | src/usr/fsi/test/fsiprestest.H | 23 | ||||
-rw-r--r-- | src/usr/hwas/hwas.C | 20 | ||||
-rwxr-xr-x | src/usr/i2c/test/eepromddtest.H | 9 | ||||
-rwxr-xr-x | src/usr/i2c/test/i2ctest.H | 9 | ||||
-rw-r--r-- | src/usr/initservice/istepdispatcher/istepdispatcher.C | 19 | ||||
-rw-r--r-- | src/usr/intr/intrrp.C | 18 | ||||
-rw-r--r-- | src/usr/intr/test/intrtest.H | 25 | ||||
-rw-r--r-- | src/usr/targeting/makefile | 5 | ||||
-rw-r--r-- | src/usr/targeting/util.C | 62 | ||||
-rw-r--r-- | src/usr/testcore/kernel/vmmbasetest.H | 10 |
13 files changed, 152 insertions, 129 deletions
diff --git a/src/include/usr/targeting/util.H b/src/include/usr/targeting/util.H new file mode 100644 index 000000000..d2bce8c66 --- /dev/null +++ b/src/include/usr/targeting/util.H @@ -0,0 +1,50 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/targeting/util.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +#ifndef __TARGETING_UTIL_H +#define __TARGETING_UTIL_H + +/** + * Miscellaneous Utility Functions + */ + +namespace TARGETING +{ + +/** + * @brief Checks to see if we are running in a hardware simulation + * environment, i.e. VPO/VBU (not Simics) + * + * @return true if in VPO/VBU + */ +bool is_vpo( void ); + + +} + + + + + + + +#endif diff --git a/src/usr/fsi/fsidd.C b/src/usr/fsi/fsidd.C index 7fe5cf8f5..4f829df5f 100644 --- a/src/usr/fsi/fsidd.C +++ b/src/usr/fsi/fsidd.C @@ -42,6 +42,7 @@ #include <sys/time.h> #include <string.h> #include <algorithm> +#include <targeting/util.H> // FSI : General driver traces trace_desc_t* g_trac_fsi = NULL; @@ -1203,13 +1204,8 @@ errlHndl_t FsiDD::initPort(FsiChipInfo_t i_fsiInfo, // Do not initialize slave in VBU because they are already done // before we run - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + //@todo - switch to SP-Capabilities Attribute (See Issue 35817) + if( TARGETING::is_vpo() ) { TRACFCOMP( g_trac_fsi, "FsiDD::initPort> Skipping Init for VPO" ); o_enabled = true; diff --git a/src/usr/fsi/test/fsiddtest.H b/src/usr/fsi/test/fsiddtest.H index 74befc8aa..66a7ba6c5 100644 --- a/src/usr/fsi/test/fsiddtest.H +++ b/src/usr/fsi/test/fsiddtest.H @@ -37,6 +37,7 @@ #include <fsi/fsiif.H> #include <fsi/fsi_reasoncodes.H> #include <sys/time.h> +#include <targeting/util.H> extern trace_desc_t* g_trac_fsi; @@ -114,17 +115,11 @@ class FsiDDTest : public CxxTest::TestSuite */ void test_readWrite(void) { - //@todo + //@todo - Issue 35803 //@VBU workaround - Disable test case //Temporarily disable this test case in VBU because of //an MFSI/CFSI XSCOM hardware bug. - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + if( TARGETING::is_vpo() ) { return; } @@ -414,17 +409,11 @@ class FsiDDTest : public CxxTest::TestSuite void test_badTargets(void) { - //@todo + //@todo - Issue 35803 //@VBU workaround - Disable test case //Temporarily disable this test case in VBU because of //an MFSI/CFSI XSCOM hardware bug. - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + if( TARGETING::is_vpo() ) { return; } diff --git a/src/usr/fsi/test/fsiprestest.H b/src/usr/fsi/test/fsiprestest.H index b50d7b8bc..7b08a21d0 100644 --- a/src/usr/fsi/test/fsiprestest.H +++ b/src/usr/fsi/test/fsiprestest.H @@ -35,6 +35,7 @@ #include <targeting/predicates/predicatectm.H> #include <targeting/predicates/predicatepostfixexpr.H> #include <targeting/iterators/rangefilter.H> +#include <targeting/util.H> using namespace TARGETING; using namespace DeviceFW; @@ -56,20 +57,14 @@ class FSIPresTest : public CxxTest::TestSuite */ void testPresence() { - //@todo - //@VBU workaround - Disable test case - //Temporarily disable this test case in VBU because of - //an MFSI/CFSI XSCOM hardware bug. - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) - { - return; - } + //@todo - Issue 35803 + //@VBU workaround - Disable test case + //Temporarily disable this test case in VBU because of + //an MFSI/CFSI XSCOM hardware bug. + if( TARGETING::is_vpo() ) + { + return; + } Target* l_masterChip = NULL; targetService().masterProcChipTargetHandle(l_masterChip); diff --git a/src/usr/hwas/hwas.C b/src/usr/hwas/hwas.C index dd1d7fb18..ffc971503 100644 --- a/src/usr/hwas/hwas.C +++ b/src/usr/hwas/hwas.C @@ -43,6 +43,7 @@ #include <fsi/fsiif.H> #include <hwas/hwas.H> #include <hwas/deconfigGard.H> +#include <targeting/util.H> namespace HWAS { @@ -98,25 +99,6 @@ void init_fsi( void *io_pArgs ) TRACDCOMP( g_trac_hwas, "init_fsi entry" ); - //@todo - //@VBU workaround - Disable init_fsi - //Temporarily disable the FSI initialization in VBU because of - //an MFSI/CFSI XSCOM hardware bug. - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) - { - // wait here on the barrier, then end the task. - pTaskArgs->waitChildSync(); - task_end(); - TRACFCOMP( g_trac_hwas, "HWBUG Workaround - No FSI initialization"); - return; - } - l_errl = FSI::initializeHardware( ); if ( l_errl ) { diff --git a/src/usr/i2c/test/eepromddtest.H b/src/usr/i2c/test/eepromddtest.H index 5f31a128b..1be82c462 100755 --- a/src/usr/i2c/test/eepromddtest.H +++ b/src/usr/i2c/test/eepromddtest.H @@ -37,6 +37,7 @@ #include <i2c/eepromddreasoncodes.H> #include <targeting/predicates/predicatectm.H> #include <targeting/predicates/predicatepostfixexpr.H> +#include <targeting/util.H> extern trace_desc_t* g_trac_eeprom; @@ -83,13 +84,7 @@ class EEPROMTest: public CxxTest::TestSuite //@VBU workaround - Disable I2C test case on fake target //Test case use fake targets, which will fail when running //on VBU. Need to fix this. - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + if( TARGETING::is_vpo() ) { return; } diff --git a/src/usr/i2c/test/i2ctest.H b/src/usr/i2c/test/i2ctest.H index 865d62248..f2ff71f5d 100755 --- a/src/usr/i2c/test/i2ctest.H +++ b/src/usr/i2c/test/i2ctest.H @@ -36,6 +36,7 @@ #include <devicefw/driverif.H> #include <i2c/i2creasoncodes.H> #include <targeting/predicates/predicatectm.H> +#include <targeting/util.H> extern trace_desc_t* g_trac_i2c; @@ -114,13 +115,7 @@ class I2CTest: public CxxTest::TestSuite //@VBU workaround - Disable I2C test case on fake target //Test case use fake targets, which will fail when running //on VBU. Need to fix this. - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + if( TARGETING::is_vpo() ) { return; } diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C index 2777208ee..84a18baae 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.C +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C @@ -59,6 +59,7 @@ #include "splesscommon.H" #include <isteps/istepmasterlist.H> +#include <targeting/util.H> // ----- namespace ERRORLOG ------------------------------------------- @@ -489,13 +490,7 @@ void IStepDispatcher::singleStepISteps( void * io_ptr ) */ // Don't delay as long in VBU because it will take VERY long to // run the simulator - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + if( TARGETING::is_vpo() ) { // VBU delay per Patrick nanosleep(0,TEN_CTX_SWITCHES_NS); @@ -721,7 +716,7 @@ void IStepDispatcher::handleBreakPoint(const fapi::Target & i_target, uint64_t i writeSts( l_sts ); // TODO Tell the outside world that a break point has been hit? - // TODO send i_target & i_info + // TODO send i_target & i_info // Poll for cmd to resume while(1) @@ -763,13 +758,7 @@ void IStepDispatcher::handleBreakPoint(const fapi::Target & i_target, uint64_t i */ // Don't delay as long in VBU because it will take VERY long to // run the simulator - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + if( TARGETING::is_vpo() ) { // VBU delay per Patrick nanosleep(0,TEN_CTX_SWITCHES_NS); diff --git a/src/usr/intr/intrrp.C b/src/usr/intr/intrrp.C index 5099c437c..9025a3ce8 100644 --- a/src/usr/intr/intrrp.C +++ b/src/usr/intr/intrrp.C @@ -37,6 +37,7 @@ #include <sys/task.h> #include <targeting/targetservice.H> #include <vmmconst.h> +#include <targeting/util.H> using namespace INTR; @@ -81,13 +82,7 @@ errlHndl_t IntrRp::_init() errlHndl_t err = NULL; // TODO Temporaritly DISABLE in VBU until P8 support is added - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + if( TARGETING::is_vpo() ) { iv_isVBU = true; } @@ -394,13 +389,8 @@ void IntrRp::initInterruptPresenter(const PIR_t i_pir) const // TODO Temporaritly DISABLE in VBU until P8 support is added if(iv_isVBU) return; - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + //@fixme - this seems redundant... + if( TARGETING::is_vpo() ) { return; } diff --git a/src/usr/intr/test/intrtest.H b/src/usr/intr/test/intrtest.H index 9c0d4e412..712e97a6e 100644 --- a/src/usr/intr/test/intrtest.H +++ b/src/usr/intr/test/intrtest.H @@ -29,6 +29,7 @@ #include <errl/errlmanager.H> #include <kernel/console.H> #include <targeting/targetservice.H> +#include <targeting/util.H> class IntrTest: public CxxTest::TestSuite @@ -41,13 +42,7 @@ class IntrTest: public CxxTest::TestSuite { // TODO Temporaritly DISABLE in VBU until P8 support is added - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + if( TARGETING::is_vpo() ) { return; } @@ -114,13 +109,7 @@ class IntrTest: public CxxTest::TestSuite void test_enableDisable( void ) { // TODO Temporaritly DISABLE in VBU until P8 support is added - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + if( TARGETING::is_vpo() ) { return; } @@ -167,13 +156,7 @@ class IntrTest: public CxxTest::TestSuite // TODO need to investigate. #ifdef __NOT_NOW__ // TODO Temporaritly DISABLE in VBU until P8 support is added - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 1) ) + if( TARGETING::is_vpo() ) { return; } diff --git a/src/usr/targeting/makefile b/src/usr/targeting/makefile index ab84a4e05..44779b292 100644 --- a/src/usr/targeting/makefile +++ b/src/usr/targeting/makefile @@ -44,7 +44,10 @@ TARGET_OBJS = \ ATTR_RP_OBJS = \ attrrp.o -OBJS = ${TARGET_OBJS} ${PREDICATES_OBJS} ${ITERATORS_OBJS} ${ATTR_RP_OBJS} +OTHER_OBJS = \ + util.o + +OBJS = ${TARGET_OBJS} ${PREDICATES_OBJS} ${ITERATORS_OBJS} ${ATTR_RP_OBJS} ${OTHER_OBJS} SUBDIRS = test.d xmltohb.d diff --git a/src/usr/targeting/util.C b/src/usr/targeting/util.C new file mode 100644 index 000000000..2d4302dc9 --- /dev/null +++ b/src/usr/targeting/util.C @@ -0,0 +1,62 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/usr/targeting/util.C $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +//****************************************************************************** +// Includes +//****************************************************************************** +#include <targeting/attributes.H> +#include <targeting/entitypath.H> +#include <targeting/targetservice.H> + + +/** + * Miscellaneous Utility Functions + */ + +namespace TARGETING +{ + +/** + * @brief Checks to see if we are running in a hardware simulation + * environment, i.e. VPO/VBU (not Simics) + */ +bool is_vpo( void ) +{ + TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); + syspath.addLast(TARGETING::TYPE_SYS,0); + TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); + uint8_t vpo_mode = 0; + if( unlikely( //compiler hint to optimize the false path + sys + && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) + && (vpo_mode == 1) + ) ) + { + return true; + } + return false; +}; + + +} + + diff --git a/src/usr/testcore/kernel/vmmbasetest.H b/src/usr/testcore/kernel/vmmbasetest.H index c217717f4..3e4a3722e 100644 --- a/src/usr/testcore/kernel/vmmbasetest.H +++ b/src/usr/testcore/kernel/vmmbasetest.H @@ -33,7 +33,7 @@ #include <arch/ppc.H> #include <sys/mm.h> #include <usr/vmmconst.h> -#include <targeting/targetservice.H> +#include <targeting/util.H> class VmmBaseTest : public CxxTest::TestSuite { @@ -123,13 +123,7 @@ class VmmBaseTest : public CxxTest::TestSuite // Don't delay in VPO because it will take VERY long to // run the simulator - TARGETING::EntityPath syspath(TARGETING::EntityPath::PATH_PHYSICAL); - syspath.addLast(TARGETING::TYPE_SYS,0); - TARGETING::Target* sys = TARGETING::targetService().toTarget(syspath); - uint8_t vpo_mode = 0; - if( sys - && sys->tryGetAttr<TARGETING::ATTR_IS_SIMULATION>(vpo_mode) - && (vpo_mode == 0) ) + if( TARGETING::is_vpo() ) { nanosleep(1,0); } |