summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMike Baiocchi <mbaiocch@us.ibm.com>2016-05-19 11:43:33 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-06-09 11:08:40 -0400
commit65f5c6f49eaae840c00cf78b6c16bcb664f51c36 (patch)
treee24bef299fdf86ddcbbb6d0f119c345e1c8a99d6 /src/include
parentc4119b881e8a6e3746ac4553dee024351d97226f (diff)
downloadblackbird-hostboot-65f5c6f49eaae840c00cf78b6c16bcb664f51c36.tar.gz
blackbird-hostboot-65f5c6f49eaae840c00cf78b6c16bcb664f51c36.zip
Add support for fapi2::getChildren with additional const TargetFilter
In addition to adding support for fapi2::getChildren with additional const TargetFilter input parameter, this commit also adds a test_fapi2GetChildrenFilter to the automatic simics testcases. Change-Id: I82e34c001ebb0af8eacb3c8f244391504ed424ae RTC:149115 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24813 Tested-by: Jenkins Server Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com> Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H1
-rw-r--r--src/include/usr/fapi2/target.H74
2 files changed, 75 insertions, 0 deletions
diff --git a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
index 90bde96ed..ded48259c 100644
--- a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
+++ b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
@@ -51,6 +51,7 @@ namespace fapi2
MOD_FAPI2_PLAT_GET_OTHER_END_TEST = 0x08,
MOD_FAPI2_PLAT_GET_OTHER_END = 0x09,
MOD_FAPI2_MVPD_ACCESS = 0x0A,
+ MOD_FAPI2_PLAT_GET_CHILDREN_FILTER_TEST = 0x0B,
};
/**
diff --git a/src/include/usr/fapi2/target.H b/src/include/usr/fapi2/target.H
index 255f66dd5..756b1d85f 100644
--- a/src/include/usr/fapi2/target.H
+++ b/src/include/usr/fapi2/target.H
@@ -726,6 +726,80 @@ FAPI_DBG(ENTER_MRK "getChildren. Type 0x%08x State:0x%08x", T, i_state);
///
+/// @brief Get this target's children, filtered
+/// @tparam T The type of the parent
+/// @tparam K The type of target of which this is called
+/// @tparam V the type of the target's Value
+/// @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 K, typename V>
+template< TargetType T>
+inline std::vector<Target<T> >
+ Target<K, V>::getChildren(const TargetFilter i_filter,
+ const TargetState i_state) const
+{
+ std::vector<Target<T>> l_children;
+
+ l_children = this->getChildren<T>(i_state);
+
+ FAPI_DBG("getChildrenFilter: Tgt=0x%.8X, i_filter=0x%.16X,"
+ "K-Type=0x%.8X, T-Type=0x%.8X, sizeA=%d",
+ TARGETING::get_huid(this->get()), i_filter, K, T, l_children.size());
+
+ // Limit to getting Pervasive children from proc_chip parent for now
+ //@TODO RTC:155755 to track possible additional support
+ static_assert(((T == fapi2::TARGET_TYPE_PERV) &&
+ (K == fapi2::TARGET_TYPE_PROC_CHIP)),
+ "fapi2::getChildren-Filter only supports getting fapi2::TARGET_TYPE_PERV children on a fapi2::TARGET_TYPE_PROC_CHIP");
+
+ for ( auto childIter = l_children.begin();
+ childIter != l_children.end();
+ // ++childIter incremented below
+ )
+ {
+ const TARGETING::Target * l_platTarget =
+ static_cast<const TARGETING::Target*>(childIter->get());
+ uint8_t l_chiplet_num = 0;
+ uint32_t l_fapi2_type = childIter->getType();
+ uint64_t l_bitMask = 0x0;
+
+ // ATTR_CHIP_UNIT represents the Pervasive Chiplet numbering and is
+ // needed to create the l_bitMask to use against i_filter
+ if(!l_platTarget->tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_chiplet_num))
+ {
+ FAPI_ERR("ERROR: getChildrenFilter: Can not read CHIP_UNIT attribute"
+ "Keeping Target 0x%lx for 0x%x", l_platTarget, T);
+ l_bitMask = 0xFFFFFFFFFFFFFFFF;
+ }
+ else
+ {
+ l_bitMask = 0x8000000000000000 >> l_chiplet_num;
+ }
+
+ if (i_filter & l_bitMask) // keep child
+ {
+ FAPI_DBG("getChildrenFilter: keep child=0x%.8X, type=0x%.8X, l_bitMask=0x%.16X, num=0x%.2X",
+ TARGETING::get_huid(l_platTarget), l_fapi2_type, l_bitMask, l_chiplet_num );
+
+ ++childIter;
+ }
+ else // remove child
+ {
+ childIter = l_children.erase(childIter); // this increments childIter
+
+ FAPI_DBG("getChildrenFilter: removed child=0x%.8X, type=0x%.8X, l_bitMask=0x%.16X, num=0x%.2X",
+ TARGETING::get_huid(l_platTarget), l_fapi2_type, l_bitMask, l_chiplet_num );
+ }
+ }
+
+ // Return filtered fapi2::Targets to the caller
+ return l_children;
+}
+
+///
/// @brief Get the target at the other end of a bus
/// @tparam T The type of the target on the other end
/// @param[out] o_target A target representing the thing on the other end
OpenPOWER on IntegriCloud