diff options
author | Alvin Wang <wangat@tw.ibm.com> | 2019-03-14 22:36:56 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-05-07 15:47:58 -0500 |
commit | 081679022f978b41f7764b50fe5b9e741b0d2ce3 (patch) | |
tree | ec27993c7b95d0f49745579f2badfac43b61f73a /src/import/generic | |
parent | e28412847eab880521683afc182e3eaceb18a723 (diff) | |
download | talos-hostboot-081679022f978b41f7764b50fe5b9e741b0d2ce3.tar.gz talos-hostboot-081679022f978b41f7764b50fe5b9e741b0d2ce3.zip |
Add exp_scrub
Change-Id: Ibf52a563c7d8ce3e1cc97d07f3801b3bca58eddd
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70247
Dev-Ready: Alvin Wang <wangat@tw.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/75146
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/generic')
3 files changed, 177 insertions, 9 deletions
diff --git a/src/import/generic/memory/lib/utils/fir/gen_mss_unmask.H b/src/import/generic/memory/lib/utils/fir/gen_mss_unmask.H index fa14534e5..a45b48202 100644 --- a/src/import/generic/memory/lib/utils/fir/gen_mss_unmask.H +++ b/src/import/generic/memory/lib/utils/fir/gen_mss_unmask.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -38,6 +38,8 @@ #include <fapi2.H> +#include <generic/memory/lib/utils/shared/mss_generic_consts.H> + namespace mss { @@ -46,40 +48,63 @@ namespace unmask /// /// @brief Unmask and setup actions performed after draminit_mc +/// @tparam MC the memory controller type /// @tparam T the fapi2::TargetType which hold the FIR bits /// @param[in] i_target the fapi2::Target /// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok /// -template< mss::mc_type MC, fapi2::TargetType T > +template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T > fapi2::ReturnCode after_draminit_mc( const fapi2::Target<T>& i_target ); /// /// @brief Unmask and setup actions performed after draminit_training +/// @tparam MC the memory controller type /// @tparam T the fapi2::TargetType which hold the FIR bits /// @param[in] i_target the fapi2::Target /// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok /// -template< mss::mc_type MC, fapi2::TargetType T > +template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T > fapi2::ReturnCode after_draminit_training( const fapi2::Target<T>& i_target ); /// /// @brief Unmask and setup actions performed after mss_scominit +/// @tparam MC the memory controller type /// @tparam T the fapi2::TargetType which hold the FIR bits -/// @param[in] i_target the fapi2::Target of the MCBIST +/// @param[in] i_target the fapi2::Target /// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok /// -template< mss::mc_type MC, fapi2::TargetType T > +template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T > fapi2::ReturnCode after_scominit( const fapi2::Target<T>& i_target ); /// /// @brief Unmask and setup actions performed after mss_ddr_phy_reset +/// @tparam MC the memory controller type /// @tparam T the fapi2::TargetType which hold the FIR bits -/// @param[in] i_target the fapi2::Target of the MCBIST +/// @param[in] i_target the fapi2::Target /// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok /// -template< mss::mc_type MC, fapi2::TargetType T > +template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T > fapi2::ReturnCode after_phy_reset( const fapi2::Target<T>& i_target ); +/// +/// @brief Unmask and setup actions for memdiags related FIR +/// @tparam MC the memory controller type +/// @tparam T the fapi2::TargetType which hold the FIR bits +/// @param[in] i_target the fapi2::Target +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T > +fapi2::ReturnCode after_memdiags( const fapi2::Target<T>& i_target ); + +/// +/// @brief Unmask and setup actions for scrub related FIR +/// @tparam MC the memory controller type +/// @tparam T the fapi2::TargetType which hold the FIR bits +/// @param[in] i_target the fapi2::Target +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T > +fapi2::ReturnCode after_background_scrub( const fapi2::Target<T>& i_target ); } } diff --git a/src/import/generic/memory/lib/utils/mc/gen_mss_port.H b/src/import/generic/memory/lib/utils/mc/gen_mss_port.H index f5e822f8f..94e3fa6bf 100644 --- a/src/import/generic/memory/lib/utils/mc/gen_mss_port.H +++ b/src/import/generic/memory/lib/utils/mc/gen_mss_port.H @@ -38,6 +38,7 @@ #define _GEN_MSS_PORT_H_ #include <fapi2.H> +#include <generic/memory/lib/mss_generic_attribute_getters.H> #include <generic/memory/lib/utils/shared/mss_generic_consts.H> #include <generic/memory/lib/utils/mc/gen_mss_port_traits.H> #include <generic/memory/lib/utils/scom.H> diff --git a/src/import/generic/memory/lib/utils/mcbist/gen_mss_memdiags.H b/src/import/generic/memory/lib/utils/mcbist/gen_mss_memdiags.H index 294756dfa..6e3ceb03f 100644 --- a/src/import/generic/memory/lib/utils/mcbist/gen_mss_memdiags.H +++ b/src/import/generic/memory/lib/utils/mcbist/gen_mss_memdiags.H @@ -44,10 +44,14 @@ #include <generic/memory/lib/utils/mcbist/gen_address.H> #include <generic/memory/lib/utils/mcbist/gen_patterns.H> #include <generic/memory/lib/utils/mcbist/gen_settings.H> +#include <generic/memory/lib/utils/fir/gen_mss_unmask.H> #include <generic/memory/lib/utils/count_dimm.H> #include <generic/memory/lib/utils/conversions.H> #include <generic/memory/lib/utils/pos.H> #include <generic/memory/lib/utils/find_magic.H> +#include <generic/memory/lib/utils/count_dimm.H> +#include <generic/memory/lib/utils/poll.H> + namespace mss { @@ -1103,7 +1107,145 @@ fapi_try_exit: return fapi2::current_err; } -} // namespace +/// +/// @brief Begin scrub helper +/// @tparam MC the mc type of the T +/// @tparam T fapi2::TargetType of the MCBIST engine +/// @tparam TT the mcbistTraits associated with T +/// @param[in] i_target MCBIST +/// @return FAPI2_RC_SUCCESS iff ok +/// +template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T, typename TT = mcbistTraits<MC, T> > +fapi2::ReturnCode mss_scrub_helper(const fapi2::Target<T>& i_target ) +{ + FAPI_INF("Start mss_scrub_helper for %s", mss::c_str(i_target)); + + // 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) + { + FAPI_INF("... skipping scrub for %s - no DIMM ...", mss::c_str(i_target)); + return fapi2::FAPI2_RC_SUCCESS; + } + + // If we're running in the simulator, we want to only touch the addresses which training touched + uint8_t l_sim = 0; + bool l_poll_results = false; + fapi2::buffer<uint64_t> l_status; + + // A small vector of addresses to poll during the polling loop + const std::vector<mss::poll_probe<T>> l_probes = + { + {i_target, "mcbist current address", TT::LAST_ADDR_REG}, + }; + + // We'll fill in the initial delay below + mss::poll_parameters l_poll_parameters(0, 200, 100 * mss::DELAY_1MS, 200, 10000); + uint64_t l_memory_size = 0; + + FAPI_TRY( mss::eff_memory_size<MC>(i_target, l_memory_size) ); + l_poll_parameters.iv_initial_delay = mss::calculate_initial_delay<MC>(i_target, (l_memory_size * mss::BYTES_PER_GB)); + + FAPI_TRY( mss::attr::get_is_simulation( l_sim) ); + + if (l_sim) + { + FAPI_INF("running mss sim init in place of scrub for %s", mss::c_str(i_target)); + + // Use some sort of pattern in sim in case the verification folks need to look for something + // TK. Need a verification pattern. This is a not-good pattern for verification ... We don't really + // have a good pattern for verification defined. + auto l_rc = mss::mcbist::sim::sf_init<MC>(i_target, mss::mcbist::PATTERN_0); + + // Unmask firs and turn off FIFO mode before returning + FAPI_TRY ( mss::unmask::after_memdiags<MC>( i_target ) ); + FAPI_TRY ( mss::unmask::after_background_scrub<MC>( i_target ) ); + FAPI_TRY ( mss::reset_reorder_queue_settings<MC>(i_target) ); + + return l_rc; + } + + // In Cronus on hardware (which is how we got here - f/w doesn't call this) we want + // 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( mss::memdiags::sf_init<MC>(i_target, mss::mcbist::PATTERN_0) ); + + // Poll for completion. + l_poll_results = mss::poll(i_target, TT::FIRQ_REG, 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<TT::MCB_PROGRAM_COMPLETE>() == true; + }, + l_probes); + + FAPI_ASSERT( l_poll_results == true, + fapi2::MSS_MEMDIAGS_SUPERFAST_INIT_FAILED_TO_INIT().set_MCBIST_TARGET(i_target), + "p9_mss_scrub (init) timedout %s", mss::c_str(i_target) ); + + // Unmask firs after memdiags and turn off FIFO mode + FAPI_TRY ( mss::unmask::after_memdiags<MC>( i_target ) ); + FAPI_TRY ( mss::reset_reorder_queue_settings<MC>(i_target) ); + + // Start background scrub + FAPI_TRY ( mss::memdiags::background_scrub<MC>( i_target, + mss::mcbist::stop_conditions<MC>(), + mss::mcbist::speed::BG_SCRUB, + mss::mcbist::address() ) ); + + // Unmask firs after background scrub is started + FAPI_TRY ( mss::unmask::after_background_scrub<MC>( i_target ) ); + +fapi_try_exit: + return fapi2::current_err; +} + +/// +/// @brief Begin background scrub helper +/// @tparam MC the mc type of the T +/// @tparam T fapi2::TargetType of the MCBIST engine +/// @tparam TT the mcbistTraits associated with T +/// @param[in] i_target MCBIST +/// @return FAPI2_RC_SUCCESS iff ok +/// +template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T, typename TT = mcbistTraits<MC, T> > +fapi2::ReturnCode mss_background_scrub_helper( const fapi2::Target<T>& i_target ) +{ + FAPI_INF("Start mss_background_scrub_helper b on: %s", mss::c_str( i_target )); + + // 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) + { + FAPI_INF("... skipping background scrub for %s - no DIMM ...", mss::c_str(i_target)); + return fapi2::FAPI2_RC_SUCCESS; + } + + // If we're running in the simulator, we want to only touch the addresses which training touched + uint8_t l_sim = 0; + FAPI_TRY( mss::attr::get_is_simulation(l_sim) ); + + // Kick off background scrub if we are not running in sim + if (!(l_sim)) + { + // Start background scrub + FAPI_TRY ( mss::memdiags::background_scrub<MC>( i_target, + mss::mcbist::stop_conditions<MC>(), + mss::mcbist::speed::BG_SCRUB, + mss::mcbist::address() ) ); + } + + // Unmask firs after background scrub is started + FAPI_TRY ( mss::unmask::after_background_scrub<MC>( i_target ) ); + +fapi_try_exit: + return fapi2::current_err; +} + +} // namespace memdiags -} // namespace +} // namespace mss #endif |