summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/resolution/iipResolutionFactory.C
blob: 3dd3a8541335f4b0c8acfdef157a640685440e69 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/resolution/iipResolutionFactory.C $ */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1997,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                                                     */

/**
 @file iipResolutionFactory.h
 @brief ResolutionFactory definition
 */
// Module Description **************************************************
//
// Description:
//
// End Module Description **********************************************

//----------------------------------------------------------------------
//  Includes
//----------------------------------------------------------------------
#define iipResolutionFactory_C

#include <iipResolutionFactory.h>
#include <prdfFlyWeight.C>            // dg01
#include <prdfFlyWeightS.C>
#include <prdfPlatServices.H>

#undef iipResolutionFactory_C
//----------------------------------------------------------------------
//  User Types
//----------------------------------------------------------------------

//----------------------------------------------------------------------
//  Constants
//----------------------------------------------------------------------

//----------------------------------------------------------------------
//  Macros
//----------------------------------------------------------------------

//----------------------------------------------------------------------
//  Internal Function Prototypes
//----------------------------------------------------------------------

//----------------------------------------------------------------------
//  class static Variables
//----------------------------------------------------------------------

// dg01 - delete 4 lines of code
// pw01 - This stuff doesn't appear to be needed anymore.
/*class CalloutFW;                      // dg01
class ResolutionLinkFW;             // dg01
class ThresholdResolutionList;    // dg02
class MaskResolutionFW;             // dg02
class ConnectedFW;            // dg04a
class AnalyzeCFW;              // dg05a
class PluginCallFW;                // dg06a
class ThresholdSigFW;             // dg06a
class EregResolutionFW;        // dg06a
class TryResolutionFW;          // dg06a
class FlagResolutionFW;        // dg06a
class DumpResolutionFW;        // dg06a
class GardResolutionFW;        // dg06a
*/

namespace PRDF
{

//---------------------------------------------------------------------
// Member Function Specifications
//---------------------------------------------------------------------

ResolutionFactory & ResolutionFactory::Access(void)
{
  static ResolutionFactory rf;
  return(rf);
}

//---------------------------------------------------------------------

ResolutionFactory::~ResolutionFactory()
{
}

// ---------------------------------------------------------------------

Resolution & ResolutionFactory::GetCalloutResolution(PRDcallout callout,
                                                     PRDpriority p)
{
  // search for existing callout
  // dg01 start
  CalloutResolution key(callout,p);
  return iv_Callouts.get(key);
  // dg01 end
}

// ----------------------------------------------------------------------

Resolution & ResolutionFactory::LinkResolutions(Resolution & r1,
                                                Resolution & r2)
{
  // dg01 start
  // search for existing link
  ResolutionFactory::ResolutionLink key(r1,r2);
  return iv_Links.get(key);
  // dg01 end
}

// ---------------------------------------------------------------------

int32_t ResolutionFactory::ResolutionLink::Resolve(
                                           STEP_CODE_DATA_STRUCT & serviceData )
{
  int32_t rc = xlnk1->Resolve(serviceData);
  if (rc == SUCCESS) rc = xlnk2->Resolve(serviceData);
  return rc;
}

// dg02a - start
MaskResolution & ResolutionFactory::GetThresholdResolution( uint32_t maskId,
                        const ThresholdResolution::ThresholdPolicy & policy,
                        const ThresholdResolution::ThresholdPolicy & mfgPolicy )
{
  MaskResolution * r = NULL;
  if ( !PlatServices::mfgMode() )
  {
    r = &iv_thresholdResolutions.get(ThresholdResolution(maskId,policy));
  }
  else
  {
    r = &iv_thresholdResolutions.get(ThresholdResolution(maskId,mfgPolicy));
  }
  return *r;
}

MaskResolution & ResolutionFactory::GetThresholdResolution( uint32_t maskId,
                        const ThresholdResolution::ThresholdPolicy & policy )
{
  MaskResolution * r = NULL;
  if ( !PlatServices::mfgMode() &&
       !(policy == ThresholdResolution::cv_mnfgDefault) )
  {
    r = &iv_thresholdResolutions.get(ThresholdResolution(maskId,policy));
  }
  else
  {
    r = &iv_maskResolutions.get(MaskResolution(maskId));
  }

  return *r;
}

MaskResolution & ResolutionFactory::GetThresholdResolution(uint32_t maskId)
{
  MaskResolution * r = NULL;
  if ( !PlatServices::mfgMode() )
  {
    r = &iv_thresholdResolutions.get(
                    ThresholdResolution(maskId,
                                        ThresholdResolution::cv_fieldDefault) );
  }
  else
  {
    r = &iv_maskResolutions.get(MaskResolution(maskId));
  }

  return *r;
}

Resolution & ResolutionFactory::GetConnectedCalloutResolution(
                                    TARGETING::TYPE i_targetType,
                                    uint32_t i_idx,
                                    PRDpriority i_priority,
                                    Resolution * i_altResolution,
                                    TARGETING::TYPE i_peerConnType )
{
    CalloutConnected key(   i_targetType,
                            i_idx,
                            i_priority,
                            i_altResolution,
                            i_peerConnType );

    return iv_connectedCallouts.get(key);
}

Resolution & ResolutionFactory::GetAnalyzeConnectedResolution(
                                    TARGETING::TYPE i_targetType,
                                    uint32_t i_idx )
{
    AnalyzeConnected key( i_targetType, i_idx );

    return iv_analyzeConnected.get(key);
}

Resolution & ResolutionFactory::GetPluginCallResolution(
                                    ExtensibleChipFunction * i_function )
{
    return iv_pluginCallFW.get( PluginCallResolution( i_function ) );
}

Resolution & ResolutionFactory::GetThresholdSigResolution(
                        const ThresholdResolution::ThresholdPolicy & policy )
{
    return iv_thresholdSigFW.get(ThresholdSigResolution(policy));
}

Resolution & ResolutionFactory::GetEregResolution(ErrorRegisterType & i_er)
{
    return iv_eregResolutionFW.get(EregResolution(i_er));
}

Resolution & ResolutionFactory::GetTryResolution( Resolution & i_tryRes,
                                                  Resolution & i_defaultRes )
{
    return iv_tryResolutionFW.get(TryResolution(i_tryRes,i_defaultRes));
}

Resolution & ResolutionFactory::GetFlagResolution(
                                    ServiceDataCollector::Flag i_flag )
{
    return iv_flagResolutionFW.get( FlagResolution( i_flag ) );
}

Resolution & ResolutionFactory::GetDumpResolution(
                                    hwTableContent iDumpRequestContent )
{
    return iv_dumpResolutionFW.get(DumpResolution( iDumpRequestContent ) );
}

Resolution & ResolutionFactory::GetGardResolution(GardAction::ErrorType et)
{
    return iv_gardResolutionFW.get(GardResolution(et));
}

Resolution & ResolutionFactory::GetCaptureResolution( int32_t i_group )
{
    return iv_captureResolutionFW.get( CaptureResolution( i_group ) );
}

Resolution & ResolutionFactory::GetClockResolution(
                                    TARGETING::TargetHandle_t i_pClockHandle,
                                    TARGETING::TYPE i_targetType )
{
    return iv_clockResolutionFW.get( ClockResolution( i_pClockHandle,
                                                      i_targetType ) );
}

void ResolutionFactory::Reset()
{
  PRDF_INF( "ResolutionFactory.Reset()" );

  iv_thresholdResolutions.clear();
  // we must clear this because it could have links to Thresholds
  iv_Links.clear();
  iv_pluginCallFW.clear();
  iv_thresholdSigFW.clear();
  iv_eregResolutionFW.clear();
  iv_tryResolutionFW.clear();
  iv_captureResolutionFW.clear();
  /*Clear because the "alt resolution" could have be a link or other cleared
  resolution.*/
  iv_connectedCallouts.clear();
  iv_clockResolutionFW.clear();

}

#ifdef FLYWEIGHT_PROFILING

void ResolutionFactory::printStats()
{
    PRDF_TRAC("Callout");
    iv_Callouts.printStats( );
    PRDF_TRAC("Link Resolution");
    iv_Links.printStats( );
    PRDF_TRAC("ThresholdResolutionList");
    iv_thresholdResolutions.printStats( );
    PRDF_TRAC("MaskResolution");
    iv_maskResolutions.printStats( );
    PRDF_TRAC("ConnectedCallout");
    iv_connectedCallouts.printStats( );
    PRDF_TRAC("AnalyzeConnectedCallout");
    iv_analyzeConnected.printStats( );
    PRDF_TRAC("pluginCallFW");
    iv_pluginCallFW.printStats( );
    PRDF_TRAC("Threshhold");
    iv_thresholdSigFW.printStats( );
    PRDF_TRAC("EregResolution");
    iv_eregResolutionFW.printStats( );
    PRDF_TRAC("TryResolution");
    iv_tryResolutionFW.printStats( );
    PRDF_TRAC("FlagResolution");
    iv_flagResolutionFW.printStats( );
    PRDF_TRAC("dumpResolution");
    iv_dumpResolutionFW.printStats( );
    PRDF_TRAC("gardResolution");
    iv_gardResolutionFW.printStats( );
    PRDF_TRAC("captureResolution");
    iv_captureResolutionFW.printStats( );
    PRDF_TRAC("clockResolution");
    iv_clockResolutionFW.printStats( );

}
#endif
} // end namespace PRDF

OpenPOWER on IntegriCloud