diff options
6 files changed, 207 insertions, 14 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/dimm/rank.C b/src/import/chips/p9/procedures/hwp/memory/lib/dimm/rank.C index c7300bc71..1512f4c0c 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/dimm/rank.C +++ b/src/import/chips/p9/procedures/hwp/memory/lib/dimm/rank.C @@ -246,7 +246,7 @@ fapi2::ReturnCode primary_ranks( const fapi2::Target<TARGET_TYPE_MCA>& i_target, // Get the count of rank pairs for both DIMM on the port std::vector<uint8_t> l_rank_count(MAX_DIMM_PER_PORT, 0); - for (const auto d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target)) + for (const auto& d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target)) { FAPI_TRY( mss::eff_num_master_ranks_per_dimm(d, l_rank_count[mss::index(d)]) ); } @@ -328,7 +328,7 @@ fapi2::ReturnCode ranks( const fapi2::Target<TARGET_TYPE_MCA>& i_target, std::ve std::vector< uint64_t > l_ranks; o_ranks.clear(); - for (const auto d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target)) + for (const auto& d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target)) { FAPI_TRY( ranks(d, l_ranks) ); o_ranks.insert(o_ranks.end(), l_ranks.begin(), l_ranks.end()); @@ -353,15 +353,25 @@ template<> fapi2::ReturnCode get_rank_pair_assignments(const fapi2::Target<TARGET_TYPE_MCA>& i_target, std::pair<uint64_t, uint64_t>& o_registers) { - // Get the count of rank pairs for all DIMM on the port + // TODO RTC:160869 add enum for rank pair 0 when it gets created + typedef rankPairTraits<fapi2::TARGET_TYPE_MCA, 0> RPT; + std::vector<uint8_t> l_rank_count(MAX_DIMM_PER_PORT, 0); + uint16_t l_regs[RPT::NUM_RANK_PAIR_REGS] = {0}; - for (const auto d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target)) + for (const auto& d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target)) { FAPI_TRY( mss::eff_num_master_ranks_per_dimm(d, l_rank_count[mss::index(d)]) ); } - o_registers = rank_pair_assignments[l_rank_count[1]][l_rank_count[0]]; + // Get the override attribute setting + FAPI_TRY( mss::eff_rank_group_override(i_target, l_regs) ); + + // If the override attribute is zero, use the default assignments that correspond to the rank count. + // Need only to check the first array entry since we need a valid primary rank in RP0 due to plug rules. + o_registers = (l_regs[0] == 0) ? + rank_pair_assignments[l_rank_count[1]][l_rank_count[0]] : + std::make_pair(static_cast<uint64_t>(l_regs[0]), static_cast<uint64_t>(l_regs[1])); FAPI_DBG("rank pair assignments for %s. [%d,%d] (0x%08llx, 0x%08llx)", mss::c_str(i_target), l_rank_count[1], l_rank_count[0], o_registers.first, o_registers.second); @@ -479,30 +489,69 @@ fapi_try_exit: template<> fapi2::ReturnCode get_rank_pairs(const fapi2::Target<TARGET_TYPE_MCA>& i_target, std::vector<uint64_t>& o_pairs) { + // TODO RTC:160869 add enum for rank pair 0 when it gets created + typedef rankPairTraits<fapi2::TARGET_TYPE_MCA, 0> RPT; + uint64_t l_index = 0; std::vector<uint64_t> l_prs; + uint16_t l_regs[RPT::NUM_RANK_PAIR_REGS] = {0}; + + o_pairs.clear(); // Get the count of rank pairs for both DIMM on the port std::vector<uint8_t> l_rank_count(MAX_DIMM_PER_PORT, 0); - for (const auto d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target)) + for (const auto& d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target)) { FAPI_TRY( mss::eff_num_master_ranks_per_dimm(d, l_rank_count[mss::index(d)]) ); } - // Walk through rank pair table and skip empty pairs - o_pairs.clear(); - l_prs = primary_rank_pairs[l_rank_count[1]][l_rank_count[0]]; + // Get the override attribute setting + FAPI_TRY( mss::eff_rank_group_override(i_target, l_regs) ); + + // If the override attribute is zero, use the default assignments that correspond to the rank count + if (l_regs[0] == 0) + { + l_prs = primary_rank_pairs[l_rank_count[1]][l_rank_count[0]]; + + // Walk through rank pair table and skip empty pairs + // Can't use for (auto rp : l_prs) as rp is unused. BRS + for (auto rp_iter = l_prs.begin(); rp_iter != l_prs.end(); ++rp_iter) + { + if (*rp_iter != NO_RANK) + { + o_pairs.push_back(l_index); + } - // Can't use for (auto rp : l_prs) as rp is unused. BRS - for (auto rp_iter = l_prs.begin(); rp_iter != l_prs.end(); ++rp_iter) + l_index += 1; + } + } + // Else we have to derive the assignments from the override + else { - if (*rp_iter != NO_RANK) + // Check RP0 + if (fapi2::buffer<uint64_t>(l_regs[0]).getBit<EVEN_PRIMARY_VALID>()) + { + o_pairs.push_back(0); + } + + // Check RP1 + if (fapi2::buffer<uint64_t>(l_regs[0]).getBit<ODD_PRIMARY_VALID>()) { - o_pairs.push_back(l_index); + o_pairs.push_back(1); } - l_index += 1; + // Check RP2 + if (fapi2::buffer<uint64_t>(l_regs[1]).getBit<EVEN_PRIMARY_VALID>()) + { + o_pairs.push_back(2); + } + + // Check RP3 + if (fapi2::buffer<uint64_t>(l_regs[1]).getBit<ODD_PRIMARY_VALID>()) + { + o_pairs.push_back(3); + } } fapi_try_exit: 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 029085d20..bedf809fb 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 @@ -16893,6 +16893,102 @@ fapi_try_exit: return fapi2::current_err; } +/// +/// @brief ATTR_EFF_RANK_GROUP_OVERRIDE getter +/// @param[in] const ref to the fapi2::Target<fapi2::TARGET_TYPE_DIMM> +/// @param[out] ref to the value uint16_t +/// @note Generated by gen_accessors.pl generateParameters (F) +/// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff get is OK +/// @note Override PHY RANK_PAIR settings. First uint16 value is for RANK_PAIR0 register +/// value, and second is for RANK_PAIR1. Note that DIMM1 ranks in a dual-drop config +/// will be converted from Centaur canonical number (4,5) to correct PHY settings +/// (2,3). Set this attribute to zero to use default +/// settings. +/// +inline fapi2::ReturnCode eff_rank_group_override(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, + uint16_t& o_value) +{ + uint16_t l_value[2][2]; + auto l_mca = i_target.getParent<fapi2::TARGET_TYPE_MCA>(); + auto l_mcs = l_mca.getParent<fapi2::TARGET_TYPE_MCS>(); + + FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_EFF_RANK_GROUP_OVERRIDE, l_mcs, l_value) ); + o_value = l_value[mss::index(l_mca)][mss::index(i_target)]; + return fapi2::current_err; + +fapi_try_exit: + FAPI_ERR("failed accessing ATTR_EFF_RANK_GROUP_OVERRIDE: 0x%lx (target: %s)", + uint64_t(fapi2::current_err), mss::c_str(i_target)); + return fapi2::current_err; +} + +/// +/// @brief ATTR_EFF_RANK_GROUP_OVERRIDE getter +/// @param[in] const ref to the fapi2::Target<fapi2::TARGET_TYPE_MCA> +/// @param[out] uint16_t* memory to store the value +/// @note Generated by gen_accessors.pl generateParameters (G) +/// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff get is OK +/// @note Override PHY RANK_PAIR settings. First uint16 value is for RANK_PAIR0 register +/// value, and second is for RANK_PAIR1. Note that DIMM1 ranks in a dual-drop config +/// will be converted from Centaur canonical number (4,5) to correct PHY settings +/// (2,3). Set this attribute to zero to use default +/// settings. +/// +inline fapi2::ReturnCode eff_rank_group_override(const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target, + uint16_t* o_array) +{ + if (o_array == nullptr) + { + FAPI_ERR("nullptr passed to attribute accessor %s", __func__); + return fapi2::FAPI2_RC_INVALID_PARAMETER; + } + + uint16_t l_value[2][2]; + auto l_mcs = i_target.getParent<fapi2::TARGET_TYPE_MCS>(); + + FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_EFF_RANK_GROUP_OVERRIDE, l_mcs, l_value) ); + memcpy(o_array, &(l_value[mss::index(i_target)][0]), 4); + return fapi2::current_err; + +fapi_try_exit: + FAPI_ERR("failed accessing ATTR_EFF_RANK_GROUP_OVERRIDE: 0x%lx (target: %s)", + uint64_t(fapi2::current_err), mss::c_str(i_target)); + return fapi2::current_err; +} + +/// +/// @brief ATTR_EFF_RANK_GROUP_OVERRIDE getter +/// @param[in] const ref to the fapi2::Target<fapi2::TARGET_TYPE_MCS> +/// @param[out] uint16_t* memory to store the value +/// @note Generated by gen_accessors.pl generateParameters (H) +/// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff get is OK +/// @note Override PHY RANK_PAIR settings. First uint16 value is for RANK_PAIR0 register +/// value, and second is for RANK_PAIR1. Note that DIMM1 ranks in a dual-drop config +/// will be converted from Centaur canonical number (4,5) to correct PHY settings +/// (2,3). Set this attribute to zero to use default +/// settings. +/// +inline fapi2::ReturnCode eff_rank_group_override(const fapi2::Target<fapi2::TARGET_TYPE_MCS>& i_target, + uint16_t* o_array) +{ + if (o_array == nullptr) + { + FAPI_ERR("nullptr passed to attribute accessor %s", __func__); + return fapi2::FAPI2_RC_INVALID_PARAMETER; + } + + uint16_t l_value[2][2]; + + FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_EFF_RANK_GROUP_OVERRIDE, i_target, l_value) ); + memcpy(o_array, &l_value, 8); + return fapi2::current_err; + +fapi_try_exit: + FAPI_ERR("failed accessing ATTR_EFF_RANK_GROUP_OVERRIDE: 0x%lx (target: %s)", + uint64_t(fapi2::current_err), mss::c_str(i_target)); + return fapi2::current_err; +} + /// /// @brief ATTR_EFF_DRAM_GEN getter diff --git a/src/import/chips/p9/procedures/xml/attribute_info/memory_mcs_attributes.xml b/src/import/chips/p9/procedures/xml/attribute_info/memory_mcs_attributes.xml index 16e112f72..a05cf332a 100644 --- a/src/import/chips/p9/procedures/xml/attribute_info/memory_mcs_attributes.xml +++ b/src/import/chips/p9/procedures/xml/attribute_info/memory_mcs_attributes.xml @@ -3127,4 +3127,21 @@ <mssAccessorName>reorder_queue_setting</mssAccessorName> </attribute> + <attribute> + <id>ATTR_EFF_RANK_GROUP_OVERRIDE</id> + <targetType>TARGET_TYPE_MCS</targetType> + <description> + Override PHY RANK_PAIR settings. First uint16 value is for RANK_PAIR0 + register value, and second is for RANK_PAIR1. Note that DIMM1 ranks in + a dual-drop config will be converted from Centaur canonical number + (4,5) to correct PHY settings (2,3). Set this attribute to zero + to use default settings. + </description> + <initToZero></initToZero> + <valueType>uint16</valueType> + <writeable/> + <array> 2 2 </array> + <mssAccessorName>eff_rank_group_override</mssAccessorName> + </attribute> + </attributes> diff --git a/src/import/hwpf/fapi2/xml/attribute_info/hb_temp_defaults.xml b/src/import/hwpf/fapi2/xml/attribute_info/hb_temp_defaults.xml index 127f8ccbc..ec1230f3a 100644 --- a/src/import/hwpf/fapi2/xml/attribute_info/hb_temp_defaults.xml +++ b/src/import/hwpf/fapi2/xml/attribute_info/hb_temp_defaults.xml @@ -112,6 +112,10 @@ <id>ATTR_IO_OBUS_TX_FFE_POSTCURSOR</id> <default>0x0</default> </attribute> + <attribute> + <id>ATTR_EFF_RANK_GROUP_OVERRIDE</id> + <default>0x0</default> + </attribute> <!-- ===================================================================== End of temporary definitions ================================================================= --> diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index a708890d9..feeb16384 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -32924,6 +32924,32 @@ Measured in GB</description> </attribute> <attribute> + <id>EFF_RANK_GROUP_OVERRIDE</id> + <description> + + Override PHY RANK_PAIR settings. First uint16 value is for RANK_PAIR0 + register value, and second is for RANK_PAIR1. Note that DIMM1 ranks in + a dual-drop config will be converted from Centaur canonical number + (4,5) to correct PHY settings (2,3). Set this attribute to zero + to use default settings. + + </description> + <simpleType> + <uint16_t> + <default>0x0</default> + </uint16_t> + <array>2,2</array> + </simpleType> + <persistency>volatile-zeroed</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_EFF_RANK_GROUP_OVERRIDE</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> +</attribute> + +<attribute> <id>DISABLE_I2C_ENGINE2_PORT0_DIAG_MODE</id> <description> Used to tell I2C code whether to run diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml index dd3951097..a696e5672 100755 --- a/src/usr/targeting/common/xmltohb/target_types.xml +++ b/src/usr/targeting/common/xmltohb/target_types.xml @@ -1847,6 +1847,7 @@ <attribute><id>EFF_DRAM_RTT_NOM</id></attribute> <attribute><id>EFF_DRAM_RTT_WR</id></attribute> <attribute><id>EFF_DRAM_RTT_PARK</id></attribute> + <attribute><id>EFF_RANK_GROUP_OVERRIDE</id></attribute> <attribute><id>MSS_VREF_DAC_NIBBLE</id></attribute> <attribute><id>MSS_MVPD_FWMS</id></attribute> </targetType> |