Skip to content

Commit

Permalink
Add polling after STR entry to ensure port is in STR before asserting…
Browse files Browse the repository at this point in the history
… RESETn

Change-Id: Ic28ca541a578daccc0b9df6d8ffa99622c9eda38
CQ:SW465520
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/78505
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/78869
Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
  • Loading branch information
Tsung Yeung authored and RAJA DAS committed Jun 14, 2019
1 parent 8384a96 commit c9667ef
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace workarounds
namespace nvdimm
{


// MBASTR0Q for each MCA
// Note: Since the scoms are executed at the chip, it needs the dedicated
// address for each MCA
Expand Down Expand Up @@ -89,6 +90,19 @@ constexpr const uint64_t FARB5Q_REG[] =
MCA_7_MBA_FARB5Q,
};

// FARB6Q for each MCA
constexpr const uint64_t FARB6Q_REG[] =
{
MCA_0_MBA_FARB6Q,
MCA_1_MBA_FARB6Q,
MCA_2_MBA_FARB6Q,
MCA_3_MBA_FARB6Q,
MCA_4_MBA_FARB6Q,
MCA_5_MBA_FARB6Q,
MCA_6_MBA_FARB6Q,
MCA_7_MBA_FARB6Q,
};

// MCB_CNTLQ
constexpr const uint64_t MCB_CNTLQ_REG[] =
{
Expand Down Expand Up @@ -118,7 +132,10 @@ fapi2::ReturnCode self_refresh_entry( const fapi2::Target<fapi2::TARGET_TYPE_PRO
FAPI_DBG("Entering STR on port %u.", l_mca_pos);

{
fapi2::buffer<uint64_t> l_mbarpc0_data, l_mbastr0_data, l_mcbcntlq_data;
fapi2::buffer<uint64_t> l_mbarpc0_data;
fapi2::buffer<uint64_t> l_mbastr0_data;
fapi2::buffer<uint64_t> l_mcbcntlq_data;
fapi2::buffer<uint64_t> l_mcafarb6q_data;
constexpr uint64_t ENABLE = 1;
constexpr uint64_t DISABLE = 0;
constexpr uint64_t MAXALL_MIN0 = 0b010;
Expand All @@ -127,6 +144,15 @@ fapi2::ReturnCode self_refresh_entry( const fapi2::Target<fapi2::TARGET_TYPE_PRO
constexpr uint64_t TIME_0 = 0;
const uint8_t l_mcbist = l_mca_pos < PORTS_PER_MCBIST ? 0 : 1;

// Variables for polling. Poll up to a second to make sure the port has entered STR
// Why a second? No idea. STR is controlled by the sequencer via power control.
// The settings are set to enter STR ASAP but a poll here would let us know
// if somehow the port is not in STR.
constexpr uint64_t POLL_ITERATION = 500;
constexpr uint64_t DELAY_2MS_IN_NS = 2000000;
bool l_in_str = false;
uint8_t l_sim = 0;

// Stop mcbist first otherwise it can kick the DIMM out of STR
FAPI_TRY(fapi2::getScom(i_target, MCB_CNTLQ_REG[l_mcbist], l_mcbcntlq_data));
l_mcbcntlq_data.writeBit<MCBIST_CCS_CNTLQ_STOP>(STOP);
Expand All @@ -149,6 +175,34 @@ fapi2::ReturnCode self_refresh_entry( const fapi2::Target<fapi2::TARGET_TYPE_PRO
// Step 3 - In MBARPC0Q, enable power domain control.
l_mbarpc0_data.writeBit<MCA_MBARPC0Q_CFG_MIN_MAX_DOMAINS_ENABLE>(ENABLE);
FAPI_TRY(fapi2::putScom(i_target, MBARPC0Q_REG[l_mca_pos], l_mbarpc0_data));

#ifndef __PPE__
FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_IS_SIMULATION, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), l_sim) );
#endif

if (!l_sim)
{
// Poll to make sure we are in STR before proceeding.
for (uint8_t i = 0; i < POLL_ITERATION; i++)
{
FAPI_TRY(fapi2::delay(DELAY_2MS_IN_NS, 0), "Error returned from fapi2::delay call");
FAPI_TRY(fapi2::getScom(i_target, FARB6Q_REG[l_mca_pos], l_mcafarb6q_data));

if (l_mcafarb6q_data.getBit<MCA_MBA_FARB6Q_CFG_STR_STATE>())
{
l_in_str = true;
break;
}
}

FAPI_ASSERT(l_in_str,
fapi2::MSS_STR_NOT_ENTERED().
set_PROC_TARGET(i_target).
set_MCA_POS(l_mca_pos).
set_MCA_FARB6Q(l_mcafarb6q_data).
set_STR_STATE(l_in_str),
"STR not entered on port %u", l_mca_pos);
}
}

fapi_try_exit:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,4 +509,17 @@
<priority>HIGH</priority>
</callout>
</hwpError>

<hwpError>
<rc>RC_MSS_STR_NOT_ENTERED</rc>
<description>Indicates a MCA has not entered STR within the allotted time</description>
<ffdc>PROC_TARGET</ffdc>
<ffdc>MCA_POS</ffdc>
<ffdc>MCA_FARB6Q</ffdc>
<ffdc>STR_STATE</ffdc>
<callout>
<procedure>CODE</procedure>
<priority>HIGH</priority>
</callout>
</hwpError>
</hwpErrors>

0 comments on commit c9667ef

Please sign in to comment.