diff options
-rw-r--r-- | src/include/usr/sbeio/sbe_extract_rc_handler.H | 67 | ||||
-rw-r--r-- | src/usr/sbeio/makefile | 1 | ||||
-rw-r--r-- | src/usr/sbeio/sbe_extract_rc_handler.C | 223 | ||||
-rw-r--r-- | src/usr/sbeio/sbe_threshold_fsm.C | 277 | ||||
-rw-r--r-- | src/usr/sbeio/sbe_threshold_fsm.H | 98 |
5 files changed, 379 insertions, 287 deletions
diff --git a/src/include/usr/sbeio/sbe_extract_rc_handler.H b/src/include/usr/sbeio/sbe_extract_rc_handler.H index ab83ee7ae..db22267f5 100644 --- a/src/include/usr/sbeio/sbe_extract_rc_handler.H +++ b/src/include/usr/sbeio/sbe_extract_rc_handler.H @@ -36,73 +36,6 @@ enum SBE_REG_RETURN SBE_FAILED_TO_BOOT = 2, // SBE has failed to boot }; -/*************************** State declarations ***************************/ -/** - * @brief This is the initial retry. If we get to a failure, we attempt to - * reboot the SBE on the other side. - * - * @param[in] i_target - current proc target - * @param[in] i_orig_error - Original SBE error - * - * @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); - -/** - * @brief This is the other side retry. If we fail twice on the same side - * We attempt to reboot the SBE on the other proc. - * - * @param[in] i_target - current proc target - * @param[in] i_orig_error - Original SBE error - * - * @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); - -/** - * @brief This is the working (passing) exit state. This state occurs when - * we start an SBE correctly within the threshold FSM. Depending on - * which state we come from, there are some different functions. - * - * @param[in] i_target - current proc target - * @param[in] i_orig_error - Original SBE error - * - * @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); - -/** - * @brief This is the failing exit state. This state only occurs when we - * fail on every retry. In this case we look at where we came from - * and either escalate to REIPL_BKP_SEEPROM or we gard and callout - * this proc and return to complete the istep. - * - * @param[in] i_target - current proc target - * @param[in] i_orig_error - Original SBE error - * - * @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); - -/** - * @brief This is the main function of the finite state machine. It handles - * the outputs, current state and next state transitions. - * - * @param[in] i_procSide - Which side we want to try to reboot. - * false/true: current/other - * @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 - */ -void sbe_threshold_handler( bool i_procSide, - TARGETING::Target * i_target, - P9_EXTRACT_SBE_RC::RETURN_ACTION i_currentAction, - uint8_t i_previousError ); - /** * @brief This is the switch case that handles the different actions needed for * each output of the proc_extract_sbe_rc HWP. diff --git a/src/usr/sbeio/makefile b/src/usr/sbeio/makefile index 4092c4b35..9d5710c7c 100644 --- a/src/usr/sbeio/makefile +++ b/src/usr/sbeio/makefile @@ -54,6 +54,7 @@ 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_extract_rc_handler.o VPATH += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/perv/ diff --git a/src/usr/sbeio/sbe_extract_rc_handler.C b/src/usr/sbeio/sbe_extract_rc_handler.C index ebce51e63..703179f7a 100644 --- a/src/usr/sbeio/sbe_extract_rc_handler.C +++ b/src/usr/sbeio/sbe_extract_rc_handler.C @@ -59,6 +59,7 @@ #include <../../usr/sbeio/sbe_fifo_buffer.H> #include <sbeio/sbe_ffdc_parser.H> #include <sbeio/sbeioreasoncodes.H> +#include "sbe_threshold_fsm.H" extern trace_desc_t* g_trac_sbeio; @@ -74,224 +75,6 @@ extern trace_desc_t* g_trac_sbeio; using namespace SBEIO; -/* array and enum must be in sync */ -P9_EXTRACT_SBE_RC::RETURN_ACTION (* sbe_handler_state[])( - TARGETING::Target * i_target, - uint8_t i_prev_error) = - { same_side_retry_state, // SAME_SIDE_RETRY - other_side_state, // OTHER_SIDE - working_exit_state, // WORKING_EXIT - failing_exit_state }; // FAILING_EXIT - -enum STATE_CODES { SAME_SIDE_RETRY, - OTHER_SIDE, - WORKING_EXIT, - FAILING_EXIT }; -struct transition -{ - enum STATE_CODES src_state; - uint8_t ret_code; - enum STATE_CODES dst_state; -}; - -/* transistions from end states aren't needed */ -struct transition state_transitions[] = { - { SAME_SIDE_RETRY, 0, WORKING_EXIT }, - { SAME_SIDE_RETRY, 1, OTHER_SIDE }, - { OTHER_SIDE, 0, WORKING_EXIT }, - { OTHER_SIDE, 1, FAILING_EXIT } -}; - -enum STATE_CODES get_next_state( enum STATE_CODES i_src, uint8_t i_rc ) -{ - return (state_transitions[ i_src*2 + i_rc ]).dst_state; -} - -void sbe_threshold_handler( bool i_procSide, - TARGETING::Target * i_target, - P9_EXTRACT_SBE_RC::RETURN_ACTION i_initialAction, - uint8_t i_previousError ) -{ - // Note: This is set up as a finite state machine since all actions are - // connected and most of them lead to another. - - STATE_CODES cur_state = SAME_SIDE_RETRY; - - // The initial state depends on our inputs - if( i_procSide ) - { - cur_state = OTHER_SIDE; - } - - // 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); - - // Begin FSM - for(;;) - { -#ifdef CONFIG_BMC_IPMI - // This could potentially take awhile, reset watchdog - errlHndl_t l_errl = IPMIWATCHDOG::resetWatchDogTimer(); - if(l_errl) - { - SBE_TRACF("Inside sbe_extract_rc_handler FSM, " - "Resetting watchdog"); - l_errl->collectTrace("ISTEPS_TRACE",256); - errlCommit(l_errl,ISTEP_COMP_ID); - } -#endif - - state_fcn = sbe_handler_state[cur_state]; - l_returnedAction = state_fcn(i_target, i_initialAction); - - if( cur_state == WORKING_EXIT || cur_state == FAILING_EXIT) - { - break; - } - // If the returned action was 0, the return is a pass: 0, - // Else, the SBE did not start cleanly and we continue - cur_state = get_next_state(cur_state, - !(P9_EXTRACT_SBE_RC::ERROR_RECOVERED == l_returnedAction)); - - } - - return; - -} - -P9_EXTRACT_SBE_RC::RETURN_ACTION same_side_retry_state( - TARGETING::Target * i_target, - uint8_t i_orig_error) -{ - SBE_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, - P9_EXTRACT_SBE_RC::ERROR_RECOVERED); -} - -P9_EXTRACT_SBE_RC::RETURN_ACTION other_side_state( - TARGETING::Target * i_target, - uint8_t i_orig_error) -{ - SBE_TRACF("Running p9_start_cbs HWP on processor target %.8X", - TARGETING::get_huid(i_target)); - - errlHndl_t l_errl = NULL; - - // Run HWP, but from the other side. - const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> - l_fapi2_proc_target(i_target); - - l_errl = switch_sbe_sides(i_target); - if(l_errl) - { - errlCommit(l_errl,ISTEP_COMP_ID); - return P9_EXTRACT_SBE_RC::NO_RECOVERY_ACTION; - } - - // 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, - P9_EXTRACT_SBE_RC::ERROR_RECOVERED); - if(i_target->getAttr<TARGETING::ATTR_SBE_IS_STARTED>()) - { - // Information log - /*@ - * @errortype - * @moduleid SBEIO_THRESHOLD_FSM - * @reasoncode SBEIO_BOOTED_UNEXPECTED_SIDE_BKP - * @userdata1 SBE status reg - * @userdata2 HUID - * @devdesc The SBE has booted on an unexpected side - */ - l_errl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - SBEIO_THRESHOLD_FSM, - SBEIO_BOOTED_UNEXPECTED_SIDE_BKP, - l_ret, - get_huid(i_target)); - - l_errl->collectTrace( "ISTEPS_TRACE", 256); - - errlCommit(l_errl, ISTEP_COMP_ID); - - } - - return l_ret; -} - -P9_EXTRACT_SBE_RC::RETURN_ACTION working_exit_state( - TARGETING::Target * i_target, - uint8_t i_orig_error) -{ - 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) -{ - errlHndl_t l_errl = NULL; - - // Look at original error - // Escalate to REIPL_BKP_SEEPROM (recall fcn) - if( (i_orig_error == P9_EXTRACT_SBE_RC::RESTART_SBE) || - (i_orig_error == P9_EXTRACT_SBE_RC::RESTART_CBS) || - (i_orig_error == P9_EXTRACT_SBE_RC::REIPL_UPD_SEEPROM) ) - { -#ifdef CONFIG_BMC_IPMI - // This could potentially take awhile, reset watchdog - l_errl = IPMIWATCHDOG::resetWatchDogTimer(); - if(l_errl) - { - SBE_TRACF("Inside sbe_extract_rc_handler FSM, before sbe_handler " - "Resetting watchdog"); - l_errl->collectTrace("ISTEPS_TRACE",256); - errlCommit(l_errl,ISTEP_COMP_ID); - } -#endif - proc_extract_sbe_handler(i_target, - P9_EXTRACT_SBE_RC::REIPL_BKP_SEEPROM); - } - // Gard and callout proc, return back to 8.4 - else if(i_orig_error == P9_EXTRACT_SBE_RC::REIPL_BKP_SEEPROM) - { - // There is no action possible. Gard and Callout the proc - /*@ - * @errortype ERRL_SEV_UNRECOVERABLE - * @moduleid SBEIO_THRESHOLD_FSM - * @reasoncode SBEIO_NO_RECOVERY_ACTION - * @userdata1 SBE current error - * @userdata2 HUID of proc - * @devdesc There is no recovery action on the SBE. - * We're garding this proc - */ - l_errl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - SBEIO_THRESHOLD_FSM, - SBEIO_NO_RECOVERY_ACTION, - i_orig_error, - TARGETING::get_huid(i_target)); - l_errl->collectTrace( "ISTEPS_TRACE", 256); - l_errl->addHwCallout( i_target, - HWAS::SRCI_PRIORITY_HIGH, - HWAS::DECONFIG, - HWAS::GARD_Predictive ); - errlCommit(l_errl, ISTEP_COMP_ID); - - } - - return P9_EXTRACT_SBE_RC::ERROR_RECOVERED; //pass -} -// end FSM - - void proc_extract_sbe_handler( TARGETING::Target * i_target, uint8_t i_current_error) { @@ -641,12 +424,12 @@ 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_threshold_handler(false, i_target, l_rcAction, l_prevError); + SBE_FSM::sbe_threshold_handler(false, i_target, l_rcAction, l_prevError); } else { // Call sbe_threshold handler on the same side - sbe_threshold_handler(true, i_target, l_rcAction, l_prevError); + SBE_FSM::sbe_threshold_handler(true, i_target, l_rcAction, l_prevError); } return P9_EXTRACT_SBE_RC::ERROR_RECOVERED; } diff --git a/src/usr/sbeio/sbe_threshold_fsm.C b/src/usr/sbeio/sbe_threshold_fsm.C new file mode 100644 index 000000000..759101499 --- /dev/null +++ b/src/usr/sbeio/sbe_threshold_fsm.C @@ -0,0 +1,277 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/sbeio/sbe_threshold_fsm.C $ */ +/* */ +/* 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 */ + +/*****************************************************************************/ +// Includes +/*****************************************************************************/ +#include <stdint.h> +#include <trace/interface.H> +#include <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <ipmi/ipmiwatchdog.H> + +#include <sbeio/sbeioreasoncodes.H> +#include "sbe_threshold_fsm.H" +#include <sbeio/sbe_extract_rc_handler.H> + +extern trace_desc_t* g_trac_sbeio; + +#define SBE_FSM_TRACF(printf_string,args...) \ + TRACFCOMP(g_trac_sbeio,"sbe_threshold_fsm.C: " printf_string,##args) +#define SBE_FSM_TRACD(printf_string,args...) \ + TRACDCOMP(g_trac_sbeio,"sbe_threshold_fsm.C: " printf_string,##args) +#define SBE_FSM_TRACU(args...) +#define SBE_FSM_TRACFBIN(printf_string,args...) \ + TRACFBIN(g_trac_sbeio,"sbe_threshold_fsm.C: " printf_string,##args) +#define SBE_FSM_TRACDBIN(printf_string,args...) \ + TRACDBIN(g_trac_sbeio,"sbe_threshold_fsm.C: " printf_string,##args) + + + +using namespace SBEIO; + +namespace SBE_FSM +{ + +P9_EXTRACT_SBE_RC::RETURN_ACTION (* sbe_handler_state[])( + TARGETING::Target * i_target, + uint8_t i_prev_error) = + { same_side_retry_state, // SAME_SIDE_RETRY + other_side_state, // OTHER_SIDE + working_exit_state, // WORKING_EXIT + failing_exit_state }; // FAILING_EXIT + +enum STATE_CODES { SAME_SIDE_RETRY, + OTHER_SIDE, + WORKING_EXIT, + FAILING_EXIT }; + +struct transition +{ + enum STATE_CODES src_state; + uint8_t ret_code; + enum STATE_CODES dst_state; +}; + +// transistions from end states aren't needed // +struct transition state_transitions[] = { + { SAME_SIDE_RETRY, 0, WORKING_EXIT }, + { SAME_SIDE_RETRY, 1, OTHER_SIDE }, + { OTHER_SIDE, 0, WORKING_EXIT }, + { OTHER_SIDE, 1, FAILING_EXIT } +}; + +enum STATE_CODES get_next_state( enum STATE_CODES i_src, uint8_t i_rc ) +{ + return (state_transitions[ i_src*2 + i_rc ]).dst_state; +} + +void sbe_threshold_handler( bool i_procSide, + TARGETING::Target * i_target, + P9_EXTRACT_SBE_RC::RETURN_ACTION i_initialAction, + uint8_t i_previousError) +{ + // Note: This is set up as a finite state machine since all actions are + // connected and most of them lead to another. + + STATE_CODES cur_state = SAME_SIDE_RETRY; + + // The initial state depends on our inputs + if( i_procSide ) + { + cur_state = OTHER_SIDE; + } + + // 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 ); + + // Begin FSM + for(;;) + { +#ifdef CONFIG_BMC_IPMI + // This could potentially take awhile, reset watchdog + errlHndl_t l_errl = IPMIWATCHDOG::resetWatchDogTimer(); + if(l_errl) + { + SBE_FSM_TRACF("Inside sbe_extract_dd FSM, " + "Resetting watchdog"); + l_errl->collectTrace("ISTEPS_TRACE",256); + errlCommit(l_errl,ISTEP_COMP_ID); + } +#endif + + state_fcn = SBE_FSM::sbe_handler_state[cur_state]; + l_returnedAction = state_fcn(i_target, i_initialAction); + + if( cur_state == WORKING_EXIT || + cur_state == FAILING_EXIT) + { + break; + } + // If the returned action was 0, the return is a pass: 0, + // Else, the SBE did not start cleanly and we continue + cur_state = get_next_state(cur_state, + !(P9_EXTRACT_SBE_RC::ERROR_RECOVERED == l_returnedAction)); + + } + + return; +} + +P9_EXTRACT_SBE_RC::RETURN_ACTION same_side_retry_state( + TARGETING::Target * i_target, + uint8_t i_orig_error) +{ + 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, + P9_EXTRACT_SBE_RC::ERROR_RECOVERED); +} + +P9_EXTRACT_SBE_RC::RETURN_ACTION other_side_state( + TARGETING::Target * i_target, + uint8_t i_orig_error) +{ + SBE_FSM_TRACF("Running p9_start_cbs HWP on processor target %.8X", + TARGETING::get_huid(i_target)); + + errlHndl_t l_errl = NULL; + + // Run HWP, but from the other side. + const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> + l_fapi2_proc_target(i_target); + + l_errl = switch_sbe_sides(i_target); + if(l_errl) + { + errlCommit(l_errl,ISTEP_COMP_ID); + return P9_EXTRACT_SBE_RC::NO_RECOVERY_ACTION; + } + + // 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, + P9_EXTRACT_SBE_RC::ERROR_RECOVERED); + if(i_target->getAttr<TARGETING::ATTR_SBE_IS_STARTED>()) + { + // Information log + /*@ + * @errortype + * @moduleid SBEIO_THRESHOLD_FSM + * @reasoncode SBEIO_BOOTED_UNEXPECTED_SIDE_BKP + * @userdata1 SBE status reg + * @userdata2 HUID + * @devdesc The SBE has booted on an unexpected side + */ + l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + SBEIO_THRESHOLD_FSM, + SBEIO_BOOTED_UNEXPECTED_SIDE_BKP, + l_ret, + get_huid(i_target)); + + l_errl->collectTrace( "ISTEPS_TRACE", 256); + + errlCommit(l_errl, ISTEP_COMP_ID); + + } + + return l_ret; +} + +P9_EXTRACT_SBE_RC::RETURN_ACTION working_exit_state( + TARGETING::Target * i_target, + uint8_t i_orig_error) +{ + 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) +{ + errlHndl_t l_errl = NULL; + + // Look at original error + // Escalate to REIPL_BKP_SEEPROM (recall fcn) + if( (i_orig_error == P9_EXTRACT_SBE_RC::RESTART_SBE) || + (i_orig_error == P9_EXTRACT_SBE_RC::RESTART_CBS) || + (i_orig_error == P9_EXTRACT_SBE_RC::REIPL_UPD_SEEPROM) ) + { +#ifdef CONFIG_BMC_IPMI + // This could potentially take awhile, reset watchdog + l_errl = IPMIWATCHDOG::resetWatchDogTimer(); + if(l_errl) + { + SBE_FSM_TRACF("Inside sbe_extract_dd FSM, before sbe_handler " + "Resetting watchdog"); + l_errl->collectTrace("ISTEPS_TRACE",256); + errlCommit(l_errl,ISTEP_COMP_ID); + } +#endif + proc_extract_sbe_handler(i_target, + P9_EXTRACT_SBE_RC::REIPL_BKP_SEEPROM); + } + + // Gard and callout proc, return back to 8.4 + else if(i_orig_error == P9_EXTRACT_SBE_RC::REIPL_BKP_SEEPROM) + { + // There is no action possible. Gard and Callout the proc + /*@ + * @errortype ERRL_SEV_UNRECOVERABLE + * @moduleid SBEIO_THRESHOLD_FSM + * @reasoncode SBEIO_NO_RECOVERY_ACTION + * @userdata1 SBE current error + * @userdata2 HUID of proc + * @devdesc There is no recovery action on the SBE. + * We're garding this proc + */ + l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + SBEIO_THRESHOLD_FSM, + SBEIO_NO_RECOVERY_ACTION, + i_orig_error, + TARGETING::get_huid(i_target)); + l_errl->collectTrace( "ISTEPS_TRACE", 256); + l_errl->addHwCallout( i_target, + HWAS::SRCI_PRIORITY_HIGH, + HWAS::DECONFIG, + HWAS::GARD_Predictive ); + errlCommit(l_errl, ISTEP_COMP_ID); + + } + + return P9_EXTRACT_SBE_RC::ERROR_RECOVERED; //pass +} +// end FSM + +}; // End of namespace SBE_FSM + diff --git a/src/usr/sbeio/sbe_threshold_fsm.H b/src/usr/sbeio/sbe_threshold_fsm.H new file mode 100644 index 000000000..c78a4bb11 --- /dev/null +++ b/src/usr/sbeio/sbe_threshold_fsm.H @@ -0,0 +1,98 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/sbeio/sbe_threshold_fsm.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 */ +#include <p9_extract_sbe_rc.H> + +namespace SBE_FSM +{ + +/** + * @brief This is the initial retry. If we get to a failure, we + * attempt to reboot the SBE on the other side. + * + * @param[in] i_target - current proc target + * @param[in] i_orig_error - Original SBE error + * + * @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); + +/** + * @brief This is the other side retry. If we fail twice on the same + * side. We attempt to reboot the SBE on the other proc. + * + * @param[in] i_target - current proc target + * @param[in] i_orig_error - Original SBE error + * + * @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); + +/** + * @brief This is the working (passing) exit state. This state occurs + * when we start an SBE correctly within the threshold FSM. + * Depending on which state we come from, there are some + * different functions. + * + * @param[in] i_target - current proc target + * @param[in] i_orig_error - Original SBE error + * + * @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); + +/** + * @brief This is the failing exit state. This state only occurs when + * we fail on every retry. In this case we look at where we + * came from and either escalate to REIPL_BKP_SEEPROM or we gard + * and callout this proc and return to complete the istep. + * + * @param[in] i_target - current proc target + * @param[in] i_orig_error - Original SBE error + * + * @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); + +/** + * @brief This is the main function of the finite state machine. It + * handles the outputs, current state and next + * state transitions. + * + * @param[in] i_procSide - Which side we want to try to reboot. + * false/true: current/other + * @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 + */ +void sbe_threshold_handler( bool i_procSide, + TARGETING::Target * i_target, + P9_EXTRACT_SBE_RC::RETURN_ACTION i_currentAction, + uint8_t i_previousError); + +}; // End of namespace SBE_FSM |