summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSantosh Puranik <santosh.puranik@in.ibm.com>2016-12-07 03:19:35 -0600
committerSantosh S. Puranik <santosh.puranik@in.ibm.com>2017-01-12 04:45:50 -0500
commit9cb883e5647c2e02d07fa49d93ea9dbbfd4443d6 (patch)
treeb4c59e8c30d19fd61504da16db74d409753150cc /src
parentdf7e2b85dbf9e51987a9b79a5e18f258bf5dac45 (diff)
downloadtalos-sbe-9cb883e5647c2e02d07fa49d93ea9dbbfd4443d6.tar.gz
talos-sbe-9cb883e5647c2e02d07fa49d93ea9dbbfd4443d6.zip
Specialization of getParent for compound targets
Change-Id: I14f9a99a4f645d9560a96503fc3941abc18c3c04 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33516 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Santosh S. Puranik <santosh.puranik@in.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/hwpf/include/plat/plat_target.H8
-rw-r--r--src/hwpf/include/plat/target.H39
-rw-r--r--src/hwpf/src/plat/target.C35
3 files changed, 70 insertions, 12 deletions
diff --git a/src/hwpf/include/plat/plat_target.H b/src/hwpf/include/plat/plat_target.H
index 14df2ab8..45a213a5 100644
--- a/src/hwpf/include/plat/plat_target.H
+++ b/src/hwpf/include/plat/plat_target.H
@@ -170,6 +170,14 @@ namespace fapi2
}
///
+ /// @brief Get this target's parent
+ ///
+ /// @param [in] The fapi2 type of the requested parent
+ /// @return Plat target handle to the parent target
+ ///
+ plat_target_handle getParent(const TargetType i_parentType) const;
+
+ ///
/// @brief Get this target's children
///
/// @param [in] i_parentType fapi2 type of the parent
diff --git a/src/hwpf/include/plat/target.H b/src/hwpf/include/plat/target.H
index c7baef55..a204a08c 100644
--- a/src/hwpf/include/plat/target.H
+++ b/src/hwpf/include/plat/target.H
@@ -178,14 +178,13 @@ namespace fapi2
template<TargetType T>
inline Target<T, V> Target<K, V>::getParent(void) const
{
- static_assert((((K == TARGET_TYPE_EQ) ||
- (K == TARGET_TYPE_CORE) ||
- (K == TARGET_TYPE_MCBIST) ||
- (K == TARGET_TYPE_PERV) ||
- (K == TARGET_TYPE_EX) ||
- (K == TARGET_TYPE_PROC_CHIP) ||
- (K == (TARGET_TYPE_PROC_CHIP | TARGET_TYPE_EQ)) ||
- (K == (TARGET_TYPE_PROC_CHIP | TARGET_TYPE_CORE)) ||
+ constexpr TargetType TARGET_TYPE_PROC_CHILDREN =
+ TARGET_TYPE_EQ | TARGET_TYPE_PERV | TARGET_TYPE_EX |
+ TARGET_TYPE_MCBIST | TARGET_TYPE_CORE |
+ TARGET_TYPE_MCS | TARGET_TYPE_PROC_CHIP;
+
+ static_assert(((
+ ((K & TARGET_TYPE_PROC_CHILDREN) != TARGET_TYPE_NONE) ||
(K == TARGET_TYPE_ALL)) &&
((T == TARGET_TYPE_EQ) ||
(T == TARGET_TYPE_EX) ||
@@ -199,10 +198,9 @@ namespace fapi2
"Invalid parent for EQ target, must be PERV or "
"PROC_CHIP");
- static_assert(!((K == TARGET_TYPE_ALL) &&
- (T != TARGET_TYPE_PROC_CHIP)),
- "Invalid parent for ALL target, must be "
- "PROC_CHIP");
+ static_assert(!((T == TARGET_TYPE_PROC_CHIP) &&
+ ((K & TARGET_TYPE_PROC_CHILDREN) == TARGET_TYPE_NONE)),
+ "Parent proc chip invalid for this target type");
static_assert(!((K == TARGET_TYPE_MCBIST) &&
(T != TARGET_TYPE_PERV) &&
@@ -252,6 +250,23 @@ namespace fapi2
}
}
+ ///
+ /// @brief Get this target's immediate parent - specialization for compound
+ // target (PROC_CHIP | CORE | EX)
+ /// @tparam T The type of the parent
+ /// @return Target<T, plat_target_handle_t> a target representing the parent
+ ///
+ template<>
+ template<TargetType T>
+ Target<T, plat_target_handle_t>
+ Target<TARGET_TYPE_PROC_CHIP | TARGET_TYPE_CORE | TARGET_TYPE_EX,
+ plat_target_handle_t>::getParent(void) const
+ {
+ static_assert(((T == TARGET_TYPE_PROC_CHIP) || (T == TARGET_TYPE_EQ)),
+ "Wrong parent target type");
+ return static_cast<plat_target_handle_t>(get()).getParent(T);
+ }
+
/// @brief Get this target's children - handles EQ/EX/EC conversions
/// @tparam K The type of parent
/// @tparam V The plat target handle type
diff --git a/src/hwpf/src/plat/target.C b/src/hwpf/src/plat/target.C
index 301e8534..dbf8413b 100644
--- a/src/hwpf/src/plat/target.C
+++ b/src/hwpf/src/plat/target.C
@@ -162,6 +162,41 @@ namespace fapi2
return l_targetType;
}
+ plat_target_handle_t plat_target_handle_t::getParent(
+ const TargetType i_parentType) const
+ {
+ plat_target_handle_t l_handle;
+ switch(i_parentType)
+ {
+ case TARGET_TYPE_PROC_CHIP:
+ l_handle = G_vec_targets[CHIP_TARGET_OFFSET];
+ break;
+ case TARGET_TYPE_PERV:
+ assert(fields.type & PPE_TARGET_TYPE_PERV);
+ l_handle = *this;
+ break;
+ case TARGET_TYPE_EX:
+ assert(fields.type & PPE_TARGET_TYPE_CORE);
+ l_handle = G_vec_targets
+ [(fields.type_target_num / EX_PER_QUAD) + EX_TARGET_OFFSET];
+ break;
+ case TARGET_TYPE_EQ:
+ assert(fields.type &
+ (PPE_TARGET_TYPE_EX | PPE_TARGET_TYPE_CORE));
+ {
+ uint32_t l_perQuad = (fields.type & PPE_TARGET_TYPE_EX) ?
+ EX_PER_QUAD : CORES_PER_QUAD;
+ l_handle = G_vec_targets
+ [(fields.type_target_num / l_perQuad) +
+ EX_TARGET_OFFSET];
+ }
+ break;
+ default:
+ assert(false);
+ }
+ return l_handle;
+ }
+
void plat_target_handle_t::getChildren(const TargetType i_parentType,
const TargetType i_childType,
const plat_target_type_t i_platType,
OpenPOWER on IntegriCloud