summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/tod_init/TodProc.H
blob: 0addf9a7b17b9e4e92e27221a3d94062965e4ec8 (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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/hwpf/hwp/tod_init/TodProc.H $                         */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 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  TODPROC_H
#define  TODPROC_H

/**
 *  @file TodProc.H
 *
 *  @brief Contains TodProc class declaration
 *      TodProc class encapsulates a proc chip target with other attributes
 *      that are necessary to define the proc chip in a TOD topology
 *
 *  HWP_IGNORE_VERSION_CHECK
 *
 */

#include "proc_tod_utils.H"
#include "TodTypes.H"
#include "TodSvcUtil.H"

namespace TOD
{

//------------------------------------------------------------------------------
//Forward declarations
//------------------------------------------------------------------------------
struct TodChipData;
class TodDrawer;
class TodProc;

//------------------------------------------------------------------------------
//Typedefs
//------------------------------------------------------------------------------
typedef std::list<TodProc*> TodProcContainer;
typedef std::list<tod_topology_node*> TodTopologyNodeContainer;

/**
 * @class TodProc
 *
 * @brief TodProc class encapsulates a proc chip target with other
 *     attributes that helps to identify the position of proc chip in a
 *     TOD netwok and also define its connection with other proc chips
 */
class TodProc
{
public:
    //Specify proc master type :
    //TOD master/drawer master
    enum ProcMasterType
    {
        NOT_MASTER    = 0x00,
        TOD_MASTER    = 0x01,
        DRAWER_MASTER = 0x02
    };

    /**
     * @brief Constructor
     *
     * @param[in] i_procTarget
     *     Pointer to proc target
     *
     * @param[in] i_parentDrawer
     *     Pointer to TOD drawer in which this proc is contained
     */
    TodProc(const TARGETING::Target* i_procTarget,
            const TodDrawer* i_parentDrawer);

    /**
     * @brief Destructor
     */
    ~TodProc();

    /**
     * @brief The method will try to connect TodProc object, for which the
     *     method has been called to the TodProc object specificed in
     *     destination argument.
     *
     * @par Detailed Description:
     *     While creating the TOD topology TodTopologyManager will connect
     *     TodProc objects to the topology if they
     *     physically connect over A/X bus, to a TodProc object
     *     that is already part of the topology and also valid  candidate for
     *     connecting the TodProc object under consideration.
     *
     *     The process of connecting processors starts with MDMT and will
     *     continue till all the processors are connected.
     *     At each step TodTopologyManager will make call to connect
     *     method. This method will check if processor chip owned by
     *     TodProc object (for which the method is called ) is physically
     *     connected to the destination (passed as argument), over the bus type
     *     specified in argument to the method.
     *
     *     If they connect then the i_bus_rx and  i_bus_tx members of
     *     iv_tod_node_data will be filled up for the destination object
     *     such that
     *     i_bus_rx == The bus on destination object that connects to the
     *     this proc
     *     i_bus_tx == The bus on this proc that connects to the
     *     destination
     *
     * @param[in] i_destination, Pointer to destination TodProc object
     *     that has to be connected.
     *
     * @param[in] i_busChipUnitType, Type of the bus (A/X) for which connection
     *      has to be determined
     *
     * @param[out] o_isConnected, this parameter will be set to true if
     *      source and destination connect over the specified bus type. Before
     *      looking for o_isConnected the caller should check for returned error
     *      log handle and only if it is NULL o_isConnected should be considered.
     *
     * @return Error log handle, indicates status of request
     * @retval NULL indicates that connect method's algorithm  executed
     *      successfully, however in order to know if two processor objects
     *      connect over the specified bus or not o_isConnected has to be
     *      examined.
     * @retval !NULL indicates that method connect could not be completed
     *     successfully. In this case o_isConnected should be ignored.
     *
     *     Error log handle points to a valid error log object whose primary
     *     SRC reason code (pError->getSRC()->reasonCode()) indicates the type
     *     of error.
     *
     * @note It is up to the caller to change the severity of the
     *     returned error based on what it decides to do with it. By default
     *     any returned error created by this function will be a non-reported
     *     tracing event error log.
     */
    errlHndl_t connect(
            TodProc* i_destination,
            const TARGETING::TYPE i_busChipUnitType,
            bool& o_isConnected);

    /**
     * @brief This is a helper method for connect, that will pick a value
     *      from proc_tod_setup_bus enum corresponding to the bus type and
     *      the  port specified as argument
     *
     * @param[in] i_busChipUnitType , This will indicate   A/X bus type
     *
     * @param[in] i_busPort , The port of the bus
     *
     * @param[out] o_busId , proc_tod_setup_bus enum member corresponding to
     *      the bus type and bus port specified as parameter. Before looking for
     *      o_busId caller should look for returned error handle and only if it
     *      is NULL, o_busId should be considered.
     *
     * @return Error log handle, indicates status of request
     * @retval NULL, indicates o_busId was successfully found
     * @retval !NULL, indicates that o_busId could not be found possibly
     *     because specified bus type and port combination is not supported
     *
     *     Error log handle points to a valid error log object whose primary
     *     SRC reason code (pError->getSRC()->reasonCode()) indicates the type
     *     of error.
     *
     * @note It is up to the caller to change the severity of the
     *     returned error based on what it decides to do with it. By default
     *     any returned error created by this function will be a non-reported
     *     tracing event error log.
     */
    errlHndl_t getBusPort(
            const   TARGETING::TYPE  i_busChipUnitType,
            const uint32_t  i_busPort,
            proc_tod_setup_bus& o_busId) const;

    /**
     * @brief Method to create an errlHndl_t object for
     *      TOD_UNSUPPORTED_BUSTYPE
     *
     * @par Detailed Description:
     *      This error will be logged by a method if it finds that a particular
     *      bus type is not supported on TOD topology.
     *
     * @param[in] i_busChipUnitType, Type of bus that is not supported
     *
     * @param[out] io_errHdl
     *      On input this parameter will be either NULL or pointing to
     *      an existing error handle.
     *      On output this parameter will either have a newly created handle
     *      assigned to it ( If input parameter was NULL ) or a new SRC will be
     *      appened to existing error handle ( If the input was not NULL )
     *
     * @return N/A
     */
     void logUnsupportedBusType(const int32_t i_busChipUnitType,
                    errlHndl_t& io_errHdl) const;

    /**
     * @brief Method to create an errlHndl_t object for
     *      TOD_UNSUPPORTED_BUSPORT
     *
     * @par Detailed Description:
     *      This error will be logged by getBusPort if it finds that the input
     *      bus port is not supported for a specified bus type, from
     *      TOD topology point of view.
     *
     * @param[in] i_busPort , Type of bus that is not currently supported.
     *
     * @param[out] io_errHdl
     *      On input this parameter will be either NULL or pointing to
     *      an existing error handle.
     *      On output this parameter will either have a newly created handle
     *      assigned to it ( If input parameter was NULL ) or a new SRC will be
     *      appened to existing error handle ( If the input was not NULL )
     *
     * @return N/A
     */
     void logUnsupportedBusPort(
                const int32_t i_busPort,
                const int32_t i_busChipUnitType,
                errlHndl_t& io_errHdl) const;

    /**
     * @brief Add a child TodProc to this (adds to iv_childrenList).
     *     Added child will receive TOD signal from the processor
     *     represented by this TodProc object.
     *
     * @param[in] i_child
     *     Pointer to child TodProc
     *
     * @return N/A
     */
    void addChild(TodProc* i_child);

    /**
     * @brief Setter method for iv_masterType
     *
     * @param[in] i_masterType
     *      Parameter to indicate the master type
     *
     * @return N/A
     */
    void setMasterType(const ProcMasterType i_masterType);

    /**
     * @brief Getter method for iv_masterType
     *
     * @return ProcMasterType, value of iv_masterType
     */
     ProcMasterType getMasterType() const ;

    /**
     * @brief Getter for TOD registers for this proc
     *     Check proc_tod_utils.H : proc_tod_setup_conf_regs for the list of
     *     registers. The registers are updated by the TOD HWP.
     *
     * @param[out] o_todRegs
     *      container of TOD registers
     *
     * @return N/A
     */
    void getTodRegs(proc_tod_setup_conf_regs& o_todRegs) const;

    /**
     * @brief This method will populate the TodChipData object passed as
     *     input with the TOD register values of the this proc.
     *
     * @param[out] o_todChipData
     *     The TodChipData object in which data has to be output
     *
     * @return NA
     *
     */
    void setTodChipData(TodChipData& o_todChipData) const;

    /**
     * @brief Getter method for iv_tod_node_data
     *
     * @return tod_topology_node*, pointer to this proc's topology
     *      node structure
     */
    tod_topology_node* getTopologyNode()
    {
        return iv_tod_node_data;
    }

    /**
     * @brief Getter method for iv_parentDrawer
     *
     * @return TodDrawer*, pointer to this proc's containing TOD drawer
     */
    const TodDrawer* getParentDrawer() const
    {
        return iv_parentDrawer;
    }

    /**
     * @brief Getter method for tod_topology_node::i_bus_rx data member ,
     *      i_bus_rx is the fabric bus over which current processor receives
     *      signals from its parent
     *
     * @return proc_tod_setup_bus bus type and port
     */
    proc_tod_setup_bus getBusIn() const
    {
        return iv_tod_node_data->i_bus_rx;
    }

    /**
     * @brief Getter method for tod_topology_node::i_bus_tx data member ,
     *      i_bus_tx is the bus over which signal is transmitted by the
     *      parent of this processor
     *
     * @return proc_tod_setup_bus bus type and port
     */
    proc_tod_setup_bus getBusOut() const
    {
        return iv_tod_node_data->i_bus_tx;
    }

    /**
     * @brief Getter method for iv_procTarget
     *
     * @return Target pointer for this proc
     */
    const TARGETING::Target* getTarget() const
    {
        return iv_procTarget;
    }

    /**
     * @brief Getter method for iv_childrenList.
     *     see also addChild
     *
     * @param[out] o_childrenList
     *     List of pointers to children TodProc
     *
     * @return N/A
     */
    void getChildren(TodProcContainer& o_childrenList) const
    {
        o_childrenList = iv_childrenList;
    }

    /**
     * @brief Sets bus in and bus out
     *
     * @return N/A
     */
    void setConnections(const proc_tod_setup_bus i_parentBusOut,
                        const proc_tod_setup_bus i_thisBusIn)
    {
        iv_tod_node_data->i_bus_tx = i_parentBusOut;
        iv_tod_node_data->i_bus_rx = i_thisBusIn;
    }

private:
    /*
     * @brief Helper method to initialize the bus parameters
     *      (iv_xbusTargetList and iv_abusTargetList) and iv_tod_node_data, for
     *      this object.
     *      It will be called from the constructor.
     *
     * @return N/A
     */
    void init();

    //Target pointer to the processor chip, that is been encapsulated in
    //the TodProc object
    const TARGETING::Target* iv_procTarget;

    //Pointer to the parent TodDrawer object to which this processor
    //belong
    const TodDrawer * iv_parentDrawer;

    //List of X bus targets for this processor
    TARGETING::TargetHandleList iv_xbusTargetList;

    //List of A bus targets for this processor
    TARGETING::TargetHandleList iv_abusTargetList;

    //List of children that will receive TOD signal from this processor belongs
    TodProcContainer iv_childrenList;

    //Pointer to the tod_topology_node object that defines  TOD specific
    //attributes for this processor chip, the reason this has been kept
    //seperate is this data structure is shared across HB and HW procedure
    tod_topology_node* iv_tod_node_data;

    //Data member to indicate if this processor is either a TOD_MASTER or
    //DRAWER_MASTER
    ProcMasterType iv_masterType;
};

}//end of namespace

#endif // TODPROC_H
OpenPOWER on IntegriCloud