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

// Module Description **************************************************
//
// Description: PRD resolution definition
//
// End Module Description **********************************************

//----------------------------------------------------------------------
//  Includes
//----------------------------------------------------------------------
#define iipResolution_C

#include <iipconst.h>
#include <CcAutoDeletePointer.h>
#include <iipSystem.h>
#include <iipglobl.h>
//#include <iipCalloutMap.h>
#include <iipCalloutResolution.h>
#include <iipstep.h>
#include <iipScanCommRegisterChip.h>
#include <iipCaptureData.h>
#include <iipServiceDataCollector.h>
#include <iipErrorRegister.h>
#include <iipEregResolution.h>
#include <iipsdbug.h>
#include <iipResolutionList.h>
//#include <iipThresholdResolution.h>
#include <iipCallAttnResolution.h>
#include <iipTerminateResolution.h>
#include <iipAnalyzeChipResolution.h>
#include <xspprdTryResolution.h>
//#include <prdfResetThresholdResolution.H>
//#include <prdfIntervalThresholdResolution.H>
#include <iipchip.h>
#include <prdfCalloutConnected.H>
#include <prdfAnalyzeConnected.H>
#include <prdfPlatServices.H>

#undef iipResolution_C

using namespace PRDF;

//----------------------------------------------------------------------
//  User Types
//----------------------------------------------------------------------

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

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

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

//----------------------------------------------------------------------
//  Global Variables
//----------------------------------------------------------------------

//---------------------------------------------------------------------
// Resolution Member Function Specifications
//---------------------------------------------------------------------
Resolution::~Resolution() {}

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

int32_t EregResolution::Resolve(STEP_CODE_DATA_STRUCT & data)
{
    int32_t rc = PRD_INTERNAL_CODE_ERROR;
    if(errorRegister != NULL)
    {
        rc = errorRegister->Analyze(data);
    }
    return rc;
}


//---------------------------------------------------------------------
// CalloutResolution Member Function Specifications
// using MruValues (xspiiCallout.h)
//---------------------------------------------------------------------

int32_t CalloutResolution::Resolve(STEP_CODE_DATA_STRUCT & error)
{
    error.service_data->SetCallout(xMruCallout,xPriority);
    return(SUCCESS);
}

//--------------------------------------------------------------------
// ResolutionList Member Functions
//--------------------------------------------------------------------

int32_t ResolutionList::Resolve(STEP_CODE_DATA_STRUCT & error)
{
    int32_t rc = SUCCESS;
    for(std::vector<void *>::iterator iter = resolutionList.begin();
        iter != resolutionList.end();
        ++iter)
    {
        Resolution * r = (Resolution *) *iter;
        rc = r->Resolve(error);
        if(rc != SUCCESS) break;
    }
    return(rc);
}

//--------------------------------------------------------------------
// ThresholdResolution Member Functions
//--------------------------------------------------------------------

//int32_t ThresholdResolution::Resolve(STEP_CODE_DATA_STRUCT & error)
//{
//  ++count;
//  error.service_data->SetHits((uint16_t)count);
//  error.service_data->SetThreshold((uint16_t)threshold);
//  if((count >= threshold) || (error.service_data->IsFlooding()))
//  {
//    error.service_data->SetThresholdMaskId(maskId);  // threshold, degraded YES
//  }
//  int32_t rc = SUCCESS;
//  if(xRes != NULL) rc = xRes->Resolve(error);
//  return rc;
//}

//--------------------------------------------------------------------
// Call all chips raising attention as reported by sp sysdebug area
//--------------------------------------------------------------------
int32_t CallAttnResolution::Resolve(STEP_CODE_DATA_STRUCT & error)
{
    int32_t rc = NO_DOMAINS_AT_ATTENTION;
    SYSTEM_DEBUG_CLASS systemDebug;

    ErrorSignature * signature = error.service_data->GetErrorSignature();
    signature->clear();
    signature->setChipId(0xffffffff);

    systemDebug.CalloutThoseAtAttention(error);

    signature->setErrCode((uint16_t)NO_PRD_ANALYSIS);

    return(rc);
}

// ********************************************************************

int32_t TerminateResolution::Resolve(STEP_CODE_DATA_STRUCT & error)
{
    error.service_data->SetTerminate();
    return(SUCCESS);
}

// ********************************************************************

int32_t AnalyzeChipResolution::Resolve(STEP_CODE_DATA_STRUCT & error)
{
    // mk442956 a
    return xChip.Analyze(error,error.service_data->GetCauseAttentionType());
}

// ********************************************************************

int32_t TryResolution::Resolve(STEP_CODE_DATA_STRUCT & error)
{
    // Save the current error signature
    ErrorSignature * es = error.service_data->GetErrorSignature();
    ErrorSignature temp = *es;
    // Try the tryResolution
    int32_t rc = xTryResolution->Resolve(error);
    if ( (SUCCESS != rc) && (PRD_NO_CLEAR_FIR_BITS != rc) ) // if it didn't work
    {
        // Restore signature
        *es = temp;
        // Call the default signature
        rc = xDefaultResolution->Resolve(error);
    }
    return rc;
}

int32_t prdfCalloutConnected::Resolve(STEP_CODE_DATA_STRUCT & serviceData)
{
    using namespace TARGETING;

    TargetHandle_t l_pconnectedTarget = NULL;
    TargetHandleList l_connectedTargetList;
    l_connectedTargetList = PlatServices::getConnected( iv_psourceHandle,
                                                        iv_targetType );
    if(0xffffffff == iv_idx)
    {
        if(l_connectedTargetList.size()>0)
        {
            l_pconnectedTarget = l_connectedTargetList[0];
        }
    }
    else
    {
        for(TargetHandleList::iterator itrTarget = l_connectedTargetList.begin();
            itrTarget!= l_connectedTargetList.end();itrTarget++)
        {
            if(iv_idx == PlatServices::getTargetPosition(*itrTarget))
            {
                l_pconnectedTarget = *itrTarget ;
                break;
            }
        }
    }

    if ( l_pconnectedTarget != NULL )
    {
        serviceData.service_data->SetCallout(l_pconnectedTarget,iv_priority);
    }
    else
    {
        if(iv_altResolution != NULL)
        {
            iv_altResolution->Resolve(serviceData);
        }
        else
        {
            serviceData.service_data->SetCallout(iv_psourceHandle);
        }
    }

    return SUCCESS;
}

//--------------------------------------------------------------------
// AnalyzeConnected Member Functions
//--------------------------------------------------------------------
int32_t PrdfAnalyzeConnected::Resolve(STEP_CODE_DATA_STRUCT & serviceData)
{
    using namespace TARGETING;
    using namespace PRDF;

    CHIP_CLASS * l_connChipObj = NULL;
    TARGETING::TargetHandle_t l_pconnChipTarget = NULL;

    // Get connected list.
    TargetHandleList l_connectedTargetList = PlatServices::getConnected(
                                                            iv_psourceHandle,
                                                            iv_targetType );

    // If ID = 0xffffffff, find first valid.
    if (0xffffffff == iv_idx)
    {
        if(l_connectedTargetList.size()>0)
        {
            //First valid handle. we don't allow invalid things in list
            l_pconnChipTarget = l_connectedTargetList[0] ;
        }
    }
    // Otherwise, grab from correct index.
    else
    {
        for(TargetHandleList::iterator itrTarget = l_connectedTargetList.begin();
            itrTarget!= l_connectedTargetList.end();itrTarget++)
        {
            if(iv_idx == PlatServices::getTargetPosition(*itrTarget))
            {
                l_pconnChipTarget = *itrTarget ;
                break;

            }
        }
    }

    // If valid chip found, look up in global system container.
    if (NULL != l_pconnChipTarget)
    {
        l_connChipObj = systemPtr->GetChip(l_pconnChipTarget);
    }

    // Analyze chip.
    if (NULL != l_connChipObj)
        return l_connChipObj->Analyze( serviceData,
                            serviceData.service_data->GetCauseAttentionType() );
    else
        return PRD_UNRESOLVED_CHIP_CONNECTION;
}

//--------------------------------------------------------------------
// ResetThresholdResolution Member Functions
//--------------------------------------------------------------------

#if defined(_OBSOLITE_)
int32_t ResetThresholdResolution::Resolve(STEP_CODE_DATA_STRUCT & error)
{
    ++count;
    error.service_data->SetHits((uint16_t)count);
    error.service_data->SetThreshold((uint16_t)threshold);
    if((count == threshold) || (error.service_data->IsFlooding()))
    {
        error.service_data->SetThresholdMaskId(maskId);  // threshold, degraded YES
        count = 0;                                       // Reset the counter when threshold is hit
    }
    int32_t rc = SUCCESS;
    //  if(xRes != NULL) rc = xRes->Resolve(error);
    return rc;
}
//--------------------------------------------------------------------
// IntervalThresholdResolution Member Functions
//--------------------------------------------------------------------

int32_t IntervalThresholdResolution::Resolve(STEP_CODE_DATA_STRUCT & error)
{
    PrdTimer curTime = error.service_data->GetTOE();       // get timestamp (Time Of Error) from SDC;
    ++count;
    if (count == 1)                                        // The interval begins now at the first occurrence
        intervalEndTime = curTime + intervalLength;        // Project the end of interval (intervalLength is in seconds)
    else
    {
        if (curTime > intervalEndTime)                      // See if we're already past the time window
        {
            count = 1;                                      // Reset count as if it were the first
            intervalEndTime = curTime + intervalLength;     // Project the new end of interval (intervalLength is in seconds)
        }
        else if((count == threshold) || (error.service_data->IsFlooding())) // We've hit threshold within the interval
        {
            error.service_data->SetThresholdMaskId(maskId);  // threshold, degraded YES
            count = 0;                                       // Reset the counter when threshold is hit
        }
        else ;                                              // Nothing else--the count is already incremented
    }
    error.service_data->SetHits((uint16_t)count);
    error.service_data->SetThreshold((uint16_t)threshold);

    int32_t rc = SUCCESS;
    //  if(xRes != NULL) rc = xRes->Resolve(error);
    return rc;
}
#endif
OpenPOWER on IntegriCloud