summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorElizabeth Liner <eliner@us.ibm.com>2017-10-12 14:33:16 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-12-08 09:55:12 -0500
commit351f3287bba4fbf53d3d9d0701c1c4f0023d8cfe (patch)
tree23da1b55927101ff6680530d76bfec9ed37c6f4c /src
parentb801fd1a776fe7198359f9c2cb28c227d98a7f52 (diff)
downloadtalos-hostboot-351f3287bba4fbf53d3d9d0701c1c4f0023d8cfe.tar.gz
talos-hostboot-351f3287bba4fbf53d3d9d0701c1c4f0023d8cfe.zip
Create base class structure for SbeRetryHandler
This commit restructures the sbe_extract_rc_handler code into its own class. Change-Id: Ib6ecb1a67353b060a6578b13da951b276bc93ca7 RTC:180961 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48511 Reviewed-by: Martin Gloff <mgloff@us.ibm.com> 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> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/sbeio/sbe_extract_rc_handler.H157
-rw-r--r--src/include/usr/sbeio/sbe_retry_handler.H205
-rw-r--r--src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C16
-rw-r--r--src/usr/sbeio/makefile2
-rw-r--r--src/usr/sbeio/sbe_retry_handler.C (renamed from src/usr/sbeio/sbe_extract_rc_handler.C)104
-rw-r--r--src/usr/sbeio/sbe_threshold_fsm.C35
-rw-r--r--src/usr/sbeio/sbe_threshold_fsm.H21
7 files changed, 318 insertions, 222 deletions
diff --git a/src/include/usr/sbeio/sbe_extract_rc_handler.H b/src/include/usr/sbeio/sbe_extract_rc_handler.H
deleted file mode 100644
index db22267f5..000000000
--- a/src/include/usr/sbeio/sbe_extract_rc_handler.H
+++ /dev/null
@@ -1,157 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/include/usr/sbeio/sbe_extract_rc_handler.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2017 */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
-/* implied. See the License for the specific language governing */
-/* permissions and limitations under the License. */
-/* */
-/* IBM_PROLOG_END_TAG */
-#ifndef __SBE_EXTRACT_RC_HANDLER_H
-#define __SBE_EXTRACT_RC_HANDLER_H
-
-#include <isteps/hwpisteperror.H>
-#include <p9_extract_sbe_rc.H>
-#include <p9_get_sbe_msg_register.H>
-
-enum SBE_REG_RETURN
-{
- FUNCTION_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
-};
-
-/**
- * @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
- *
- * @return - NULL
- */
-void proc_extract_sbe_handler( TARGETING::Target * i_target,
- uint8_t i_current_error);
-
-/**
- * @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.
- *
- * @param[in] i_target - current proc target
- *
- * @return - SBE_REG_RETURN enum value describing the action needed next
- */
-SBE_REG_RETURN check_sbe_reg(TARGETING::Target * i_target);
-
-/**
- * @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.
- *
- * @param[in] i_target - current proc target
- * @param[in] i_sbe_reg - returned 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);
-
-/**
- * @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);
-
-/**
- * @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);
-
-/**
- * @brief This is the switch case that identifies the action needed for the RC
- * value in an SBE FFDC package.
- *
- * @param[in] i_rc - RC value from SBE FFDC package
- *
- * @return - pass(0) or specific returned SBE action
- */
-P9_EXTRACT_SBE_RC::RETURN_ACTION action_for_ffdc_rc( uint32_t i_rc);
-
-/**
- * @brief This function handles getting the SBE FFDC.
- *
- * @param[in] i_target - current proc target
- *
- * @return - bool for flow control on return to caller, if false, caller should
- * go on with the processing flow, if true, caller should interrupt
- * the processing flow and get out of loop or current iteration
- */
-
-bool sbe_get_ffdc_handler(TARGETING::Target * i_target);
-
-/**
- * @brief This function handles the SBE failed to boot error.
- *
- * @param[in] i_target - current proc target
- * @param[in] i_sbeReg - sbe register
- *
- * @return - NULL
- */
-
-void sbe_boot_fail_handler(TARGETING::Target * i_target,
- sbeMsgReg_t i_sbeReg);
-
-/**
- * @brief This function deals with the mask needed to switch
- * boot side on the SBE for a given proc
- *
- * @param[in] i_target - current proc target
- *
- * @return - error, NULL if no error
- */
-errlHndl_t switch_sbe_sides(TARGETING::Target * i_target);
-
-#endif
diff --git a/src/include/usr/sbeio/sbe_retry_handler.H b/src/include/usr/sbeio/sbe_retry_handler.H
new file mode 100644
index 000000000..3cbfb654c
--- /dev/null
+++ b/src/include/usr/sbeio/sbe_retry_handler.H
@@ -0,0 +1,205 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/sbeio/sbe_retry_handler.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __SBE_EXTRACT_DD_H
+#define __SBE_EXTRACT_DD_H
+
+#include <isteps/hwpisteperror.H>
+#include <p9_extract_sbe_rc.H>
+#include <p9_get_sbe_msg_register.H>
+
+namespace SBEIO
+{
+
+class SbeRetryHandler
+{
+ public:
+
+ /**
+ * @brief Get the instance of this class
+ *
+ * @return the instance of SbeRetryHandler
+ */
+ NEVER_INLINE static SbeRetryHandler& getInstance();
+
+ /**
+ * @brief Constructor
+ */
+ SbeRetryHandler();
+
+ /**
+ * @brief Destructor
+ */
+ ~SbeRetryHandler();
+
+ 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
+ };
+
+ /**
+ * @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);
+
+ /**
+ * @brief This function handles getting the SBE FFDC.
+ *
+ * @param[in] i_target - current proc target
+ *
+ * @return - bool for flow control on return to caller, if false,
+ * caller should go on with the processing flow, if true,
+ * caller should interrupt the processing flow and get out
+ * of loop or current iteration
+ */
+
+ bool sbe_get_ffdc_handler(TARGETING::Target * i_target);
+
+ /**
+ * @brief This function handles the SBE failed to boot error.
+ *
+ * @param[in] i_target - current proc target
+ * @param[in] i_sbeReg - sbe register
+ *
+ * @return - NULL
+ */
+
+ void sbe_boot_fail_handler(TARGETING::Target * i_target,
+ sbeMsgReg_t i_sbeReg);
+
+ /*
+ * @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);
+
+ /**
+ * @brief This function deals with the mask needed to switch
+ * boot side on the SBE for a given proc
+ *
+ * @param[in] i_target - current proc target
+ *
+ * @return - error, NULL if no error
+ */
+ 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
+ *
+ * @return - NULL
+ */
+ void proc_extract_sbe_handler( TARGETING::Target * i_target,
+ uint8_t i_current_error);
+
+ 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.
+ *
+ * @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);
+
+ /**
+ * @brief This is the switch case that identifies the action needed
+ * for the RC value in an SBE FFDC package.
+ *
+ * @param[in] i_rc - RC value from SBE FFDC package
+ *
+ * @return - pass(0) or specific returned SBE action
+ */
+ P9_EXTRACT_SBE_RC::RETURN_ACTION action_for_ffdc_rc( uint32_t i_rc);
+
+ /**
+ * @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.
+ *
+ * @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);
+
+ /************************** Class Elements **************************/
+
+ /*
+ * @brief True if we successfully restarted the SBE
+ */
+ bool iv_sbeRestarted;
+
+ /*
+ * @brief True if we switched to the other side of the SBE
+ */
+ bool iv_sbeOtherSide;
+
+ /*
+ * @brief True if we logged an error during the SBE restart process
+ */
+ bool iv_sbeErrorLogged;
+
+
+}; // End of class SbeRetryHandler
+
+} // End of namespace SBEIO
+#endif
diff --git a/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C b/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C
index b3419510e..dd4e98b6d 100644
--- a/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C
+++ b/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C
@@ -64,7 +64,7 @@
#include <p9_extract_sbe_rc.H>
#include <p9_get_sbe_msg_register.H>
#include <p9_getecid.H>
-#include <sbeio/sbe_extract_rc_handler.H>
+#include <sbeio/sbe_retry_handler.H>
using namespace ISTEP;
using namespace ISTEP_ERROR;
@@ -127,16 +127,19 @@ void* call_proc_check_slave_sbe_seeprom_complete( void *io_pArgs )
" on processor target %.8X",
TARGETING::get_huid(l_cpu_target));
- SBE_REG_RETURN l_ret = SBE_REG_RETURN::SBE_FAILED_TO_BOOT;
+ SBEIO::SbeRetryHandler::SBE_REG_RETURN l_ret =
+ SBEIO::SbeRetryHandler::SBE_REG_RETURN::SBE_FAILED_TO_BOOT;
- l_errl = sbe_timeout_handler(&l_sbeReg,l_cpu_target,&l_ret);
+ 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 = sbe_get_ffdc_handler(l_cpu_target);
+ bool l_flowCtrl = SBEIO::SbeRetryHandler::getInstance().
+ sbe_get_ffdc_handler(l_cpu_target);
if(l_flowCtrl)
{
@@ -145,7 +148,8 @@ void* call_proc_check_slave_sbe_seeprom_complete( void *io_pArgs )
}
// Handle that SBE failed to boot in the allowed time
- sbe_boot_fail_handler(l_cpu_target,l_sbeReg);
+ SBEIO::SbeRetryHandler::getInstance().sbe_boot_fail_handler(
+ l_cpu_target,l_sbeReg);
}
else if (l_errl)
{
@@ -156,7 +160,7 @@ void* call_proc_check_slave_sbe_seeprom_complete( void *io_pArgs )
// capture the target data in the elog
ErrlUserDetailsTarget(l_cpu_target).addToLog( l_errl );
- // Create IStep error log and cross reference to error that occurred
+ // Create IStep error log and cross reference to error
l_stepError.addErrorDetails( l_errl );
// Commit error log
diff --git a/src/usr/sbeio/makefile b/src/usr/sbeio/makefile
index 5f8af1adc..c13f1e4af 100644
--- a/src/usr/sbeio/makefile
+++ b/src/usr/sbeio/makefile
@@ -56,7 +56,7 @@ OBJS += sbe_fifo_buffer.o
OBJS += sbe_ffdc_package_parser.o
OBJS += sbe_attn.o
OBJS += sbe_threshold_fsm.o
-OBJS += sbe_extract_rc_handler.o
+OBJS += sbe_retry_handler.o
VPATH += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/perv/
include ${ROOTPATH}/procedure.rules.mk
diff --git a/src/usr/sbeio/sbe_extract_rc_handler.C b/src/usr/sbeio/sbe_retry_handler.C
index 703179f7a..0e6679ee1 100644
--- a/src/usr/sbeio/sbe_extract_rc_handler.C
+++ b/src/usr/sbeio/sbe_retry_handler.C
@@ -1,7 +1,7 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/usr/sbeio/sbe_extract_rc_handler.C $ */
+/* $Source: src/usr/sbeio/sbe_retry_handler.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
@@ -23,7 +23,7 @@
/* */
/* IBM_PROLOG_END_TAG */
/**
- * @file sbe_extract_rc_handler.C
+ * @file sbe_extract_dd.C
*
* Handle a SBE extract rc error. We use a switch-case to determine
* what action to take, and a finite state machine to control the
@@ -51,7 +51,6 @@
#include <p9_start_cbs.H>
#include <p9_get_sbe_msg_register.H>
#include <p9_perv_scom_addresses.H>
-#include <sbeio/sbe_extract_rc_handler.H>
#include <sbe/sbe_update.H>
#include <sbeio/sbeioif.H>
#include <sbeio/sbe_sp_intf.H>
@@ -64,18 +63,42 @@
extern trace_desc_t* g_trac_sbeio;
#define SBE_TRACF(printf_string,args...) \
- TRACFCOMP(g_trac_sbeio,"sbe_extract_rc_handler.C: " printf_string,##args)
+ TRACFCOMP(g_trac_sbeio,"sbe_retry_handler.C: " printf_string,##args)
#define SBE_TRACD(printf_string,args...) \
- TRACDCOMP(g_trac_sbeio,"sbe_extract_rc_handler.C: " printf_string,##args)
+ TRACDCOMP(g_trac_sbeio,"sbe_retry_handler.C: " printf_string,##args)
#define SBE_TRACU(args...)
#define SBE_TRACFBIN(printf_string,args...) \
- TRACFBIN(g_trac_sbeio,"sbe_extract_rc_handler.C: " printf_string,##args)
+ TRACFBIN(g_trac_sbeio,"sbe_retry_handler.C: " printf_string,##args)
#define SBE_TRACDBIN(printf_string,args...) \
- TRACDBIN(g_trac_sbeio,"sbe_extract_rc_handler.C: " printf_string,##args)
+ TRACDBIN(g_trac_sbeio,"sbe_retry_handler.C: " printf_string,##args)
-using namespace SBEIO;
+namespace SBEIO
+{
+
+/**
+ * @brief Static instance function
+ */
+SbeRetryHandler& SbeRetryHandler::getInstance()
+{
+ return Singleton<SbeRetryHandler>::instance();
+}
+
+SbeRetryHandler::SbeRetryHandler()
+: iv_sbeRestarted(false)
+, iv_sbeOtherSide(false)
+, iv_sbeErrorLogged(false)
+{
+ SBE_TRACF(ENTER_MRK "SbeRetryHandler::SbeRetryHandler()");
-void proc_extract_sbe_handler( TARGETING::Target * i_target,
+ SBE_TRACF(EXIT_MRK "SbeRetryHandler::SbeRetryHandler()");
+}
+
+SbeRetryHandler::~SbeRetryHandler()
+{
+
+}
+
+void SbeRetryHandler::proc_extract_sbe_handler( TARGETING::Target * i_target,
uint8_t i_current_error)
{
SBE_TRACF(ENTER_MRK "proc_extract_sbe_handler error: %x",
@@ -118,7 +141,7 @@ void proc_extract_sbe_handler( TARGETING::Target * i_target,
SBE_TRACF("Running p9_start_cbs HWP on processor target %.8X",
TARGETING::get_huid(i_target));
- handle_sbe_restart(i_target, false,
+ this->handle_sbe_restart(i_target, false,
P9_EXTRACT_SBE_RC::RESTART_SBE);
break;
}
@@ -146,7 +169,7 @@ void proc_extract_sbe_handler( TARGETING::Target * i_target,
const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
l_fapi2_proc_target(i_target);
- l_errl = switch_sbe_sides(i_target);
+ l_errl = this->switch_sbe_sides(i_target);
if(l_errl)
{
errlCommit(l_errl,ISTEP_COMP_ID);
@@ -160,7 +183,7 @@ void proc_extract_sbe_handler( TARGETING::Target * i_target,
SBE_TRACF( "Running p9_start_cbs HWP on processor target %.8X",
TARGETING::get_huid(i_target));
- handle_sbe_restart(i_target, false,
+ this->handle_sbe_restart(i_target, false,
P9_EXTRACT_SBE_RC::REIPL_BKP_SEEPROM);
if(i_target->getAttr<TARGETING::ATTR_SBE_IS_STARTED>())
@@ -190,7 +213,7 @@ void proc_extract_sbe_handler( TARGETING::Target * i_target,
const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
l_fapi2_proc_target(i_target);
- l_errl = switch_sbe_sides(i_target);
+ l_errl = this->switch_sbe_sides(i_target);
if(l_errl)
{
errlCommit(l_errl,ISTEP_COMP_ID);
@@ -205,7 +228,7 @@ void proc_extract_sbe_handler( TARGETING::Target * i_target,
SBE_TRACF( "Running p9_start_cbs HWP on processor target %.8X",
TARGETING::get_huid(i_target));
- handle_sbe_restart(i_target, false,
+ this->handle_sbe_restart(i_target, false,
P9_EXTRACT_SBE_RC::REIPL_UPD_SEEPROM);
if(i_target->getAttr<TARGETING::ATTR_SBE_IS_STARTED>())
@@ -287,12 +310,14 @@ void proc_extract_sbe_handler( TARGETING::Target * i_target,
return;
}
-SBE_REG_RETURN check_sbe_reg(TARGETING::Target * i_target)
+SbeRetryHandler::SBE_REG_RETURN SbeRetryHandler::check_sbe_reg(
+ TARGETING::Target * i_target)
{
SBE_TRACF(ENTER_MRK "check_sbe_reg");
errlHndl_t l_errl = nullptr;
- SBE_REG_RETURN l_ret = SBE_REG_RETURN::SBE_FAILED_TO_BOOT;
+ SbeRetryHandler::SBE_REG_RETURN l_ret =
+ SbeRetryHandler::SBE_REG_RETURN::SBE_FAILED_TO_BOOT;
do
{
@@ -301,14 +326,14 @@ SBE_REG_RETURN check_sbe_reg(TARGETING::Target * i_target)
sbeMsgReg_t l_sbeReg;
- l_errl = sbe_timeout_handler(&l_sbeReg,i_target,&l_ret);
+ l_errl = this->sbe_timeout_handler(&l_sbeReg,i_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 = sbe_get_ffdc_handler(i_target);
+ bool l_flowCtrl = this->sbe_get_ffdc_handler(i_target);
if(l_flowCtrl)
{
@@ -317,7 +342,7 @@ SBE_REG_RETURN check_sbe_reg(TARGETING::Target * i_target)
}
// Handle that SBE failed to boot in the allowed time
- sbe_boot_fail_handler(i_target,l_sbeReg);
+ this->sbe_boot_fail_handler(i_target,l_sbeReg);
}
else if (l_errl)
{
@@ -346,9 +371,9 @@ SBE_REG_RETURN check_sbe_reg(TARGETING::Target * i_target)
}
-P9_EXTRACT_SBE_RC::RETURN_ACTION handle_sbe_reg_value(
+P9_EXTRACT_SBE_RC::RETURN_ACTION SbeRetryHandler::handle_sbe_reg_value(
TARGETING::Target * i_target,
- SBE_REG_RETURN i_sbe_reg,
+ SbeRetryHandler::SBE_REG_RETURN i_sbe_reg,
P9_EXTRACT_SBE_RC::RETURN_ACTION i_current_sbe_error,
bool i_fromStateMachine)
{
@@ -359,18 +384,18 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION handle_sbe_reg_value(
switch(i_sbe_reg)
{
- case SBE_REG_RETURN::FUNCTION_ERROR:
+ case SbeRetryHandler::SBE_REG_RETURN::HWP_ERROR:
{
// There has been a failure getting the SBE register
// We cannot continue any further, return failure.
return P9_EXTRACT_SBE_RC::NO_RECOVERY_ACTION;
}
- case SBE_REG_RETURN::SBE_AT_RUNTIME:
+ case SbeRetryHandler::SBE_REG_RETURN::SBE_AT_RUNTIME:
{
// The SBE has successfully booted at runtime
return P9_EXTRACT_SBE_RC::ERROR_RECOVERED;
}
- case SBE_REG_RETURN::SBE_FAILED_TO_BOOT:
+ case SbeRetryHandler::SBE_REG_RETURN::SBE_FAILED_TO_BOOT:
{
if((!i_fromStateMachine) &&
(i_current_sbe_error == P9_EXTRACT_SBE_RC::REIPL_UPD_SEEPROM))
@@ -424,12 +449,14 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION handle_sbe_reg_value(
if(i_current_sbe_error == P9_EXTRACT_SBE_RC::REIPL_BKP_SEEPROM)
{
// Call sbe_threshold handler on the opposite side
- SBE_FSM::sbe_threshold_handler(false, i_target, l_rcAction, l_prevError);
+ SBE_FSM::sbe_threshold_handler(false, i_target, l_rcAction,
+ l_prevError, this);
}
else
{
// Call sbe_threshold handler on the same side
- SBE_FSM::sbe_threshold_handler(true, i_target, l_rcAction, l_prevError);
+ SBE_FSM::sbe_threshold_handler(true, i_target, l_rcAction,
+ l_prevError, this);
}
return P9_EXTRACT_SBE_RC::ERROR_RECOVERED;
}
@@ -459,7 +486,7 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION handle_sbe_reg_value(
}
}
-P9_EXTRACT_SBE_RC::RETURN_ACTION handle_sbe_restart(
+P9_EXTRACT_SBE_RC::RETURN_ACTION SbeRetryHandler::handle_sbe_restart(
TARGETING::Target * i_target,
bool i_fromStateMachine,
P9_EXTRACT_SBE_RC::RETURN_ACTION i_current_condition)
@@ -479,18 +506,18 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION handle_sbe_restart(
errlCommit(l_errl, ISTEP_COMP_ID);
}
- SBE_REG_RETURN l_checkSBE = check_sbe_reg(i_target);
+ SbeRetryHandler::SBE_REG_RETURN l_checkSBE = check_sbe_reg(i_target);
return handle_sbe_reg_value(i_target, l_checkSBE,
i_current_condition, i_fromStateMachine);
}
-errlHndl_t sbe_timeout_handler(sbeMsgReg_t * o_sbeReg,
+errlHndl_t SbeRetryHandler::sbe_timeout_handler(sbeMsgReg_t * o_sbeReg,
TARGETING::Target * i_target,
- SBE_REG_RETURN * o_returnAction)
+ SbeRetryHandler::SBE_REG_RETURN * o_returnAction)
{
errlHndl_t l_errl = NULL;
- (*o_returnAction) = SBE_FAILED_TO_BOOT;
+ (*o_returnAction) = SbeRetryHandler::SBE_REG_RETURN::SBE_FAILED_TO_BOOT;
const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
l_fapi2_proc_target(i_target);
@@ -520,7 +547,7 @@ errlHndl_t sbe_timeout_handler(sbeMsgReg_t * o_sbeReg,
"on loop %d",
l_errl->plid(),
l_loops );
- (*o_returnAction) = SBE_REG_RETURN::FUNCTION_ERROR;
+ (*o_returnAction) = SbeRetryHandler::SBE_REG_RETURN::HWP_ERROR;
break;
}
else if ((*o_sbeReg).currState == SBE_STATE_RUNTIME)
@@ -529,7 +556,7 @@ errlHndl_t sbe_timeout_handler(sbeMsgReg_t * o_sbeReg,
"on loop %d",
TARGETING::get_huid(i_target), (*o_sbeReg).reg,
l_loops);
- (*o_returnAction) = SBE_REG_RETURN::SBE_AT_RUNTIME;
+ (*o_returnAction) = SbeRetryHandler::SBE_REG_RETURN::SBE_AT_RUNTIME;
break;
}
else if ((*o_sbeReg).asyncFFDC)
@@ -575,7 +602,8 @@ errlHndl_t sbe_timeout_handler(sbeMsgReg_t * o_sbeReg,
return l_errl;
}
-P9_EXTRACT_SBE_RC::RETURN_ACTION action_for_ffdc_rc(uint32_t i_rc)
+P9_EXTRACT_SBE_RC::RETURN_ACTION SbeRetryHandler::action_for_ffdc_rc(
+ uint32_t i_rc)
{
P9_EXTRACT_SBE_RC::RETURN_ACTION l_action;
@@ -632,7 +660,7 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION action_for_ffdc_rc(uint32_t i_rc)
return l_action;
}
-bool sbe_get_ffdc_handler(TARGETING::Target * i_target)
+bool SbeRetryHandler::sbe_get_ffdc_handler(TARGETING::Target * i_target)
{
bool l_flowCtrl = false;
errlHndl_t l_errl = nullptr;
@@ -730,7 +758,7 @@ bool sbe_get_ffdc_handler(TARGETING::Target * i_target)
return l_flowCtrl;
}
-void sbe_boot_fail_handler(TARGETING::Target * i_target,
+void SbeRetryHandler::sbe_boot_fail_handler(TARGETING::Target * i_target,
sbeMsgReg_t i_sbeReg)
{
errlHndl_t l_errl = nullptr;
@@ -815,7 +843,7 @@ void sbe_boot_fail_handler(TARGETING::Target * i_target,
return;
}
-errlHndl_t switch_sbe_sides(TARGETING::Target * i_target)
+errlHndl_t SbeRetryHandler::switch_sbe_sides(TARGETING::Target * i_target)
{
errlHndl_t l_errl = NULL;
fapi2::buffer<uint32_t> l_read_reg;
@@ -879,4 +907,4 @@ errlHndl_t switch_sbe_sides(TARGETING::Target * i_target)
return l_errl;
}
-
+} // End of namespace SBEIO
diff --git a/src/usr/sbeio/sbe_threshold_fsm.C b/src/usr/sbeio/sbe_threshold_fsm.C
index 759101499..81f2b1aa3 100644
--- a/src/usr/sbeio/sbe_threshold_fsm.C
+++ b/src/usr/sbeio/sbe_threshold_fsm.C
@@ -31,10 +31,9 @@
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
#include <ipmi/ipmiwatchdog.H>
-
-#include <sbeio/sbeioreasoncodes.H>
+#include <sbeio/sbe_retry_handler.H>
#include "sbe_threshold_fsm.H"
-#include <sbeio/sbe_extract_rc_handler.H>
+#include <sbeio/sbeioreasoncodes.H>
extern trace_desc_t* g_trac_sbeio;
@@ -57,7 +56,8 @@ namespace SBE_FSM
P9_EXTRACT_SBE_RC::RETURN_ACTION (* sbe_handler_state[])(
TARGETING::Target * i_target,
- uint8_t i_prev_error) =
+ uint8_t i_prev_error,
+ SbeRetryHandler * i_obj) =
{ same_side_retry_state, // SAME_SIDE_RETRY
other_side_state, // OTHER_SIDE
working_exit_state, // WORKING_EXIT
@@ -91,7 +91,8 @@ enum STATE_CODES get_next_state( enum STATE_CODES i_src, uint8_t i_rc )
void sbe_threshold_handler( bool i_procSide,
TARGETING::Target * i_target,
P9_EXTRACT_SBE_RC::RETURN_ACTION i_initialAction,
- uint8_t i_previousError)
+ uint8_t i_previousError,
+ SbeRetryHandler * i_obj )
{
// Note: This is set up as a finite state machine since all actions are
// connected and most of them lead to another.
@@ -107,7 +108,7 @@ void sbe_threshold_handler( bool i_procSide,
// Setup the rest of the FSM
P9_EXTRACT_SBE_RC::RETURN_ACTION l_returnedAction;
P9_EXTRACT_SBE_RC::RETURN_ACTION (*state_fcn)(TARGETING::Target * i_target,
- uint8_t i_orig_error );
+ uint8_t i_orig_error, SbeRetryHandler * i_obj);
// Begin FSM
for(;;)
@@ -125,7 +126,7 @@ void sbe_threshold_handler( bool i_procSide,
#endif
state_fcn = SBE_FSM::sbe_handler_state[cur_state];
- l_returnedAction = state_fcn(i_target, i_initialAction);
+ l_returnedAction = state_fcn(i_target, i_initialAction, i_obj);
if( cur_state == WORKING_EXIT ||
cur_state == FAILING_EXIT)
@@ -144,20 +145,22 @@ void sbe_threshold_handler( bool i_procSide,
P9_EXTRACT_SBE_RC::RETURN_ACTION same_side_retry_state(
TARGETING::Target * i_target,
- uint8_t i_orig_error)
+ uint8_t i_orig_error,
+ SbeRetryHandler * i_obj)
{
SBE_FSM_TRACF("Running p9_start_cbs HWP on processor target %.8X",
TARGETING::get_huid(i_target));
// We don't actually need an accurate p9_extract_sbe_rc value if
// we're coming from the state machine, so we send in a pass.
- return handle_sbe_restart(i_target,true,
+ return i_obj->handle_sbe_restart(i_target,true,
P9_EXTRACT_SBE_RC::ERROR_RECOVERED);
}
P9_EXTRACT_SBE_RC::RETURN_ACTION other_side_state(
TARGETING::Target * i_target,
- uint8_t i_orig_error)
+ uint8_t i_orig_error,
+ SbeRetryHandler * i_obj)
{
SBE_FSM_TRACF("Running p9_start_cbs HWP on processor target %.8X",
TARGETING::get_huid(i_target));
@@ -168,7 +171,7 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION other_side_state(
const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
l_fapi2_proc_target(i_target);
- l_errl = switch_sbe_sides(i_target);
+ l_errl = i_obj->switch_sbe_sides(i_target);
if(l_errl)
{
errlCommit(l_errl,ISTEP_COMP_ID);
@@ -178,7 +181,7 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION other_side_state(
// We don't actually need an accurate p9_extract_sbe_rc value if
// we're coming from the state machine, so we send in a pass.
P9_EXTRACT_SBE_RC::RETURN_ACTION l_ret =
- handle_sbe_restart(i_target, true,
+ i_obj->handle_sbe_restart(i_target, true,
P9_EXTRACT_SBE_RC::ERROR_RECOVERED);
if(i_target->getAttr<TARGETING::ATTR_SBE_IS_STARTED>())
{
@@ -209,14 +212,16 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION other_side_state(
P9_EXTRACT_SBE_RC::RETURN_ACTION working_exit_state(
TARGETING::Target * i_target,
- uint8_t i_orig_error)
+ uint8_t i_orig_error,
+ SbeRetryHandler * i_obj)
{
return P9_EXTRACT_SBE_RC::ERROR_RECOVERED; //pass
}
P9_EXTRACT_SBE_RC::RETURN_ACTION failing_exit_state(
TARGETING::Target * i_target,
- uint8_t i_orig_error)
+ uint8_t i_orig_error,
+ SbeRetryHandler * i_obj)
{
errlHndl_t l_errl = NULL;
@@ -237,7 +242,7 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION failing_exit_state(
errlCommit(l_errl,ISTEP_COMP_ID);
}
#endif
- proc_extract_sbe_handler(i_target,
+ i_obj->proc_extract_sbe_handler(i_target,
P9_EXTRACT_SBE_RC::REIPL_BKP_SEEPROM);
}
diff --git a/src/usr/sbeio/sbe_threshold_fsm.H b/src/usr/sbeio/sbe_threshold_fsm.H
index c78a4bb11..f0d048521 100644
--- a/src/usr/sbeio/sbe_threshold_fsm.H
+++ b/src/usr/sbeio/sbe_threshold_fsm.H
@@ -23,6 +23,7 @@
/* */
/* IBM_PROLOG_END_TAG */
#include <p9_extract_sbe_rc.H>
+#include <sbeio/sbe_retry_handler.H>
namespace SBE_FSM
{
@@ -33,11 +34,13 @@ namespace SBE_FSM
*
* @param[in] i_target - current proc target
* @param[in] i_orig_error - Original SBE error
+ * @param[in] i_obj - SbeRetryHandler object
*
* @return - pass(0) or specific returned SBE error
*/
P9_EXTRACT_SBE_RC::RETURN_ACTION same_side_retry_state(
- TARGETING::Target * i_target,uint8_t i_orig_error);
+ TARGETING::Target * i_target,uint8_t i_orig_error,
+ SBEIO::SbeRetryHandler * i_obj);
/**
* @brief This is the other side retry. If we fail twice on the same
@@ -45,11 +48,13 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION same_side_retry_state(
*
* @param[in] i_target - current proc target
* @param[in] i_orig_error - Original SBE error
+ * @param[in] i_obj - SbeRetryHandler object
*
* @return - pass(0) or specific returned SBE error
*/
P9_EXTRACT_SBE_RC::RETURN_ACTION other_side_state(
- TARGETING::Target * i_target,uint8_t i_orig_error);
+ TARGETING::Target * i_target,uint8_t i_orig_error,
+ SBEIO::SbeRetryHandler * i_obj);
/**
* @brief This is the working (passing) exit state. This state occurs
@@ -59,11 +64,13 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION other_side_state(
*
* @param[in] i_target - current proc target
* @param[in] i_orig_error - Original SBE error
+ * @param[in] i_obj - SbeRetryHandler object
*
* @return - pass(0) or specific returned SBE error
*/
P9_EXTRACT_SBE_RC::RETURN_ACTION working_exit_state(
- TARGETING::Target * i_target,uint8_t i_orig_error);
+ TARGETING::Target * i_target,uint8_t i_orig_error,
+ SBEIO::SbeRetryHandler * i_obj);
/**
* @brief This is the failing exit state. This state only occurs when
@@ -73,11 +80,13 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION working_exit_state(
*
* @param[in] i_target - current proc target
* @param[in] i_orig_error - Original SBE error
+ * @param[in] i_obj - SbeRetryHandler object
*
* @return - pass(0) or specific returned SBE error
*/
P9_EXTRACT_SBE_RC::RETURN_ACTION failing_exit_state(
- TARGETING::Target * i_target,uint8_t i_orig_error);
+ TARGETING::Target * i_target,uint8_t i_orig_error,
+ SBEIO::SbeRetryHandler * i_obj);
/**
* @brief This is the main function of the finite state machine. It
@@ -89,10 +98,12 @@ P9_EXTRACT_SBE_RC::RETURN_ACTION failing_exit_state(
* @param[in] i_target - Current Proc target
* @param[in] i_currentAction - Most recent return value from HWP
* @param[in] i_previousError - The previous return value from HWP
+ * @param[in] i_obj - SbeRetryHandler object
*/
void sbe_threshold_handler( bool i_procSide,
TARGETING::Target * i_target,
P9_EXTRACT_SBE_RC::RETURN_ACTION i_currentAction,
- uint8_t i_previousError);
+ uint8_t i_previousError,
+ SBEIO::SbeRetryHandler * i_obj );
}; // End of namespace SBE_FSM
OpenPOWER on IntegriCloud