Skip to content

Commit

Permalink
SBE error logging and handler cleanup
Browse files Browse the repository at this point in the history
This commit takes care of a few things
1) Removing the sbe threshold handler - we decided
   that retrying after the initial loop was overkill
2) Making use of the class structure - we added a lot
   of class elements to decrease things passed
   between functions and to facilitate debugging
3) Creating a main entry point and simplifying functions
   We decided that we wanted one function to handle all
   actions.  This also made some function irrelevant and
   as such they were removed.  Additionally, this also
   fixes an infinite circular logic bug.

Change-Id: I9556e3181226755150c3debd1471f1be23e13be4
RTC:180961
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/49886
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@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>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
e-liner authored and dcrowell77 committed Dec 13, 2017
1 parent 92466e6 commit e29c5cf
Show file tree
Hide file tree
Showing 9 changed files with 327 additions and 852 deletions.
174 changes: 105 additions & 69 deletions src/include/usr/sbeio/sbe_retry_handler.H
Expand Up @@ -22,8 +22,8 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
#ifndef __SBE_EXTRACT_DD_H
#define __SBE_EXTRACT_DD_H
#ifndef __SBE_RETRY_HANDLER_H
#define __SBE_RETRY_HANDLER_H

#include <isteps/hwpisteperror.H>
#include <p9_extract_sbe_rc.H>
Expand All @@ -36,6 +36,16 @@ class SbeRetryHandler
{
public:

static const uint8_t MAX_SWITCH_SIDE_COUNT = 2;

enum SBE_REG_RETURN
{
HWP_ERROR = 0, // Error returned from HWP
SBE_AT_RUNTIME = 1, // SBE is at runtime and booted
SBE_FAILED_TO_BOOT = 2, // SBE has failed to boot
PROC_DECONFIG = 3, // Deconfig done on Proc with SBE
};

/**
* @brief Get the instance of this class
*
Expand All @@ -53,28 +63,71 @@ class SbeRetryHandler
*/
~SbeRetryHandler();

enum SBE_REG_RETURN
/**************** Functions to return Class Elements ****************/
inline bool getSbeRestart()
{
HWP_ERROR = 0, // Error returned from HWP
SBE_AT_RUNTIME = 1, // SBE is at runtime and booted
SBE_FAILED_TO_BOOT = 2, // SBE has failed to boot
PROC_DECONFIG = 3, // Deconfig done on Proc with SBE
};
return this->iv_sbeRestarted;
}

inline uint8_t getSbeSide()
{
return this->iv_sbeSide;
}

inline bool getErrorLogged()
{
return this->iv_sbeErrorLogged;
}

inline uint32_t getPLID()
{
return this->iv_errorLogPLID;
}

inline uint8_t getSwitchCount()
{
return this->iv_switchSidesCount;
}

inline sbeMsgReg_t getSbeRegister()
{
return this->iv_sbeRegister;
}

inline P9_EXTRACT_SBE_RC::RETURN_ACTION getCurrentAction()
{
return this->iv_currentAction;
}

inline SBE_REG_RETURN getCurrentSBEState()
{
return this->iv_currentSBEState;
}

/**
* @brief This function is the main entry point for all of the
* SBE handler functions.
*
* @param[in] i_target - current proc target
* @param[in] i_actionSet - There are a few instances where we have
* to recall the main function. This variable is
* set so that we don't override the new action.
*/

void main_sbe_handler( TARGETING::Target * i_target, bool i_actionSet);

private:

/**
* @brief This function handles the SBE timeout and loops
* required to start it.
*
* @param[out] o_sbeReg - pointer to the sbe register
* @param[in] i_target - current proc target
* @param[out] o_returnAction - sbe returned action
*
* @return - error, NULL if no error
*/

errlHndl_t sbe_timeout_handler(sbeMsgReg_t * o_sbeReg,
TARGETING::Target * i_target,
SBE_REG_RETURN * o_returnAction);
errlHndl_t sbe_timeout_handler(TARGETING::Target * i_target);

/**
* @brief This function handles getting the SBE FFDC.
Expand All @@ -93,31 +146,12 @@ class SbeRetryHandler
* @brief This function handles the SBE failed to boot error.
*
* @param[in] i_target - current proc target
* @param[in] i_sbeReg - sbe register
* @param[out] o_regReturn - sbe reg return
*
* @return - NULL
* @return - bool: true if we need to retry
*/

void sbe_boot_fail_handler(TARGETING::Target * i_target,
sbeMsgReg_t i_sbeReg,
SBE_REG_RETURN * o_regReturn = nullptr);

/*
* @brief This function handles the HWP calls and error logs
* associated with them
*
* @param[in] i_target - current proc target
* @param[in] i_fromStateMachine - true: from state machine, false: not
* @param[in] i_current_condition - current sbe conditions value
*
* @return - sbe returned action
*
*/
P9_EXTRACT_SBE_RC::RETURN_ACTION handle_sbe_restart(
TARGETING::Target * i_target,
bool i_fromStateMachine,
P9_EXTRACT_SBE_RC::RETURN_ACTION i_current_condition);
bool sbe_boot_fail_handler(TARGETING::Target * i_target);

/**
* @brief This function deals with the mask needed to switch
Expand All @@ -129,41 +163,13 @@ class SbeRetryHandler
*/
errlHndl_t switch_sbe_sides(TARGETING::Target * i_target);

/**
* @brief This is the switch case that handles the different actions
* needed for each output of the proc_extract_sbe_rc HWP.
*
* @param[in] i_target - current proc target
* @param[in] i_current_error - The most recent return value from HWP
* @param[out] o_regReturn - sbe reg return
*
* @return - NULL
*/
void proc_extract_sbe_handler( TARGETING::Target * i_target,
uint8_t i_current_error,
SBE_REG_RETURN * io_regReturn = nullptr);

private:

/**
* @brief This function handles the SBE register value and the actions
* that go along with it. The state machine is handled
* separately, but every other instance of check_sbe_reg should
* be accompanied by this handler function.
* that go along with it.
*
* @param[in] i_target - current proc target
* @param[in] i_sbe_reg - enum value from check_sbe_reg
* @param[in] i_current_sbe_error - current sbe conditions value
* @param[in] i_fromStateMachine - if we are coming from state machine
* functions or not.
*
* @return - sbe returned action
*/
P9_EXTRACT_SBE_RC::RETURN_ACTION handle_sbe_reg_value(
TARGETING::Target * i_target,
SBE_REG_RETURN i_sbe_reg,
P9_EXTRACT_SBE_RC::RETURN_ACTION i_current_sbe_error,
bool i_fromStateMachine);
void handle_sbe_reg_value( TARGETING::Target * i_target);

/**
* @brief This is the switch case that identifies the action needed
Expand All @@ -177,14 +183,12 @@ class SbeRetryHandler

/**
* @brief This function handles the call to the p9_get_sbe_msg_handler.
* It determines what state the SBE is in and returns an enum
* that describes the future actions needed.
* It determines what state the SBE is in.
*
* @param[in] i_target - current proc target
*
* @return - SBE_REG_RETURN enum value describing the action needed
*/
SBE_REG_RETURN check_sbe_reg(TARGETING::Target * i_target);
void get_sbe_reg(TARGETING::Target * i_target);

/************************** Class Elements **************************/

Expand All @@ -196,13 +200,45 @@ class SbeRetryHandler
/*
* @brief True if we switched to the other side of the SBE
*/
bool iv_sbeOtherSide;
uint8_t iv_sbeSide;

/*
* @brief True if we logged an error during the SBE restart process
*/
bool iv_sbeErrorLogged;

/*
* @brief PLID of the unrecoverable error logged. NULL if no error
* was logged.
*/
uint32_t iv_errorLogPLID;

/*
* @brief Number of times we switch SBE sides. Max is 2
*/
uint8_t iv_switchSidesCount;

/*
* @brief The current sbe register
*/
sbeMsgReg_t iv_sbeRegister;

/*
* @brief The current SBE return action that has to be taken
*/
P9_EXTRACT_SBE_RC::RETURN_ACTION iv_currentAction;

/*
* @brief The current SBE state - booted, failed, or deconfig
*/
SBE_REG_RETURN iv_currentSBEState;

/*
* @brief There are a few situations in which we have to retrigger
* the main function. This variable ensures we do not fall into
* an infinite loop situation
*/
bool iv_retriggeredMain;

}; // End of class SbeRetryHandler

Expand Down
9 changes: 4 additions & 5 deletions src/include/usr/sbeio/sbeioreasoncodes.H
Expand Up @@ -111,14 +111,13 @@ enum sbeioReasonCode
SBEIO_MEM_REGION_DOES_NOT_EXIST = SBEIO_COMP_ID | 0x50,
SBEIO_EXCEEDS_MAXIMUM_MEM_REGIONS = SBEIO_COMP_ID | 0x51,

SBEIO_BOOTED_UNEXPECTED_SIDE_BKP = SBEIO_COMP_ID | 0x52,
SBEIO_BOOTED_UNEXPECTED_SIDE = SBEIO_COMP_ID | 0x52,
SBEIO_NO_RECOVERY_ACTION = SBEIO_COMP_ID | 0x53,
SBEIO_EXTRACT_RC_ERROR = SBEIO_COMP_ID | 0x54,
SBEIO_BOOT_FROM_BKP_SEEPROM = SBEIO_COMP_ID | 0x55,
SBEIO_BOOTED_UNEXPECTED_SIDE_UPD = SBEIO_COMP_ID | 0x56,
SBEIO_INCORRECT_FCN_CALL = SBEIO_COMP_ID | 0x57,
SBEIO_RETURNED_FFDC = SBEIO_COMP_ID | 0x58,
SBEIO_SLAVE_TIMEOUT = SBEIO_COMP_ID | 0x59,
SBEIO_INCORRECT_FCN_CALL = SBEIO_COMP_ID | 0x56,
SBEIO_RETURNED_FFDC = SBEIO_COMP_ID | 0x57,
SBEIO_SLAVE_TIMEOUT = SBEIO_COMP_ID | 0x58,

// Remove once we collect the FFDC ourselves - @todo-RTC:144313
//termination_rc
Expand Down
Expand Up @@ -124,54 +124,17 @@ void* call_proc_check_slave_sbe_seeprom_complete( void *io_pArgs )
const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> l_fapi2ProcTarget(
const_cast<TARGETING::Target*> (l_cpu_target));

sbeMsgReg_t l_sbeReg;

TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"Running p9_get_sbe_msg_register HWP"
" on processor target %.8X",
TARGETING::get_huid(l_cpu_target));

SBEIO::SbeRetryHandler::SBE_REG_RETURN l_ret =
SBEIO::SbeRetryHandler::SBE_REG_RETURN::SBE_FAILED_TO_BOOT;

l_errl = SBEIO::SbeRetryHandler::getInstance().sbe_timeout_handler(
&l_sbeReg,l_cpu_target,&l_ret);

if((!l_errl) && (l_sbeReg.currState != SBE_STATE_RUNTIME))
{
// See if async FFDC bit is set in SBE register
if(l_sbeReg.asyncFFDC)
{
bool l_flowCtrl = SBEIO::SbeRetryHandler::getInstance().
sbe_get_ffdc_handler(l_cpu_target);

if(l_flowCtrl)
{
continue;
}
}

// Handle that SBE failed to boot in the allowed time
SBEIO::SbeRetryHandler::getInstance().sbe_boot_fail_handler(
l_cpu_target,l_sbeReg);
}
else if (l_errl)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR : call p9_check_slave_sbe_seeprom_complete, "
"PLID=0x%x", l_errl->plid() );

// capture the target data in the elog
ErrlUserDetailsTarget(l_cpu_target).addToLog( l_errl );
SBEIO::SbeRetryHandler l_SBEobj = SBEIO::SbeRetryHandler();

// Create IStep error log and cross reference to error
l_stepError.addErrorDetails( l_errl );
l_SBEobj.main_sbe_handler(l_cpu_target,false);

// Commit error log
errlCommit( l_errl, HWPF_COMP_ID );
}
// No error and still functional
else if(l_cpu_target->getAttr<ATTR_HWAS_STATE>().functional)
if(l_cpu_target->getAttr<ATTR_HWAS_STATE>().functional)
{
// Set attribute indicating that SBE is started
l_cpu_target->setAttr<ATTR_SBE_IS_STARTED>(1);
Expand Down
1 change: 0 additions & 1 deletion src/usr/sbeio/makefile
Expand Up @@ -55,7 +55,6 @@ OBJS += sbe_memRegionMgr.o
OBJS += sbe_fifo_buffer.o
OBJS += sbe_ffdc_package_parser.o
OBJS += sbe_attn.o
OBJS += sbe_threshold_fsm.o
OBJS += sbe_retry_handler.o

VPATH += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/perv/
Expand Down

0 comments on commit e29c5cf

Please sign in to comment.