diff options
Diffstat (limited to 'src/import/chips/p9/procedures')
6 files changed, 155 insertions, 6 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 29689c59d..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 @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -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) ); diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/plug_rules.H b/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/plug_rules.H index 14ae03d36..aabc7b09f 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/plug_rules.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/eff_config/plug_rules.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -46,6 +46,15 @@ namespace mss namespace plug_rule { +/// +/// @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); + /// /// @brief Enforce the plug-rules per MCS @@ -182,6 +191,17 @@ fapi2::ReturnCode check_stack_type(const fapi2::Target<fapi2::TARGET_TYPE_MCA>& fapi2::ReturnCode check_hybrid(const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target, const std::vector<dimm::kind>& i_kinds); +/// +/// @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); + // Adding in code based plug rules - as supporting code gets added, the following checks can be deleted namespace code { diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/mss_attribute_accessors.H b/src/import/chips/p9/procedures/hwp/memory/lib/mss_attribute_accessors.H index 47fbf0e2b..cc580d3e7 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/mss_attribute_accessors.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/mss_attribute_accessors.H @@ -21510,6 +21510,30 @@ fapi_try_exit: return fapi2::current_err; } +/// +/// @brief ATTR_MSS_MRW_NVDIMM_PLUG_RULES getter +/// @param[out] uint64_t& reference to store the value +/// @note Generated by gen_accessors.pl generateParameters (SYSTEM) +/// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff get is OK +/// @note A bitmap containing the plug rules for NVDIMM. 1 if a DIMM supports an NVDIMM +/// being plugged in, 0 if it does not DIMM slot 0 is the left most bit The index to +/// the bitmap is the position of the DIMM target As such, a bitmap of 0b10010000, +/// would allow NVDIMM plugged into DIMM0 and DIMM3 Note: this attribute is a 64 bit +/// number to account for 16 DIMM per processor if there is ever a 4 processor +/// system +/// +inline fapi2::ReturnCode mrw_nvdimm_plug_rules(uint64_t& o_value) +{ + + FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_MSS_MRW_NVDIMM_PLUG_RULES, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), o_value) ); + return fapi2::current_err; + +fapi_try_exit: + FAPI_ERR("failed accessing ATTR_MSS_MRW_NVDIMM_PLUG_RULES: 0x%lx (system target)", + uint64_t(fapi2::current_err)); + return fapi2::current_err; +} + /// /// @brief ATTR_MSS_VPD_MR_0_VERSION_LAYOUT getter diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/mss_attribute_accessors_manual.H b/src/import/chips/p9/procedures/hwp/memory/lib/mss_attribute_accessors_manual.H index 60c51e9ae..ee405528b 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/mss_attribute_accessors_manual.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/mss_attribute_accessors_manual.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -41,6 +41,7 @@ #include <fapi2.H> #include <generic/memory/lib/utils/find.H> +#include <lib/mss_attribute_accessors.H> namespace mss { diff --git a/src/import/chips/p9/procedures/xml/attribute_info/memory_mrw_attributes.xml b/src/import/chips/p9/procedures/xml/attribute_info/memory_mrw_attributes.xml index 163cb8d54..6b4ff1a28 100755 --- a/src/import/chips/p9/procedures/xml/attribute_info/memory_mrw_attributes.xml +++ b/src/import/chips/p9/procedures/xml/attribute_info/memory_mrw_attributes.xml @@ -5,7 +5,7 @@ <!-- --> <!-- OpenPOWER HostBoot Project --> <!-- --> -<!-- Contributors Listed Below - COPYRIGHT 2016,2017 --> +<!-- Contributors Listed Below - COPYRIGHT 2016,2018 --> <!-- [+] International Business Machines Corp. --> <!-- --> <!-- --> @@ -630,4 +630,22 @@ <enum> ENABLE = 0, DISABLE = 1 </enum> <mssAccessorName>mrw_memdiags_bcmode</mssAccessorName> </attribute> + + <attribute> + <id>ATTR_MSS_MRW_NVDIMM_PLUG_RULES</id> + <targetType>TARGET_TYPE_SYSTEM</targetType> + <description> + A bitmap containing the plug rules for NVDIMM. + 1 if a DIMM supports an NVDIMM being plugged in, 0 if it does not + DIMM slot 0 is the left most bit + The index to the bitmap is the position of the DIMM target + As such, a bitmap of 0b10010000, would allow NVDIMM plugged into DIMM0 and DIMM3 + Note: this attribute is a 64 bit number to account for 16 DIMM per processor if there is ever a 4 processor system + </description> + <valueType>uint64</valueType> + <platInit/> + <default> 0 </default> + <enum> NO_NVDIMM = 0, NVDIMM_CAPABLE = 1 </enum> + <mssAccessorName>mrw_nvdimm_plug_rules</mssAccessorName> + </attribute> </attributes> diff --git a/src/import/chips/p9/procedures/xml/error_info/p9_memory_mss_plug_rules.xml b/src/import/chips/p9/procedures/xml/error_info/p9_memory_mss_plug_rules.xml index 9c8f265e2..ca7c2fa8d 100644 --- a/src/import/chips/p9/procedures/xml/error_info/p9_memory_mss_plug_rules.xml +++ b/src/import/chips/p9/procedures/xml/error_info/p9_memory_mss_plug_rules.xml @@ -5,7 +5,7 @@ <!-- --> <!-- OpenPOWER HostBoot Project --> <!-- --> -<!-- Contributors Listed Below - COPYRIGHT 2016,2017 --> +<!-- Contributors Listed Below - COPYRIGHT 2016,2018 --> <!-- [+] International Business Machines Corp. --> <!-- --> <!-- --> @@ -163,6 +163,32 @@ </hwpError> <hwpError> + <rc>RC_MSS_PLUG_RULES_NVDIMM_PLUG_ERROR</rc> + <description> + An NVDIMM was plugged in a slot where NVDIMM's are not supported + </description> + <ffdc>DIMM_TARGET</ffdc> + <ffdc>DIMM_POS</ffdc> + <callout> + <procedure>MEMORY_PLUGGING_ERROR</procedure> + <priority>HIGH</priority> + </callout> + <callout> + <childTargets> + <parent>MCA_TARGET</parent> + <childType>TARGET_TYPE_DIMM</childType> + </childTargets> + <priority>MEDIUM</priority> + </callout> + <deconfigure> + <childTargets> + <parent>MCA_TARGET</parent> + <childType>TARGET_TYPE_DIMM</childType> + </childTargets> + </deconfigure> + </hwpError> + + <hwpError> <rc>RC_MSS_PLUG_RULES_LRDIMM_UNSUPPORTED</rc> <description> The DIMM is an LRDIMM and that is currently not supported |