summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/mdia/mdiafwd.H
blob: 164daafe78f8ac72ef89f6e36cc52fbdd33474d9 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/mdia/mdiafwd.H $                                 */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2013              */
/*                                                                        */
/* 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 __MDIA_MDIAFWD_H
#define __MDIA_MDIAFWD_H

/**
 * @file mdiafwd.H
 * @brief internal mdia declarations
 */

#include <mdia/mdia.H>
#include <mdia/mdiareasoncodes.H>
#include <targeting/common/attributes.H>
#include <targeting/common/targetservice.H>
#include <vector>
#include <map>

/**
 * @brief forwards
 */
class MdiaSmTest;
class MdiaTest;
class MdiaMbaTest;
class MdiaCommandMonitorTest;
class MdiaTraceTest;
class MdiaWorkItemTest;

namespace MDIA
{

/**
 * forwards
 */
class StateMachine;
class WorkItem;
class CommandMonitor;
struct Globals;
struct WorkFlowProperties;

/**
 * @brief per mba diagnostic mode
 */
enum DiagMode
{
    ONE_PATTERN,
    FOUR_PATTERNS,
    NINE_PATTERNS,
};

/**
 * @brief misc constants
 */
enum
{
    // mem chiplet regs
    MEM_SPA_FIR = 0x03040004,
    MEM_SPA_FIR_MASK = 0x03040007,
    MEM_MBA0_MBSTR = 0x02011655,
    MEM_MBA1_MBSTR = 0x02011755,

    // mba unit regs
    MBA01_SPA = 0X03010611,
    MBA01_SPA_MASK = 0X03010614,
    MBA01_CMD_TYPE = 0X0301060A,
    MBA01_CMD_CONTROL = 0X0301060B,
    MBA01_CMD_STATUS = 0X0301060C,
    MBA01_MBMACAQ = 0X0301060D,
    MBA01_MBMEA = 0X0301060E,

    // mcs unit regs
    MCI_FIR = 0x02011840,
    MCI_FIR_MASK = 0x02011843,
    MCI_FIR_ACT0 = 0x02011846,
    MCI_FIR_ACT1 = 0x02011847,
    MCS_MODE4 = 0x0201181A,

    // proc regs
    HOST_ATTN_PRES = 0x01020000,
    HOST_ATTN_MASK = 0x0102000C,
    HOST_ATTN_CFG = 0x0102000F,
    IPOLL_MASK = 0x01020013,
    IPOLL_STATUS = 0x01020014,
    PBUS_GP1 = 0x02000001,
    PBUS_GP2 = 0x02000002,
};

/**
 * @brief workflow status
 */
enum WorkFlowStatus
{
    /**
     * @brief workflow in progress or hasn't started yet
     */
    IN_PROGRESS,

    /**
     * @brief indicates workflow stopped because a maint command timed out
     */
    COMMAND_TIMED_OUT,

    /**
     * @brief indicates workflow stopped because of a failure
     */
    FAILED,

    /**
     * @brief workflow finished
     */
    COMPLETE,
};

/**
* @brief Workflow container of workflow phases
*/
typedef std::vector<uint64_t> WorkFlow;

/**
* @brief WorkflowAssocMap target / workflow association map
*/
typedef std::map<TARGETING::TargetHandle_t, WorkFlow> WorkFlowAssocMap;

/**
* @brief WorkflowAssoc target / workflow association list element
*/
typedef WorkFlowAssocMap::const_iterator WorkFlowAssoc;

/**
* @brief MonitorIDs container of monitorIDs unique to a target
*/
typedef std::vector<uint64_t> MonitorIDs;

/**
 * @brief getMbaDiagnosticMode get the mode (scrub, init, one, four, nine)
 *
 * @param[in] i_globals policy flags needed to determine the mode
 * @param[in] i_target the mba target for which the mode is determined
 * @param[out] o_mode the mode for the target mba
 *
 * @retval 0 no error
 * @retval !0 unexpected error occurred
 */
errlHndl_t getMbaDiagnosticMode(
        const Globals & i_globals,
        TARGETING::TargetHandle_t i_mba,
        DiagMode & o_mode);

/**
 * @brief getMbaWorkFlow get the workflow for an mba target
 *
 * @param[in] i_mode the diagnostic mode for the target
 * @param[out] o_wf the workflow for the mba target
 * @param[in] i_globals policy flags needed to determine MNFG status
 *
 * @retval 0 no error
 * @retval !0 unexpected error occurred
 */
errlHndl_t getMbaWorkFlow(
        DiagMode i_mode,
        WorkFlow & o_wf,
        const Globals & i_globals);

/**
 * @brief doStepCleanup shut down threads and pools on step exit
 *
 * @param[in] i_globals contains objects to be cleaned up
 */
void doStepCleanup(const Globals & i_globals);

/**
 * @brief check if hw state has been changed for an mba's
 *        associated targets
 *
 * @param[in] i_mba input mba target
 *
 * @retval true if hw state has been changed or else
 */
bool isHWStateChanged(TARGETING::TargetHandle_t i_mba);

/**
 * @brief clear hw changed state for an mba's
 *        associated targets
 *
 * @param[in] i_mba input mba target
 *
 */
void clearHWStateChanged(TARGETING::TargetHandle_t i_mba);

}
#endif
OpenPOWER on IntegriCloud