diff options
author | Brian Silver <bsilver@us.ibm.com> | 2016-11-04 07:42:49 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-11-04 22:21:03 -0400 |
commit | 6dbf6c5df5736f4a606c21a7bbd8762f513aa1f5 (patch) | |
tree | 92bd3d8c2e15c05f0acfe4cfc5e52cd33a603e48 /src/import/chips/p9 | |
parent | c143edcc5c9fa945128d1cf556a7a2636bf436c3 (diff) | |
download | talos-hostboot-6dbf6c5df5736f4a606c21a7bbd8762f513aa1f5.tar.gz talos-hostboot-6dbf6c5df5736f4a606c21a7bbd8762f513aa1f5.zip |
Change lab memory init to poll, remove read phase
Change-Id: Ib4d57ee3b74d482da761f530d1983238dc3094cf
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/32239
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com>
Dev-Ready: Brian R. Silver <bsilver@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/32242
Reviewed-by: Hostboot Team <hostboot@us.ibm.com>
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')
3 files changed, 59 insertions, 6 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/shared/mss_const.H b/src/import/chips/p9/procedures/hwp/memory/lib/shared/mss_const.H index e8db285f3..db7881827 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/shared/mss_const.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/shared/mss_const.H @@ -63,7 +63,8 @@ enum sizes MAX_DQ_BITS = 72, /// TODO RTC:157753 This is Nimbus specific. Should be attribute/trait of processor. BYTES_PER_GB = 1000000000, ///< Multiplier to go from GB to B - T_PER_MT = 1000000, ///< Multiplier to go from MT/s to T/s + T_PER_MT = 1000000, ///< Multiplier to go from MT/s to T/s + CYCLES_PER_CMD = 4, ///< Best case cycles per MCBIST command // All need to be attributes? - BRS WR_LVL_BIG_STEP = 0b0111, diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H b/src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H index 897d90075..18a0cb429 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/utils/conversions.H @@ -362,6 +362,29 @@ inline uint64_t max_ck_ns(const fapi2::Target<T>& i_target, const uint64_t i_clo return std::max( i_clocks, ns_to_cycles(i_target, i_time) ); } +/// +/// @brief Return and estimated time an MCBIST subtest will take to complete +/// Useful for initial polling delays, probably isn't accurate for much else +/// as it doesn't take refresh in to account (which will necessarily slow down +/// the program.) +/// @param[in] i_target the target from which to gather memory frequency +/// @param[in] i_bytes number of *bytes* in the address range +/// @param[in] i_64B_per mss::YES if the command is 64B, mss::NO if it's 128B. Defaults to mss::YES +/// @return the initial polling delay for this program in ns +/// +template< fapi2::TargetType T > +inline uint64_t calculate_initial_delay(const fapi2::Target<T>& i_target, + const uint64_t i_bytes, + const bool i_64B_per = mss::YES) +{ + // TODO RTC: 164104 Update MCBIST delay calculator. As we learn more about what + // the lab really needs, we can probably make this function better. + const uint64_t l_bytes_per_cmd = (i_64B_per == mss::YES) ? 64 : 128; + + // Best case is a command takes 4 cycles. Given the number of commands and address space size + // we can get some idea of how long to wait before we start polling. + return cycles_to_ns(i_target, (i_bytes / l_bytes_per_cmd) * mss::CYCLES_PER_CMD); +} };// mss namespace diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_scrub.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_scrub.C index 194df8c5e..cb35d44e8 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_scrub.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_scrub.C @@ -58,9 +58,6 @@ fapi2::ReturnCode p9_mss_scrub( const fapi2::Target<TARGET_TYPE_MCBIST>& i_targe { FAPI_INF("Start mss scrub"); - // If we're running in the simulator, we want to only touch the addresses which training touched - uint8_t is_sim = 0; - // If there are no DIMM we don't need to bother. In fact, we can't as we didn't setup // attributes for the PHY, etc. if (mss::count_dimm(i_target) == 0) @@ -69,6 +66,24 @@ fapi2::ReturnCode p9_mss_scrub( const fapi2::Target<TARGET_TYPE_MCBIST>& i_targe return fapi2::FAPI2_RC_SUCCESS; } + // If we're running in the simulator, we want to only touch the addresses which training touched + uint8_t is_sim = 0; + bool l_poll_results = false; + fapi2::buffer<uint64_t> l_status; + + // A small vector of addresses to poll during the polling loop + static const std::vector<mss::poll_probe<fapi2::TARGET_TYPE_MCBIST>> l_probes = + { + {i_target, "mcbist current address", MCBIST_MCBMCATQ}, + }; + + // We'll fill in the initial delay below + mss::poll_parameters l_poll_parameters(0, 200, 10 * mss::DELAY_1MS, 200, 500); + uint64_t l_memory_size = 0; + + FAPI_TRY( mss::eff_memory_size(i_target, l_memory_size) ); + l_poll_parameters.iv_initial_delay = mss::calculate_initial_delay(i_target, (l_memory_size * mss::BYTES_PER_GB)); + FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_IS_SIMULATION, fapi2::Target<TARGET_TYPE_SYSTEM>(), is_sim) ); if (is_sim) @@ -81,11 +96,25 @@ fapi2::ReturnCode p9_mss_scrub( const fapi2::Target<TARGET_TYPE_MCBIST>& i_targe } // In Cronus on hardware (which is how we got here - f/w doesn't call this) we want - // to call sf_init (0's) and then a sf_read. + // to call sf_init (0's) // TK we need to check FIR given the way this is right now, we should adjust with better stop // conditions when we learn more about what we want to find in the lab FAPI_TRY( memdiags::sf_init(i_target, mss::mcbist::PATTERN_0) ); - return memdiags::sf_read(i_target, mss::mcbist::stop_conditions(), mss::mcbist::end_boundary::STOP_AFTER_ADDRESS); + + // Poll for completion. + l_poll_results = mss::poll(i_target, MCBIST_MCBISTFIRQ, l_poll_parameters, + [&l_status](const size_t poll_remaining, + const fapi2::buffer<uint64_t>& stat_reg) -> bool + { + FAPI_DBG("mcbist firq 0x%llx, remaining: %d", stat_reg, poll_remaining); + l_status = stat_reg; + return l_status.getBit<MCBIST_MCBISTFIRQ_MCBIST_PROGRAM_COMPLETE>() == true; + }, + l_probes); + + FAPI_ASSERT( l_poll_results == true, + fapi2::MSS_MEMDIAGS_SUPERFAST_INIT_FAILED_TO_INIT().set_TARGET(i_target), + "p9_mss_scrub (init) timedout %s", mss::c_str(i_target) ); fapi_try_exit: return fapi2::current_err; |