Skip to content

Commit 7c00408

Browse files
sglancy6dcrowell77
authored andcommitted
Updates MWD_COARSE to run multiple patterns
Change-Id: I796af0ac1b02ceafe4c637136068dad920acd17b Original-Change-Id: Idc5ea0ddbc7d19ff79d0f802ba966f05bdcc18c3 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69848 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Louis Stermole <stermole@us.ibm.com> Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com> Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/104158 Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com> Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com> Tested-by: Daniel M Crowell <dcrowell@us.ibm.com>
1 parent d751613 commit 7c00408

File tree

4 files changed

+80
-42
lines changed

4 files changed

+80
-42
lines changed

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace lrdimm
6464
/// @param[in] i_target - the MCA target on which to operate
6565
/// @param[in] i_rp - the rank pair
6666
/// @param[in] i_abort_on_error - whether or not we are aborting on cal error
67-
/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff ok
67+
/// @return FAPI2_RC_SUCCESS iff ok
6868
///
6969
fapi2::ReturnCode mrd_coarse::pre_workaround( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
7070
const uint64_t i_rp,
@@ -86,7 +86,7 @@ fapi_try_exit:
8686
/// @param[in] i_target - the MCA target on which to operate
8787
/// @param[in] i_rp - the rank pair
8888
/// @param[in] i_abort_on_error - whether or not we are aborting on cal error
89-
/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS if ok
89+
/// @return FAPI2_RC_SUCCESS if ok
9090
///
9191
fapi2::ReturnCode mrd_coarse::post_workaround( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
9292
const uint64_t i_rp,
@@ -105,7 +105,7 @@ fapi_try_exit:
105105
/// @param[in] i_target the DIMM target
106106
/// @param[in] i_rank the DIMM rank on which to set the delay
107107
/// @param[in] i_delay the indexed delay to set
108-
/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff ok
108+
/// @return FAPI2_RC_SUCCESS iff ok
109109
/// @note Sets up buffer control word F6BC4x to do compares on a per-bit level
110110
///
111111
fapi2::ReturnCode mrd_coarse::set_delay(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
@@ -167,7 +167,7 @@ fapi_try_exit:
167167
/// @param[in] i_dimm_rank the DIMM rank on which to set the delay
168168
/// @param[in] i_delay the delay for this run
169169
/// @param[in,out] io_results the results
170-
/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff ok
170+
/// @return FAPI2_RC_SUCCESS iff ok
171171
///
172172
fapi2::ReturnCode mrd_coarse::analyze_results(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
173173
const uint64_t i_dimm_rank,
@@ -186,7 +186,7 @@ fapi2::ReturnCode mrd_coarse::analyze_results(const fapi2::Target<fapi2::TARGET_
186186
// Displays all of the data here - just.in.case.
187187
for(uint8_t l_buffer_loop = 0; l_buffer_loop < MAX_LRDIMM_BUFFERS; ++l_buffer_loop)
188188
{
189-
for(uint8_t i = 0; i < 8; ++i)
189+
for(uint8_t i = 0; i < data_response::MAX_NUM_BEATS; ++i)
190190
{
191191
FAPI_DBG("%s delay:0x%02x MRD_COARSE result buffer%u BEAT%u data:0x%02x",
192192
mss::c_str(i_target), i_delay, l_buffer_loop, i, l_data.iv_buffer_beat[l_buffer_loop][i]);
@@ -374,7 +374,7 @@ fapi_try_exit:
374374
/// @param[in] i_target the MCA target
375375
/// @param[in] i_dimm_rank the DIMM rank on which to set the delay
376376
/// @param[in,out] io_results the results
377-
/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff ok
377+
/// @return FAPI2_RC_SUCCESS iff ok
378378
///
379379
fapi2::ReturnCode mrd_coarse::find_final_results(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
380380
const uint64_t i_dimm_rank,
@@ -399,7 +399,7 @@ fapi_try_exit:
399399
/// @param[in] i_dimm_rank the DIMM rank on which to set the delay
400400
/// @param[in] i_results the results
401401
/// @param[out] o_container the PBA commands structure
402-
/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff ok
402+
/// @return FAPI2_RC_SUCCESS iff ok
403403
///
404404
fapi2::ReturnCode mrd_coarse::set_final_delays_helper(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
405405
const uint64_t i_dimm_rank,
@@ -431,7 +431,7 @@ fapi2::ReturnCode mrd_coarse::set_final_delays_helper(const fapi2::Target<fapi2:
431431
l_result.first.iv_final_delay :
432432
l_result.second.iv_final_delay;
433433

434-
FAPI_DBG("%s MRD coarse rank%u buffer:%u final values (0x%02x,0x%02x) %s swapped nibble0:0x%02x nibble1:0x%02x",
434+
FAPI_DBG("%s MRD_COARSE rank%u buffer:%u final values (0x%02x,0x%02x) %s swapped nibble0:0x%02x nibble1:0x%02x",
435435
mss::c_str(l_mca), i_dimm_rank, l_buffer, l_result.first.iv_final_delay, l_result.second.iv_final_delay,
436436
l_are_nibbles_swapped ? "are" : "not", l_bcw_result0, l_bcw_result1);
437437

@@ -462,7 +462,7 @@ fapi_try_exit:
462462
/// @param[in] i_target the DIMM target
463463
/// @param[in] i_dimm_rank the DIMM rank on which to set the delay
464464
/// @param[in] i_results the results
465-
/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff ok
465+
/// @return FAPI2_RC_SUCCESS iff ok
466466
///
467467
fapi2::ReturnCode mrd_coarse::set_final_delays(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
468468
const uint64_t i_dimm_rank,
@@ -491,15 +491,22 @@ fapi_try_exit:
491491
/// @param[in] i_target - the MCA target on which to operate
492492
/// @param[in] i_rp - the rank pair
493493
/// @param[in] i_abort_on_error - whether or not we are aborting on cal error
494-
/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff ok
494+
/// @return FAPI2_RC_SUCCESS iff ok
495495
///
496496
fapi2::ReturnCode mrd_coarse::run( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
497497
const uint64_t i_rp,
498498
const uint8_t i_abort_on_error ) const
499499
{
500500
constexpr uint8_t MPR_LOCATION0 = 0;
501501
std::vector<uint64_t> l_ranks;
502+
503+
// Use 0x2b for the pattern
504+
// This pattern was determined experimentally, but has the following good qualities
505+
// 1) it is not cyclic
506+
// 2) it has all transitions (00, 01, 10, 11), making for a good SI test pattern
502507
constexpr uint8_t l_pattern_expected = 0x2B;
508+
// We write to all of the MPR registers, so we clone the 2B pattern four times
509+
// The patterns get split and written individually
503510
constexpr uint32_t l_pattern_set = 0x2B2B2B2B;
504511

505512
// 1) Get our ranks within the configured rank pair

src/import/chips/p9/procedures/hwp/memory/lib/phy/mss_mrd_coarse.H

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ class mrd_coarse : public step
5959
// From the LRDIMM spec - we only have 5 delays -2->+2
6060
static constexpr uint64_t NUM_DELAYS = 5;
6161

62+
// Default delay value 2 is for 0 nck
63+
static constexpr uint8_t DEFAULT_DELAYS = 2;
64+
static constexpr uint8_t DEFAULT_TO_FAIL = 0;
65+
static constexpr uint64_t RANKS_PER_FUNCTION_SPACE = 2;
66+
6267
mrd_coarse() :
6368
step("MRD_COARSE")
6469
{}
@@ -80,15 +85,18 @@ class mrd_coarse : public step
8085
/// @brief Default constructor
8186
///
8287
recorder() :
83-
iv_results(0),
84-
iv_final_delay(2), // 2 is for 0 delay
88+
iv_results(DEFAULT_TO_FAIL),
89+
iv_final_delay(DEFAULT_DELAYS), // 2 is for 0 delay
8590
iv_invalid_data_count(CLEAN)
8691
{}
8792

8893
///
8994
/// @brief constructor
95+
/// @param[in] i_results results from the MRD_COARSE run
96+
/// @param[in] i_final_delay final delay chosen by the MRD_COARSE run
97+
/// @param[in] i_invalid_count number of invalid data results seen
9098
///
91-
recorder(const fapi2::buffer<uint8_t> i_results, const uint8_t i_final_delay, const uint64_t i_invalid_count = CLEAN) :
99+
recorder(const fapi2::buffer<uint8_t>& i_results, const uint8_t i_final_delay, const uint64_t i_invalid_count = CLEAN) :
92100
iv_results(i_results),
93101
iv_final_delay(i_final_delay),
94102
iv_invalid_data_count(i_invalid_count)
@@ -210,7 +218,7 @@ class mrd_coarse : public step
210218
// So, odd ranks are on function space 0
211219
// Even ranks are on function space 1
212220
// Just mod it by 2...
213-
return (i_dimm_rank % 2) ? FUNC_SPACE_1 : FUNC_SPACE_0;
221+
return (i_dimm_rank % RANKS_PER_FUNCTION_SPACE) ? FUNC_SPACE_1 : FUNC_SPACE_0;
214222
}
215223

216224
///
@@ -224,7 +232,9 @@ class mrd_coarse : public step
224232
// Taken from the spec ~page 60->64
225233
// Ranks 0/1: 0x0c
226234
// Ranks 2/3: 0x0e
227-
return (i_dimm_rank < 2) ? 0x0c : 0x0e;
235+
constexpr uint8_t RANK01 = 0x0c;
236+
constexpr uint8_t RANK23 = 0x0e;
237+
return (i_dimm_rank < RANKS_PER_FUNCTION_SPACE) ? RANK01 : RANK23;
228238
}
229239

230240
///

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

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/* OpenPOWER HostBoot Project */
77
/* */
88
/* Contributors Listed Below - COPYRIGHT 2018,2020 */
9+
/* [+] International Business Machines Corp. */
910
/* */
1011
/* */
1112
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -476,13 +477,16 @@ fapi2::ReturnCode mwd_coarse::run( const fapi2::Target<fapi2::TARGET_TYPE_MCA>&
476477
const uint8_t i_abort_on_error ) const
477478
{
478479
std::vector<uint64_t> l_ranks;
479-
constexpr uint8_t l_pattern = 0x2B;
480+
uint8_t l_patterns[NUM_LRDIMM_TRAINING_PATTERNS] = {};
480481

481482
// Get ranks
482483
FAPI_TRY(mss::rank::get_ranks_in_pair( i_target, i_rp, l_ranks),
483-
"Failed get_ranks_in_pair in mwd::run %s",
484+
"Failed get_ranks_in_pair in mwd_coarse::run %s",
484485
mss::c_str(i_target));
485486

487+
// Gets the patterns to use
488+
FAPI_TRY(mss::lrdimm_training_pattern(mss::find_target<fapi2::TARGET_TYPE_MCS>(i_target), l_patterns));
489+
486490
// Loop through all ranks
487491
for(const auto l_rank : l_ranks)
488492
{
@@ -510,39 +514,44 @@ fapi2::ReturnCode mwd_coarse::run( const fapi2::Target<fapi2::TARGET_TYPE_MCA>&
510514
FAPI_TRY(mss::rank::get_dimm_target_from_rank(i_target, l_rank, l_dimm),
511515
"%s failed to get DIMM from rank%u", mss::c_str(i_target), l_dimm_rank);
512516

513-
// 1) Setup data pattern in the buffer MPR regs
514-
FAPI_TRY(lrdimm::set_expected_mpr_pattern(l_dimm, l_pattern), "%s failed set_expect_mpr_pattern rank%u, pattern%u",
515-
mss::c_str(l_dimm), l_dimm_rank, l_pattern);
516-
517517
// Setup per-lane compare for MWD
518-
// 2) Configure the compare output on a per-bit level (each bit returns 0/1, rather than each nibble)
518+
// 1) Configure the compare output on a per-bit level (each bit returns 0/1, rather than each nibble)
519519
FAPI_TRY(lrdimm::set_training_level(l_dimm, lrdimm::training_level::BIT), "%s failed set_per_lane_level rank %u",
520520
mss::c_str(l_dimm), l_dimm_rank);
521521

522-
// 3) Buffer into MWD mode
522+
// 2) Buffer into MWD mode
523523
FAPI_TRY(set_buffer_training(l_dimm, ddr4::MWD), "%s failed set_buffer_training rank%u", mss::c_str(l_dimm),
524524
l_dimm_rank);
525525

526526
// For all delays
527527
for(uint8_t l_delay = 0; l_delay < NUM_DELAYS; ++l_delay)
528528
{
529529
// Set delay (broadcast across rank)
530-
// 4) Setup our delays across the buffer
530+
// 3) Setup our delays across the buffer
531531
FAPI_TRY(set_delay(l_dimm, l_dimm_rank, l_delay), "%s rank%u failed set_delay delay:%u", mss::c_str(l_dimm),
532532
l_dimm_rank, l_delay);
533533

534-
// Conduct a WR/RD
535-
// Write sends data from the buffer MPR
536-
// 5) Read reads back what was written and does a bitwise compare
537-
FAPI_TRY(conduct_write_read(l_dimm, l_dimm_rank), "%s rank%u failed conduct_write_read", mss::c_str(l_dimm),
538-
l_dimm_rank);
539-
540-
// 6) Conduct an NTTM mode read
541-
FAPI_TRY(execute_nttm_mode_read(i_target), "%s rank%u failed execute_nttm_mode_read", mss::c_str(l_dimm), l_dimm_rank);
542-
543-
// 7) Analyze results
544-
FAPI_TRY(analyze_results(l_dimm, l_dimm_rank, l_delay, l_results), "%s rank%u failed process_results",
545-
mss::c_str(i_target), l_dimm_rank);
534+
// Loop over all patterns
535+
for(uint8_t l_pattern_num = 0; l_pattern_num < NUM_LRDIMM_TRAINING_PATTERNS; ++l_pattern_num)
536+
{
537+
// 4) Setup data pattern in the buffer MPR regs
538+
FAPI_TRY(lrdimm::set_expected_mpr_pattern(l_dimm, l_patterns[l_pattern_num]),
539+
"%s failed set_expect_mpr_pattern rank%u, pattern%u",
540+
mss::c_str(l_dimm), l_dimm_rank, l_patterns[l_pattern_num]);
541+
542+
// Conduct a WR/RD
543+
// Write sends data from the buffer MPR
544+
// 5) Read reads back what was written and does a bitwise compare
545+
FAPI_TRY(conduct_write_read(l_dimm, l_dimm_rank), "%s rank%u failed conduct_write_read", mss::c_str(l_dimm),
546+
l_dimm_rank);
547+
548+
// 6) Conduct an NTTM mode read
549+
FAPI_TRY(execute_nttm_mode_read(i_target), "%s rank%u failed execute_nttm_mode_read", mss::c_str(l_dimm), l_dimm_rank);
550+
551+
// 7) Analyze results
552+
FAPI_TRY(analyze_results(l_dimm, l_dimm_rank, l_delay, l_results), "%s rank%u failed process_results",
553+
mss::c_str(i_target), l_dimm_rank);
554+
}
546555
}
547556

548557
// 8) Buffer out of training mode

src/import/chips/p9/procedures/hwp/memory/lib/phy/mss_mwd_coarse.H

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/* OpenPOWER HostBoot Project */
77
/* */
88
/* Contributors Listed Below - COPYRIGHT 2018,2020 */
9+
/* [+] International Business Machines Corp. */
910
/* */
1011
/* */
1112
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -60,6 +61,9 @@ class mwd_coarse : public step
6061

6162
// Default delay value 2 is for 0 nck
6263
static constexpr uint8_t DEFAULT_DELAYS = 2;
64+
static constexpr uint8_t DEFAULT_TO_PASS = 0xF8;
65+
static constexpr uint8_t PASSING_RESULT = 0x0f;
66+
static constexpr uint8_t FAILING_RESULT = 0x00;
6367

6468
mwd_coarse() :
6569
step("MWD_COARSE")
@@ -68,7 +72,9 @@ class mwd_coarse : public step
6872
///
6973
/// @brief Default virtual destructor
7074
///
71-
~mwd_coarse() = default; ///
75+
~mwd_coarse() = default;
76+
77+
///
7278
/// @class mwd_coarse::recorder
7379
/// @brief Records the results for a given nibble
7480
///
@@ -78,9 +84,15 @@ class mwd_coarse : public step
7884
/// @brief Default constructor
7985
///
8086
recorder() :
81-
iv_results(0),
87+
iv_results(DEFAULT_TO_PASS),
8288
iv_final_delay(DEFAULT_DELAYS)
8389
{}
90+
91+
///
92+
/// @brief constructor
93+
/// @param[in] i_results results from the MRD_COARSE run
94+
/// @param[in] i_final final delay chosen by the MRD_COARSE run
95+
///
8496
recorder(fapi2::buffer<uint8_t> i_result, uint8_t i_delay)
8597
{
8698
this->iv_results = i_result;
@@ -105,15 +117,15 @@ class mwd_coarse : public step
105117
bool l_passed = false;
106118

107119
// 0 is not passed
108-
if(i_result == 0x00)
120+
if(i_result == FAILING_RESULT)
109121
{
110122
l_passed = false;
111123
}
112124

113-
// F is passed
114-
else if(i_result == 0x0f)
125+
// F is passed - only if we had already passed at this location
126+
else if(i_result == PASSING_RESULT)
115127
{
116-
l_passed = true;
128+
l_passed = iv_results.getBit(i_delay);
117129
}
118130

119131
// Anything else is an error case just call it not passed for now

0 commit comments

Comments
 (0)