summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp/memory
diff options
context:
space:
mode:
authorBrian Silver <bsilver@us.ibm.com>2017-01-11 13:27:13 -0600
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2017-01-13 15:53:15 -0500
commitdce27a0e1adde4fb35ef3198291219c8357338e4 (patch)
tree82992ae88c839f25488bd44b52be169bb8f551d0 /src/import/chips/p9/procedures/hwp/memory
parent3088c3df50bccc4c8603591c369cb78a9104750b (diff)
downloadtalos-hostboot-dce27a0e1adde4fb35ef3198291219c8357338e4.tar.gz
talos-hostboot-dce27a0e1adde4fb35ef3198291219c8357338e4.zip
Change mss::pos for DIMM to leverage FAPI_POS
Change-Id: Ibc29722256387d599da0d624e014de2be4f67d7f Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34734 Reviewed-by: Louis Stermole <stermole@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34739 Reviewed-by: Hostboot Team <hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/memory')
-rw-r--r--src/import/chips/p9/procedures/hwp/memory/lib/utils/pos.H61
1 files changed, 30 insertions, 31 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/utils/pos.H b/src/import/chips/p9/procedures/hwp/memory/lib/utils/pos.H
index a3dc5328c..f0afbd85f 100644
--- a/src/import/chips/p9/procedures/hwp/memory/lib/utils/pos.H
+++ b/src/import/chips/p9/procedures/hwp/memory/lib/utils/pos.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -84,85 +84,86 @@ class posTraits<fapi2::TARGET_TYPE_PROC_CHIP>
template< fapi2::TargetType T, typename TT = posTraits<T> >
inline typename TT::pos_type pos(const fapi2::Target<T>& i_target)
{
- typename TT::pos_type i_pos = 0;
+ typename TT::pos_type l_pos = 0;
// Don't use FAPI_TRY as you'll mess up fapi2::current_err which
// lmits where this can be used.
- if (FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, i_target, i_pos) != fapi2::FAPI2_RC_SUCCESS)
+ if (FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, i_target, l_pos) != fapi2::FAPI2_RC_SUCCESS)
{
goto fapi_try_exit;
}
- return i_pos;
+ return l_pos;
fapi_try_exit:
// If we can't get our unit position, we're in other trouble
FAPI_ERR("can't get our chip unit position");
-
- // Cronusflex doesn't support Assert.
- // Enable once move to dev complete - AAM
-#if MOVED_AWAY_FROM_CRONUSFLEX
fapi2::Assert(false);
-#endif
return 0;
}
///
-/// @brief Return a DIMM's position from a fapi2 target
+/// @brief Return a processor's position from a fapi2 target
/// @param[in] i_target a target representing the target in question
/// @return The position relative to the chip
///
template<>
-inline posTraits<fapi2::TARGET_TYPE_DIMM>::pos_type pos(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
+inline posTraits<fapi2::TARGET_TYPE_PROC_CHIP>::pos_type pos(
+ const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target)
{
- posTraits<fapi2::TARGET_TYPE_DIMM>::pos_type i_pos = 0;
+ posTraits<fapi2::TARGET_TYPE_PROC_CHIP>::pos_type l_pos = 0;
- if (FAPI_ATTR_GET(fapi2::ATTR_POS, i_target, i_pos) != fapi2::FAPI2_RC_SUCCESS)
+ if (FAPI_ATTR_GET(fapi2::ATTR_POS, i_target, l_pos) != fapi2::FAPI2_RC_SUCCESS)
{
goto fapi_try_exit;
}
- return i_pos;
+ return l_pos;
fapi_try_exit:
// If we can't get our position, we're in other trouble
FAPI_ERR("can't get our position");
-#if MOVED_AWAY_FROM_CRONUSFLEX
fapi2::Assert(false);
-#endif
return 0;
}
///
-/// @brief Return a processor's position from a fapi2 target
+/// @brief Return a DIMM's position from a fapi2 target
/// @param[in] i_target a target representing the target in question
/// @return The position relative to the chip
///
template<>
-inline posTraits<fapi2::TARGET_TYPE_PROC_CHIP>::pos_type pos(
- const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target)
+inline posTraits<fapi2::TARGET_TYPE_DIMM>::pos_type pos(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
{
- posTraits<fapi2::TARGET_TYPE_PROC_CHIP>::pos_type i_pos = 0;
+ // Proc 0 is DIMM 0-15, proc 2 is 64-79 - 64 is the stride between processors
+ constexpr uint64_t DIMM_STRIDE_PER_PROC = 64;
+ constexpr uint64_t TOTAL_DIMM = MC_PER_MODULE * MCS_PER_MC * PORTS_PER_MCS * MAX_DIMM_PER_PORT;
+
+ posTraits<fapi2::TARGET_TYPE_DIMM>::pos_type l_pos = 0;
+
+ // Using fapi2 rather than mss::find as this is pretty low level stuff.
+ const auto l_proc_pos =
+ mss::template pos(i_target.getParent<fapi2::TARGET_TYPE_MCA>().getParent<fapi2::TARGET_TYPE_PROC_CHIP>());
- if (FAPI_ATTR_GET(fapi2::ATTR_POS, i_target, i_pos) != fapi2::FAPI2_RC_SUCCESS)
+ if (FAPI_ATTR_GET(fapi2::ATTR_FAPI_POS, i_target, l_pos) != fapi2::FAPI2_RC_SUCCESS)
{
goto fapi_try_exit;
}
- return i_pos;
+ // To get the FAPI_POS to the equivilent of ATTR_POS, we need to normalize the fapi_pos value
+ // to the processor (stride across which ever processor we're on) and then add in the delta
+ // per processor as ATTR_POS isn't processor relative (delta is the total dimm on a processor)
+ return ((l_pos - (l_proc_pos * DIMM_STRIDE_PER_PROC)) % TOTAL_DIMM) + (TOTAL_DIMM * l_proc_pos);
fapi_try_exit:
// If we can't get our position, we're in other trouble
- FAPI_ERR("can't get our position");
-#if MOVED_AWAY_FROM_CRONUSFLEX
+ FAPI_ERR("can't get our fapi position");
fapi2::Assert(false);
-#endif
return 0;
}
-
///
/// @brief Return a target's relative position from a fapi2 target
/// @tparam T the fapi2::TargetType
@@ -234,23 +235,21 @@ relative_pos<fapi2::TARGET_TYPE_MCS>(const fapi2::Target<fapi2::TARGET_TYPE_MCA>
template< fapi2::TargetType T, typename TT = posTraits<T> >
inline uint32_t fapi_pos(const fapi2::Target<T>& i_target)
{
- uint32_t i_pos = 0;
+ uint32_t l_pos = 0;
// Don't use FAPI_TRY as you'll mess up fapi2::current_err which
// lmits where this can be used.
- if (FAPI_ATTR_GET(fapi2::ATTR_FAPI_POS, i_target, i_pos) != fapi2::FAPI2_RC_SUCCESS)
+ if (FAPI_ATTR_GET(fapi2::ATTR_FAPI_POS, i_target, l_pos) != fapi2::FAPI2_RC_SUCCESS)
{
goto fapi_try_exit;
}
- return i_pos;
+ return l_pos;
fapi_try_exit:
// If we can't get our fapi position, we're in other trouble
FAPI_ERR("can't get our fapi position");
-#if MOVED_AWAY_FROM_CRONUSFLEX
fapi2::Assert(false);
-#endif
return 0;
}
OpenPOWER on IntegriCloud