summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Glancy <sglancy@us.ibm.com>2018-01-30 14:34:40 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-09-18 22:39:50 -0500
commit5e126f31d70e4c44e1c23e7b6182a636e7f9a8b1 (patch)
tree13a7d61132de06a2138f706a5220c20451e8d4f3
parentbb0c1121374cac632988e090dee4c37d38d0376f (diff)
downloadtalos-hostboot-5e126f31d70e4c44e1c23e7b6182a636e7f9a8b1.tar.gz
talos-hostboot-5e126f31d70e4c44e1c23e7b6182a636e7f9a8b1.zip
Adds plug rule for NVDIMM in specific DIMM slots
NVDIMMs can only be plugged into specific slots on certain systems. This code adds in plug rules to ensure that NVDIMM are only plugged into slots that can support them. Change-Id: Ie67bc57b6764df37d2478bb4de22cff1166a5469 Original-Change-Id: Ie54e46bbdf09236c8d6a431dcc41e19af54b9b34 RTC:186541 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/52946 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Louis Stermole <stermole@us.ibm.com> Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/66312 Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/import/chips/p9/procedures/hwp/memory/lib/eff_config/plug_rules.C62
1 files changed, 61 insertions, 1 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/plug_rules.C b/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/plug_rules.C
index b8f23cd1a..f3230ef8b 100644
--- a/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/plug_rules.C
+++ b/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/plug_rules.C
@@ -27,7 +27,7 @@
/// @file plug_rules.C
/// @brief Enforcement of rules for plugging in DIMM
///
-// *HWP HWP Owner: Jacob L Harvey <jlharvey@us.ibm.com>
+// *HWP HWP Owner: Stephen Glancy <sglancy@us.ibm.com>
// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 3
@@ -160,6 +160,63 @@ fapi_try_exit:
}
///
+/// @brief Helper function to determine if a given DIMM slot can support an NVDIMM
+/// @param[in] const ref to the DIMM target
+/// @param[out] o_is_capable true if the DIMM slot is NVDIMM capable
+/// @return bool FAPI2_RC_SUCCESS iff we pass without errors
+///
+fapi2::ReturnCode dimm_slot_is_nv_capable(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+ bool& o_is_capable)
+{
+ const auto l_pos = mss::pos(i_target);
+
+ fapi2::buffer<uint64_t> l_plug_rules_bitmap = 0;
+
+ FAPI_TRY( mss::mrw_nvdimm_plug_rules(l_plug_rules_bitmap) );
+
+ o_is_capable = l_plug_rules_bitmap.getBit(l_pos);
+
+ FAPI_INF("failed accessing ATTR_MSS_MRW_NVDIMM_PLUG_RULES: 0x%016lx %s capable (target: %s)",
+ l_plug_rules_bitmap, o_is_capable ? "is" : "isn't", mss::c_str(i_target));
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+///
+/// @brief Enforces that NVDIMM are plugged in the proper location
+/// @note NVDIMM can only be plugged in locations where the MRW attribute bitmap is set
+/// @param[in] i_target the port
+/// @param[in] i_kinds a vector of DIMM (sorted while processing)
+/// @return fapi2::FAPI2_RC_SUCCESS if okay
+/// @note Expects the kind array to represent the DIMM on the port.
+///
+fapi2::ReturnCode check_nvdimm(const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
+ const std::vector<dimm::kind>& i_kinds)
+{
+ fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
+
+ // Note: NVDIMM + non-NVDIMM mixing is checked in check hybrid
+ for(const auto& l_kind : i_kinds)
+ {
+ bool l_nvdimm_supported = true;
+ FAPI_TRY(dimm_slot_is_nv_capable(l_kind.iv_target, l_nvdimm_supported));
+
+ // We're always good if NVDIMM is supported OR we're not an NVDIMM, otherwise, throw an error
+ FAPI_ASSERT( (l_nvdimm_supported) || (l_kind.iv_hybrid_memory_type != fapi2::ENUM_ATTR_EFF_HYBRID_MEMORY_TYPE_NVDIMM),
+ fapi2::MSS_PLUG_RULES_NVDIMM_PLUG_ERROR()
+ .set_DIMM_TARGET(l_kind.iv_target)
+ .set_DIMM_POS(mss::pos(l_kind.iv_target))
+ .set_MCA_TARGET(i_target),
+ "%s is an NVDIMM plugged into a DIMM slot where NVDIMM are not supported",
+ mss::c_str(l_kind.iv_target) );
+ }
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+///
/// @brief Enforce DRAM stack type checks
/// @note No 3DS and non-3DS DIMM's can mix
/// @param[in] i_target the port
@@ -658,6 +715,9 @@ fapi2::ReturnCode plug_rule::enforce_plug_rules(const fapi2::Target<fapi2::TARGE
// Ensures that the port has a valid combination of hybrid DIMM
FAPI_TRY( plug_rule::check_hybrid(i_target, l_dimm_kinds) );
+ // Checks if NVDIMM are properly plugged for this system
+ FAPI_TRY( plug_rule::check_nvdimm(i_target, l_dimm_kinds) );
+
// Checks to see if any DIMM are LRDIMM
FAPI_TRY( plug_rule::code::check_lrdimm(l_dimm_kinds) );
OpenPOWER on IntegriCloud