summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2016-03-14 11:27:49 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-03-23 11:31:45 -0400
commit16ff4c0894f726ea97362536af36a413b1f255cd (patch)
tree78e5c57d3fe5307917dca729d444437db8ead3b3
parentefb976fc64fc447d93015d3bb950431f341b6c19 (diff)
downloadtalos-hostboot-16ff4c0894f726ea97362536af36a413b1f255cd.tar.gz
talos-hostboot-16ff4c0894f726ea97362536af36a413b1f255cd.zip
Support getChildren and getParent FAPI2 tests
- Added FAPI reason codes to support tests - Added special handlers to getParent/getChildren for pervasive associations - Added new APIs to filtering utilities to walk pervasive associations - Updated getParent/getChildren tests to fully exercise pervasive associations RTC: 148577 Change-Id: I0d8ec427e6c2092852a32c7da605d1c47c554b50 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22084 Tested-by: Jenkins Server Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Tested-by: FSP CI Jenkins Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H1
-rw-r--r--src/include/usr/fapi2/target.H50
-rw-r--r--src/include/usr/targeting/common/utilFilter.H39
-rw-r--r--src/usr/fapi2/test/fapi2GetChildrenTest.C220
-rw-r--r--src/usr/fapi2/test/fapi2GetParentTest.C134
-rw-r--r--src/usr/fapi2/test/fapi2TestUtils.H45
-rw-r--r--src/usr/targeting/common/utilFilter.C22
7 files changed, 463 insertions, 48 deletions
diff --git a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
index 4a8d10868..f08e34014 100644
--- a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
+++ b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
@@ -88,6 +88,7 @@ namespace fapi2
RC_CAPP_NO_PROC_FOUND = FAPI2_COMP_ID | 0x20,
RC_SBE_NO_PROC_FOUND = FAPI2_COMP_ID | 0x21,
RC_INVALID_CHILD_COUNT = FAPI2_COMP_ID | 0x22,
+ RC_UNIT_NO_PERV_FOUND = FAPI2_COMP_ID | 0x23,
// HWP generated errors
RC_HWP_GENERATED_ERROR = HWPF_COMP_ID | 0x0f,
diff --git a/src/include/usr/fapi2/target.H b/src/include/usr/fapi2/target.H
index c11454f2f..5eb375336 100644
--- a/src/include/usr/fapi2/target.H
+++ b/src/include/usr/fapi2/target.H
@@ -456,11 +456,24 @@ inline Target<T> Target<K, V>::getParent(void) const
TARGETING::TYPE requiredPType = fapi2::convertFapi2TypeToTargeting(T);
- TARGETING::getParentAffinityTargetsByState(l_parentList,
- static_cast<TARGETING::Target*>(this->get()),
- TARGETING::CLASS_NA,
- requiredPType,
- TARGETING::UTIL_FILTER_ALL);
+ if(T == fapi2::TARGET_TYPE_PERV)
+ {
+ TARGETING::getParentPervasiveTargetsByState(
+ l_parentList,
+ static_cast<TARGETING::Target*>(this->get()),
+ TARGETING::CLASS_NA,
+ requiredPType,
+ TARGETING::UTIL_FILTER_ALL);
+ }
+ else
+ {
+ TARGETING::getParentAffinityTargetsByState(
+ l_parentList,
+ static_cast<TARGETING::Target*>(this->get()),
+ TARGETING::CLASS_NA,
+ requiredPType,
+ TARGETING::UTIL_FILTER_ALL);
+ }
assert(l_parentList.size() == 1, "Found %d parents of the same type. Target HUID %x , \
looking for parents of type %x", l_parentList.size(), TARGETING::get_huid(this->get()) , requiredPType);
@@ -642,22 +655,43 @@ FAPI_DBG(ENTER_MRK "getChildren. Type 0x%08x State:0x%08x", T, i_state);
TARGETING::TargetHandleList l_childList;
bool l_functional = (i_state & fapi2::TARGET_STATE_FUNCTIONAL)? true:false;
-
if(!l_functional)
{
- TARGETING::getChildAffinityTargetsByState(l_childList,
+ if(K == fapi2::TARGET_TYPE_PERV)
+ {
+ TARGETING::getPervasiveChildTargetsByState(l_childList,
+ static_cast<TARGETING::Target*>(this->get()),
+ TARGETING::CLASS_NA,
+ l_type,
+ TARGETING::UTIL_FILTER_ALL);
+ }
+ else
+ {
+ TARGETING::getChildAffinityTargetsByState(l_childList,
static_cast<TARGETING::Target*>(this->get()),
TARGETING::CLASS_NA,
l_type,
TARGETING::UTIL_FILTER_ALL);
+ }
}
else
{
- TARGETING::getChildAffinityTargetsByState(l_childList,
+ if(K == fapi2::TARGET_TYPE_PERV)
+ {
+ TARGETING::getPervasiveChildTargetsByState(l_childList,
+ static_cast<TARGETING::Target*>(this->get()),
+ TARGETING::CLASS_NA,
+ l_type,
+ TARGETING::UTIL_FILTER_FUNCTIONAL);
+ }
+ else
+ {
+ TARGETING::getChildAffinityTargetsByState(l_childList,
static_cast<TARGETING::Target*>(this->get()),
TARGETING::CLASS_NA,
l_type,
TARGETING::UTIL_FILTER_FUNCTIONAL);
+ }
}
FAPI_DBG("getChildren: l_functional 0x%.8X, l_type = 0x%.8X, ChipUnitId 0x%.8X",
diff --git a/src/include/usr/targeting/common/utilFilter.H b/src/include/usr/targeting/common/utilFilter.H
index 9c501f418..4771edace 100644
--- a/src/include/usr/targeting/common/utilFilter.H
+++ b/src/include/usr/targeting/common/utilFilter.H
@@ -183,6 +183,26 @@ void getChildAffinityTargetsByState ( TARGETING::TargetHandleList& o_vector,
ResourceState i_state );
/**
+ * @brief Given an input target, finds all the targets linked to it via a
+ * PERVASIVE_CHILD relationship and writes them to the output vector.
+ * The class, type, and resource state further filter the set of results.
+ *
+ * @parm[out] o_vector, reference to vector of target pointers
+ * @parm[in] i_target, source target to search from
+ * @parm[in] i_class, class of the targets to be obtained
+ * @parm[in] i_type, type of the targets to be obtained
+ * @parm[in] i_state, specifies state the target should be in
+ *
+ * @return N/A
+ */
+void getPervasiveChildTargetsByState (
+ TARGETING::TargetHandleList& o_vector,
+ const Target* i_target,
+ CLASS i_class,
+ TYPE i_type,
+ ResourceState i_state );
+
+/**
* @brief Populate the o_vector with target object pointers which are
* affinity children of the input target
*
@@ -221,6 +241,25 @@ void getChildAffinityTargets ( TARGETING::TargetHandleList& o_vector,
void getParentAffinityTargetsByState ( TARGETING::TargetHandleList& o_vector,
const Target * i_target, CLASS i_class, TYPE i_type,
ResourceState i_state );
+/**
+ * @brief Given an input target, finds all the targets linked to it via a
+ * PARENT_PERVASIVE relationship and writes them to the output vector.
+ * The class, type, and resource state further filter the set of results.
+ *
+ * @parm[out] o_vector, reference to vector of target pointers
+ * @parm[in] i_target, source target to search from
+ * @parm[in] i_class, class of the targets to be obtained
+ * @parm[in] i_type, type of the targets to be obtained
+ * @parm[in] i_state, specifies state the target should be in
+ *
+ * @return N/A
+ */
+void getParentPervasiveTargetsByState (
+ TARGETING::TargetHandleList& o_vector,
+ const Target* i_target,
+ CLASS i_class,
+ TYPE i_type,
+ ResourceState i_state);
/**
* @brief Populate the o_vector with target object pointers which are
diff --git a/src/usr/fapi2/test/fapi2GetChildrenTest.C b/src/usr/fapi2/test/fapi2GetChildrenTest.C
index b7923081c..cd394f3ef 100644
--- a/src/usr/fapi2/test/fapi2GetChildrenTest.C
+++ b/src/usr/fapi2/test/fapi2GetChildrenTest.C
@@ -29,6 +29,7 @@
#include <hwpf_fapi2_reasoncodes.H>
#include <fapi2TestUtils.H>
#include <cxxtest/TestSuite.H>
+#include <functional>
using namespace fapi2;
@@ -116,7 +117,6 @@ errlHndl_t fapi2GetChildrenTest()
}
}
-
Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget(
l_nimbusProc);
Target<fapi2::TARGET_TYPE_EQ> fapi2_eqTarget(
@@ -125,8 +125,6 @@ errlHndl_t fapi2GetChildrenTest()
targeting_targets[MY_EX]);
Target<fapi2::TARGET_TYPE_MCS> fapi2_mcsTarget(
targeting_targets[MY_MCS]);;
- Target<fapi2::TARGET_TYPE_PERV> fapi2_pervTarget(
- targeting_targets[MY_PERV]);
Target<fapi2::TARGET_TYPE_MCBIST> fapi2_mcbistTarget(
targeting_targets[MY_MCBIST]);
@@ -216,52 +214,196 @@ errlHndl_t fapi2GetChildrenTest()
break;
}
- //Currently PERV targets do not have CORE children, but its valid to look for PERV's children
- //TODO 148577 Implement Parent/Child Relationships for PERV Targets
- // valid children for PERV
+ // Test pervasive children
+
+ // Valid children for PERV:
// PERV -> EQ // PERV -> CORE // PERV -> XBUS // PERV -> OBUS
// PERV -> CAPP // PERV -> NV // PERV -> MCBIST // PERV -> MCS
// PERV -> MCA // PERV -> PEC // PERV -> PHB // PERV -> MI
// PERV -> DMI
- l_childCores = fapi2_pervTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT);
- l_targetHuid = TARGETING::get_huid(targeting_targets[MY_PERV]) ;
- l_actualSize = l_childCores.size();
- l_expectedSize = 0;
- numTests++;
- if(l_actualSize != l_expectedSize)
+ static struct pervasiveChildTestRec {
+
+ // Expected number of children
+ uint32_t expectedSize;
+
+ // Lambda function specifying which pervasive chip units map to
+ // children of the type implied by the body of the lambda function
+ // below
+ bool (*unitMapsToRightTargetType)(TARGETING::ATTR_CHIP_UNIT_type);
+
+ // Lambda function taking a pervasive target and returning the
+ // number of children it has for a given FAPI type
+ size_t (*actualSize)(Target<fapi2::TARGET_TYPE_PERV>&);
+
+ } pervasiveChildTests [] = {
+
+ // EQ pervasive has 1 EQ child
+ {PERV_EQ_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return ((i_unit >= EQ_LOW) && (i_unit <= EQ_HIGH)); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_EQ>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // CORE pervasive has 1 CORE child
+ {PERV_CORE_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return ((i_unit >= CORE_LOW) && (i_unit <= CORE_HIGH)); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_CORE>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // XBUS pervasive has 2 XBUS children
+ {PERV_XBUS_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return (i_unit == XBUS_RANGE); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_XBUS>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // OBUS pervasive has 1 OBUS child
+ {PERV_OBUS_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return ((i_unit >= OBUS_LOW) && (i_unit <= OBUS_HIGH)); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_OBUS>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // CAPP pervasive has 1 CAPP child
+ {PERV_CAPP_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return ((i_unit == CAPP0_RANGE) || (i_unit == CAPP1_RANGE));},
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_CAPP>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // NV pervasive has 2 NV children
+ {PERV_NV_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return (i_unit == NV_RANGE); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_NV>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // MCBIST/MCS/MCA pervasive has 1 MCBIST child
+ {PERV_MCBIST_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return ( (i_unit >= MC_LOW)
+ && (i_unit <= MC_HIGH)); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_MCBIST>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // MCBIST/MCS/MCA pervasive has 2 MCS children
+ {PERV_MCS_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return ((i_unit >= MC_LOW) && (i_unit <= MC_HIGH)); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_MCS>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // MCBIST/MCS/MCA pervasive has 4 MCA children
+ {PERV_MCA_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return ((i_unit >= MC_LOW) && (i_unit <= MC_HIGH)); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_MCA>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // PEC/PHB pervasive has 1 PEC child
+ {PERV_PEC_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return ((i_unit >= PEC_LOW) && (i_unit <= PEC_HIGH)); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_PEC>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // PEC/PHB pervasive with 1 PHB child
+ {PERV_PEC0_PHB_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return (i_unit == PEC_LOW); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_PHB>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // PEC/PHB pervasive with 2 PHB children
+ {PERV_PEC1_PHB_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return (i_unit == PEC_MID); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_PHB>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // PEC/PHB pervasive with 3 PHB children
+ {PERV_PEC2_PHB_CHILDREN,
+ [](TARGETING::ATTR_CHIP_UNIT_type i_unit)
+ { return (i_unit == PEC_HIGH); },
+ [](Target<fapi2::TARGET_TYPE_PERV>& i_perv)
+ { return i_perv.getChildren<fapi2::TARGET_TYPE_PHB>(
+ TARGET_STATE_PRESENT).size(); } },
+
+ // No MI or DMI units for Nimbus
+ };
+
+ // Build list of all pervasive targets in the blueprint
+ TARGETING::TargetHandleList pervasiveTargets;
+ TARGETING::getAllChiplets(
+ pervasiveTargets,
+ TARGETING::TYPE_PERV,
+ false);
+
+ // Test each type of target that can be a child of a pervasive
+ for(const pervasiveChildTestRec& pervasiveChildTest
+ : pervasiveChildTests)
{
- numFails++;
- break;
- }
+ l_expectedSize = pervasiveChildTest.expectedSize;
+ l_actualSize = 0;
+ l_targetHuid = 0;
+
+ numTests++;
+ TARGETING::TargetHandle_t candidateTarget = NULL;
+ for(TARGETING::TargetHandleList::const_iterator pIt
+ = pervasiveTargets.begin();
+ pIt != pervasiveTargets.end();
+ ++pIt)
+ {
+ auto unit = (*pIt)->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+ if ( pervasiveChildTest.unitMapsToRightTargetType(unit) )
+ {
+ candidateTarget = (*pIt);
+ break;
+ }
+ }
- l_childEQs = fapi2_pervTarget.getChildren<fapi2::TARGET_TYPE_EQ>(TARGET_STATE_PRESENT);
- l_targetHuid = TARGETING::get_huid(targeting_targets[MY_PERV]) ;
- l_actualSize = l_childEQs.size();
- l_expectedSize = 0;
+ if(candidateTarget == NULL)
+ {
+ numFails++;
+ break;
+ }
- numTests++;
- if(l_actualSize != l_expectedSize)
- {
- numFails++;
- break;
- }
+ l_targetHuid = TARGETING::get_huid(candidateTarget);
- l_childXBUSs = fapi2_pervTarget.getChildren<fapi2::TARGET_TYPE_XBUS>(TARGET_STATE_PRESENT);
- l_targetHuid = TARGETING::get_huid(targeting_targets[MY_PERV]) ;
- l_actualSize = l_childXBUSs.size();
- l_expectedSize = 0;
+ Target<fapi2::TARGET_TYPE_PERV> fapi2_pervTarget(
+ candidateTarget);
+
+ l_actualSize = pervasiveChildTest.actualSize(fapi2_pervTarget);
+
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
- numTests++;
- if(l_actualSize != l_expectedSize)
- {
- numFails++;
- break;
}
- //Uncomment to test compile fails
-// std::vector<Target<fapi2::TARGET_TYPE_PROC_CHIP> > l_childProcs;
-// l_childProcs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PROC_CHIP>(TARGET_STATE_PRESENT);
-// l_childCores = fapi2_mcsTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT);
+
+ // Uncomment to test compile fails
+ // std::vector<Target<fapi2::TARGET_TYPE_PROC_CHIP> > l_childProcs;
+ // l_childProcs = fapi2_procTarget.getChildren<
+ // fapi2::TARGET_TYPE_PROC_CHIP>(TARGET_STATE_PRESENT);
+ // l_childCores = fapi2_mcsTarget.getChildren<
+ // fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT);
+
}while(0);
if(l_actualSize != l_expectedSize)
@@ -296,4 +438,4 @@ errlHndl_t fapi2GetChildrenTest()
-} \ No newline at end of file
+}
diff --git a/src/usr/fapi2/test/fapi2GetParentTest.C b/src/usr/fapi2/test/fapi2GetParentTest.C
index 3fc30cfbb..d17968b52 100644
--- a/src/usr/fapi2/test/fapi2GetParentTest.C
+++ b/src/usr/fapi2/test/fapi2GetParentTest.C
@@ -34,7 +34,26 @@ using namespace fapi2;
namespace fapi2
{
-//@TODO RTC:148577 need to add tests to get the PERV parent of targets
+/**
+ * @brief Helper to get the parent pervasive of the given target
+ *
+ * @tparam K Input target's FAPI2 type
+ * @tparam V Platform target handle type
+ *
+ * @param[in] i_pTarget Targeting target
+ *
+ * @return Platform target handle giving the pervasive of the input target
+ * @retval NULL No parent found
+ * @retval !NULL Parent found, equal to the retval
+ */
+template< TargetType K, typename V = plat_target_handle_t >
+inline V getPervasiveParent(V i_pTarget)
+{
+ Target<K,V> fapi2_target(i_pTarget);
+ return static_cast<V>(
+ fapi2_target.template getParent<TARGET_TYPE_PERV>());
+}
+
//******************************************************************************
// fapi2GetParentTest
//******************************************************************************
@@ -946,6 +965,119 @@ errlHndl_t fapi2GetParentTest()
numFails++;
}
+ // Check units which have a pervasive parent
+
+ static struct pervasiveParentTestRec {
+
+ // Source unit from which to find parent pervasive
+ TARGETING::Target* pTarget;
+
+ // Lambda function taking a unit target and returning its
+ // parent pervasive target (if any)
+ TARGETING::Target* (*getParent)(TARGETING::Target* i_pTarget);
+
+ } pervasiveParentTests [] = {
+
+ {targeting_targets[MY_EQ],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_EQ>(i_pTarget); }},
+ {targeting_targets[MY_CORE],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_CORE>(i_pTarget); }},
+ {targeting_targets[MY_MCS],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_MCS>(i_pTarget); }},
+ {targeting_targets[MY_MCA],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_MCA>(i_pTarget); }},
+ {targeting_targets[MY_MCBIST],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_MCBIST>(i_pTarget);}},
+ {targeting_targets[MY_PEC],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_PEC>(i_pTarget); }},
+ {targeting_targets[MY_PHB],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_PHB>(i_pTarget); }},
+ {targeting_targets[MY_XBUS],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_XBUS>(i_pTarget); }},
+ {targeting_targets[MY_OBUS],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_OBUS>(i_pTarget); }},
+ {targeting_targets[MY_NV],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_NV>(i_pTarget); }},
+ {targeting_targets[MY_CAPP],
+ [](TARGETING::Target* i_pTarget)
+ {return getPervasiveParent<TARGET_TYPE_CAPP>(i_pTarget); }},
+ };
+
+ // Test each type of target that can have exactly one pervasive parent
+ for(const pervasiveParentTestRec& pervasiveParentTest
+ : pervasiveParentTests)
+ {
+ numTests++;
+ l_tempTargetingParent = pervasiveParentTest.getParent(
+ pervasiveParentTest.pTarget);
+
+ // Result must be a non-NULL target of pervasive type, and its
+ // parent must be the same proc as the other tests above
+ TARGETING::Target* pPervasiveParent = NULL;
+ if( l_tempTargetingParent
+ && ( l_tempTargetingParent->getAttr<TARGETING::ATTR_TYPE>()
+ == TARGETING::TYPE_PERV))
+ {
+ Target<TARGET_TYPE_PERV> fapi2_pervTarg(l_tempTargetingParent);
+ pPervasiveParent = static_cast<TARGETING::Target*>(
+ fapi2_pervTarg.getParent<TARGET_TYPE_PROC_CHIP>());
+ }
+
+ // If the parent of the target under test was NULL, or it was
+ // not a pervasive, or if the parent of the pervasive was NULL
+ // or was not the processor, fail the test
+ if(TARGETING::get_huid(l_nimbusProc) !=
+ TARGETING::get_huid(pPervasiveParent))
+ {
+ TARGETING::ATTR_CHIP_UNIT_type instance = 0;
+ TARGETING::ATTR_TYPE_type type = TARGETING::TYPE_NA;
+ pervasiveParentTest.pTarget->
+ tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(instance);
+ pervasiveParentTest.pTarget->
+ tryGetAttr<TARGETING::ATTR_TYPE>(type);
+
+ /*@
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST
+ * @reasoncode fapi2::RC_UNIT_NO_PERV_FOUND
+ * @userdata1[0:31] Actual PROC HUID
+ * @userdata1[32:63] Actual PERV HUID
+ * @userdata2[0:31] Source unit's "chip unit"
+ * @userdata2[32:63] Source unit's "targeting type"
+ * @devdesc Could not find the parent PERV of this
+ * unit target or the pervasive did not
+ * map to expected PROC
+ */
+ l_err = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST,
+ fapi2::RC_UNIT_NO_PERV_FOUND,
+ TWO_UINT32_TO_UINT64(
+ TO_UINT32(
+ TARGETING::get_huid(pPervasiveParent)),
+ TO_UINT32(
+ TARGETING::get_huid(l_tempTargetingParent))),
+ TWO_UINT32_TO_UINT64(
+ TO_UINT32(instance),
+ TO_UINT32(type)),
+ true/*SW Error*/);
+
+ errlCommit(l_err,HWPF_COMP_ID);
+ TS_FAIL("fapi2TargetTest::Unable to find unit's pervasive!");
+ numFails++;
+ }
+ }
+
}while(0);
FAPI_INF("fapi2TargetTest:: Test Complete. %d/%d fails", numTests, numFails);
return l_err;
diff --git a/src/usr/fapi2/test/fapi2TestUtils.H b/src/usr/fapi2/test/fapi2TestUtils.H
index 0a841d6a6..2fafc296b 100644
--- a/src/usr/fapi2/test/fapi2TestUtils.H
+++ b/src/usr/fapi2/test/fapi2TestUtils.H
@@ -63,6 +63,51 @@ enum{
NUM_TARGETS
};
+/**
+ * @brief Number of children of given type that applicable pervasive has
+ */
+enum PERVASIVE_CHILDREN {
+ PERV_EQ_CHILDREN = 1,
+ PERV_CORE_CHILDREN = 1,
+ PERV_XBUS_CHILDREN = 2,
+ PERV_OBUS_CHILDREN = 1,
+ PERV_CAPP_CHILDREN = 1,
+ PERV_NV_CHILDREN = 2,
+ PERV_MCBIST_CHILDREN = 1,
+ PERV_MCS_CHILDREN = 2,
+ PERV_MCA_CHILDREN = 4,
+ PERV_PEC_CHILDREN = 1,
+ PERV_PEC0_PHB_CHILDREN = 1,
+ PERV_PEC1_PHB_CHILDREN = 2,
+ PERV_PEC2_PHB_CHILDREN = 3,
+};
+
+/**
+ * @brief Unit ranges for pervasive function
+ *
+ * @par Detailed Description:
+ * Maps pervasive target with chip unit X to one or more unit types. For
+ * example, a pervasive chip unit of 18 maps to EQ type because
+ * EQ_LOW <= X <= EQ_HIGH .
+ */
+enum PERVASIVE_RANGE {
+ EQ_LOW = 16,
+ EQ_HIGH = 21,
+ CORE_LOW = 32,
+ CORE_HIGH = 55,
+ XBUS_RANGE = 6,
+ OBUS_LOW = 9,
+ OBUS_HIGH = 12,
+ CAPP0_RANGE = 2,
+ CAPP1_RANGE = 4,
+ NV_RANGE = 5,
+ MC_LOW = 7,
+ MC_HIGH = 8,
+ PEC_LOW = 13,
+ PEC_MID = 14,
+ PEC_HIGH = 15,
+};
+
///
/// @brief Generates a list of platform targets of all differnt types.
/// This comes in handy when testing out fapi2 target interfaces
diff --git a/src/usr/targeting/common/utilFilter.C b/src/usr/targeting/common/utilFilter.C
index aeca62ad3..a58a7e585 100644
--- a/src/usr/targeting/common/utilFilter.C
+++ b/src/usr/targeting/common/utilFilter.C
@@ -388,6 +388,17 @@ void getChildAffinityTargetsByState(
TargetService::CHILD_BY_AFFINITY);
}
+void getPervasiveChildTargetsByState(
+ TARGETING::TargetHandleList& o_vector,
+ const Target* i_target,
+ CLASS i_class,
+ TYPE i_type,
+ ResourceState i_state )
+
+{
+ getAffinityTargets(o_vector, i_target, i_class, i_type, i_state,
+ TargetService::PERVASIVE_CHILD);
+}
void getParentAffinityTargetsByState(
TARGETING::TargetHandleList& o_vector,
@@ -401,6 +412,17 @@ void getParentAffinityTargetsByState(
TargetService::PARENT_BY_AFFINITY);
}
+void getParentPervasiveTargetsByState(
+ TARGETING::TargetHandleList& o_vector,
+ const Target* i_target,
+ CLASS i_class,
+ TYPE i_type,
+ ResourceState i_state )
+{
+ getAffinityTargets(o_vector, i_target, i_class, i_type, i_state,
+ TargetService::PARENT_PERVASIVE);
+}
+
const Target * getParentChip( const Target * i_pChiplet )
{
OpenPOWER on IntegriCloud