summaryrefslogtreecommitdiffstats
path: root/src/include/usr/sbeio/sbe_extract_rc_handler.H
blob: ab83ee7ae5cb2ee0c233fef70de938d82f328a85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/* 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
};

/*************************** 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.
 *
 * @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
OpenPOWER on IntegriCloud