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

/**
 @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
*/

using 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 ( !PRDF::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 ( !PRDF::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 ( !PRDF::PlatServices::mfgMode() )
  {
    r = &iv_thresholdResolutions.get(
                    ThresholdResolution(maskId,
                                        ThresholdResolution::cv_fieldDefault) );
  }
  else
  {
    r = &iv_maskResolutions.get(MaskResolution(maskId));
  }

  return *r;
}

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

    return iv_connectedCallouts.get(key);
}

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

    return iv_analyzeConnected.get(key);
}

Resolution & ResolutionFactory::GetPluginCallResolution(
        PrdfExtensibleChip * i_chip, PrdfExtensibleChipFunction * i_function)
{
    return iv_pluginCallFW.get(PrdfPluginCallResolution(i_chip,i_function));
}

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

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

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

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

#ifdef __HOSTBOOT_MODULE
Resolution & ResolutionFactory::GetDumpResolution(
                                    /* FIXME: hwTableContent iDumpRequestContent, */
                                    TARGETING::TargetHandle_t i_pDumpHandle )
{
    return iv_dumpResolutionFW.get(DumpResolution(/*FIXME: iDumpRequestContent,*/ i_pDumpHandle));
}
#else
Resolution & ResolutionFactory::GetDumpResolution(
                                    hwTableContent iDumpRequestContent,
                                    TARGETING::TargetHandle_t i_pDumpHandle )
{
    return iv_dumpResolutionFW.get(DumpResolution(iDumpRequestContent, i_pDumpHandle));
}
#endif

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

Resolution & ResolutionFactory::GetCaptureResolution
    (PrdfExtensibleChip * i_chip,
     uint32_t i_group)
{
    return iv_captureResolutionFW.get(PrdfCaptureResolution(i_chip,i_group));
}

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

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

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

}
// dg03a end
// Change Log *************************************************************************************
//
//  Flag Reason    Vers Date     Coder    Description
//  ---- --------- ---- -------- -------- ---------------------------------------------------------
//                      02/28/97 DGILBERT Initial Creation
//       D49274.11 v4r5 01/20/99 SERAFIN  Increased MAX_CALLOUT_RESOLUTIONS and MAX_LINKS
//       D49420.1  v5r2 07/17/00 mkobler  Add interface which uses ChipEnums
//       d49420.2  v5r2 09/20/00 dgilbert increase link vector size
//       d49420.7  v5r2 11/10/00 dgilbert move GetCalloutResolution(CHIP_ID...)
//                                        to xspprdCondorOnly.C
//       d49420.7  v5r2 11/20/00 mkobler  change default list/link size
//       d49420.10 v5r2 01/16/00 mkobler  change default callout list size
//  dg00 p4907689  v5r2 02/22/01 dgilbert link/list size += 1000
//                 csp  07/11/01 dgilbert rewrite to solve size problem
//  dg01           fips 08/09/02 dgilbert rewrite using FlyWeight template
//  dg02 400647    fips 03/24/03 dgilbert add GetThresholdResolution()
//  dg04 493306    235  03/01/05 dgilbert Add prdfCalloutConnected
//       497866    235  03/29/05 dgilbert add idx & priority to prdfCalloutConnected
//  dg05 498293    310  04/06/05 dgilbert add analyzeConnected
//  pw01 F527129   f300 10/31/05 iawillia Move inlined code to .C so it compiles.
//  ecdf F550548   f300 05/04/06 iawillia eClipz DUMP flags support.
//  dg05           f310 05/18/07 dgilbert Clear iv_captureResolutoinFW to prevent memory leak.
// End Change Log *********************************************************************************
OpenPOWER on IntegriCloud