summaryrefslogtreecommitdiffstats
path: root/src/import/generic/memory/lib/utils/index.H
diff options
context:
space:
mode:
authorAndre A. Marin <aamarin@us.ibm.com>2019-03-20 09:01:13 -0500
committerChristian R. Geddes <crgeddes@us.ibm.com>2019-04-02 13:20:03 -0500
commitee76c2ca5927122cc9bfc792de240f20b87abe82 (patch)
tree5a2a256cc16f3b45ba1d3bf166b41b17692ab490 /src/import/generic/memory/lib/utils/index.H
parent8daf280f7d24a3f5b2c553bb39ceda4d0fd32736 (diff)
downloadtalos-hostboot-ee76c2ca5927122cc9bfc792de240f20b87abe82.tar.gz
talos-hostboot-ee76c2ca5927122cc9bfc792de240f20b87abe82.zip
Fix c_str and pos DIMM specialization
Change-Id: Id234f7f14bc4dd90de1f8ea70a4617c513ca1ffa Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/74846 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@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> Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Reviewed-by: Mark Pizzutillo <mark.pizzutillo@ibm.com> Reviewed-by: Louis Stermole <stermole@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/74877 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/generic/memory/lib/utils/index.H')
-rw-r--r--src/import/generic/memory/lib/utils/index.H66
1 files changed, 18 insertions, 48 deletions
diff --git a/src/import/generic/memory/lib/utils/index.H b/src/import/generic/memory/lib/utils/index.H
index dc60b8c19..fde43f711 100644
--- a/src/import/generic/memory/lib/utils/index.H
+++ b/src/import/generic/memory/lib/utils/index.H
@@ -38,13 +38,10 @@
#include <fapi2.H>
#include <generic/memory/lib/utils/shared/mss_generic_consts.H>
-#include <generic/memory/lib/utils/pos.H>
namespace mss
{
-// TODO Add mc_type template on mss::index API"
-
///
/// @brief Return an attribute array index from a fapi2 target
/// @tparam T the fapi2::TargetType - derived
@@ -52,55 +49,28 @@ namespace mss
/// @return size_t the attribute array index.
///
template< fapi2::TargetType T >
-inline size_t index(const fapi2::Target<T>& i_target);
-
-///
-/// @brief Return an attribute array index from a DIMM target
-/// @param[in] i_target a DIMM target representing the DIMM in question
-/// @return size_t the attribute array index.
-///
-template<>
-inline size_t index(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
+inline size_t index(const fapi2::Target<T>& i_target)
{
- typedef procTraits<proc_type::NIMBUS> TT;
- return mss::pos(i_target) % TT::DIMMS_PER_PORT;
-}
+ // Unrolled c_str to avoid a circular include
+ char l_c_str_storage[fapi2::MAX_ECMD_STRING_LEN] = {};
+ fapi2::toString( i_target, l_c_str_storage, fapi2::MAX_ECMD_STRING_LEN );
-///
-///@brief Return an attribute array index from a MCA target
-/// @param[in] i_target a MCA target representing the MCA in question
-/// @return size_t the attribute array index.
-///
-template<>
-inline size_t index(const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target)
-{
- typedef procTraits<proc_type::NIMBUS> TT;
- return mss::pos(i_target) % TT::PORTS_PER_MCS;
-}
+ uint8_t l_pos = 0;
-///
-/// @brief Return an attribute array index from a MCS target
-/// @param[in] i_target a MCS target representing the MCS in question
-/// @return size_t the attribute array index.
-///
-template<>
-inline size_t index(const fapi2::Target<fapi2::TARGET_TYPE_MCS>& i_target)
-{
- typedef procTraits<proc_type::NIMBUS> TT;
- return mss::pos(i_target) % TT::MCS_PER_MC;
-}
+ // 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_REL_POS, i_target, l_pos) != fapi2::FAPI2_RC_SUCCESS)
+ {
+ goto fapi_try_exit;
+ }
-///
-/// @brief Return an attribute array index from a OCMB target
-/// @param[in] i_target a MEM_PORT target representing the OCMB in question
-/// @return size_t the attribute array index.
-///
-template<>
-inline size_t index(const fapi2::Target<fapi2::TARGET_TYPE_MEM_PORT>& i_target)
-{
- typedef procTraits<proc_type::AXONE> TT;
- // We may need to revisit this later if we get an OCMB that has more than one port.
- return mss::pos(i_target) % TT::EXP_PORTS_PER_OCMB;
+ return l_pos;
+
+fapi_try_exit:
+ // If we can't get our relative position, we're in other trouble
+ FAPI_ERR("can't get ATTR_REL_POS for %s", l_c_str_storage);
+ fapi2::Assert(false);
+ return 0;
}
///
OpenPOWER on IntegriCloud