summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/register/prdfScanFacility.H
blob: a0e407c735330b87c7b91ab7ed8526f0fa2f9e65 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/register/prdfScanFacility.H $ */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2002,2014              */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

#ifndef PRDFSCANFACILITY_H
#define PRDFSCANFACILITY_H
/**
   @file prdfScanFacility.H
   @brief Description
*/


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

#include <prdfFlyWeight.H>
#include <prdfFlyWeightS.H>
#include <vector>
#include <prdfHomRegisterAccess.H>
#include <prdfScomRegister.H>
#include <prdfScomRegisterAccess.H>
#include <prdfOperatorRegister.H>
#include <prdfPlatServices.H>

namespace PRDF
{


/**
    PRD Scan Facility
    @author Doug Gilbert
    @par    The Scan facility is used by PRD to access Scan and Scan Comm
    @       functions.It attempts to reduce duplicate objects and their
    @       aggragates as must as possible.
    @code
      ScanFacility & sf = ScanFacility::Access();
      SCAN_COMM_REGISTER_CLASS & scr = sf.GetScanCommRegister(chipId,Address,bitLen);
      scr.Read() ... see iipscr.h
      ScanRingField srf[] =
      {{hregAliasId1 , fieldBitLength1},
       {hregAliasId2 , fieldBitLength2}};
      SCAN_COMM_REGISTER_CLASS & sr = s.GetScanRingRegister(aTARGETING::
      TargetHandle_t,srf,srf+2);
      scr.Read() .... SCAN_COMM_REGISTER_CLASS
      // Note you can't write a scan ring register from PRD
      // you can only read scan ring registers from PRD if the global attention
      // type is CHECK_STOP
    @endcode
*/
class ScanFacility
{
public:
  /**
   The Scan Facility is a singleton - this function provides access to it.
   */
  static ScanFacility & Access(void);

    /**
    * @brief     Returns reference to flyweight object of type ScomRegister.
    *            An object of given address is first searched in flyweight.
    *            If object exist, reference to existing object is returned
    *            else a new one is created.
    * @param     i_address        address of the register
    * @param     i_scomLength     length of the bit string
    * @param     i_type           type of target associated with register
    * @param     i_regOp          operations supported for given register
    * @return   returns reference to flyweight object from factory
    */
   SCAN_COMM_REGISTER_CLASS & GetScanCommRegister( uint64_t address,
                                uint32_t i_scomLength, TARGETING::TYPE i_type,
                                SCAN_COMM_REGISTER_CLASS::AccessLevel i_regOp );

  /**
   Get a scan ring register
   * @param i_ptargetHandle        handle to target in targeting
   * @param pointer to list an array of ScanRingField  see prdfHomRegisterAccess.H
   * @param pointer to last entry+1 of ScanFingField array
   * @pre   AliasId's for the scan ring registers MUST exist in the function unit
          associated with the Id given
   * @post  Access object and scr created for this register. the bit length of the
          scr returned will be the sum of all the field lengths provided.
   * @note  an SCR based on a scan ring register can not be written, and should
          only be read if the global
    attention type is CHECK_STOP.
   */

//FIXME  Need to discuss before deleting the function below
#if 0
  SCAN_COMM_REGISTER_CLASS & GetScanRingRegister(
                                TARGETING::TargetHandle_t i_ptargetHandle,
                                ScanRingField * start,
                                ScanRingField * end);
#endif

  /**
   * @brief  Get a register that bitwise inverts the bitstring of a register
   *         when read or written to
   * @param  SCAN_COMM_REGISTER_CLASS source
   * @post   Only one instance of the register with this SCR paramter will exist
   */
  SCAN_COMM_REGISTER_CLASS & GetNotRegister(SCAN_COMM_REGISTER_CLASS & i_arg);

  /**
   * @brief  Get a register that bitwise left shift the bitstring of a register
   *         when read or written to
   * @param  SCAN_COMM_REGISTER_CLASS source
   * @post   Only one instance of the register with this SCR paramter and amount
     @       will exist
   */
  SCAN_COMM_REGISTER_CLASS & GetLeftShiftRegister(
                        SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount);

  /**
   * @brief Get a register that bitwise right shift the bitstring of a register
   *        when read or written to
   * @param SCAN_COMM_REGISTER_CLASS source
   * @post  Only one instance of the register with this SCR paramter and amount
   * @      will exist
   */
  SCAN_COMM_REGISTER_CLASS & GetRightShiftRegister(
                        SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount);



  /**
   * @brief  Get a register that bit-wise ANDs the bitstring of two register
   *         when read or written to
   * @param  The 2 SCR 's to AND
   * @posrt  Only one instance of the register with these SCRs will exist
   */
  SCAN_COMM_REGISTER_CLASS & GetAndRegister(SCAN_COMM_REGISTER_CLASS & i_left,
                                            SCAN_COMM_REGISTER_CLASS & i_right);

  /**
   * @brief  Get a register that bitwise ORs the bitstrings of two register when
   *         read or written
   * @param  the 2 SCR's to OR
   * @post   Only one instance of the register with these SCR's will exist
   */
  SCAN_COMM_REGISTER_CLASS & GetOrRegister(SCAN_COMM_REGISTER_CLASS & i_left,
                                           SCAN_COMM_REGISTER_CLASS & i_right);

  /**
   * @brief  Get a AttnTypeRegister
   * @params 4 pointers to scr Registers
   * @post only one instance of the register with these SCR's will exist
   */
  SCAN_COMM_REGISTER_CLASS & GetAttnTypeRegister(
                                    SCAN_COMM_REGISTER_CLASS * i_check,
                                    SCAN_COMM_REGISTER_CLASS * i_recov,
                                    SCAN_COMM_REGISTER_CLASS * i_special,
                                    SCAN_COMM_REGISTER_CLASS * i_proccs);

  /**
   * @brief Get a PrdfConstantRegister
   * @param BIT_STRING_CLASS - the bit string constant to use.
   * @post only one instance of the register with this BIT_STRING value will
   * exist.
   */
  SCAN_COMM_REGISTER_CLASS & GetConstantRegister(BIT_STRING_CLASS i_val);
  /**
   * @brief Get a plugin  register
   * @param Reference to target less flyweight object
   * @param RuleChip  associatd with register
   * @post only one instance of the register with this BIT_STRING value will
   * exist.
   */
  SCAN_COMM_REGISTER_CLASS & GetPluginRegister(
                                SCAN_COMM_REGISTER_CLASS & i_flyweight,
                                ExtensibleChip & i_RuleChip );
  /**
   * @brief Delete all the plugin  register
   * @param None
   * @post  all the ScomRegisterAccess register flyweight object created for
   *        plugin shall be deleted
   * exist.
   */
  void ResetPluginRegister();
#ifdef FLYWEIGHT_PROFILING
/**
 * @brief       prints memory allocated for object residing on flyweight
 */
  void printStats();
#endif

  /**
   Destructor
   */
//  ~ScanFacility();
private:  // functions
  /**
   Constructor
   * @param
   * @returns
   * @pre
   * @post
   * @see
   * @note
   */
  ScanFacility() {}


private:  // Data
  typedef FlyWeightS<ScomRegister,50>           ScanCommRegisters;
  //FIXME RTC 64345 Investigate benefit of changing below from FlyWeight to
  //FlyWeightS
  typedef FlyWeight<AttnTypeRegister,50>        AttnTypeRegisters;
  typedef FlyWeightS<AndRegister,50>            AndRegisters;
  typedef FlyWeightS<OrRegister,10>             OrRegisters;
  typedef FlyWeightS<NotRegister,50>            NotRegisters;
  typedef FlyWeightS<LeftShiftRegister,10>      LeftShiftRegisters;
  typedef FlyWeightS<RightShiftRegister, 10>    RightShiftRegisters;
  typedef FlyWeight<ConstantRegister, 10>       ConstantRegisters;
  typedef FlyWeightS<ScomRegisterAccess, 10>    PluginRegisters;

  ScanCommRegisters     iv_scomRegFw;
  AttnTypeRegisters     iv_attnRegFw;
  AndRegisters          iv_andRegFw;
  OrRegisters           iv_orRegFw;
  NotRegisters          iv_notRegFw;
  LeftShiftRegisters    iv_leftRegFw;
  RightShiftRegisters   iv_rightRegFw;
  ConstantRegisters     iv_constRegFw;
  PluginRegisters       iv_pluginRegFw;

};

} // end namespace PRDF

#endif /* PRDFSCANFACILITY_H */
OpenPOWER on IntegriCloud