diff options
author | Tsung Yeung <tyeung@us.ibm.com> | 2018-10-30 16:20:12 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-01-09 12:41:27 -0600 |
commit | 468aed31ffbed5d33e14de5959c66230ed50ee05 (patch) | |
tree | bcd09912499f1b786a0cacef4b366e69043060a2 /src/usr/targeting | |
parent | b9a994a7a57a0d909b452e4e8a385224498beae3 (diff) | |
download | talos-hostboot-468aed31ffbed5d33e14de5959c66230ed50ee05.tar.gz talos-hostboot-468aed31ffbed5d33e14de5959c66230ed50ee05.zip |
Move NVDIMM Erase and Arm to Runtime
-Move erase and arm to after OCC has started
-Address several TODOs in I2d68123ceb0b8e7a33b54f9acad0968670a67ea9
-Combine arm and erase into an atomic operation with ATOMIC_SAVE_AND_ERASE
Change-Id: Iad06f6fe7128df3defc4ded57b0151f9c4b9d15e
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/68197
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/targeting')
-rw-r--r-- | src/usr/targeting/common/util.C | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/usr/targeting/common/util.C b/src/usr/targeting/common/util.C index c8b8c7c5f..a5a9bb7a9 100644 --- a/src/usr/targeting/common/util.C +++ b/src/usr/targeting/common/util.C @@ -38,6 +38,9 @@ #include <targeting/common/utilFilter.H> #include <targeting/common/trace.H> +#define MCA_PER_MCS 2 +#define DIMM_PER_MCA 2 + namespace TARGETING { @@ -281,4 +284,46 @@ uint8_t is_fused_mode( ) } // end is_fused_mode +/** + * @brief Determine if the given dimm target is an NVDIMM + * + * @param[in] i_target : dimm target to check + * + * @return bool - True if the given target is an NVDIMM + */ +bool isNVDIMM( TARGETING::Target * i_target ) +{ + // Not the most elegant way of doing it but the hybrid attributes + // are at the MCS level. Need to find my way up to MCS and check + // if the dimm is hybrid + TARGETING::TargetHandleList l_mcaList; + getParentAffinityTargets(l_mcaList, i_target, TARGETING::CLASS_UNIT, TARGETING::TYPE_MCA); + + if (l_mcaList.size()) + { + TARGETING::TargetHandleList l_mcsList; + getParentAffinityTargets(l_mcsList, l_mcaList[0], TARGETING::CLASS_UNIT, TARGETING::TYPE_MCS); + + if(l_mcsList.size()) + { + // 2-D array. [MCA][DIMM] + TARGETING::ATTR_EFF_HYBRID_type l_hybrid; + TARGETING::ATTR_EFF_HYBRID_MEMORY_TYPE_type l_hybrid_type; + + if( l_mcsList[0]->tryGetAttr<TARGETING::ATTR_EFF_HYBRID>(l_hybrid) && + l_mcsList[0]->tryGetAttr<TARGETING::ATTR_EFF_HYBRID_MEMORY_TYPE>(l_hybrid_type) ) + { + //Using relative position to lookup the hybrid attribute for the current dimm + TARGETING::ATTR_REL_POS_type l_dimm_rel_pos = i_target->getAttr<ATTR_REL_POS>(); + TARGETING::ATTR_REL_POS_type l_mca_rel_pos = l_mcaList[0]->getAttr<ATTR_REL_POS>(); + + return (l_hybrid[l_mca_rel_pos][l_dimm_rel_pos] == TARGETING::EFF_HYBRID_IS_HYBRID && + l_hybrid_type[l_mca_rel_pos][l_dimm_rel_pos] == TARGETING::EFF_HYBRID_MEMORY_TYPE_NVDIMM); + } + } + } + + return false; +} + } // end namespace TARGETING |