summaryrefslogtreecommitdiffstats
path: root/src/include/usr/initservice/initsvcstructs.H
blob: 036369e9c3ffd05d7e98205fb0f2225686dd90d3 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/include/usr/initservice/initsvcstructs.H $                */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2011,2014              */
/*                                                                        */
/* 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 otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef __COMMON_INITSVCSTRUCTS_H
#define __COMMON_INITSVCSTRUCTS_H
/**
 *  @file initsvcstructs.H
 *
 *  common structs for initservice, extinitsvc, istepdispatcher
 *
 */

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

#include <initservice/initsvcreasoncodes.H>

// This constant has a corresponding entry in src/build/tools/listdeps.pl.
#define MAX_DEPENDENT_MODULES   7


namespace   INITSERVICE
{

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


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

/**
 * @note    istepname tag - this is a way to call out the istep, substep, and
 *          istep name for spless operation.    scanistepnames.pl will run
 *          through this, find the istepnames, and publish it as a CVS file
 *          for use by the SPLess user console (python) code.
 *          Usage:
 *          @ISTEPNAME( 4, 0, "init_target_states" )
 *
 *          This will be picked up by scanistepnames.pl and put in as the line
 *              4,0,init_target_states
 *
 *          HostBoot will see it as the string "init_target_states" in the
 *          istepNlist.H file
 */
#define ISTEPNAME( ISTEP, SUBSTEP, NAME )      NAME


/**
 * @enum    TaskType
 *  - NONE          ==  placeholder, no task
 *  - INIT_TASK     ==  load and initialize task, but task has no _start()
 *                      (extended image only)
 *  - START_TASK    ==  BASE_IMAGE: call _start() function entry point
 *                      EXT_IMAGE: call _init(), then _start()
 *  - START_FN      ==  task with function pointer entry point
 *  - UNINIT_TASK   ==  call _fini() to call static destructor(s) on the task.
 *                      (extended image only)
 *  - END_TASK_LIST ==  last entry in the task list.
 */

enum    TaskType
{
    UNDEFINED_TT    =   0,
    NONE,
    INIT_TASK,
    START_TASK,
    START_FN,
    UNINIT_TASK,
    END_TASK_LIST,
};


/**
 * @enum    ModuleType
 *  -   BASE_IMAGE == module in the base image
 *  -   EXT_IMAGE == module in the extended image
 */
enum    ModuleType
{
    UNDEFINED_MT    =   0,
    BASE_IMAGE,
    EXT_IMAGE,
};

/**
 * @enum    IplOpType
 * bitmap indicating whether the task is an op in certain IPL modes.
 */
enum IplOpType
{
    IPL_NOOP      = 0x00,
    NORMAL_IPL_OP = 0x01,
    MPIPL_OP      = 0x02,
};

/**
 * @struct  TaskFlags
 *
 *  - run _start() function on start
 *  - module type, BASE_MODULE or EXT_MODULE
 *  - module_id for errorlog if task fails
 *
 */
struct  TaskFlags
{
    TaskType            task_type;          // task execution flags
    ModuleType          module_type;        // BASE_IMAGE or EXT_IMAGE
    uint8_t             ipl_op;             // bitmap of IplOpType enum
                                            // indicating whether task
                                            // is an op in certain IPL modes.
    bool                check_attn;         // flag indicating whether to check
                                            // for attentions and invoke PRD
                                            // for analysis after executing
                                            // the istep substep
                                            // true = check for attentions
};


/**
 * @struct  TaskInfo
 *
 * Holds information on each task in the system.
 *      - taskname
 *      - execution flags, see TaskFlags above
 *
 */
struct  TaskInfo
{
    const char * const  taskname;
    void*               (*taskfn)(void *ptr);
    const   TaskFlags   taskflags;
};


/**
 * @struct  DepModInfo
 *
 * Holds information on other modules that need to be loaded so that this
 * istep will run.
 */
struct  DepModInfo
{
    const char * const modulename[MAX_DEPENDENT_MODULES];
};


/**
 * @struct  ExtTaskInfo
 *
 * struct to store the TaskInfo for the ISteps, plus the number of items in
 * the istep (calculated at compiletime).
 */
struct  ExtTaskInfo
{
    const TaskInfo      *const pti;
    const uint64_t      numitems;
    const DepModInfo    *const depModules;
};

} // namespace

#endif
OpenPOWER on IntegriCloud