Skip to content

Commit ff34b02

Browse files
aamarincrgeddes
authored andcommitted
Add a common MRS engine to set up CCS instructions and UTs.
Cascade MRS engine to common copy-pasted code to mrs_load, latch_wr_vref and mrs_one_shot. Change-Id: Iabd7848816a43d012bed4f403504985488fe332c Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33010 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Louis Stermole <stermole@us.ibm.com> Reviewed-by: Brian R. Silver <bsilver@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33026 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
1 parent 01eb02a commit ff34b02

File tree

5 files changed

+390
-222
lines changed

5 files changed

+390
-222
lines changed

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

Lines changed: 5 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -69,43 +69,19 @@ fapi2::ReturnCode add_latch_wr_vref_commands( const fapi2::Target<fapi2::TARGET_
6969

7070
// Adds both VREFDQ train enables
7171
// Note: this isn't general - assumes Nimbus via MCBIST instruction here BRS
72-
ccs::instruction_t<TARGET_TYPE_MCBIST> l_inst_a_side;
73-
ccs::instruction_t<TARGET_TYPE_MCBIST> l_inst_b_side;
74-
7572
auto l_mr_override = i_mrs06;
7673

77-
enable_vref_train_enable(l_mr_override);
78-
79-
FAPI_TRY(setup_ab_side_vref_train_enable(
80-
i_target,
81-
l_mr_override,
82-
i_rank,
83-
l_inst_a_side,
84-
l_inst_b_side)
85-
);
86-
8774
// Add both to the CCS program - JEDEC step 1
88-
io_inst.push_back(l_inst_a_side);
89-
io_inst.push_back(l_inst_b_side);
75+
enable_vref_train_enable(l_mr_override);
76+
FAPI_TRY( mrs_engine(i_target, l_mr_override, i_rank, mss::tvrefdqe(i_target), io_inst) );
9077

9178
// Add both to the CCS program - JEDEC step 2
92-
io_inst.push_back(l_inst_a_side);
93-
io_inst.push_back(l_inst_b_side);
94-
95-
disable_vref_train_enable(l_mr_override);
79+
FAPI_TRY( mrs_engine(i_target, l_mr_override, i_rank, mss::tvrefdqe(i_target), io_inst) );
9680

9781
// Hits VREFDQ train disable - putting the DRAM's back in mainline mode
98-
FAPI_TRY(setup_ab_side_vref_train_enable(
99-
i_target,
100-
l_mr_override,
101-
i_rank,
102-
l_inst_a_side,
103-
l_inst_b_side)
104-
);
105-
10682
// Add both to the CCS program - JEDEC step 3
107-
io_inst.push_back(l_inst_a_side);
108-
io_inst.push_back(l_inst_b_side);
83+
disable_vref_train_enable(l_mr_override);
84+
FAPI_TRY( mrs_engine(i_target, l_mr_override, i_rank, mss::tvrefdqe(i_target), io_inst) );
10985

11086
fapi_try_exit:
11187
return fapi2::current_err;
@@ -216,57 +192,5 @@ fapi_try_exit:
216192
return fapi2::current_err;
217193
}
218194

219-
///
220-
/// @brief helper function to setup a/b side MR06 commands for the latching function based upon TRAIN_ENABLE
221-
/// @param[in] i_mrs06, base MRS 06 allows the user to setup custom values and pass it in
222-
/// @param[in] i_rank, rank on which to latch MRS 06
223-
/// @param[out] o_a_side, a-side MR06 command
224-
/// @param[out] o_b_side, b-side MR06 command
225-
/// @return FAPI2_RC_SUCCESS if and only if ok
226-
///
227-
fapi2::ReturnCode setup_ab_side_vref_train_enable(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
228-
const mrs06_data& i_mrs06,
229-
const uint64_t& i_rank,
230-
ccs::instruction_t<fapi2::TARGET_TYPE_MCBIST>& o_a_side,
231-
ccs::instruction_t<fapi2::TARGET_TYPE_MCBIST>& o_b_side)
232-
{
233-
// commands to be latched are MR06
234-
constexpr uint8_t WR_VREF_MRS = 6;
235-
236-
// Note: this isn't general - assumes Nimbus via MCBIST instruction here BRS
237-
o_a_side = ccs::mrs_command<fapi2::TARGET_TYPE_MCBIST>(i_target, i_rank, WR_VREF_MRS);
238-
239-
// Sets up variables
240-
const auto l_delay_enter = mss::tvrefdqe(i_target);
241-
242-
// Thou shalt send 2 MRS, one for the a-side and the other inverted for the b-side.
243-
// If we're on an odd-rank then we need to mirror
244-
// So configure the A-side, mirror if necessary and invert for the B-side
245-
// Gets the actual MR data to pass into CCS
246-
FAPI_TRY( mrs06(i_target, i_mrs06, o_a_side, i_rank) );
247-
248-
FAPI_TRY( mss::address_mirror(i_target, i_rank, o_a_side) );
249-
o_b_side = mss::address_invert(o_a_side);
250-
251-
// Not sure if we can get tricky here and only delay after the b-side MR. The question is whether the delay
252-
// is needed/assumed by the register or is purely a DRAM mandated delay. We know we can't go wrong having
253-
// both delays but if we can ever confirm that we only need one we can fix this. BRS
254-
o_a_side.arr1.insertFromRight<MCBIST_CCS_INST_ARR1_00_IDLES,
255-
MCBIST_CCS_INST_ARR1_00_IDLES_LEN>(l_delay_enter);
256-
o_b_side.arr1.insertFromRight<MCBIST_CCS_INST_ARR1_00_IDLES,
257-
MCBIST_CCS_INST_ARR1_00_IDLES_LEN>(l_delay_enter);
258-
259-
// Dump out the 'decoded' MRS and trace the CCS instructions.
260-
FAPI_TRY( mrs06_decode(o_a_side, i_rank) );
261-
262-
FAPI_INF("MRS%02d (%d) 0x%016llx:0x%016llx %s:rank %d a-side", WR_VREF_MRS, l_delay_enter,
263-
o_a_side.arr0, o_a_side.arr1, mss::c_str(i_target), i_rank);
264-
FAPI_INF("MRS%02d (%d) 0x%016llx:0x%016llx %s:rank %d b-side", WR_VREF_MRS, l_delay_enter,
265-
o_b_side.arr0, o_b_side.arr1, mss::c_str(i_target), i_rank);
266-
267-
fapi_try_exit:
268-
return fapi2::current_err;
269-
}
270-
271195
} // close namespace DDR4
272196
} // close namespace mss

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,6 @@ inline void disable_vref_train_enable(mrs06_data& io_mrs06)
107107
}
108108
}
109109

110-
///
111-
/// @brief helper function to setup a/b side MR06 commands for the latching function based upon TRAIN_ENABLE
112-
/// @param[in] i_mrs06, base MRS 06 allows the user to setup custom values and pass it in
113-
/// @param[in] i_rank, rank on which to latch MRS 06
114-
/// @param[out] o_a_side, a-side MR06 command
115-
/// @param[out] o_b_side, b-side MR06 command
116-
/// @return FAPI2_RC_SUCCESS if and only if ok
117-
///
118-
fapi2::ReturnCode setup_ab_side_vref_train_enable(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
119-
const mrs06_data& i_mrs06,
120-
const uint64_t& i_rank,
121-
ccs::instruction_t<fapi2::TARGET_TYPE_MCBIST>& o_a_side,
122-
ccs::instruction_t<fapi2::TARGET_TYPE_MCBIST>& o_b_side);
123-
124110
///
125111
/// @brief Add latching commands for WR VREF to the instruction array by a given rank
126112
/// @param[in] i_target, a fapi2::Target<TARGET_TYPE_MCA>

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

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,33 @@ using fapi2::FAPI2_RC_SUCCESS;
4848
namespace mss
4949
{
5050

51+
///
52+
/// @brief Sets up MRS CCS instructions
53+
/// @param[in] i_target a fapi2::Target DIMM
54+
/// @param[in] i_data the completed MRS data to send
55+
/// @param[in] i_rank the rank to send to
56+
/// @param[in,out] io_inst a vector of CCS instructions we should add to
57+
/// @return FAPI2_RC_SUCCESS if and only if ok
58+
///
59+
template< >
60+
fapi2::ReturnCode mrs_engine( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
61+
const mrs_data<fapi2::TARGET_TYPE_MCBIST>& i_data,
62+
const uint64_t i_rank,
63+
std::vector< ccs::instruction_t<fapi2::TARGET_TYPE_MCBIST> >& io_inst )
64+
{
65+
FAPI_TRY( mrs_engine(i_target, i_data, i_rank, i_data.iv_delay, io_inst) );
66+
67+
fapi_try_exit:
68+
return fapi2::current_err;
69+
}
70+
5171
namespace ddr4
5272
{
5373

5474
///
5575
/// @brief Perform the mrs_load DDR4 operations - TARGET_TYPE_DIMM specialization
5676
/// @param[in] i_target a fapi2::Target<TARGET_TYPE_DIMM>
57-
/// @param[in] io_inst a vector of CCS instructions we should add to
77+
/// @param[in,out] io_inst a vector of CCS instructions we should add to
5878
/// @return FAPI2_RC_SUCCESS if and only if ok
5979
///
6080
fapi2::ReturnCode mrs_load( const fapi2::Target<TARGET_TYPE_DIMM>& i_target,
@@ -89,38 +109,7 @@ fapi2::ReturnCode mrs_load( const fapi2::Target<TARGET_TYPE_DIMM>& i_target,
89109
{
90110
for (const auto& r : l_ranks)
91111
{
92-
// Note: this isn't general - assumes Nimbus via MCBIST instruction here BRS
93-
ccs::instruction_t<TARGET_TYPE_MCBIST> l_inst_a_side =
94-
ccs::mrs_command<TARGET_TYPE_MCBIST>(i_target, r, d.iv_mrs);
95-
ccs::instruction_t<TARGET_TYPE_MCBIST> l_inst_b_side;
96-
97-
// Thou shalt send 2 MRS, one for the a-side and the other inverted for the b-side.
98-
// If we're on an odd-rank then we need to mirror
99-
// So configure the A-side, mirror if necessary and invert for the B-side
100-
FAPI_TRY( d.iv_func(i_target, l_inst_a_side, r) );
101-
102-
FAPI_TRY( mss::address_mirror(i_target, r, l_inst_a_side) );
103-
l_inst_b_side = mss::address_invert(l_inst_a_side);
104-
105-
// Not sure if we can get tricky here and only delay after the b-side MR. The question is whether the delay
106-
// is needed/assumed by the register or is purely a DRAM mandated delay. We know we can't go wrong having
107-
// both delays but if we can ever confirm that we only need one we can fix this. BRS
108-
l_inst_a_side.arr1.insertFromRight<MCBIST_CCS_INST_ARR1_00_IDLES,
109-
MCBIST_CCS_INST_ARR1_00_IDLES_LEN>(d.iv_delay);
110-
l_inst_b_side.arr1.insertFromRight<MCBIST_CCS_INST_ARR1_00_IDLES,
111-
MCBIST_CCS_INST_ARR1_00_IDLES_LEN>(d.iv_delay);
112-
113-
// Dump out the 'decoded' MRS and trace the CCS instructions.
114-
FAPI_TRY( d.iv_dumper(l_inst_a_side, r) );
115-
116-
FAPI_INF("MRS%02d (%d) 0x%016llx:0x%016llx %s:rank %d a-side", uint8_t(d.iv_mrs), d.iv_delay,
117-
l_inst_a_side.arr0, l_inst_a_side.arr1, mss::c_str(i_target), r);
118-
FAPI_INF("MRS%02d (%d) 0x%016llx:0x%016llx %s:rank %d b-side", uint8_t(d.iv_mrs), d.iv_delay,
119-
l_inst_b_side.arr0, l_inst_b_side.arr1, mss::c_str(i_target), r);
120-
121-
// Add both to the CCS program
122-
io_inst.push_back(l_inst_a_side);
123-
io_inst.push_back(l_inst_b_side);
112+
FAPI_TRY( mrs_engine(i_target, d, r, io_inst) );
124113
}
125114
}
126115

0 commit comments

Comments
 (0)