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

/**
 * @file mdiasmimpl.H
 * @brief mdia state machine implementation
 */

#include <algorithm>
#include "mdiafwd.H"

namespace MDIA
{

/**
 * @brief workFlow properties
 *
 * associate a workflow progress indicator (workItem), log
 * and status indicator with a workflow and target
 */
struct WorkFlowProperties
{
    /**
     * @brief pointer to target / workFlow association
     */
    WorkFlowAssoc assoc;

    /**
     * @brief the workFlow phase to be run next
     */
    WorkFlow::const_iterator workItem;

    /**
     * @brief workFlow status indicator
     */
    uint64_t status;

    /**
     * @brief log associated with the workFlow
     */
    errlHndl_t log;

    /**
     * @brief timer associated with the workFlow
     */
    uint64_t timer;

    /**
     * @brief maint command flag associated with the workFlow
     */
    bool restartCommand;

    /**
     * @brief memory size associated with the workFlow
     */
    uint64_t memSize;

    /**
     * @brief pointer to single work item scoped data
     */
    void * data;

    /**
     * @brief mba position on membuf (0/1)
     */
    uint8_t chipUnit;

    /**
     * @brief timeout count associated with the workFlow
     */
    uint8_t timeoutCnt;

};

/**
 * @brief getWorkFlow alias for pair::second
 *
 * @param[in] i_assoc the WorkFlowAssocMap element from which to get
 * the workflow
 *
 * @retval reference to the workflow in the WorkFlowAssocMap
 *
 */
ALWAYS_INLINE inline const WorkFlow & getWorkFlow(WorkFlowAssoc i_assoc)
{
    return i_assoc->second;
}

/**
 * @brief getWorkFlow alias for pair::second
 *
 * @param[in] i_wfp the WorkFlowProperties from which to get
 * the workflow
 *
 * @retval reference to the workflow in the WorkFlowProperties
 *
 */
ALWAYS_INLINE inline const WorkFlow & getWorkFlow(WorkFlowProperties & i_wfp)
{
    return i_wfp.assoc->second;
}

/**
 * @brief getTarget alias for pair::first
 *
 * @param[in] i_wfp the WorkFlowProperties from which to get
 * the target
 *
 * @retval target handle in the WorkFlowAssocMap
 */
ALWAYS_INLINE inline TARGETING::TargetHandle_t getTarget(WorkFlowAssoc i_assoc)
{
    return i_assoc->first;
}

/**
 * @brief getTarget alias for pair::first
 *
 * @param[in] i_wfp the WorkFlowProperties from which to get
 * the target
 *
 * @retval target handle in the WorkFlowProperties
 */
ALWAYS_INLINE inline TARGETING::TargetHandle_t getTarget(WorkFlowProperties & i_wfp)
{
    return i_wfp.assoc->first;
}

/**
 * @brief getRemainingWorkItems
 *
 * determine the number of remaining work items for a given workflow
 *
 * @param[in] i_wfp the WorkFlowProperties from which to get
 * the workflow
 *
 * @retval number of remaining work items
 */
ALWAYS_INLINE inline uint64_t getRemainingWorkItems(WorkFlowProperties & i_wfp)
{
    return std::distance(i_wfp.workItem, getWorkFlow(i_wfp).end());
}
}
#endif
OpenPOWER on IntegriCloud