diff options
author | Santosh Puranik <santosh.puranik@in.ibm.com> | 2015-12-09 10:48:06 -0600 |
---|---|---|
committer | Gregory S. Still <stillgs@us.ibm.com> | 2016-01-27 11:45:57 -0600 |
commit | f2a5b982c77718b43e6c7a448a5c67761c143605 (patch) | |
tree | cf9523ba9bdb14c096ff197cbfa40de3eb8749d2 /hwpf/include/plat/target.H | |
parent | 1e33470b9f718cd95f4810ee1798f39c5425e47d (diff) | |
download | talos-sbe-f2a5b982c77718b43e6c7a448a5c67761c143605.tar.gz talos-sbe-f2a5b982c77718b43e6c7a448a5c67761c143605.zip |
Plat implementation of getchildren, filtered
Change-Id: I7550b2d011da5f9d87f84ec0133b5e1dffa56871
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/22577
Tested-by: Jenkins Server
Reviewed-by: Tali Rabetti <talis@il.ibm.com>
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Diffstat (limited to 'hwpf/include/plat/target.H')
-rw-r--r-- | hwpf/include/plat/target.H | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/hwpf/include/plat/target.H b/hwpf/include/plat/target.H index 79d61f7f..23f01401 100644 --- a/hwpf/include/plat/target.H +++ b/hwpf/include/plat/target.H @@ -180,7 +180,7 @@ namespace fapi2 /// template<TargetType K, typename V> template< TargetType T> - inline std::vector<Target<T> > + std::vector<Target<T> > Target<K, V>::getChildren(const TargetState i_state) const { #define INVALID_CHILD(PARENT, CHILD) \ @@ -273,6 +273,57 @@ namespace fapi2 return l_children; } + // Specialization of getChildren, filtered for the chip target + template<TargetType K, typename V> + template<TargetType T> + std::vector<Target<T> > + Target<K, V>::getChildren(const TargetFilter i_filter, + const TargetState i_state) const + { + static_assert((K == TARGET_TYPE_PROC_CHIP), "Parent target must be the proc chip"); + static_assert((T == TARGET_TYPE_EQ) || (T == TARGET_TYPE_CORE) + || (T == TARGET_TYPE_PERV) || (T == TARGET_TYPE_MCS), + "Child target type must be a pervasive chiplet"); + + std::vector<Target<T> > l_children; + static const uint64_t mask = 1; + + // Walk the bits in the input target filter. For every bit, at + // position x, that is set, x can be used as an index into our global + // target vector (indexed by chiplet number) + for (uint32_t l_idx = 0; + l_idx < sizeof(TargetFilter) * 8; + ++l_idx) + { + if (i_filter & (mask << (((sizeof(TargetFilter)*8)-1) - l_idx))) + { + uint64_t l_targetHandle = G_vec_targets.at(l_idx + NEST_GROUP1_CHIPLET_OFFSET); + + if(((static_cast<union iv_handle>(l_targetHandle)).fields.type & TARGET_TYPE_PERV)) // Can be an assertion? + { + switch (i_state) + { + case TARGET_STATE_PRESENT: + if(static_cast<union iv_handle>(l_targetHandle).fields.present) + { + l_children.push_back(l_targetHandle); + } + break; + case TARGET_STATE_FUNCTIONAL: + if(static_cast<union iv_handle>(l_targetHandle).fields.functional) + { + l_children.push_back(l_targetHandle); + } + break; + default: + break; + } + } + } + } + return l_children; + } + /// /// @brief Get the target at the other end of a bus - dimm included /// @tparam T The type of the parent |