summaryrefslogtreecommitdiffstats
path: root/src/usr/initservice/istepdispatcher/istepdispatcher.H
blob: 5add1008c608cf0c39598a8bff06f780daa1029c (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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
//  IBM_PROLOG_BEGIN_TAG
//  This is an automatically generated prolog.
//
//  $Source: src/usr/initservice/istepdispatcher/istepdispatcher.H $
//
//  IBM CONFIDENTIAL
//
//  COPYRIGHT International Business Machines Corp. 2011
//
//  p1
//
//  Object Code Only (OCO) source materials
//  Licensed Internal Code Source Materials
//  IBM HostBoot Licensed Internal Code
//
//  The source code for this program is not published or other-
//  wise divested of its trade secrets, irrespective of what has
//  been deposited with the U.S. Copyright Office.
//
//  Origin: 30
//
//  IBM_PROLOG_END

#ifndef __ISTEPDISPATCHER_ISTEPDISPATCHER_H
#define __ISTEPDISPATCHER_ISTEPDISPATCHER_H
/**
 *  @file istepdispatcher.H
 *
 *  IStep Dispatcher interface.  Launched from Extended Initialization Service
 *
 */

/**
 * @page    IStepDispatcher IStep Dispatcher
 *
 *
 */


/******************************************************************************/
// Includes
/******************************************************************************/
#include    <stdint.h>
#include    <util/singleton.H>

#include    <errl/errlentry.H>
#include    <initservice/taskargs.H>
#include    <initservice/initsvcreasoncodes.H>
#include    <initservice/initsvcstructs.H>

#include    "../baseinitsvc/initservice.H"

#include    "splesscommon.H"


namespace   INITSERVICE
{

// using namespace SPLESS;

/******************************************************************************/
// Globals/Constants
/******************************************************************************/

/******************************************************************************/
// Typedef/Enumerations
/******************************************************************************/

/******************************************************************************/
//  Class IStepDispatcher
/******************************************************************************/

/**
 *  @class  IStepDispatcher
 *
 *  Dispatch ISteps and handle return codes, errorlogs, etc.
 *
 */
class IStepDispatcher
{

public:

    /**
     * @brief Get singleton instance of this class.
     *
     *  @return the (one and only) instance of IStepDispatcher
     */
    static IStepDispatcher& getTheInstance();


    /**
     *  @brief  Provide an entry function into the class, called from _start()
     *
     *  @param[in]  i_pargs  pointer to any arguments passed in from
     *                      _start().
     *
     *  @return nothing
     */
    void            init( void *i_pargs);

protected:

    /**
     * @brief Constructor for the IStepDispatcher object.
     */
    IStepDispatcher();


    /**
     * @brief Destructor for the IStepDispatcher object.
     */
    ~IStepDispatcher();

private:

    /**
     * @note   Disable copy constructor and assignment operator
     */
    IStepDispatcher(const IStepDispatcher& i_right);
    IStepDispatcher& operator=(const IStepDispatcher& i_right);


    /**
     * @brief   init iv_istepmode flag, called in constructor
     *
     *  Call into PNOR and fetch the "IStepMode flag" .
     *
     *  @todo currently this calls into the kernel to get the value of
     *  an SCOM Scratch Reg - this will change when PNOR is finished
     *
     *  @return nothing
     *
     */
    void initIStepMode( );


    /**
     * @brief   getIStepMode - return value of IStep Mode
     *
     *  @return bool - value of iv_istepmodeflag
     *  @retval false if IStep Mode is "OFF"
     *          true if IStep Mode is "ON"
     */
    bool getIStepMode( )    const;


    /**
     * @brief   Find a TaskInfo struct in the global istep list(s),
     *          addressed by { IStep, SubStep }
     *
     *
     * @param[in]   i_IStep     -   IStepNumber
     * @param[in]   i_SubStep   -   SubStepNumber
     *
     * @return  pointer to a TaskInfo struct
     * @retval  pointer to a TaskInfo struct, or NULL
     *
     */
    const TaskInfo *findTaskInfo( uint16_t  i_IStep,
                                  uint16_t  i_SubStep ) const;

    /**
     * @brief   Command 0: Run the requested IStep/SubStep
     *
     * param[in]    i_rcmd  -   ref to a filled in SPLessCmd struct
     * param[out]   o_sts   -   ref to a SPLessSts struct to be filled in
     *
     * @return  none
     */
    void    processSingleIStepCmd(
                        SPLESS::SPLessCmd &i_rcmd,
                        SPLESS::SPLessSts &o_rsts ) const;


     /**
      * @brief  singleStepISteps
      *
      * Stop and wait for SP to send the next IStep to run.  Run that, then
      * wait for the next one.
      * This is not expected to return - errors etc are sent to the user to
      * handle.
      *
      * @param[in,out] io_ptr   -   pointer to any args passed in from
      *                             ExtInitSvc.  This may be a pointer to an
      *                             TaskArgs struct (or something else) which
      *                             can be filled out on return
      *
      * @return none
      */
     void   singleStepISteps( void *  io_ptr )  const;


     /**
      * @brief  runAllISteps
      *
      * Run all available ISteps sequentially.
      * If an IStep gets an error, report it and stop.
      * Otherwise, return.
      *
      * @param[in,out] io_ptr   -   pointer to a TaskArgs struct on input
      *                             command, returncode and errorlog will be
      *                             clear on input
      *                             one or more may be filled in on return
      *
      * @return none
      */
     void   runAllISteps( void *  io_ptr )  const;


    /**
     * @brief   getCanContinueProcedure
     *  If an IStep fails, this routine will fetch the recovery procedure
     *  This is only used in "normal" mode, it will not be used when IStep Mode
     *  is ON (i.e. it will not be used when single-stepping).
     *
     *  @param[in]      i_failingIStep  -   ref to IStepInfo struct for failing
     *                                      Istep
     *  @param[in]      i_failingError  -   ref to errorlog for the failure
     *  @param[in,out]  io_nextIStep    -   ref to TaskInfo struct for next
     *                                      IStep to run.  struct will be filled
     *                                      out with info on the next IStep to
     *                                      run.
     *
     *  @return     bool
     *  @retval     false if there is no Can-Continue procedure,
     *                  true otherwise
     *
     *  @todo   2011-08-22 currently the defs for this procedure are pretty
     *          vague - requirements for Can-Continue behaviour have not been
     *          defined yet.
     */
    bool getCanContinueProcedure(   const TaskInfo  &i_failingIStep,
                                    errlHndl_t      &i_failingError,
                                    TaskInfo        &io_nextIStep  ) const;


    //  -----   internal vars   -----------------------------

};  //  class IStepDispatcher


} // namespace

#endif
OpenPOWER on IntegriCloud