Skip to content

Commit aba5dad

Browse files
sglancy6dcrowell77
authored andcommitted
Updates to run HW VREF cal by default
This code runs the HW VREF calibrations (both WR and RD VREF) by default if it is supported by the HW. Four new attributes are added to handle whether HW VREF cal should be run and with what overrides it needs to be run. Change-Id: I3ed63794e955ee8c94cffce0b98dba58886e4a9d Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36803 Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Reviewed-by: Brian R. Silver <bsilver@us.ibm.com> Reviewed-by: RYAN P. KING <rpking@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> Reviewed-by: Louis Stermole <stermole@us.ibm.com> Reviewed-by: JACOB L. HARVEY <jlharvey@us.ibm.com> Reviewed-by: Matt K. Light <mklight@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36807 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
1 parent 98d40a9 commit aba5dad

File tree

14 files changed

+376
-21
lines changed

14 files changed

+376
-21
lines changed

src/import/chips/p9/procedures/hwp/memory/lib/dimm/eff_dimm.C

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4327,6 +4327,53 @@ fapi_try_exit:
43274327
return fapi2::current_err;
43284328
}
43294329

4330+
///
4331+
/// @brief Determines and sets the cal_step_enable values
4332+
/// @return fapi2::FAPI2_RC_SUCCESS if okay
4333+
///
4334+
fapi2::ReturnCode eff_dimm::cal_step_enable()
4335+
{
4336+
// Gets the MCS target to use
4337+
const auto& l_mcs = mss::find_target<TARGET_TYPE_MCS>(iv_dimm);
4338+
4339+
// These constexpr values are taken from the defiitions in ATTR_MSS_CAL_STEP_ENABLE
4340+
// RD/WR VREF correspond to 0x0400 and 0x0100 respectively.
4341+
constexpr uint64_t ONLY_1D = 0xFAC0;
4342+
constexpr uint64_t RD_VREF_WR_VREF_1D = 0xFFC0;
4343+
const uint16_t l_cal_step_value = (mss::chip_ec_feature_skip_hw_vref_cal(l_mcs) ? ONLY_1D : RD_VREF_WR_VREF_1D);
4344+
4345+
FAPI_DBG("%s %s running HW VREF cal. cal_step value: 0x%0x VREF", mss::c_str(l_mcs),
4346+
mss::chip_ec_feature_skip_hw_vref_cal(l_mcs) ? "not" : "", l_cal_step_value);
4347+
4348+
// Sets up the vector
4349+
std::vector<uint16_t> l_cal_step(PORTS_PER_MCS, l_cal_step_value);
4350+
4351+
// Sets the values
4352+
return FAPI_ATTR_SET(fapi2::ATTR_MSS_CAL_STEP_ENABLE, l_mcs, UINT16_VECTOR_TO_1D_ARRAY(l_cal_step, PORTS_PER_MCS));
4353+
}
43304354

4355+
///
4356+
/// @brief Determines and sets the vref_enable_bit settings
4357+
/// @return fapi2::FAPI2_RC_SUCCESS if okay
4358+
///
4359+
fapi2::ReturnCode eff_dimm::vref_enable_bit()
4360+
{
4361+
// Gets the MCS target to use
4362+
const auto& l_mcs = mss::find_target<TARGET_TYPE_MCS>(iv_dimm);
4363+
4364+
// This enables which bits should be run for RD VREF, all 1's indicates that all bits should be run
4365+
constexpr uint64_t DISABLE = 0x0000;
4366+
constexpr uint64_t ENABLE = 0xFFFF;
4367+
const uint16_t l_vref_enable_value = (mss::chip_ec_feature_skip_hw_vref_cal(l_mcs) ? DISABLE : ENABLE);
4368+
4369+
FAPI_DBG("%s %s running HW VREF cal. VREF enable value: 0x%0x", mss::c_str(l_mcs),
4370+
mss::chip_ec_feature_skip_hw_vref_cal(l_mcs) ? "not" : "", l_vref_enable_value);
4371+
4372+
// Sets up the vector
4373+
std::vector<uint16_t> l_vref_enable(PORTS_PER_MCS, l_vref_enable_value);
4374+
4375+
// Sets the values
4376+
return FAPI_ATTR_SET(fapi2::ATTR_MSS_VREF_CAL_ENABLE, l_mcs, UINT16_VECTOR_TO_1D_ARRAY(l_vref_enable, PORTS_PER_MCS));
4377+
}
43314378

43324379
}//mss

src/import/chips/p9/procedures/hwp/memory/lib/dimm/eff_dimm.H

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,18 @@ class eff_dimm
701701
///
702702
fapi2::ReturnCode dram_trtp();
703703

704+
///
705+
/// @brief Determines and sets the cal_step_enable values
706+
/// @return fapi2::FAPI2_RC_SUCCESS if okay
707+
///
708+
fapi2::ReturnCode cal_step_enable();
709+
710+
///
711+
/// @brief Determines and sets the vref_enable_bit settings
712+
/// @return fapi2::FAPI2_RC_SUCCESS if okay
713+
///
714+
fapi2::ReturnCode vref_enable_bit();
715+
704716
///
705717
/// @brief Sets the RTT_NOM value from SPD
706718
/// @return fapi2::FAPI2_RC_SUCCESS if okay

src/import/chips/p9/procedures/hwp/memory/lib/mss_attribute_accessors_manual.H

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,37 @@ fapi_try_exit:
284284
return false;
285285
}
286286

287+
///
288+
/// @brief ATTR_CHIP_EC_FEATURE_MSS_ENABLE_HW_VREF_CAL getter
289+
/// @tparam T the fapi2 target type of the target
290+
/// @param[in] const ref to the target
291+
/// @return bool true iff feature is enabled
292+
///
293+
template< fapi2::TargetType T >
294+
inline bool chip_ec_feature_skip_hw_vref_cal(const fapi2::Target<T>& i_target)
295+
{
296+
const auto l_chip = mss::find_target<fapi2::TARGET_TYPE_PROC_CHIP>(i_target);
297+
uint8_t l_chip_check = 0;
298+
uint8_t l_skip_check = 0;
299+
uint8_t is_sim = 0;
300+
301+
FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_CHIP_EC_FEATURE_MSS_CHECK_DISABLE_HW_VREF_CAL, l_chip, l_chip_check) );
302+
FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_SKIP_HW_VREF_CAL, l_chip, l_skip_check) );
303+
FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_IS_SIMULATION, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), is_sim) );
304+
305+
FAPI_DBG("Values of the attributes for HW VREF cal skip chip: %d skip: %d", l_chip_check, l_skip_check);
306+
307+
// Chip check is required && we're in the HW sub-revision where the skip is required - then set a skip value
308+
// Skips if we are in sim mode - VREF cal takes too long for simulation
309+
return is_sim || ((l_chip_check != 0) && (l_skip_check != 0));
310+
311+
fapi_try_exit:
312+
FAPI_ERR("failed accessing ATTR_SKIP_HW_VREF_CAL or ATTR_CHIP_EC_FEATURE_MSS_CHECK_DISABLE_HW_VREF_CAL: 0x%lx (target: %s)",
313+
uint64_t(fapi2::current_err), mss::c_str(i_target));
314+
fapi2::Assert(false);
315+
return false;
316+
}
317+
287318
///
288319
/// @brief ATTR_CHIP_EC_FEATURE_MSS_ODT_CONFIG getter
289320
/// @tparam T the fapi2 target type of the target
@@ -307,6 +338,37 @@ fapi_try_exit:
307338
return false;
308339
}
309340

341+
///
342+
/// @brief ATTR_SKIP_RD_VREF_VREFSENSE_OVERRIDE getter
343+
/// @tparam T the fapi2 target type of the target
344+
/// @param[in] const ref to the target
345+
/// @return bool true iff feature is enabled
346+
///
347+
template< fapi2::TargetType T >
348+
inline bool chip_ec_feature_skip_rd_vref_vrefsense_override(const fapi2::Target<T>& i_target)
349+
{
350+
const auto l_chip = mss::find_target<fapi2::TARGET_TYPE_PROC_CHIP>(i_target);
351+
uint8_t l_chip_check = 0;
352+
uint8_t l_skip_check = 0;
353+
uint8_t is_sim = 0;
354+
355+
FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_CHIP_EC_FEATURE_MSS_CHECK_DIABLE_RD_VREF_CAL_VREFSENSE, l_chip, l_chip_check) );
356+
FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_SKIP_RD_VREF_VREFSENSE_OVERRIDE, l_chip, l_skip_check) );
357+
FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_IS_SIMULATION, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), is_sim) );
358+
359+
FAPI_DBG("Values of the attributes VREFSENSE chip: %d skip: %d", l_chip_check, l_skip_check);
360+
361+
// Chip check is required && we're in the HW sub-revision where the skip is required - then set a skip value
362+
// Skips if we are in sim mode - VREF cal takes too long for simulation
363+
return is_sim || ((l_chip_check != 0) && (l_skip_check != 0));
364+
365+
fapi_try_exit:
366+
FAPI_ERR("failed accessing ATTR_SKIP_RD_VREF_VREFSENSE_OVERRIDE or ATTR_CHIP_EC_FEATURE_MSS_CHECK_DIABLE_RD_VREF_CAL_VREFSENSE: 0x%lx (target: %s)",
367+
uint64_t(fapi2::current_err), mss::c_str(i_target));
368+
fapi2::Assert(false);
369+
return false;
370+
}
371+
310372
} // close mss namespace
311373

312374
#endif

src/import/chips/p9/procedures/hwp/memory/lib/phy/ddr_phy.C

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,9 @@ fapi2::ReturnCode setup_cal_config( const fapi2::Target<fapi2::TARGET_TYPE_MCA>&
911911
mss::c_str(i_target), uint16_t(l_cal_config), uint16_t(i_cal_steps_enabled));
912912
FAPI_TRY( mss::putScom(i_target, MCA_DDRPHY_PC_INIT_CAL_CONFIG0_P0, l_cal_config) );
913913

914+
// Setsup the workarounds
915+
FAPI_TRY(mss::workarounds::dp16::rd_vref_vref_sense_setup(i_target));
916+
914917
fapi_try_exit:
915918
return fapi2::current_err;
916919
}

src/import/chips/p9/procedures/hwp/memory/lib/workarounds/dp16_workarounds.C

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,107 @@ fapi_try_exit:
9595
return fapi2::current_err;
9696
}
9797

98+
///
99+
/// @brief Modifies the VREF sense bit based upon the passed in value
100+
/// @param[in] i_target the fapi2 target of the port
101+
/// @param[in] i_state the state to set bit 62 to
102+
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
103+
/// @note this is a helper function to reduce repeated code in cleanup and workaround functions below
104+
///
105+
fapi2::ReturnCode modify_vref_sense(const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target, const mss::states i_state )
106+
{
107+
// Runs the cleanup here
108+
static const std::vector<uint64_t> l_addrs =
109+
{
110+
MCA_DDRPHY_DP16_DATA_BIT_DIR1_P0_0,
111+
MCA_DDRPHY_DP16_DATA_BIT_DIR1_P0_1,
112+
MCA_DDRPHY_DP16_DATA_BIT_DIR1_P0_2,
113+
MCA_DDRPHY_DP16_DATA_BIT_DIR1_P0_3,
114+
MCA_DDRPHY_DP16_DATA_BIT_DIR1_P0_4,
115+
};
116+
117+
// Note: this bit does not exist in our scom def, so constexpr'ing it here
118+
constexpr uint64_t VREFSENSE_BIT = 62;
119+
120+
for(const auto& l_reg : l_addrs)
121+
{
122+
fapi2::buffer<uint64_t> l_data;
123+
124+
// Gets the data
125+
FAPI_TRY(mss::getScom(i_target, l_reg, l_data));
126+
127+
// Modifies the data
128+
l_data.writeBit<VREFSENSE_BIT>(i_state);
129+
130+
// Writes the data
131+
FAPI_TRY(mss::putScom(i_target, l_reg, l_data));
132+
}
133+
134+
fapi_try_exit:
135+
return fapi2::current_err;
136+
}
137+
138+
///
139+
/// @brief Workarounds for after training
140+
/// @param[in] i_target the fapi2 target of the port
141+
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
142+
/// @note This function is called after training - it will only be run after coarse wr/rd
143+
///
144+
fapi2::ReturnCode rd_vref_vref_sense_cleanup( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target )
145+
{
146+
// If the workaround does not need to be run, return success
147+
if(mss::chip_ec_feature_skip_rd_vref_vrefsense_override(i_target))
148+
{
149+
return fapi2::FAPI2_RC_SUCCESS;
150+
}
151+
152+
// Per Ryan King, this needs to be set to OFF for mainline mode
153+
return modify_vref_sense(i_target, mss::states::OFF);
154+
}
155+
156+
///
157+
/// @brief Sets up the VREF sense values before training
158+
/// @param[in] i_target the fapi2 target of the port
159+
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
160+
/// @note This function is called before training
161+
///
162+
fapi2::ReturnCode rd_vref_vref_sense_setup( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target )
163+
{
164+
// If the workaround does not need to be run, return success
165+
if(mss::chip_ec_feature_skip_rd_vref_vrefsense_override(i_target))
166+
{
167+
return fapi2::FAPI2_RC_SUCCESS;
168+
}
169+
170+
// Per Ryan King, this needs to be set to ON to run training
171+
return modify_vref_sense(i_target, mss::states::ON);
172+
}
173+
174+
///
175+
/// @brief Workarounds for after training
176+
/// @param[in] i_target the fapi2 target of the port
177+
/// @param[in] i_cal_steps_enable the enabled cal steps
178+
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
179+
/// @note This function is called after training - it will only be run after coarse wr/rd
180+
///
181+
fapi2::ReturnCode post_training_workarounds( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
182+
const fapi2::buffer<uint16_t>& i_cal_steps_enabled )
183+
{
184+
// Only runs on the last cal steps (coarse wr/rd)
185+
if (i_cal_steps_enabled.getBit<mss::cal_steps::COARSE_RD>() ||
186+
i_cal_steps_enabled.getBit<mss::cal_steps::COARSE_WR>())
187+
{
188+
FAPI_TRY( mss::workarounds::dp16::modify_calibration_results( i_target ) );
189+
FAPI_TRY( mss::workarounds::dp16::rd_vref_vref_sense_cleanup( i_target ) );
190+
}
191+
192+
// Returns success, as we might not have run these workarounds, depending upon cal step enable
193+
return fapi2::FAPI2_RC_SUCCESS;
194+
195+
fapi_try_exit:
196+
return fapi2::current_err;
197+
}
198+
98199
///
99200
/// @brief DP16 Read Diagnostic Configuration 5 work around
100201
/// Not in the Model 67 spydef, so we scom them. Should be removed when they are

src/import/chips/p9/procedures/hwp/memory/lib/workarounds/dp16_workarounds.H

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,33 @@ fapi2::ReturnCode fix_blue_waterfall_gate( const fapi2::Target<fapi2::TARGET_TYP
252252
///
253253
fapi2::ReturnCode modify_calibration_results( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target );
254254

255+
///
256+
/// @brief Cleans up the VREF sense values after training
257+
/// @param[in] i_target the fapi2 target of the port
258+
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
259+
/// @note This function is called after training - it will only be run after coarse wr/rd
260+
///
261+
fapi2::ReturnCode rd_vref_vref_sense_cleanup( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target );
262+
263+
///
264+
/// @brief Sets up the VREF sense values before training
265+
/// @param[in] i_target the fapi2 target of the port
266+
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
267+
/// @note This function is called before training
268+
///
269+
fapi2::ReturnCode rd_vref_vref_sense_setup( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target );
270+
271+
272+
///
273+
/// @brief Workarounds for after training
274+
/// @param[in] i_target the fapi2 target of the port
275+
/// @param[in] i_cal_steps_enabled the enabled cal steps
276+
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
277+
/// @note This function is called after training - it will only be run after coarse wr/rd
278+
///
279+
fapi2::ReturnCode post_training_workarounds( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
280+
const fapi2::buffer<uint16_t>& i_cal_steps_enabled );
281+
255282
namespace wr_vref
256283
{
257284

src/import/chips/p9/procedures/hwp/memory/p9_mss_draminit_training.C

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,8 @@ extern "C"
192192
// bits for a cal failure. We'll return the proper ReturnCode so all we need to do is FAPI_TRY.
193193
FAPI_TRY( mss::ccs::execute(i_target, l_program, p) );
194194

195-
// Modifies the training steps, based upon workarounds - only do this if we've run coarse_rd or coarse_wr
196-
if (l_cal_steps_enabled.getBit<mss::cal_steps::COARSE_RD>() ||
197-
l_cal_steps_enabled.getBit<mss::cal_steps::COARSE_WR>())
198-
{
199-
FAPI_TRY( mss::workarounds::dp16::modify_calibration_results( p ) );
200-
}
195+
// Conducts workarounds after training if needed
196+
FAPI_TRY( mss::workarounds::dp16::post_training_workarounds( p, l_cal_steps_enabled ) );
201197

202198
// If we're aborting on error we can just FAPI_TRY. If we're not, we don't want to exit if there's
203199
// an error but we want to log the error and keep on keeping on.

src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config.C

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,14 @@ fapi2::ReturnCode p9_mss_eff_config( const fapi2::Target<fapi2::TARGET_TYPE_MCS>
196196
FAPI_TRY( l_eff_dimm->dram_rtt_wr () );
197197
FAPI_TRY( l_eff_dimm->dram_rtt_park() );
198198

199+
// Sets up the calibration steps
200+
FAPI_TRY( l_eff_dimm->cal_step_enable() );
201+
FAPI_TRY( l_eff_dimm->vref_enable_bit() );
202+
199203
//Let's do some checking
200204
FAPI_TRY( mss::check::temp_refresh_mode());
201205
}// dimm
202206

203-
// TODO RTC:160060 Clean up hard coded values at bottom of eff_config
204-
// Don't set these attributes if we only want to set VPD attributes
205-
// This will be cleaner once we resolve attributes below
206-
{
207-
uint16_t l_cal_step[mss::PORTS_PER_MCS] = {0xFAC0, 0xFAC0};
208-
FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_CAL_STEP_ENABLE, i_target, l_cal_step) );
209-
}
210-
211207
// Check plug rules. We check the MCS, and this will iterate down to children as needed.
212208
FAPI_TRY( mss::plug_rule::enforce_plug_rules(i_target) );
213209

src/import/chips/p9/procedures/hwp/perv/p9_getecid.C

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ static fapi2::ReturnCode setup_memory_work_around_attributes(
118118
uint8_t l_value = 1;
119119
FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_DO_MSS_WR_VREF, i_target, l_value) );
120120
FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_DO_MSS_VREF_DAC, i_target, l_value) );
121+
// The value for this is SKIP - we want to skip in sub DD1.02 HW
122+
FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_SKIP_HW_VREF_CAL, i_target, l_value) );
121123
}
122124

123125
// Workarounds for modules which are before 1.03 (memory part 2)
@@ -129,6 +131,8 @@ static fapi2::ReturnCode setup_memory_work_around_attributes(
129131
uint8_t l_value = 1;
130132
FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_DO_MSS_TRAINING_BAD_BITS, i_target, l_value) );
131133
FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_DO_BLUE_WATERFALL_ADJUST, i_target, l_value) );
134+
// The value for this is SKIP - we want to skip in sub DD1.03 HW
135+
FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_SKIP_RD_VREF_VREFSENSE_OVERRIDE, i_target, l_value) );
132136
}
133137

134138
return fapi2::FAPI2_RC_SUCCESS;

0 commit comments

Comments
 (0)