summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/config/prdfPllDomain.C
blob: 3acd6c45cf03ca668f25b99e249d88e376b47e37 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/config/prdfPllDomain.C $   */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2003,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  prdfPllDomain.C
 *  @brief Definition of PllDomain class
 */

#include <CcAutoDeletePointer.h>
#include <iipscr.h>
#include <iipsdbug.h>
#include <iipServiceDataCollector.h>
#include <prdfErrorSignature.H>
#include <prdfPllDomain.H>
#include <iipResolution.h>
#include <prdfPlatServices.H>
#include <prdfPluginDef.H>
#include <iipglobl.h>
#include <iipSystem.h>

namespace PRDF
{

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

int32_t PllDomain::Initialize(void)
{

  int32_t rc = SUCCESS;
  if(PlatServices::isMasterFSP())
  {
//@jl01 D-START
//Deleting the call of the ClearPll error.
//These errors used to have to be cleared before you tried to use the chips.
//However, the inits from other comps are better are cleaning up the PLL errors.
//    for (unsigned int i = 0; i < GetSize() && rc == SUCCESS; ++i)
//    {
//      PrdfExtensibleChip * l_chip = LookUp(i);
//      PrdfExtensibleFunction * l_clearPll = l_chip->getExtensibleFunction("ClearPll");
      // Call ClearPll on this chip  (see prdfPluginDef.H for bindParm defn)
//      (*l_clearPll)(l_chip,PrdfPluginDef::bindParm<void *>(NULL));
//@jl01 D-END

// Don't unmask   04/20/2006 Review
//      PrdfExtensibleFunction * l_unmask = l_chip->getExtensibleFunction("UnmaskPll");
//      (*l_unmask)(l_chip,PrdfPluginDef::bindParm<void *>(NULL));
//    }
  }
  return(rc);
}

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

bool PllDomain::Query(ATTENTION_TYPE attentionType)
{
    bool atAttn = false;
    // System always checks for RE's first, even if there is an XSTOP
    // So we only need to check for PLL errors on RECOVERABLE type
    if(attentionType == RECOVERABLE)
    {
        // check sysdbug for attention first
        SYSTEM_DEBUG_CLASS sysdbug;
        for(unsigned int index = 0; (index < GetSize()) && (atAttn == false);
            ++index)
        {
            if(sysdbug.IsAttentionActive(LookUp(index)->GetChipHandle()))
            {
                PrdfExtensibleChip * l_chip = LookUp(index);
                PrdfExtensibleChipFunction * l_query =
                                    l_chip->getExtensibleFunction("QueryPll");
                int32_t rc = (*l_query)(l_chip,PrdfPluginDef::bindParm<bool &>(atAttn));
                // if rc then scom read failed - Error log has already been generated
                if( PRD_POWER_FAULT == rc )
                {
                    PRDF_ERR( "prdfPllDomain::Query() Power Fault detected!" );
                    break;
                }
                else if(SUCCESS != rc)
                {
                    PRDF_ERR( "prdfPllDomain::Query() SCOM fail. RC=%x", rc );
                }
            }
        }
    }

    return(atAttn);
}

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

int32_t PllDomain::Analyze(STEP_CODE_DATA_STRUCT & serviceData,
                          ATTENTION_TYPE attentionType)
{
    typedef PrdfExtensibleChip * ChipPtr;
    CcAutoDeletePointerVector<ChipPtr> chip(new ChipPtr[GetSize()]);
    int count = 0;
    int32_t rc = SUCCESS;

    // Due to clock issues some chips may be moved to non-functional during
    // analysis. In this case, these chips will need to be removed from their
    // domains.
    typedef std::vector<PrdfExtensibleChip *> NonFuncChips;
    NonFuncChips nfchips;

    // Count # of chips that had PLL error
    for(unsigned int index = 0; index < GetSize(); ++index)
    {
        PrdfExtensibleChip * l_chip = LookUp(index);
        PrdfExtensibleChipFunction * l_query = l_chip->getExtensibleFunction("QueryPll");
        bool atAttn;
        rc = (*l_query)(l_chip,PrdfPluginDef::bindParm<bool &>(atAttn));
        if(atAttn == true)
        {
            chip()[count] = LookUp(index);
            ++count;
            l_chip->CaptureErrorData(serviceData.service_data->GetCaptureData());
        }
        else if ( !PlatServices::isFunctional(l_chip->GetChipHandle()) )
        {
            // The chip is now non-functional.
            nfchips.push_back( l_chip );
        }
    }

    // Remove all non-functional chips.
    for ( NonFuncChips::iterator i = nfchips.begin(); i != nfchips.end(); i++ )
    {
        systemPtr->RemoveStoppedChips( (*i)->GetChipHandle() );
    }

    // always suspect the clock source
    closeClockSource.Resolve(serviceData);  // dg06c
    if(&closeClockSource != &farClockSource)
    {
        farClockSource.Resolve(serviceData); // dg06c
    }

    // If only one detected the error, add it to the callout list.
    if ( 1 == count )
    {
        const uint32_t tmpCount = serviceData.service_data->GetMruList().size();

        // Call this chip's CalloutPll plugin if it exists.
        PrdfExtensibleChipFunction * l_callout =
                chip()[0]->getExtensibleFunction( "CalloutPll", true );
        if ( NULL != l_callout )
        {
            (*l_callout)( chip()[0],
                PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT &>(serviceData) );
        }

        if ( tmpCount == serviceData.service_data->GetMruList().size() )
        {
            // No additional callouts were made so add this chip to the list.
            serviceData.service_data->SetCallout( chip()[0]->GetChipHandle());
        }
    }

    iv_threshold.Resolve(serviceData);
    // Test for threshold
    if(serviceData.service_data->IsAtThreshold())
    {
        // Mask in all chips in domain
        PrdfExtensibleDomainFunction * l_mask = getExtensibleFunction("MaskPll");
        (*l_mask)(this,
                  PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(serviceData));
    }
    // Set Signature
    serviceData.service_data->GetErrorSignature()->setChipId(chip()[0]->GetId());
    serviceData.service_data->GetErrorSignature()->setRegId(PRDF_PLL_ERROR);

#ifndef __HOSTBOOT_MODULE
    // Set dump flag dg09a
    serviceData.service_data->SetDump(iv_dumpContent,chip()[0]->GetChipHandle());
#endif

    // Clear PLLs from this domain.
    PrdfExtensibleDomainFunction * l_clear = getExtensibleFunction("ClearPll");
    (*l_clear)(this,
               PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(serviceData));

    // Run any PLL Post Analysis functions from this domain.
    for(int i = 0; i < count; i++)
    {
        PrdfExtensibleChip * l_chip = chip()[i];
        // Send any special messages indicating there was a PLL error.
        PrdfExtensibleChipFunction * l_pllPostAnalysis =
                        l_chip->getExtensibleFunction("PllPostAnalysis", true);
        (*l_pllPostAnalysis)(l_chip,
                PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(serviceData));
    }

    return rc;
}

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

void PllDomain::Order(ATTENTION_TYPE attentionType)
{
    // Order is not important for PLL errors
}

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

int32_t PllDomain::ClearPll( PrdfExtensibleDomain * i_domain,
                             STEP_CODE_DATA_STRUCT i_sc )
{
    PllDomain * l_domain = (PllDomain *) i_domain;

    // Clear children chips.
    for ( uint32_t i = 0; i < l_domain->GetSize(); i++ )
    {
        PrdfExtensibleChip * l_chip = l_domain->LookUp(i);
        PrdfExtensibleChipFunction * l_clear =
                                    l_chip->getExtensibleFunction("ClearPll");
        (*l_clear)( l_chip,
                    PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_sc) );
    }

    // Clear children domains.
    // This looks like a recursive call.  It calls other domains of Clear.
    ParentDomain<PrdfExtensibleDomain>::iterator i;
    for (i = l_domain->getBeginIterator(); i != l_domain->getEndIterator(); i++)
    {
        // Clear PLLs from this domain.
        PrdfExtensibleDomainFunction * l_clear =
                                (i->second)->getExtensibleFunction("ClearPll");
        (*l_clear)( i->second,
                    PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_sc) );
    }

    return SUCCESS;
}
PRDF_PLUGIN_DEFINE( PllDomain, ClearPll );

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

int32_t PllDomain::MaskPll( PrdfExtensibleDomain * i_domain,
                            STEP_CODE_DATA_STRUCT i_sc )
{
    PllDomain * l_domain = (PllDomain *) i_domain;

    // Mask children chips.
    for ( uint32_t i = 0; i < l_domain->GetSize(); i++ )
    {
        PrdfExtensibleChip * l_chip = l_domain->LookUp(i);
        PrdfExtensibleChipFunction * l_mask =
                                    l_chip->getExtensibleFunction("MaskPll");
        (*l_mask)( l_chip,
                   PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_sc) );
    }

    // Mask children domains.
    // This looks like a recursive call.  It calls other domains of Mask.
    ParentDomain<PrdfExtensibleDomain>::iterator i;
    for (i = l_domain->getBeginIterator(); i != l_domain->getEndIterator(); i++)
    {
        PrdfExtensibleDomainFunction * l_mask =
                                (i->second)->getExtensibleFunction("MaskPll");
        (*l_mask)( i->second,
                   PrdfPluginDef::bindParm<STEP_CODE_DATA_STRUCT&>(i_sc) );
    }

    return SUCCESS;
}
PRDF_PLUGIN_DEFINE( PllDomain, MaskPll );

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

} // end namespace PRDF

OpenPOWER on IntegriCloud