summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/plat/p9/prdfP9Ex.C
blob: 71f3b79ab053711bde0e56f8dba9a27324882ce9 (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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/plat/p9/prdfP9Ex.C $                 */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2018                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* 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                                                     */
// Framework includes
#include <prdfPluginDef.H>
#include <iipServiceDataCollector.h>
#include <prdfExtensibleChip.H>
#include <prdfPluginMap.H>

#include <prdfP9ExDataBundle.H>
#include <prdfP9ExExtraSig.H>
#include <prdfMfgThresholdMgr.H>
#include <prdfMfgThreshold.H>
#include <UtilHash.H>

using namespace TARGETING;

namespace PRDF
{

using namespace PlatServices;

namespace Ex
{

/**
 * @brief  Plugin that initializes the EX data bundle.
 * @param  i_exChip An ex chip.
 * @return SUCCESS
 */
int32_t Initialize( ExtensibleChip * i_exChip )
{
    i_exChip->getDataBundle() = new P9ExDataBundle( i_exChip );
    return SUCCESS;
}
PRDF_PLUGIN_DEFINE_NS( nimbus_ex,  Ex, Initialize );
PRDF_PLUGIN_DEFINE_NS( cumulus_ex, Ex, Initialize );

/**
 * @brief  Plugin function called after analysis is complete but before PRD
 *         exits.
 * @param  i_exChip An EX chip.
 * @param  io_sc     The step code data struct.
 * @note   This is especially useful for any analysis that still needs to be
 *         done after the framework clears the FIR bits that were at attention.
 * @return SUCCESS.
 */
int32_t PostAnalysis( ExtensibleChip * i_exChip,
                      STEP_CODE_DATA_STRUCT & io_sc )
{
    #define PRDF_FUNC "[Ex::PostAnalysis] "

    int32_t l_rc = SUCCESS;

    //##########################################################################
    // Start Nimbus DD1.0 core recovery workaround
    //##########################################################################

    do
    {
        if ( CHECK_STOP   == io_sc.service_data->getPrimaryAttnType() ||
             MODEL_NIMBUS != getChipModel(i_exChip->getTrgt()) ||
             0x10         != getChipLevel(i_exChip->getTrgt()) )
        {
            break; // nothing to do
        }

        // If there was an attention from L2FIR[39], the rule code would have
        // then analyzed one of the two attached cores. There is no mechanism in
        // the rule code to come back to this bit and clear it. So we must do
        // that here.

        // Only need to clear the FIR if it is currently set.
        SCAN_COMM_REGISTER_CLASS * l2fir = i_exChip->getRegister("L2FIR");
        l_rc = l2fir->Read();
        if ( SUCCESS != l_rc )
        {
            PRDF_ERR( PRDF_FUNC "Read() failed on L2FIR" );
            break;
        }

        if ( !l2fir->IsBitSet(39) ) break; // nothing to do

        // Clear the FIR bit.
        SCAN_COMM_REGISTER_CLASS * l2fir_and =
            i_exChip->getRegister("L2FIR_AND");
        l2fir_and->setAllBits();
        l2fir_and->ClearBit(39);
        l_rc = l2fir_and->Write();
        if ( SUCCESS != l_rc )
        {
            PRDF_ERR( PRDF_FUNC "Write() failed on L2FIR_AND" );
            break;
        }

        // The workaround is not level driven. So we need to check the
        // current value of the COREFIR WOFs to determine if there is a new
        // attention.

        ExtensibleChipList ecChipList = getConnected( i_exChip, TYPE_CORE );
        for ( auto & ecChip : ecChipList )
        {
            SCAN_COMM_REGISTER_CLASS * corefir_wof =
                ecChip->getRegister("COREFIR_WOF");
            SCAN_COMM_REGISTER_CLASS * corefir_mask =
                ecChip->getRegister("COREFIR_MASK");

            // A ForceRead() is required because a new attention may have
            // occured after the initial analysis.
            l_rc  = corefir_wof->ForceRead();
            l_rc |= corefir_mask->ForceRead();
            if ( SUCCESS != l_rc )
            {
                PRDF_ERR( PRDF_FUNC "ForceRead() failed on "
                          "COREFIR_WOF/COREFIR_MASK" );
                continue; // Try the other core.
            }

            // If there are attentions in the COREFIR_WOF, set L2FIR[39].
            if (  corefir_wof->GetBitFieldJustified(0,64) &
                 ~corefir_mask->GetBitFieldJustified(0,64) )
            {
                SCAN_COMM_REGISTER_CLASS * l2fir_or =
                    i_exChip->getRegister("L2FIR_OR");
                l2fir_or->clearAllBits();
                l2fir_or->SetBit(39);
                l_rc = l2fir_or->Write();
                if ( SUCCESS != l_rc )
                {
                    PRDF_ERR( PRDF_FUNC "Write() failed on L2FIR_OR" );
                    continue; // Try the other core.
                }

                // At this point there is no need to check the other core
                // since we only need to know if there is at least one
                // attention on any core.
                break;
            }
        }

    } while(0);

    //##########################################################################
    // End Nimbus DD1.0 core recovery workaround
    //##########################################################################

    return SUCCESS; // Always return SUCCESS for this plugin.

    #undef PRDF_FUNC
}
PRDF_PLUGIN_DEFINE_NS( nimbus_ex,  Ex, PostAnalysis );
PRDF_PLUGIN_DEFINE_NS( cumulus_ex, Ex, PostAnalysis );

/**
 * @brief  For L2/L3 Cache CEs, L3 Directory CEs, and L3 LRU Parity Errors.
 * @param  i_chip EX chip.
 * @param  io_sc  Step code data struct.
 * @return SUCCESS always
 */
int32_t cacheCeWorkaround( ExtensibleChip * i_chip,
                           STEP_CODE_DATA_STRUCT & io_sc )
{
    // WORKAROUND: Nimbus DD1.x only.
    if ( TARGETING::MODEL_NIMBUS == getChipModel(i_chip->getTrgt()) &&
         0x20                    >  getChipLevel(i_chip->getTrgt()) )
    {
        // If we are unable to issue any more line deletes, mask the attention
        // and do not make the error log predictive.
        if ( io_sc.service_data->IsAtThreshold() )
            io_sc.service_data->clearServiceCall();
    }
    // END WORKAROUND

    return SUCCESS;

}
PRDF_PLUGIN_DEFINE_NS( nimbus_ex,  Ex, cacheCeWorkaround );
PRDF_PLUGIN_DEFINE_NS( cumulus_ex, Ex, cacheCeWorkaround );

/**
 * @brief Adds L2 Line Delete/Column Repair FFDC to an SDC.
 * @param i_exChip An ex chip.
 * @param io_sc     Step code data struct.
 */
void addL2LdCrFfdc( ExtensibleChip * i_chip, STEP_CODE_DATA_STRUCT & io_sc,
                    LD_CR_FFDC::L2LdCrFfdc & i_LdCrFfdc )
{
    CaptureData & cd = io_sc.service_data->GetCaptureData();

    static const size_t sz_word = sizeof(CPU_WORD);

    // Get the maximum capture data size and
    // adjust the size for endianness.
    static const size_t sz_maxData =
        ((sizeof(LD_CR_FFDC::L2LdCrFfdc) + sz_word-1) / sz_word) * sz_word;

    uint8_t data[sz_maxData];
    memset( data, 0x00, sz_maxData );
    memcpy( &data, &i_LdCrFfdc, sz_maxData);

    // Fix endianness issues with non PPC machines.
#if( __BYTE_ORDER == __LITTLE_ENDIAN )

    for ( uint32_t i = 0; i < (sz_maxData/sz_word); i++ )
        ((CPU_WORD*)data)[i] = htonl(((CPU_WORD*)data)[i]);

#endif

    // Add data to capture data.
    BitString  bs( sz_maxData*8, (CPU_WORD *) &data );
    cd.Add( i_chip->GetChipHandle(),
            Util::hashString(LD_CR_FFDC::L2TITLE), bs );
}

/**
 * @brief Adds L3 Line Delete/Column Repair FFDC to an SDC.
 * @param i_exChip An ex chip.
 * @param io_sc     Step code data struct.
 */
void addL3LdCrFfdc( ExtensibleChip * i_chip, STEP_CODE_DATA_STRUCT & io_sc,
                    LD_CR_FFDC::L3LdCrFfdc & i_LdCrFfdc )
{
    CaptureData & cd = io_sc.service_data->GetCaptureData();

    static const size_t sz_word = sizeof(CPU_WORD);

    // Get the maximum capture data size and
    // adjust the size for endianness.
    static const size_t sz_maxData =
        ((sizeof(LD_CR_FFDC::L3LdCrFfdc) + sz_word-1) / sz_word) * sz_word;

    uint8_t data[sz_maxData];
    memset( data, 0x00, sz_maxData );
    memcpy( &data, &i_LdCrFfdc, sz_maxData);

    // Fix endianness issues with non PPC machines.
#if( __BYTE_ORDER == __LITTLE_ENDIAN )

    for ( uint32_t i = 0; i < (sz_maxData/sz_word); i++ )
        ((CPU_WORD*)data)[i] = htonl(((CPU_WORD*)data)[i]);

#endif

    // Add data to capture data.
    BitString bs( sz_maxData*8, (CPU_WORD *) &data );
    cd.Add( i_chip->GetChipHandle(),
            Util::hashString(LD_CR_FFDC::L3TITLE), bs );
}


/**
 * @brief  Handle an L2 UE
 * @param  i_chip EX chip.
 * @param  io_sc  Step code data struct.
 * @return SUCCESS always
 */
int32_t L2UE( ExtensibleChip * i_chip, STEP_CODE_DATA_STRUCT & io_sc )
{
#ifdef __HOSTBOOT_RUNTIME
    int32_t l_rc = SUCCESS;
    p9_l2err_extract_err_data errorAddr =
        { L2ERR_CE_UE, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

    // Get failing location from trace array
    l_rc = extractL2Err( i_chip->getTrgt(), false, errorAddr );
    if (SUCCESS != l_rc)
    {
        PRDF_ERR( "[L2UE] HUID: 0x%08x extractL2Err failed",
                  i_chip->GetId());
        return SUCCESS;
    }

    PRDF_TRAC( "[L2UE] HUID: 0x%08x Error data: member=%d dw=%d "
               "bank=%d macro=%d ow_select=%x bitline=%x is_top_sa=%x "
               "is_left_sa=%x addr=%x",
               i_chip->GetId(), errorAddr.member, errorAddr.dw,
               errorAddr.bank, errorAddr.macro, errorAddr.ow_select,
               errorAddr.bitline, errorAddr.is_top_sa,
               errorAddr.is_left_sa, errorAddr.address );

    // Add L2 FFDC
    P9ExDataBundle * l_bundle = getExDataBundle(i_chip);
    l_bundle->iv_L2LDCount++;

    LD_CR_FFDC::L2LdCrFfdc ldcrffdc;
    ldcrffdc.L2LDcnt        = l_bundle->iv_L2LDCount;
    ldcrffdc.L2errMember    = errorAddr.member;
    ldcrffdc.L2errDW        = errorAddr.dw;
    ldcrffdc.L2errMacro     = errorAddr.macro;
    ldcrffdc.L2errBank      = errorAddr.bank;
    ldcrffdc.L2errOWSelect  = errorAddr.ow_select;
    ldcrffdc.L2errBitLine   = errorAddr.bitline;
    ldcrffdc.L2errIsTopSA   = errorAddr.is_top_sa;
    ldcrffdc.L2errIsLeftSA  = errorAddr.is_left_sa;
    ldcrffdc.L2errAddress   = errorAddr.address;
    addL2LdCrFfdc( i_chip, io_sc, ldcrffdc );

#endif
    return SUCCESS;
}
PRDF_PLUGIN_DEFINE_NS( nimbus_ex,  Ex, L2UE );
PRDF_PLUGIN_DEFINE_NS( cumulus_ex, Ex, L2UE );

/**
 * @brief  Handle an L3 UE
 * @param  i_chip EX chip.
 * @param  io_sc  Step code data struct.
 * @return SUCCESS always
 */
int32_t L3UE( ExtensibleChip * i_chip, STEP_CODE_DATA_STRUCT & io_sc )
{
#ifdef __HOSTBOOT_RUNTIME
    int32_t l_rc = SUCCESS;
    p9_l3err_extract_err_data errorAddr = { L3ERR_CE_UE, 0, 0, 0, 0, 0, 0 };

    // Get failing location from trace array
    l_rc = extractL3Err( i_chip->getTrgt(), errorAddr );
    if (SUCCESS != l_rc)
    {
        PRDF_ERR( "[L3CE] HUID: 0x%08x extractL3Err failed",
                  i_chip->GetId());
        return SUCCESS;
    }

    PRDF_TRAC( "[L3CE] HUID: 0x%08x Error data: member=%d dw=%d "
               "bank=%d dataout=%d hashed addr=%x cache addr=%x",
               i_chip->GetId(), errorAddr.member, errorAddr.dw,
               errorAddr.bank, errorAddr.dataout,
               errorAddr.hashed_real_address_45_56,
               errorAddr.cache_read_address );

    // Add L3 FFDC
    P9ExDataBundle * l_bundle = getExDataBundle(i_chip);
    l_bundle->iv_L3LDCount++;

    LD_CR_FFDC::L3LdCrFfdc ldcrffdc;
    ldcrffdc.L3LDcnt           = l_bundle->iv_L3LDCount;
    ldcrffdc.L3errMember       = errorAddr.member;
    ldcrffdc.L3errDW           = errorAddr.dw;
    ldcrffdc.L3errBank         = errorAddr.bank;
    ldcrffdc.L3errDataOut      = errorAddr.dataout;
    ldcrffdc.L3errHshAddress   = errorAddr.hashed_real_address_45_56;
    ldcrffdc.L3errCacheAddress = errorAddr.cache_read_address;
    addL3LdCrFfdc( i_chip, io_sc, ldcrffdc );

#endif
    return SUCCESS;
}
PRDF_PLUGIN_DEFINE_NS( nimbus_ex,  Ex, L3UE );
PRDF_PLUGIN_DEFINE_NS( cumulus_ex, Ex, L3UE );

/**
 * @brief  Handle an L2 CE
 * @param  i_chip EX chip.
 * @param  io_sc  Step code data struct.
 * @return SUCCESS always
 */
int32_t L2CE( ExtensibleChip * i_chip, STEP_CODE_DATA_STRUCT & io_sc )
{
#if defined(__HOSTBOOT_RUNTIME) || defined(ESW_SIM_COMPILE)

    do {
        P9ExDataBundle * l_bundle = getExDataBundle(i_chip);
        uint16_t l_maxLineDelAllowed = 0;
        int32_t l_rc = SUCCESS;

#ifdef __HOSTBOOT_RUNTIME
        p9_l2err_extract_err_data errorAddr =
            { L2ERR_CE_UE, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

        // Get failing location from trace array
        l_rc = extractL2Err( i_chip->getTrgt(), true, errorAddr );
        if (SUCCESS != l_rc)
        {
            PRDF_ERR( "[L2CE] HUID: 0x%08x extractL2Err failed",
                      i_chip->GetId());
            break;
        }

        PRDF_TRAC( "[L2CE] HUID: 0x%08x Error data: member=%d dw=%d "
                   "bank=%d macro=%d ow_select=%x bitline=%x is_top_sa=%x "
                   "is_left_sa=%x addr=%x",
                   i_chip->GetId(), errorAddr.member, errorAddr.dw,
                   errorAddr.bank, errorAddr.macro, errorAddr.ow_select,
                   errorAddr.bitline, errorAddr.is_top_sa,
                   errorAddr.is_left_sa, errorAddr.address );

        LD_CR_FFDC::L2LdCrFfdc ldcrffdc;
        ldcrffdc.L2LDcnt        = l_bundle->iv_L2LDCount;
        ldcrffdc.L2errMember    = errorAddr.member;
        ldcrffdc.L2errDW        = errorAddr.dw;
        ldcrffdc.L2errMacro     = errorAddr.macro;
        ldcrffdc.L2errBank      = errorAddr.bank;
        ldcrffdc.L2errOWSelect  = errorAddr.ow_select;
        ldcrffdc.L2errBitLine   = errorAddr.bitline;
        ldcrffdc.L2errIsTopSA   = errorAddr.is_top_sa;
        ldcrffdc.L2errIsLeftSA  = errorAddr.is_left_sa;
        ldcrffdc.L2errAddress   = errorAddr.address;
        addL2LdCrFfdc( i_chip, io_sc, ldcrffdc );
#endif
        if (mfgMode())
            l_maxLineDelAllowed =
              getSystemTarget()->getAttr<ATTR_MNFG_TH_P8EX_L2_LINE_DELETES>();
        else
            l_maxLineDelAllowed =
              getSystemTarget()->getAttr<ATTR_FIELD_TH_P8EX_L2_LINE_DELETES>();

        // Ensure we're still allowed to issue repairs
        if (l_bundle->iv_L2LDCount >= l_maxLineDelAllowed)
        {
            PRDF_TRAC( "[L2CE] HUID: 0x%08x No more repairs allowed",
                       i_chip->GetId());

            // MFG wants to be able to ignore these errors
            // If they have LD  allowed set to 0, wait for
            // predictive threshold
            if (!mfgMode() ||
                l_maxLineDelAllowed != 0 )
            {
                io_sc.service_data->SetThresholdMaskId(0);
            }
            break;
        }

        // Add to CE table and Check if we need to issue a repair on this CE
        if (l_bundle->iv_L2CETable->addAddress(l_bundle->iv_L2LDCount,
                                               io_sc) == false)
        {
            // No action required on this CE, we're waiting for additional
            // errors before applying a line delete
            break;
        }

        // Execute the line delete
        PRDF_TRAC( "[L2CE] HUID: 0x%08x apply directed line delete",
                        i_chip->GetId());
#ifdef __HOSTBOOT_RUNTIME
        l_rc = l2LineDelete(i_chip->getTrgt(), errorAddr);
#endif
        if (SUCCESS != l_rc)
        {
            PRDF_ERR( "[L2CE] HUID: 0x%08x l2LineDelete failed",
                      i_chip->GetId());
            // Set signature to indicate L2 Line Delete failed
            io_sc.service_data->SetErrorSig(
                            PRDFSIG_P9EX_L2CE_LD_FAILURE);
        }
        else
        {
            l_bundle->iv_L2LDCount++;

            // Set signature to indicate L2 Line Delete issued
            io_sc.service_data->SetErrorSig(
                                PRDFSIG_P9EX_L2CE_LD_ISSUED);
        }

    } while(0);

#endif

    return SUCCESS;

}
PRDF_PLUGIN_DEFINE_NS( nimbus_ex,  Ex, L2CE );
PRDF_PLUGIN_DEFINE_NS( cumulus_ex, Ex, L2CE );

/**
 * @brief Handle an L3 CE
 * @param i_chip Ex chip.
 * @param io_sc Step Code data struct
 * @return PRD return code
 */
int32_t L3CE( ExtensibleChip * i_chip,
                           STEP_CODE_DATA_STRUCT & io_sc )
{

#if defined(__HOSTBOOT_RUNTIME) || defined(ESW_SIM_COMPILE)

    do {
        P9ExDataBundle * l_bundle = getExDataBundle(i_chip);
        uint16_t l_maxLineDelAllowed = 0;
        uint16_t curMem = 0xFFFF;
        int32_t l_rc = SUCCESS;

#ifdef __HOSTBOOT_RUNTIME
        p9_l3err_extract_err_data errorAddr =
            { L3ERR_CE_UE, 0, 0, 0, 0, 0, 0 };

        // Get failing location from trace array
        l_rc = extractL3Err( i_chip->getTrgt(), errorAddr );
        if (SUCCESS != l_rc)
        {
            PRDF_ERR( "[L3CE] HUID: 0x%08x extractL3Err failed",
                      i_chip->GetId());
            break;
        }

        PRDF_TRAC( "[L3CE] HUID: 0x%08x Error data: member=%d dw=%d "
                   "bank=%d dataout=%d hashed addr=%x cache addr=%x",
                   i_chip->GetId(), errorAddr.member, errorAddr.dw,
                   errorAddr.bank, errorAddr.dataout,
                   errorAddr.hashed_real_address_45_56,
                   errorAddr.cache_read_address );

        LD_CR_FFDC::L3LdCrFfdc ldcrffdc;
        ldcrffdc.L3LDcnt           = l_bundle->iv_L3LDCount;
        ldcrffdc.L3errMember       = errorAddr.member;
        ldcrffdc.L3errDW           = errorAddr.dw;
        ldcrffdc.L3errBank         = errorAddr.bank;
        ldcrffdc.L3errDataOut      = errorAddr.dataout;
        ldcrffdc.L3errHshAddress   = errorAddr.hashed_real_address_45_56;
        ldcrffdc.L3errCacheAddress = errorAddr.cache_read_address;
        addL3LdCrFfdc( i_chip, io_sc, ldcrffdc );

        curMem = errorAddr.member;
#endif

        if (mfgMode())
            l_maxLineDelAllowed =
              getSystemTarget()->getAttr<ATTR_MNFG_TH_P8EX_L3_LINE_DELETES>();
        else
            l_maxLineDelAllowed =
              getSystemTarget()->getAttr<ATTR_FIELD_TH_P8EX_L3_LINE_DELETES>();

        // Ensure we're still allowed to issue repairs
        if (l_bundle->iv_L3LDCount >= l_maxLineDelAllowed)
        {
            PRDF_TRAC( "[L3CE] HUID: 0x%08x No more repairs allowed",
                       i_chip->GetId());

            // MFG wants to be able to ignore these errors
            // If they have LD  allowed set to 0, wait for
            // predictive threshold
            if (!mfgMode() ||
                l_maxLineDelAllowed != 0 )
            {
                io_sc.service_data->SetThresholdMaskId(0);
            }
            break;
        }

        // Add to CE table and Check if we need to issue a repair on this CE
        if (l_bundle->iv_L3CETable->addAddress(l_bundle->iv_L3LDCount,
                                               io_sc) == false)
        {
            // No action required on this CE, we're waiting for additional
            // errors before applying a line delete
            break;
        }

        // Check for multi-bitline fail
        Timer curTime = io_sc.service_data->GetTOE();
        uint16_t prvMem = l_bundle->iv_prevMember;

        if ( prvMem != 0xFFFF && // we have data saved from a previous LD
             l_bundle->iv_blfTimeout > curTime && // the timer has not expired
             prvMem != curMem ) // the current fail is on a different bitline
        {
            // We have multiple bit lines failing within a 24 hour period
            // Make this predictive
            PRDF_TRAC( "[L3CE] HUID: 0x%08x Multi-bitline fail detected",
                       i_chip->GetId() );
            io_sc.service_data->SetThresholdMaskId(0);
            io_sc.service_data->SetErrorSig( PRDFSIG_P9EX_L3CE_MBF_FAIL );
            break;
        }

        // Update saved bitline data
        l_bundle->iv_prevMember = curMem;
        l_bundle->iv_blfTimeout = curTime + Timer::SEC_IN_DAY;

        // Execute the line delete
        if ( MODEL_NIMBUS != getChipModel(i_chip->getTrgt()) ||
             0x10         != getChipLevel(i_chip->getTrgt()) )
        {
            PRDF_TRAC( "[L3CE] HUID: 0x%08x apply directed line delete",
                        i_chip->GetId());
#ifdef __HOSTBOOT_RUNTIME
            l_rc = l3LineDelete(i_chip->getTrgt(), errorAddr);
#endif
        }
        else
        {
            // HW bug affecting directed line delete on NIMBUS 1.0
            // So set delete-on-next-ce instead

            SCAN_COMM_REGISTER_CLASS * prgReg =
                               i_chip->getRegister("L3_PURGE_REG");

            prgReg->clearAllBits();
            prgReg->SetBit(5);

            l_rc = prgReg->Write();
        }

        if (SUCCESS != l_rc)
        {
            PRDF_ERR( "[L3CE] HUID: 0x%08x l3LineDelete failed",
                      i_chip->GetId());
            // Set signature to indicate L3 Line Delete failed
            io_sc.service_data->SetErrorSig(
                            PRDFSIG_P9EX_L3CE_LD_FAILURE);
        }
        else
        {
            l_bundle->iv_L3LDCount++;

            // Set signature to indicate L3 Line Delete issued
            io_sc.service_data->SetErrorSig(
                                PRDFSIG_P9EX_L3CE_LD_ISSUED);
        }

    } while(0);

#endif

    return SUCCESS;

}
PRDF_PLUGIN_DEFINE_NS( nimbus_ex,  Ex, L3CE );
PRDF_PLUGIN_DEFINE_NS( cumulus_ex, Ex, L3CE );

}
}
OpenPOWER on IntegriCloud