summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H
blob: 4700d909909351f64a403ee147d812b0c0e2e60b (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H $ */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2002,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 PRDFHOMREGISTERACCESS_H
#define PRDFHOMREGISTERACCESS_H
/**
   @file prdfHomRegisterAccess.H
   @brief Provide access to scan & scan com registers via the HOM
*/


//--------------------------------------------------------------------
// Includes
//--------------------------------------------------------------------

#include <iipMopRegisterAccess.h>
#include <vector>
#include <prdfPlatServices.H>
#include <prdfErrlUtil.H>
#include <prdfGlobal.H>
//--------------------------------------------------------------------
//  Forward References
//--------------------------------------------------------------------

namespace PRDF
{

class ScomAccessor
{
  public:

    /**
     * @brief ctor
     */
    inline ScomAccessor() {}

    /**
     * @brief dtor
     */
    inline virtual ~ScomAccessor() {}

    /**
     * @brief Access the scan com register
     * @param i_target    Target to access the register
     * @param bs holds    data read or to write
     * @param registerId  register address
     * @param operation   [READ|WRITE]
     * @returns NULL if Success, valid error handle otherwise.
     * @pre bs.Length() must be size of register data to read/write
     * @post For read operation, bs is modified to reflect hardware
     *       register state
     */
    virtual errlHndl_t  Access( TARGETING::TargetHandle_t i_target,
                                BIT_STRING_CLASS & bs,
                                uint64_t registerId,
                                MopRegisterAccess::Operation operation) const;

  private:

    /**
     * @brief disable copy
     */
    ScomAccessor(const ScomAccessor &);

    /**
     * @brief disable assignment
     */
    ScomAccessor & operator=(const ScomAccessor &);

};

/**
 *  @brief Singleton to access the only ScomService
 */
class ScomService;
PRDF_DECLARE_SINGLETON(ScomService, theScomService);

/**
 *  @brief Returns a reference to the ScomService singleton
 *
 *  @return Reference to the ScomService
 */
ScomService& getScomService();

/**
 *  @brief ScomService class
 */
class ScomService
{
  public:

    /**
     *  @brief Construct ScomService
     */
    ScomService();

    /**
     *  @brief Destroys ScomService
     */
    ~ScomService();

    /**
     * @brief set the scom accessor to be used
     *
     * @param[in] i_ScomAccessor new scom accessor
     */
    void setScomAccessor(ScomAccessor & i_ScomAccessor);

    /**
     Access the scan com register
     @param i_target Target to access the register
     @param BIT_STRING_CLASS - holds data read or to write
     @param register address
     @param [READ|WRITE]
     @returns [SUCCESS|FAIL]
     @pre bs.Length() must be size of register data to read/write
     @post For read operation, bs is modified to reflect hardware register state
     @note
     */
    virtual uint32_t Access(TARGETING::TargetHandle_t i_target,
                            BIT_STRING_CLASS & bs,
                            uint64_t registerId,
                            MopRegisterAccess::Operation operation) const;

  private:

    // Disable copy constructor / assignment operator
    ScomService(const ScomService& i_right);
    ScomService& operator=(const ScomService& i_right);

    // Scom access to actual HW or Sim
    ScomAccessor * iv_ScomAccessor;
};

/**
    Access Scan comm via the HOM
    @author Doug Gilbert
    @par
    @code
    @endcode
*/
class HomRegisterAccessScom : public MopRegisterAccess
{
public:
  /**
   Constructor
   @param
   @returns
   @pre
   @post
   @see
   @note
   */
  inline HomRegisterAccessScom(TARGETING::TargetHandle_t i_ptargetHandle );
  inline HomRegisterAccessScom(void);

  /*
   Destructor
   */
  //  ~HomRegisterAccessScom();

  /**
   Access the scan com register
   @param BIT_STRING_CLASS - holds data read or to write
   @param register address
   @param [READ|WRITE]
   @returns [SUCCESS|FAIL]
   @pre bs.Length() must be size of register data to read/write
   @post For read operation, bs is modified to reflect hardware register state
   @note
   */
  virtual uint32_t Access(BIT_STRING_CLASS & bs,
                          uint64_t registerId,
                          Operation operation) const;

  /**
   Get the handle used to pass to access (obsolite???)
   @param returnes number of targethandles in TargetHandle list
   @returns list of targethandles
   @pre none
   @post none
   @note  Can this be removed from the framework???
   */
  inline virtual const TARGETING::TargetHandle_t * GetChipIds(int & count) const { count = 0; return NULL;}

  bool operator==(const HomRegisterAccessScom & hrm)
  {
    return (hrm.iv_ptargetHandle == iv_ptargetHandle);
  }

private:  // functions
private:  // Data

  // maybe we should store the functionalUnitPtr instead
 TARGETING::TargetHandle_t  iv_ptargetHandle;

};

struct ScanRingField
{
  uint64_t registerId;
  uint32_t length;
};
/**
    Access Scan ring registers via the HOM
    @author Doug Gilbert
    @par
    @code
    @endcode
*/
class HomRegisterAccessScan : public MopRegisterAccess
{
public:
  /**
   Constructor
   @param
   @returns
   @pre
   @post
   @see
   @note
   */
  HomRegisterAccessScan(TARGETING::TargetHandle_t i_ptargetHandle ,ScanRingField * start, ScanRingField * end);
  inline HomRegisterAccessScan(void);

  /*
   Destructor
   */
  //  ~HomRegisterAccessScan();

  /**
   Access the scan com register
   @param BIT_STRING_CLASS - holds data read or to write
   @param register address
   @param [READ|WRITE]
   @returns [SUCCESS|FAIL]
   @pre bs.Length() must be size of register data to read/write
   @post For read operation, bs is modified to reflect hardware register state
   @note
   */
  virtual uint32_t Access(BIT_STRING_CLASS & bs,
                          uint64_t registerId,
                          Operation operation) const;


  /**
   Get the Id(s) used to pass to access (obsolite???)
   @param returnes number of targetHandle
   @returns list of targetHandles
   @pre none
   @post none
   @note  Can this be removed from the framework???
   */
  inline virtual const TARGETING::TargetHandle_t * GetChipIds(int & count) const { count = 0; return NULL;}

  bool operator==(const HomRegisterAccessScan & hrm)
  {
    return (hrm.iv_punitHandle == iv_punitHandle);
  }

private:  // functions
private:  // Data

  typedef std::vector<ScanRingField> AliasIdList;

  // maybe we should store the functionalUnitPtr instead
  TARGETING::TargetHandle_t iv_punitHandle;

  // list of fields to extract
  AliasIdList iv_aliasIds;

};




inline HomRegisterAccessScom::HomRegisterAccessScom(TARGETING::TargetHandle_t i_ptargetHandle )
: MopRegisterAccess(), iv_ptargetHandle(i_ptargetHandle )
{}

inline HomRegisterAccessScom::HomRegisterAccessScom()
: MopRegisterAccess(), iv_ptargetHandle(NULL)
{}

inline HomRegisterAccessScan::HomRegisterAccessScan()
: MopRegisterAccess(),iv_punitHandle(NULL)
{}

} // End namespace PRDF

#endif /* PRDFHOMREGISTERACCESS_H */
OpenPOWER on IntegriCloud