From 081679022f978b41f7764b50fe5b9e741b0d2ce3 Mon Sep 17 00:00:00 2001 From: Alvin Wang Date: Thu, 14 Mar 2019 22:36:56 -0500 Subject: Add exp_scrub Change-Id: Ibf52a563c7d8ce3e1cc97d07f3801b3bca58eddd Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70247 Dev-Ready: Alvin Wang Tested-by: Jenkins Server Tested-by: Hostboot CI Tested-by: FSP CI Jenkins Reviewed-by: Louis Stermole Reviewed-by: STEPHEN GLANCY Reviewed-by: Jennifer A. Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/75146 Reviewed-by: Daniel M. Crowell Tested-by: Daniel M. Crowell --- .../procedures/hwp/memory/lib/fir/memdiags_fir.C | 175 --------------------- .../procedures/hwp/memory/lib/fir/memdiags_fir.H | 68 -------- .../p9/procedures/hwp/memory/lib/fir/unmask.C | 122 ++++++++++++++ .../p9/procedures/hwp/memory/lib/fir/unmask.H | 52 +++++- .../chips/p9/procedures/hwp/memory/lib/mss.mk | 3 +- .../hwp/memory/p9_mss_background_scrub.C | 45 ++---- .../procedures/hwp/memory/p9_mss_ddr_phy_reset.C | 5 +- .../p9/procedures/hwp/memory/p9_mss_draminit_mc.C | 3 +- .../hwp/memory/p9_mss_draminit_training.C | 3 +- .../p9/procedures/hwp/memory/p9_mss_memdiag.C | 2 +- .../p9/procedures/hwp/memory/p9_mss_scominit.C | 2 +- .../chips/p9/procedures/hwp/memory/p9_mss_scrub.C | 98 ++---------- 12 files changed, 209 insertions(+), 369 deletions(-) delete mode 100644 src/import/chips/p9/procedures/hwp/memory/lib/fir/memdiags_fir.C delete mode 100644 src/import/chips/p9/procedures/hwp/memory/lib/fir/memdiags_fir.H (limited to 'src/import/chips/p9') diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/fir/memdiags_fir.C b/src/import/chips/p9/procedures/hwp/memory/lib/fir/memdiags_fir.C deleted file mode 100644 index f4ab6727c..000000000 --- a/src/import/chips/p9/procedures/hwp/memory/lib/fir/memdiags_fir.C +++ /dev/null @@ -1,175 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/fir/memdiags_fir.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016,2019 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/// -/// @file memdiags_fir.C -/// @brief Subroutines for memdiags/prd FIR -/// -// *HWP HWP Owner: Stephen Glancy -// *HWP HWP Backup: Marc Gollub -// *HWP Team: Memory -// *HWP Level: 3 -// *HWP Consumed by: FSP:HB - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -using fapi2::TARGET_TYPE_MCBIST; -using fapi2::TARGET_TYPE_MCA; - -namespace mss -{ - -namespace unmask -{ - -/// -/// @brief Unmask and setup actions for memdiags related FIR -/// @param[in] i_target the fapi2::Target MCBIST -/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok -/// -template<> -fapi2::ReturnCode after_memdiags( const fapi2::Target& i_target ) -{ - fapi2::ReturnCode l_rc; - fapi2::buffer dsm0_buffer; - fapi2::buffer l_mnfg_buffer; - uint64_t rd_tag_delay = 0; - uint64_t wr_done_delay = 0; - fapi2::buffer l_aue_buffer; - fapi2::ATTR_CHIP_EC_FEATURE_HW414700_Type l_checkstop_flag; - constexpr uint64_t MNFG_THRESHOLDS_ATTR = 63; - - // Broadcast mode workaround for UEs causing out of sync - FAPI_TRY(mss::workarounds::mcbist::broadcast_out_of_sync(i_target, mss::ON)); - - for (const auto& p : mss::find_targets(i_target)) - { - fir::reg l_ecc64_fir_reg(p, l_rc); - FAPI_TRY(l_rc, "unable to create fir::reg for %d", MCA_FIR); - - fir::reg l_cal_fir_reg(p, l_rc); - FAPI_TRY(l_rc, "unable to create fir::reg for %d", MCA_MBACALFIRQ); - - // Read out the wr_done and rd_tag delays and find min - // and set the RCD Protect Time to this value - FAPI_TRY (mss::read_dsm0q_register(p, dsm0_buffer) ); - mss::get_wrdone_delay(dsm0_buffer, wr_done_delay); - mss::get_rdtag_delay(dsm0_buffer, rd_tag_delay); - const auto rcd_protect_time = std::min(wr_done_delay, rd_tag_delay); - FAPI_TRY (mss::change_rcd_protect_time(p, rcd_protect_time) ); - - l_ecc64_fir_reg.checkstop() - .recoverable_error() - .checkstop() - .recoverable_error(); - - l_cal_fir_reg.recoverable_error(); - - // If ATTR_CHIP_EC_FEATURE_HW414700 is enabled set checkstops - auto l_chip_target = mss::find_target(i_target); - FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_CHIP_EC_FEATURE_HW414700, l_chip_target, l_checkstop_flag) ); - - // If the system is running DD2 chips override some recoverable firs with checkstop - // Due to a known hardware defect with DD2 certain errors are not handled properly - // As a result, these firs are marked as checkstop for DD2 to avoid any mishandling - if (l_checkstop_flag) - { - l_ecc64_fir_reg.checkstop() - .checkstop(); - l_cal_fir_reg.checkstop(); - } - - // If MNFG FLAG Threshhold is enabled skip IUE unflagging - FAPI_TRY ( mss::mnfg_flags(l_mnfg_buffer) ); - - if ( !(l_mnfg_buffer.getBit()) ) - { - l_ecc64_fir_reg.recoverable_error(); - } - - FAPI_TRY(l_ecc64_fir_reg.write(), "unable to write fir::reg %d", MCA_FIR); - FAPI_TRY(l_cal_fir_reg.write(), "unable to write fir::reg %d", MCA_MBACALFIRQ); - - // Change Maint AUE and IAUE to checkstop without unmasking - // Normal setup modifies masked bits in addition to setting checkstop - // This causes issues if error has occured, manually scoming to avoid this - FAPI_TRY( mss::getScom(p, MCA_ACTION1, l_aue_buffer) ); - l_aue_buffer.clearBit(); - l_aue_buffer.clearBit(); - FAPI_TRY( mss::putScom(p, MCA_ACTION1, l_aue_buffer) ); - - // Note: We also want to include the following setup RCD recovery and port fail - FAPI_TRY( mss::change_port_fail_disable(p, mss::LOW) ); - FAPI_TRY( mss::change_rcd_recovery_disable(p, mss::LOW) ); - } - - return fapi2::FAPI2_RC_SUCCESS; - -fapi_try_exit: - return fapi2::current_err; -} - -/// -/// @brief Unmask and setup actions for scrub related FIR -/// @param[in] i_target the fapi2::Target MCBIST -/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok -/// -template<> -fapi2::ReturnCode after_background_scrub( const fapi2::Target& i_target ) -{ - for (const auto& p : mss::find_targets(i_target)) - { - fapi2::ReturnCode l_rc; - fir::reg l_ecc64_fir_reg(p, l_rc); - FAPI_TRY(l_rc, "unable to create fir::reg for %d", MCA_FIR); - - l_ecc64_fir_reg.recoverable_error() - .recoverable_error() - .recoverable_error() - .recoverable_error() - .recoverable_error(); - - FAPI_TRY(l_ecc64_fir_reg.write(), "unable to write fir::reg %d", MCA_FIR); - } - - return fapi2::FAPI2_RC_SUCCESS; - -fapi_try_exit: - return fapi2::current_err; -} - -} -} diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/fir/memdiags_fir.H b/src/import/chips/p9/procedures/hwp/memory/lib/fir/memdiags_fir.H deleted file mode 100644 index c3a8e6c8c..000000000 --- a/src/import/chips/p9/procedures/hwp/memory/lib/fir/memdiags_fir.H +++ /dev/null @@ -1,68 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/fir/memdiags_fir.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/// -/// @file memdiags_fir.H -/// @brief Subroutines for memdiags/prd FIR -/// -// *HWP HWP Owner: Stephen Glancy -// *HWP HWP Backup: Marc Gollub -// *HWP Team: Memory -// *HWP Level: 3 -// *HWP Consumed by: FSP:HB - -#ifndef _MSS_MEMDIAGS_FIR_H_ -#define _MSS_MEMDIAGS_FIR_H_ - -#include -#include - -namespace mss -{ - -namespace unmask -{ - -/// -/// @brief Unmask and setup actions for memdiags related FIR -/// @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< fapi2::TargetType T > -fapi2::ReturnCode after_memdiags( const fapi2::Target& i_target ); - -/// -/// @brief Unmask and setup actions for scrub related FIR -/// @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< fapi2::TargetType T > -fapi2::ReturnCode after_background_scrub( const fapi2::Target& i_target ); - -} -} -#endif diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/fir/unmask.C b/src/import/chips/p9/procedures/hwp/memory/lib/fir/unmask.C index 3d28935f8..800291aea 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/fir/unmask.C +++ b/src/import/chips/p9/procedures/hwp/memory/lib/fir/unmask.C @@ -39,7 +39,9 @@ #include #include #include +#include #include +#include #include #include @@ -252,5 +254,125 @@ fapi_try_exit: } + +/// +/// @brief Unmask and setup actions for memdiags related FIR +/// @param[in] i_target the fapi2::Target MCBIST +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template<> +fapi2::ReturnCode after_memdiags( const fapi2::Target& i_target ) +{ + fapi2::ReturnCode l_rc1, l_rc2; + fapi2::buffer dsm0_buffer; + fapi2::buffer l_mnfg_buffer; + uint64_t rd_tag_delay = 0; + uint64_t wr_done_delay = 0; + fapi2::buffer l_aue_buffer; + fapi2::ATTR_CHIP_EC_FEATURE_HW414700_Type l_checkstop_flag; + constexpr uint64_t MNFG_THRESHOLDS_ATTR = 63; + + // Broadcast mode workaround for UEs causing out of sync + FAPI_TRY(mss::workarounds::mcbist::broadcast_out_of_sync(i_target, mss::ON)); + + for (const auto& p : mss::find_targets(i_target)) + { + fir::reg l_ecc64_fir_reg(p, l_rc1); + fir::reg l_cal_fir_reg(p, l_rc2); + uint64_t rcd_protect_time = 0; + const auto l_chip_target = mss::find_target(i_target); + + FAPI_TRY(l_rc1, "unable to create fir::reg for %d", MCA_FIR); + FAPI_TRY(l_rc2, "unable to create fir::reg for %d", MCA_MBACALFIRQ); + + // Read out the wr_done and rd_tag delays and find min + // and set the RCD Protect Time to this value + FAPI_TRY (mss::read_dsm0q_register(p, dsm0_buffer) ); + mss::get_wrdone_delay(dsm0_buffer, wr_done_delay); + mss::get_rdtag_delay(dsm0_buffer, rd_tag_delay); + rcd_protect_time = std::min(wr_done_delay, rd_tag_delay); + FAPI_TRY (mss::change_rcd_protect_time(p, rcd_protect_time) ); + + l_ecc64_fir_reg.checkstop() + .recoverable_error() + .checkstop() + .recoverable_error(); + + l_cal_fir_reg.recoverable_error(); + + // If ATTR_CHIP_EC_FEATURE_HW414700 is enabled set checkstops + FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_CHIP_EC_FEATURE_HW414700, l_chip_target, l_checkstop_flag) ); + + // If the system is running DD2 chips override some recoverable firs with checkstop + // Due to a known hardware defect with DD2 certain errors are not handled properly + // As a result, these firs are marked as checkstop for DD2 to avoid any mishandling + if (l_checkstop_flag) + { + l_ecc64_fir_reg.checkstop() + .checkstop(); + l_cal_fir_reg.checkstop(); + } + + // If MNFG FLAG Threshhold is enabled skip IUE unflagging + FAPI_TRY ( mss::mnfg_flags(l_mnfg_buffer) ); + + if ( !(l_mnfg_buffer.getBit()) ) + { + l_ecc64_fir_reg.recoverable_error(); + } + + FAPI_TRY(l_ecc64_fir_reg.write(), "unable to write fir::reg %d", MCA_FIR); + FAPI_TRY(l_cal_fir_reg.write(), "unable to write fir::reg %d", MCA_MBACALFIRQ); + + // Change Maint AUE and IAUE to checkstop without unmasking + // Normal setup modifies masked bits in addition to setting checkstop + // This causes issues if error has occured, manually scoming to avoid this + FAPI_TRY( mss::getScom(p, MCA_ACTION1, l_aue_buffer) ); + l_aue_buffer.clearBit(); + l_aue_buffer.clearBit(); + FAPI_TRY( mss::putScom(p, MCA_ACTION1, l_aue_buffer) ); + + // Note: We also want to include the following setup RCD recovery and port fail + FAPI_TRY( mss::change_port_fail_disable(p, mss::LOW) ); + FAPI_TRY( mss::change_rcd_recovery_disable(p, mss::LOW) ); + } + + return fapi2::FAPI2_RC_SUCCESS; + +fapi_try_exit: + return fapi2::current_err; +} + +/// +/// @brief Unmask and setup actions for scrub related FIR +/// @param[in] i_target the fapi2::Target MCBIST +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template<> +fapi2::ReturnCode after_background_scrub( const fapi2::Target& + i_target ) +{ + for (const auto& p : mss::find_targets(i_target)) + { + fapi2::ReturnCode l_rc; + fir::reg l_ecc64_fir_reg(p, l_rc); + FAPI_TRY(l_rc, "unable to create fir::reg 0x%016lx for %s", MCA_FIR, mss::c_str(p)); + + l_ecc64_fir_reg.recoverable_error() + .recoverable_error() + .recoverable_error() + .recoverable_error() + .recoverable_error(); + + FAPI_TRY(l_ecc64_fir_reg.write(), "unable to write fir::reg 0x%016lx for %s", MCA_FIR, mss::c_str(p)); + } + + return fapi2::FAPI2_RC_SUCCESS; + +fapi_try_exit: + return fapi2::current_err; +} + } } diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/fir/unmask.H b/src/import/chips/p9/procedures/hwp/memory/lib/fir/unmask.H index 7a4d271bc..a6ae3863f 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/fir/unmask.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/fir/unmask.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2018 */ +/* Contributors Listed Below - COPYRIGHT 2016,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -45,7 +45,57 @@ namespace mss namespace unmask { +/// +/// @brief Unmask and setup actions performed after draminit_mc +/// @param[in] i_target the fapi2::Target of the MCBIST +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template<> +fapi2::ReturnCode after_draminit_mc( const fapi2::Target& i_target ); + +/// +/// @brief Unmask and setup actions performed after draminit_training +/// @param[in] i_target the fapi2::Target of the MCBIST +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template<> +fapi2::ReturnCode after_draminit_training( const fapi2::Target& + i_target ); +/// +/// @brief Unmask and setup actions performed after mss_scominit +/// (yeah, it's clearing bits - it's ok) +/// @param[in] i_target the fapi2::Target of the MCBIST +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template<> +fapi2::ReturnCode after_scominit( const fapi2::Target& i_target ); + +/// +/// @brief Unmask and setup actions performed after mss_ddr_phy_reset +/// @param[in] i_target the fapi2::Target of the MCBIST +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template<> +fapi2::ReturnCode after_phy_reset( const fapi2::Target& i_target ); + + +/// +/// @brief Unmask and setup actions for memdiags related FIR +/// @param[in] i_target the fapi2::Target +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template<> +fapi2::ReturnCode after_memdiags( const fapi2::Target& i_target ); + +/// +/// @brief Unmask and setup actions for scrub related FIR +/// @param[in] i_target the fapi2::Target +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template<> +fapi2::ReturnCode after_background_scrub( const fapi2::Target& + i_target ); } } diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/mss.mk b/src/import/chips/p9/procedures/hwp/memory/lib/mss.mk index 2b07ee18c..878c51e37 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/mss.mk +++ b/src/import/chips/p9/procedures/hwp/memory/lib/mss.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2015,2017 +# Contributors Listed Below - COPYRIGHT 2015,2019 # [+] International Business Machines Corp. # # @@ -44,6 +44,7 @@ $(call ADD_MODULE_INCDIR,$(1),$(FAPI2_PATH)/include) $(call ADD_MODULE_INCDIR,$(1),$(GENPATH)) $(call ADD_MODULE_INCDIR,$(1),$(FAPI2_PLAT_INCLUDE)) $(call ADD_MODULE_INCDIR,$(1),$(ROOTPATH)) +$(call ADD_MODULE_INCDIR,$(1),$(ROOTPATH)/generic/memory/lib) endef MODULE = mss OBJS += $(MSS_MODULE_OBJS) diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_background_scrub.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_background_scrub.C index 06e15b95b..7f02e7cf6 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_background_scrub.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_background_scrub.C @@ -43,48 +43,29 @@ #include #include #include -#include +#include using fapi2::TARGET_TYPE_MCBIST; using fapi2::TARGET_TYPE_MCA; using fapi2::TARGET_TYPE_SYSTEM; using fapi2::FAPI2_RC_SUCCESS; -/// -/// @brief Begin background scrub -/// @param[in] i_target MCBIST -/// @return FAPI2_RC_SUCCESS iff ok -/// -fapi2::ReturnCode p9_mss_background_scrub( const fapi2::Target& i_target ) -{ - FAPI_INF("Start mss background scrub 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::is_simulation(l_sim) ); +extern "C" +{ - // Kick off background scrub if we are not running in sim - if (!(l_sim)) + /// + /// @brief Begin background scrub + /// @param[in] i_target MCBIST + /// @return FAPI2_RC_SUCCESS iff ok + /// + fapi2::ReturnCode p9_mss_background_scrub( const fapi2::Target& i_target ) { - // Start background scrub - FAPI_TRY ( mss::memdiags::background_scrub( i_target, - mss::mcbist::stop_conditions<>(), - mss::mcbist::speed::BG_SCRUB, - mss::mcbist::address() ) ); + FAPI_INF("Start mss background scrub on: %s", mss::c_str( i_target )); + FAPI_TRY(mss::memdiags::mss_background_scrub_helper(i_target)); + fapi_try_exit: + return fapi2::current_err; } - // Unmask firs after background scrub is started - FAPI_TRY ( mss::unmask::after_background_scrub( i_target ) ); - -fapi_try_exit: - return fapi2::current_err; } diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_ddr_phy_reset.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_ddr_phy_reset.C index 27b616a72..8d439b9d8 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_ddr_phy_reset.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_ddr_phy_reset.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2018 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -33,6 +33,7 @@ // *HWP Level: 3 // *HWP Consumed by: FSP:HB +#include #include #include @@ -198,7 +199,7 @@ extern "C" // The algorithm is 'good path do after_phy_reset, all paths (error or not) perform the checks // which are defined in during_phy_reset'. We won't run after_phy_reset (unmask of FIR) unless // we're done with a success. - FAPI_TRY( mss::unmask::after_phy_reset(i_target), "%s Error in p9_mss_ddr_phy_reset.C", + FAPI_TRY( mss::unmask::after_phy_reset(i_target), "%s Error in p9_mss_ddr_phy_reset.C", mss::c_str(i_target) ); // Leave as we're all good and checked the FIR already ... diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_mc.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_mc.C index 66892c8bd..076f2396b 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_mc.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_mc.C @@ -33,6 +33,7 @@ // *HWP Level: 3 // *HWP Consumed by: FSP:HB +#include #include #include @@ -147,7 +148,7 @@ extern "C" } // At this point the DDR interface must be monitored for memory errors. Memory related FIRs should be unmasked. - FAPI_TRY( mss::unmask::after_draminit_mc(i_target), "%s Failed after_draminit_mc", + FAPI_TRY( mss::unmask::after_draminit_mc(i_target), "%s Failed after_draminit_mc", mss::c_str(i_target) ); fapi_try_exit: diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_training.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_training.C index e4084b461..0a13ac90c 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_training.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_training.C @@ -33,6 +33,7 @@ // *HWP Level: 3 // *HWP Consumed by: FSP:HB +#include #include #include #include @@ -212,7 +213,7 @@ extern "C" // We do it here in order to train every port FAPI_TRY( mss::draminit_training_error_handler(l_fails) ); // Unmask FIR - FAPI_TRY( mss::unmask::after_draminit_training(i_target), "Error in p9_mss_draminit" ); + FAPI_TRY( mss::unmask::after_draminit_training(i_target), "Error in p9_mss_draminit" ); fapi_try_exit: FAPI_INF("End draminit training"); diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_memdiag.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_memdiag.C index 33efe93b5..b04d66c20 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_memdiag.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_memdiag.C @@ -47,7 +47,7 @@ #include #include #include -#include +#include using fapi2::TARGET_TYPE_MCBIST; using fapi2::TARGET_TYPE_SYSTEM; diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_scominit.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_scominit.C index 3ee15dc3b..d2f58b0bc 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_scominit.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_scominit.C @@ -119,7 +119,7 @@ fapi2::ReturnCode p9_mss_scominit( const fapi2::Target& i_ta FAPI_TRY( mss::phy_scominit(i_target), "%s failed phy_scominit", mss::c_str(i_target) ); // Do FIRry things - FAPI_TRY( mss::unmask::after_scominit(i_target), "%s failed after_scominit", + FAPI_TRY( mss::unmask::after_scominit(i_target), "%s failed after_scominit", mss::c_str(i_target) ); fapi_try_exit: 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 6ba472549..0fb902ac2 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 @@ -43,102 +43,28 @@ #include #include #include -#include +#include using fapi2::TARGET_TYPE_MCBIST; using fapi2::TARGET_TYPE_MCA; using fapi2::TARGET_TYPE_SYSTEM; using fapi2::FAPI2_RC_SUCCESS; -/// -/// @brief Begin background scrub -/// @param[in] i_target MCBIST -/// @return FAPI2_RC_SUCCESS iff ok -/// -fapi2::ReturnCode p9_mss_scrub( const fapi2::Target& i_target ) +extern "C" { - FAPI_INF("Start mss scrub"); - // 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) + /// + /// @brief Begin background scrub + /// @param[in] i_target MCBIST + /// @return FAPI2_RC_SUCCESS iff ok + /// + fapi2::ReturnCode p9_mss_scrub( const fapi2::Target& i_target ) { - 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 l_status; + FAPI_INF("Start mss scrub for %s", mss::c_str(i_target)); + FAPI_TRY(mss::memdiags::mss_scrub_helper(i_target)); - // A small vector of addresses to poll during the polling loop - const std::vector> 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, 100 * mss::DELAY_1MS, 200, 10000); - 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( mss::is_simulation( l_sim) ); - - if (l_sim) - { - fapi2::ReturnCode l_rc; - - // 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. - FAPI_INF("running mss sim init in place of scrub"); - l_rc = mss::mcbist::sim::sf_init(i_target, mss::mcbist::PATTERN_0); - - // Unmask firs and turn off FIFO mode before returning - FAPI_TRY ( mss::unmask::after_memdiags( i_target ) ); - FAPI_TRY ( mss::unmask::after_background_scrub( i_target ) ); - FAPI_TRY ( mss::reset_reorder_queue_settings(i_target) ); - - return l_rc; + fapi_try_exit: + return fapi2::current_err; } - // 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(i_target, mss::mcbist::PATTERN_0) ); - - // 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& stat_reg) -> bool - { - FAPI_DBG("mcbist firq 0x%llx, remaining: %d", stat_reg, poll_remaining); - l_status = stat_reg; - return l_status.getBit() == 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( i_target ) ); - FAPI_TRY ( mss::reset_reorder_queue_settings(i_target) ); - - // Start background scrub - FAPI_TRY ( mss::memdiags::background_scrub( i_target, - mss::mcbist::stop_conditions<>(), - mss::mcbist::speed::BG_SCRUB, - mss::mcbist::address() ) ); - - // Unmask firs after background scrub is started - FAPI_TRY ( mss::unmask::after_background_scrub( i_target ) ); - -fapi_try_exit: - return fapi2::current_err; } -- cgit v1.2.1