summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp/memory
diff options
context:
space:
mode:
authorAndre Marin <aamarin@us.ibm.com>2016-07-27 22:48:11 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-08-06 22:27:23 -0400
commit1ce7b0abf88a945385f498ee4d0b602290289497 (patch)
tree0aa48c7c7a9d10b2b6c89f6f22664830eaa0a528 /src/import/chips/p9/procedures/hwp/memory
parent99d93ab152b97b7e14045ccca5d7b4ccb7d1a175 (diff)
downloadtalos-hostboot-1ce7b0abf88a945385f498ee4d0b602290289497.tar.gz
talos-hostboot-1ce7b0abf88a945385f498ee4d0b602290289497.zip
Fix p9_freq_system bug for VBU
Change-Id: Id261bb82c94d64114b4040678c500598627f5893 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27854 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Louis Stermole <stermole@us.ibm.com> Reviewed-by: Brian R. Silver <bsilver@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27855 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/memory')
-rw-r--r--src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.C55
1 files changed, 43 insertions, 12 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.C b/src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.C
index 99f5917cc..4672cebf8 100644
--- a/src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.C
+++ b/src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.C
@@ -63,30 +63,61 @@ fapi2::ReturnCode dimm_speed_map(const std::vector< fapi2::Target<TARGET_TYPE_MC
if(i_targets.empty())
{
- FAPI_ERR("Empty target vector found when constructing dimm speed mapping!");
+ FAPI_ERR("Empty MCBIST target vector found when constructing dimm speed mapping!");
return fapi2::FAPI2_RC_INVALID_PARAMETER;
}
- // Getting a sample freq value from an arbitrary target (first one)
- // to compare against all other target freq values
+ // The find_if loop is meant to find the "first" good (non-zero) freq value
+ // so I can compare it against all other freq values from the MCBIST vector
+ // I am checking to make sure I don't get a value of 0
+ // Since Cronus can hand me back an MCBIST w/no DIMMs
+ // Which would give ATTR_MSS_FREQ value of 0 in p9_mss_freq
uint64_t l_comparator = 0;
- FAPI_TRY( mss::freq(i_targets[0], l_comparator), "Failed accessor to mss_freq" );
+ fapi2::ReturnCode l_rc(fapi2::FAPI2_RC_SUCCESS);
+ const auto l_found_comp = std::find_if(i_targets.begin(), i_targets.end(),
+ [&l_rc, &l_comparator] (const fapi2::Target<TARGET_TYPE_MCBIST>& i_target)->bool
+ {
+ l_rc = mss::freq(i_target, l_comparator);
+ return l_comparator != 0;
+ });
+
+ FAPI_TRY(l_rc, "Failed accessor mss::freq()");
+
+ // If all MCBISTs are 0 we go no further
+ if( l_found_comp == i_targets.end() )
+ {
+ FAPI_ERR( "All MCBIST have a 0 MSS_FREQ" );
+ return fapi2::FAPI2_RC_FALSE;
+ }
+ // DIMM speed is equal until we deduce otherwise
o_is_speed_equal = speed_equality::EQUAL_DIMM_SPEEDS;
// Loop through all MCSBISTs and store dimm speeds
- for (const auto& l_mcbist : i_targets)
+ // Starting from known 1st known good freq (non-zero) value
+ // I found above to avoid double looping target vector
+ for (auto l_iter = l_found_comp + 1; l_iter != i_targets.end(); ++l_iter)
{
uint64_t l_dimm_speed = 0;
- FAPI_TRY( mss::freq(l_mcbist, l_dimm_speed), "Failed accessor to mss_freq" );
-
- if(l_comparator != l_dimm_speed)
+ FAPI_TRY( mss::freq(*l_iter, l_dimm_speed), "Failed accessor to mss_freq" );
+
+ // In FW, parents are deconfigured if they have no children
+ // So there is no way to get an MCBIST w/no DIMMs.
+ // This isn't true for Cronus so I am skipping map
+ // insertion and check for dimm speed equality
+ // to avoid incorrect settings
+ if( l_dimm_speed != 0)
{
- o_is_speed_equal = speed_equality::NOT_EQUAL_DIMM_SPEEDS;
- }
+ // At least one mismatch freq value occurred
+ if(l_comparator != l_dimm_speed)
+ {
+ o_is_speed_equal = speed_equality::NOT_EQUAL_DIMM_SPEEDS;
+ }
- FAPI_INF("%s: Dimm speed %d MT/s", c_str(l_mcbist), l_dimm_speed);
- o_freq_map.emplace( std::make_pair(l_mcbist, l_dimm_speed) );
+ FAPI_INF("%s: Dimm speed %d MT/s", c_str(*l_iter), l_dimm_speed);
+
+ o_freq_map.emplace( std::make_pair(*l_iter, l_dimm_speed) );
+ }
}
fapi_try_exit:
OpenPOWER on IntegriCloud