summaryrefslogtreecommitdiffstats
path: root/src/usr/initservice/istepdispatcher/istepdispatcher.H
blob: 551f8292c36442e53639a60c27b736b5615e8aed (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
/****************************************************************************
 * $IBMCopyrightBlock:
 * 
 *  IBM Confidential
 * 
 *  Licensed Internal Code Source Materials
 * 
 *  IBM Flexible Support Processor Licensed Internal Code
 * 
 *  (C) Copyright IBM Corp. 2011
 * 
 *  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.
 * $
****************************************************************************/

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


/******************************************************************************/
// Includes
/******************************************************************************/
#include <stdint.h>
#include <sys/vfs.h>            // VFS_MODULE_NAME_MAX

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

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


namespace   INITSERVICE
{


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

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

/******************************************************************************/
//  Class
/******************************************************************************/

/**
 *  @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().
     */
    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   getIStepMode
     *  call into PNOR and fetch the "IStepMode flag" .
     *  This will tell us if we are locked to the SP (IStepMode=ON) or
     *  can run all the ISteps available (IStepMode=OFF).
     *
     *  @return false if IStep Mode is "OFF"
     *          true if IStep Mode is "ON"
     */
    bool getIStepMode( ) const;


    /**
     * @brief   getCanContinueProcedure
     *  If an IStep fails, this routine will fetch the recovery procedure
     *
     *  @param[in]      reference to IStepInfo struct for failing Istep
     *  @param[in]      reference to errorlog for the failure
     *  @param[in,out]  reference to IStepInfo struct for next IStep to run
     *
     *  @return         false if there is no Can-Continue procedure
     *                  true otherwise
     *
     */
    bool getCanContinueProcedure(   const TaskInfo  &i_failingIStep,
                                    errlHndl_t      &i_failingError,
                                    TaskInfo        &io_nextIstep  ) const;

    /**
     * @brief   reportIStepErrorLog
     * If an IStep returns an error log, commit it.
     *
     * @todo Later there may be some decision about whether to report it
     * based on the IStep.
     */
    void reportIStepErrorLog(   const TaskInfo  *i_failingIStep,
                                errlHndl_t      io_errl );


    bool        iv_istepmodeflag;
    uint64_t    iv_nextistep;
    bool        iv_cancontinueflag;

};  //  class IStepDispatcher

} // namespace

#endif
OpenPOWER on IntegriCloud