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 | |
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')
-rw-r--r-- | hwpf/include/fapi2_target.H | 13 | ||||
-rw-r--r-- | hwpf/include/plat/target.H | 53 | ||||
-rw-r--r-- | hwpf/include/target_types.H | 136 |
3 files changed, 201 insertions, 1 deletions
diff --git a/hwpf/include/fapi2_target.H b/hwpf/include/fapi2_target.H index 363c371e..35fbf97e 100644 --- a/hwpf/include/fapi2_target.H +++ b/hwpf/include/fapi2_target.H @@ -218,6 +218,19 @@ namespace fapi2 getChildren(const TargetState i_state = TARGET_STATE_FUNCTIONAL) const; /// + /// @brief Get this target's children, filtered + /// @tparam T The type of the parent + /// @param[in], i_filter The desired chiplet filter + /// @param[in] i_state The desired TargetState of the children + /// @return std::vector<Target<T> > a vector of present/functional + /// children + /// + template< TargetType T> + std::vector<Target<T> > + getChildren(const TargetFilter i_filter, + const TargetState i_state = TARGET_STATE_FUNCTIONAL) const; + + /// /// @brief Get the target at the other end of a bus - dimm included /// @tparam T The type of the parent /// @param[in] i_state The desired TargetState of the children 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 diff --git a/hwpf/include/target_types.H b/hwpf/include/target_types.H index ca5c6af8..90b400b7 100644 --- a/hwpf/include/target_types.H +++ b/hwpf/include/target_types.H @@ -92,6 +92,142 @@ namespace fapi2 /// typedef uint16_t TargetTypes_t; + /// + /// @brief Enumeration of chiplet filters + /// + enum TargetFilter + { + TARGET_FILTER_TP = 0x8000000000000000, // Pervasive 1 + TARGET_FILTER_NEST_NORTH = 0x4000000000000000, // Pervasive 2 + TARGET_FILTER_NEST_SOUTH = 0x2000000000000000, // Pervasive 3 + TARGET_FILTER_NEST_EAST = 0x1000000000000000, // Pervasive 4 + TARGET_FILTER_NEST_WEST = 0x0800000000000000, // Pervasive 5 + TARGET_FILTER_XBUS = 0x0400000000000000, // Pervasive 6 + TARGET_FILTER_MC_WEST = 0x0200000000000000, // Pervasive 7 + TARGET_FILTER_MC_EAST = 0x0100000000000000, // Pervasive 8 + TARGET_FILTER_OBUS0 = 0x0080000000000000, // Pervasive 9 + TARGET_FILTER_OBUS1 = 0x0040000000000000, // Pervasive 10 + TARGET_FILTER_OBUS2 = 0x0020000000000000, // Pervasive 11 + TARGET_FILTER_OBUS3 = 0x0010000000000000, // Pervasive 12 + TARGET_FILTER_PCI0 = 0x0008000000000000, // Pervasive 13 + TARGET_FILTER_PCI1 = 0x0004000000000000, // Pervasive 14 + TARGET_FILTER_PCI2 = 0x0002000000000000, // Pervasive 15 + TARGET_FILTER_CACHE0 = 0x0001000000000000, // Pervasive 16 + TARGET_FILTER_CACHE1 = 0x0000800000000000, // Pervasive 17 + TARGET_FILTER_CACHE2 = 0x0000400000000000, // Pervasive 18 + TARGET_FILTER_CACHE3 = 0x0000200000000000, // Pervasive 19 + TARGET_FILTER_CACHE4 = 0x0000100000000000, // Pervasive 20 + TARGET_FILTER_CACHE5 = 0x0000080000000000, // Pervasive 21 + TARGET_FILTER_CORE0 = 0x0000040000000000, // Pervasive 32 + TARGET_FILTER_CORE1 = 0x0000020000000000, // Pervasive 33 + TARGET_FILTER_CORE2 = 0x0000010000000000, // Pervasive 34 + TARGET_FILTER_CORE3 = 0x0000008000000000, // Pervasive 35 + TARGET_FILTER_CORE4 = 0x0000004000000000, // Pervasive 36 + TARGET_FILTER_CORE5 = 0x0000002000000000, // Pervasive 37 + TARGET_FILTER_CORE6 = 0x0000001000000000, // Pervasive 38 + TARGET_FILTER_CORE7 = 0x0000000800000000, // Pervasive 39 + TARGET_FILTER_CORE8 = 0x0000000400000000, // Pervasive 40 + TARGET_FILTER_CORE9 = 0x0000000200000000, // Pervasive 41 + TARGET_FILTER_CORE10 = 0x0000000100000000, // Pervasive 42 + TARGET_FILTER_CORE11 = 0x0000000080000000, // Pervasive 43 + TARGET_FILTER_CORE12 = 0x0000000040000000, // Pervasive 44 + TARGET_FILTER_CORE13 = 0x0000000020000000, // Pervasive 45 + TARGET_FILTER_CORE14 = 0x0000000010000000, // Pervasive 46 + TARGET_FILTER_CORE15 = 0x0000000008000000, // Pervasive 47 + TARGET_FILTER_CORE16 = 0x0000000004000000, // Pervasive 48 + TARGET_FILTER_CORE17 = 0x0000000002000000, // Pervasive 49 + TARGET_FILTER_CORE18 = 0x0000000001000000, // Pervasive 50 + TARGET_FILTER_CORE19 = 0x0000000000800000, // Pervasive 51 + TARGET_FILTER_CORE20 = 0x0000000000400000, // Pervasive 52 + TARGET_FILTER_CORE21 = 0x0000000000200000, // Pervasive 53 + TARGET_FILTER_CORE22 = 0x0000000000100000, // Pervasive 54 + TARGET_FILTER_CORE23 = 0x0000000000080000, // Pervasive 55 + + // Composite filters follow + + // Pervasive 32-55 (all cores) + TARGET_FILTER_ALL_CORES = (TARGET_FILTER_CORE0 | + TARGET_FILTER_CORE1 | TARGET_FILTER_CORE2 | + TARGET_FILTER_CORE3 | TARGET_FILTER_CORE4 | + TARGET_FILTER_CORE5 | TARGET_FILTER_CORE6 | + TARGET_FILTER_CORE7 | TARGET_FILTER_CORE8 | + TARGET_FILTER_CORE9 | TARGET_FILTER_CORE10 | + TARGET_FILTER_CORE11 | TARGET_FILTER_CORE12 | + TARGET_FILTER_CORE13 | TARGET_FILTER_CORE14 | + TARGET_FILTER_CORE15 | TARGET_FILTER_CORE16 | + TARGET_FILTER_CORE17 | TARGET_FILTER_CORE18 | + TARGET_FILTER_CORE19 | TARGET_FILTER_CORE20 | + TARGET_FILTER_CORE21 | TARGET_FILTER_CORE22 | + TARGET_FILTER_CORE23), + + // Pervasive 16-21 (all caches) + TARGET_FILTER_ALL_CACHES = (TARGET_FILTER_CACHE0 | + TARGET_FILTER_CACHE1 | TARGET_FILTER_CACHE2 | + TARGET_FILTER_CACHE3 | TARGET_FILTER_CACHE4 | + TARGET_FILTER_CACHE5), + + // Pervasive 2-5 (eg N0-N3) < req'd + TARGET_FILTER_ALL_NEST = (TARGET_FILTER_NEST_NORTH | + TARGET_FILTER_NEST_SOUTH | TARGET_FILTER_NEST_EAST | + TARGET_FILTER_NEST_WEST), + + // Pervasive 2-4 (eg N0-N2) < req'd + TARGET_FILTER_NEST_SLAVES = + (TARGET_FILTER_NEST_NORTH | TARGET_FILTER_NEST_SOUTH | + TARGET_FILTER_NEST_EAST), + + // Pervasive 5 (eg N32) < req'd + TARGET_FILTER_NEST_MASTER = TARGET_FILTER_NEST_WEST, + + // Pervasive 7-8 (eg MC0-MC1) + TARGET_FILTER_ALL_MC = + (TARGET_FILTER_MC_WEST | TARGET_FILTER_MC_EAST), + + // Pervasive 9-12 (OB0-OB3) + TARGET_FILTER_ALL_OBUS = + (TARGET_FILTER_OBUS0 | TARGET_FILTER_OBUS1 | TARGET_FILTER_OBUS2 | + TARGET_FILTER_OBUS3), + + // Pervasive 13-15 (PCI0-PCI2) + TARGET_FILTER_ALL_PCI = + (TARGET_FILTER_PCI0 | TARGET_FILTER_PCI1 | TARGET_FILTER_PCI2), + + // Sync mode filter = All NEST + All MCS + TARGET_FILTER_SYNC_MODE_NEST = + (TARGET_FILTER_ALL_NEST | TARGET_FILTER_ALL_MC), + + // All IO Targets except NEST + TARGET_FILTER_ALL_IO_EXCEPT_NEST = + (TARGET_FILTER_XBUS | TARGET_FILTER_ALL_PCI | TARGET_FILTER_ALL_OBUS), + + // All sync mode IO except NEST + TARGET_FILTER_SYNC_MODE_ALL_IO_EXCEPT_NEST = + (TARGET_FILTER_ALL_MC | TARGET_FILTER_XBUS | TARGET_FILTER_ALL_PCI | + TARGET_FILTER_ALL_OBUS), + + // All sync mode NEST slaves + TARGET_FILTER_SYNC_MODE_NEST_SLAVES = + (TARGET_FILTER_ALL_MC | TARGET_FILTER_NEST_SLAVES), + + // All sync mode IO + TARGET_FILTER_SYNC_MODE_ALL_IO = + (TARGET_FILTER_ALL_MC | TARGET_FILTER_ALL_NEST | + TARGET_FILTER_ALL_OBUS | TARGET_FILTER_ALL_PCI | + TARGET_FILTER_XBUS), + + // All IO + TARGET_FILTER_ALL_IO = (TARGET_FILTER_ALL_NEST | + TARGET_FILTER_ALL_OBUS | TARGET_FILTER_ALL_PCI | + TARGET_FILTER_XBUS), + + // All sync mode except TP + TARGET_FILTER_SYNC_MODE_ALL_EXCEPT_TP = + (TARGET_FILTER_ALL_MC | TARGET_FILTER_ALL_NEST | + TARGET_FILTER_ALL_OBUS | TARGET_FILTER_ALL_PCI | + TARGET_FILTER_XBUS | TARGET_FILTER_ALL_CORES | + TARGET_FILTER_ALL_CACHES), + }; + /// @cond constexpr TargetType operator|(TargetType x, TargetType y) { |