Skip to content

Commit

Permalink
HTMGT: Save WOF reset reasons across all WOF resets
Browse files Browse the repository at this point in the history
-Add query command to retrieve these reset reasons

Change-Id: I55436031b73eff95ec7e69020050dad556f4809a
RTC:192844
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/61903
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
aalugore authored and dcrowell77 committed Jul 24, 2018
1 parent 98e6e05 commit d1c85ff
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 17 deletions.
8 changes: 8 additions & 0 deletions src/usr/htmgt/htmgt.C
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,14 @@ namespace HTMGT
}
break;



case PASSTHRU_WOF_RESET_REASONS:
TMGT_INF("passThruCommand: Query WOF Reset Reasons");
OccManager::getWOFResetReasons(o_rspLength, o_rspData);
break;


case PASSTHRU_OCC_CFG_DATA:
if (i_cmdLength == 3)
{
Expand Down
67 changes: 53 additions & 14 deletions src/usr/htmgt/htmgt_occ.C
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace HTMGT
iv_needsReset(false),
iv_needsWofReset(false),
iv_wofResetCount(0),
iv_wofResetReasons(0),
iv_failed(false),
iv_seqNumber(0),
iv_homer(i_homer),
Expand Down Expand Up @@ -1336,7 +1337,7 @@ namespace HTMGT
(0 == safeMode))
{
// Make sure OCCs were built first (so data is valid)
errlHndl_t err = _buildOccs(); // if not a already built.
errlHndl_t err = _buildOccs(); // if not already built.
if (err)
{
TMGT_ERR("_getOccData: failed to build OCC structures "
Expand Down Expand Up @@ -1396,6 +1397,35 @@ namespace HTMGT
o_length = index;
}

// Get WOF Reset reasons for all OCCs
// NOTE: Data returned is of the form [ 1-byte ID | 4-byte bit vector]
// per OCC instance found
void OccManager::_getWOFResetReasons(uint16_t & o_length,
uint8_t * o_data)
{
uint16_t index = 0;

// Make sure OCCs were built first (so data is valid)
errlHndl_t l_err = _buildOccs(); // if not already built.
if( l_err )
{
TMGT_ERR("_getWOFResetReasons: Failed to build OCC structures "
"rc=0x%04X", l_err->reasonCode());
ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID);
}

// Iterate through OCC objects to get bit vectors.
for( const auto & occ : iv_occArray )
{
o_data[index++] = occ->getInstance();
UINT32_PUT(&o_data[index], occ->getWofResetReasons());
index += 4;
}

o_length = index;
}



// Set default pstate table type and reset all OCCs to pick them up
errlHndl_t OccManager::_loadPstates(bool i_normalPstates)
Expand Down Expand Up @@ -1456,36 +1486,39 @@ namespace HTMGT
{
sys->tryGetAttr<TARGETING::ATTR_HTMGT_SAFEMODE>(safeMode);
}

for( const auto & occ : iv_occArray )
{
if (occ->iv_resetCount != 0)
if ( occ->iv_resetCount != 0 )
{
TMGT_INF("_clearResetCounts: Clearing OCC%d reset count "
"(was %d)",
occ->getInstance(),
occ->iv_resetCount);
occ->iv_resetCount = 0;
if (safeMode)
{
// Clear OCC flags (failed, commEstablished, etc)
occ->postResetClear();
}
}

if(occ->iv_wofResetCount != 0)
if( occ->iv_wofResetCount != 0 )
{
occ->iv_wofResetCount = 0;
TMGT_INF("_clearResetCounts: Clearing OCC%d WOF reset count "
"( was %d)",
occ->getInstance(),
occ->iv_wofResetCount);
if(safeMode)
{
// Clear OCC flags
occ->postResetClear();
}
}

if( occ->iv_wofResetReasons != 0 )
{
TMGT_INF("_clearResetCounts: Clearing OCC%d WOF reset reasons "
"( was 0x%08x)",
occ->getInstance(),
occ->iv_wofResetReasons );
}
if( safeMode )
{
// Clear OCC flags (failed, commEstablished, etc)
occ->postResetClear();
}

}

if (iv_sysResetCount != 0)
Expand Down Expand Up @@ -1584,6 +1617,12 @@ namespace HTMGT
Singleton<OccManager>::instance()._getOccData(o_length, o_data);
}

void OccManager::getWOFResetReasons(uint16_t & o_length, uint8_t * o_data)
{
Singleton<OccManager>::instance()._getWOFResetReasons(o_length,
o_data);
}

errlHndl_t OccManager::loadPstates(bool i_normalPstates)
{
return Singleton<OccManager>::instance()._loadPstates(i_normalPstates);
Expand Down
23 changes: 23 additions & 0 deletions src/usr/htmgt/htmgt_occ.H
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,14 @@ namespace HTMGT
uint8_t wofResetCount() { return iv_wofResetCount; }


/**
* @brief Returns a bit vector representing aggregate WOF
* resets reasons
*
* @return WOF Reset reason bit vector
*/
uint32_t getWofResetReasons() { return iv_wofResetReasons; }

/**
* @brief Return OCCs present bits
*
Expand Down Expand Up @@ -385,6 +393,8 @@ namespace HTMGT
bool iv_needsWofReset;
// WOF reset count
uint8_t iv_wofResetCount;
// WOF reset reason. Aggregate across all WOF resets until cleared.
uint32_t iv_wofResetReasons;
// true if OCC failed
bool iv_failed;
// Sequence number of last/current OCC command
Expand Down Expand Up @@ -604,6 +614,16 @@ namespace HTMGT
*/
static void getOccData(uint16_t & o_length, uint8_t *o_data);

/**
* @brief Collect WOF reset reasons for ALL OCCs
*
* @param[out] o_length Length of data returned in o_data
* @param[out] o_data Buffer containing all OCCs 32-bit
* WOF reset reason vector preceded by
* their instanceId
*/
static void getWOFResetReasons(uint16_t & o_length,
uint8_t * o_data);

/**
* @brief Load specified pstate tables for all OCCs.
Expand Down Expand Up @@ -771,6 +791,9 @@ namespace HTMGT
/** See getOccData() above */
void _getOccData(uint16_t & o_length, uint8_t *o_data);

/** See getWOFResetReasons above */
void _getWOFResetReasons(uint16_t & o_length, uint8_t *o_data);

/** See loadPstates() above */
errlHndl_t _loadPstates(bool i_normalPstates);

Expand Down
1 change: 1 addition & 0 deletions src/usr/htmgt/htmgt_utility.H
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ namespace HTMGT
//HOLD for future need. PASSTHRU_QUERY_MODE_FUNCTION = 0x07,
PASSTHRU_ENA_DIS_OPAL_STATE = 0x08,
PASSTHRU_SET_OCC_STATE = 0x09,
PASSTHRU_WOF_RESET_REASONS = 0x0A,
PASSTHRU_OCC_CFG_DATA = 0x0C,
};

Expand Down
23 changes: 20 additions & 3 deletions src/usr/htmgt/occError.C
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ namespace HTMGT

TMGT_BIN("OCC ELOG", l_occElog, 256);


// Get user details section
const occErrlUsrDtls_t *l_usrDtls_ptr = (occErrlUsrDtls_t *)
((uint8_t*)l_occElog + sizeof(occErrlEntry_t));

const uint32_t l_occSrc = OCCC_COMP_ID | l_occElog->reasonCode;
ERRORLOG::errlSeverity_t severity =
ERRORLOG::ERRL_SEV_INFORMATIONAL;
Expand All @@ -130,13 +135,27 @@ namespace HTMGT
bool l_occReset = false;
elogProcessActions(l_occElog->actions, l_occReset, severity);



// Need to add WOF reason code to OCC object regardless of
// whether WOF resets are disabled.
if( l_occElog->actions & TMGT_ERRL_ACTIONS_WOF_RESET_REQUIRED )
{
iv_wofResetReasons |= l_usrDtls_ptr->userData1;
TMGT_ERR("WOF Reset Reasons for OCC%d = 0x%08x",
iv_instance,
iv_wofResetReasons);

}

// Check if we need a WOF requested reset
if(iv_needsWofReset == true)
{
TMGT_ERR("WOF Reset detected! SRC = 0x%X",
l_occSrc);

// We compare against one less than the threshold because
// the WOF reset count doesnt get incremented until resetPrep
// the WOF reset count doesn't get incremented until resetPrep
if( iv_wofResetCount < (WOF_RESET_COUNT_THRESHOLD-1) )
{
// Not at WOF reset threshold yet. Set sev to INFO
Expand All @@ -156,8 +175,6 @@ namespace HTMGT
// srcs which have similar uniqueness
// NOTE: SRC tags are NOT required here as these logs will get
// parsed with the OCC src tags
const occErrlUsrDtls_t *l_usrDtls_ptr = (occErrlUsrDtls_t *)
((uint8_t*)l_occElog + sizeof(occErrlEntry_t));
bldErrLog(l_errlHndl,
(htmgtModuleId)(l_usrDtls_ptr->modId & 0x00FF),
(htmgtReasonCode)l_occSrc, // occ reason code
Expand Down

0 comments on commit d1c85ff

Please sign in to comment.