Skip to content

Commit

Permalink
Add periodic mem cal to end of exp_draminit_mc
Browse files Browse the repository at this point in the history
Change-Id: I4eacea04e88761e0a3b72c9d908203778f002a0e
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/92746
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Dev-Ready: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: Mark Pizzutillo <mark.pizzutillo@ibm.com>
Reviewed-by: ANDRE A MARIN <aamarin@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@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/92784
Reviewed-by: Christian R Geddes <crgeddes@us.ibm.com>
  • Loading branch information
stermole authored and crgeddes committed Mar 25, 2020
1 parent 3eaf029 commit fde4c9f
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 24 deletions.
Expand Up @@ -92,6 +92,10 @@ extern "C"
// Enable periodic short zq cal
FAPI_TRY( mss::enable_zq_cal(i_target), "%s Failed enable_zq_cal", mss::c_str(i_target) );

// Enable periodic mem calibration
FAPI_TRY( mss::enable_periodic_cal<mss::mc_type::EXPLORER>(i_target), "%s Failed enable_periodic_cal",
mss::c_str(i_target) );

// Enable ecc checking
FAPI_TRY( mss::enable_read_ecc<mss::mc_type::EXPLORER>(i_target), "%s Failed enable_read_ecc", mss::c_str(i_target) );

Expand Down
Expand Up @@ -77,5 +77,46 @@ fapi_try_exit:
return fapi2::current_err;
}

///
/// @brief Enable the MC Periodic calibration functionality
/// @param[in] i_target the target
/// @return FAPI2_RC_SUCCESS if and only if ok
/// @note EXPLORER, OCMB_CHIP specialization
///
template<>
fapi2::ReturnCode enable_periodic_cal<mss::mc_type::EXPLORER>( const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>&
i_target )
{
using TT = portTraits<mss::mc_type::EXPLORER>;

// Settings: INTERVAL = 16K * 128 = 2M cycles, CTRLUPD_MIN = 128
constexpr uint8_t CAL_INTERVAL_TB_16384_CYCLES = 0x02;
constexpr uint16_t CAL_INTERVAL_VALUE = 0x0080;
constexpr uint16_t CAL_CTRLUPD_MIN_VALUE = 0x0080;

fapi2::buffer<uint64_t> l_data;

FAPI_TRY( mss::getScom(i_target, TT::FARB9Q_REG, l_data) );

// Set up noise window triggered calibration
l_data.setBit<TT::CFG_CTRLUPD_AFTER_ERR>();

// Set up periodic calibration
l_data.setBit<TT::CFG_MC_PER_CAL_ENABLE>();
l_data.insertFromRight<TT::CFG_MC_PER_CAL_INTERVAL_TB,
TT::CFG_MC_PER_CAL_INTERVAL_TB_LEN>(CAL_INTERVAL_TB_16384_CYCLES);
l_data.insertFromRight<TT::CFG_MC_PER_CAL_INTERVAL,
TT::CFG_MC_PER_CAL_INTERVAL_LEN>(CAL_INTERVAL_VALUE);
l_data.clearBit<TT::CFG_MC_PER_CAL_FIXED_RUN_LENGTH_EN>();
l_data.insertFromRight<TT::CFG_MC_PER_CAL_RUN_LENGTH,
TT::CFG_MC_PER_CAL_RUN_LENGTH_LEN>(0);
l_data.insertFromRight<TT::CFG_MC_PER_CAL_CTRLUPD_MIN,
TT::CFG_MC_PER_CAL_CTRLUPD_MIN_LEN>(CAL_CTRLUPD_MIN_VALUE);

FAPI_TRY( mss::putScom(i_target, TT::FARB9Q_REG, l_data) );

fapi_try_exit:
return fapi2::current_err;
}

}// mss
}// namespace mss
Expand Up @@ -122,6 +122,18 @@ class portTraits< mss::mc_type::EXPLORER >
RECR_MBSECCQ_MAINT_NO_RETRY_UE = EXPLR_RDF_RECR_MBSECCQ_MAINT_NO_RETRY_UE,
RECR_MBSECCQ_MAINT_NO_RETRY_MPE = EXPLR_RDF_RECR_MBSECCQ_MAINT_NO_RETRY_MPE,

CFG_CTRLUPD_AFTER_ERR = EXPLR_SRQ_MBA_FARB9Q_CFG_CTRLUPD_AFTER_ERR,
CFG_MC_PER_CAL_ENABLE = EXPLR_SRQ_MBA_FARB9Q_CFG_MC_PER_CAL_ENABLE,
CFG_MC_PER_CAL_INTERVAL_TB = EXPLR_SRQ_MBA_FARB9Q_CFG_MC_PER_CAL_INTERVAL_TB,
CFG_MC_PER_CAL_INTERVAL_TB_LEN = EXPLR_SRQ_MBA_FARB9Q_CFG_MC_PER_CAL_INTERVAL_TB_LEN,
CFG_MC_PER_CAL_INTERVAL = EXPLR_SRQ_MBA_FARB9Q_CFG_MC_PER_CAL_INTERVAL,
CFG_MC_PER_CAL_INTERVAL_LEN = EXPLR_SRQ_MBA_FARB9Q_CFG_MC_PER_CAL_INTERVAL_LEN,
CFG_MC_PER_CAL_FIXED_RUN_LENGTH_EN = EXPLR_SRQ_MBA_FARB9Q_CFG_MC_PER_CAL_FIXED_RUN_LENGTH_EN,
CFG_MC_PER_CAL_RUN_LENGTH = EXPLR_SRQ_MBA_FARB9Q_CFG_MC_PER_CAL_RUN_LENGTH,
CFG_MC_PER_CAL_RUN_LENGTH_LEN = EXPLR_SRQ_MBA_FARB9Q_CFG_MC_PER_CAL_RUN_LENGTH_LEN,
CFG_MC_PER_CAL_CTRLUPD_MIN = EXPLR_SRQ_MBA_FARB9Q_CFG_MC_PER_CAL_CTRLUPD_MIN,
CFG_MC_PER_CAL_CTRLUPD_MIN_LEN = EXPLR_SRQ_MBA_FARB9Q_CFG_MC_PER_CAL_CTRLUPD_MIN_LEN,

CTCR_MPE_TIMER = EXPLR_RDF_CTCR_MPE_TIMER,
CTCR_MPE_TIMER_LEN = EXPLR_RDF_CTCR_MPE_TIMER_LEN,
CTCR_MPE_TIMEBASE = EXPLR_RDF_CTCR_MPE_TIMEBASE,
Expand Down
5 changes: 3 additions & 2 deletions src/import/chips/p9/procedures/hwp/memory/lib/mc/port.C
Expand Up @@ -68,12 +68,13 @@ constexpr uint64_t BIT_SPARE_6 = 14; // 6: SPARE
constexpr uint64_t BIT_SPARE_7 = 15; // 7: SPARE

///
/// @brief Enable the MC Periodic calibration functionality - MCA specialization
/// @brief Enable the MC Periodic calibration functionality
/// @param[in] i_target the target
/// @return FAPI2_RC_SUCCESS if and only if ok
/// @note NIMBUS, MCA specialization
///
template<>
fapi2::ReturnCode enable_periodic_cal( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target )
fapi2::ReturnCode enable_periodic_cal<mss::mc_type::NIMBUS>( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target )
{
typedef portTraits<mss::mc_type::NIMBUS> TT;

Expand Down
20 changes: 0 additions & 20 deletions src/import/chips/p9/procedures/hwp/memory/lib/mc/port.H
Expand Up @@ -803,26 +803,6 @@ fapi_try_exit:
return fapi2::current_err;
}


///
/// @brief Enable the MC Periodic calibration functionality
/// @tparam T the fapi2 target type of the target
/// @tparam TT the class traits for the port
/// @param[in] i_target the target
/// @return FAPI2_RC_SUCCESS if and only if ok
///
template< fapi2::TargetType T, typename TT = portTraits<mss::mc_type::NIMBUS> >
fapi2::ReturnCode enable_periodic_cal( const fapi2::Target<T>& i_target );

///
/// @brief Enable the MC Periodic calibration functionality - MCA specialization
/// @param[in] i_target the target
/// @return FAPI2_RC_SUCCESS if and only if ok
///
template<>
fapi2::ReturnCode enable_periodic_cal( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target );


///
/// @brief Change the state of the force_str bit - mc_type::NIMBUS specialization
/// @tparam MC the memory controller type
Expand Down
Expand Up @@ -137,7 +137,7 @@ extern "C"
// Power management is handled in the init file. (or should be BRS)

// Enabling periodic calibration
FAPI_TRY( mss::enable_periodic_cal(p), "%s Failed enable_periodic_cal", mss::c_str(i_target) );
FAPI_TRY( mss::enable_periodic_cal<mss::mc_type::NIMBUS>(p), "%s Failed enable_periodic_cal", mss::c_str(i_target) );

// Step Six: Setup Control Bit ECC
FAPI_TRY( mss::enable_read_ecc<mss::mc_type::NIMBUS>(p), "%s Failed enable_read_ecc", mss::c_str(i_target) );
Expand Down
11 changes: 11 additions & 0 deletions src/import/generic/memory/lib/utils/mc/gen_mss_port.H
Expand Up @@ -403,6 +403,17 @@ fapi_try_exit:
return fapi2::current_err;
}

///
/// @brief Enable the MC Periodic calibration functionality
/// @tparam MC the memory controller type
/// @tparam T the fapi2 target type of the target
/// @tparam TT the class traits for the port
/// @param[in] i_target the target
/// @return FAPI2_RC_SUCCESS if and only if ok
///
template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T, typename TT = portTraits<MC> >
fapi2::ReturnCode enable_periodic_cal( const fapi2::Target<T>& i_target );


///
/// @brief Change the state of the force_str bit
Expand Down

0 comments on commit fde4c9f

Please sign in to comment.