summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/plat/pegasus/prdfP8Mcs.C
blob: 5a3747b94f1336660d3d429bf3a3e6fcfc1e9cb4 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfP8Mcs.C $           */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2013              */
/*                                                                        */
/* 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  prdfP8Mcs.C
 *  @brief Contains all the plugin code for the PRD P8 MCS
 */

#include <iipServiceDataCollector.h>
#include <prdfExtensibleChip.H>
#include <prdfPluginMap.H>
#include <UtilHash.H>
#include <prdfGlobal.H>
#include <iipSystem.h>
#include <prdfP8McsDataBundle.H>
#include <prdfCenMembufDataBundle.H>
#include <prdfLaneRepair.H>

//##############################################################################
//
//                             Special plugins
//
//##############################################################################

namespace PRDF
{

namespace Mcs
{

/**
 * @brief  Plugin that initializes the MCS data bundle.
 * @param  i_mcsChip An MCS chip.
 * @return SUCCESS
 */
int32_t Initialize( ExtensibleChip * i_mcsChip )
{
    i_mcsChip->getDataBundle() = new P8McsDataBundle( i_mcsChip );
    return SUCCESS;
}
PRDF_PLUGIN_DEFINE( Mcs, Initialize );

/**
 * @brief Check for and handle a Centaur Unit Checkstop
 * @param i_mcsChip An MCS chip.
 * @param i_sc Step Code Data structure
 * @return failure or success
 */
int32_t CheckCentaurCheckstop( ExtensibleChip * i_mcsChip,
                               STEP_CODE_DATA_STRUCT & i_sc )
{
    int32_t l_rc = SUCCESS;

    do
    {
        // Skip if we're already at Unit Checkstop in SDC
        if (i_sc.service_data->GetFlag(ServiceDataCollector::UNIT_CS))
            break;

        // Check MCIFIR[31] for presence of Centaur checkstop
        SCAN_COMM_REGISTER_CLASS * l_mcifir = i_mcsChip->getRegister("MCIFIR");
        l_rc = l_mcifir->Read();

        if (l_rc)
        {
            PRDF_ERR( "[CheckCentaurCheckstop] SCOM fail on 0x%08x rc=%x",
                      i_mcsChip->GetId(), l_rc);
            break;
        }

        if ( ! l_mcifir->IsBitSet(31) )  { break; }

        // Set Unit checkstop flag
        i_sc.service_data->SetFlag(ServiceDataCollector::UNIT_CS);
        i_sc.service_data->SetThresholdMaskId(0);

        // Set the cause attention type
        i_sc.service_data->SetCauseAttentionType(UNIT_CS);

    } while (0);

    return l_rc;
}

/**
 * @brief Analysis code that is called before the main analyze() function.
 * @param i_mcsChip An MCS chip.
 * @param i_sc Step Code Data structure
 * @param o_analyzed TRUE if analysis has been done on this chip
 * @return failure or success
 */
int32_t PreAnalysis ( ExtensibleChip * i_mcsChip, STEP_CODE_DATA_STRUCT & i_sc,
                      bool & o_analyzed )
{
    o_analyzed = false;

    // Get memory capture data.
    CaptureData & cd = i_sc.service_data->GetCaptureData();
    P8McsDataBundle * mcsdb = getMcsDataBundle( i_mcsChip );
    ExtensibleChip * membChip = mcsdb->getMembChip();
    if ( NULL != membChip )
    {
        membChip->CaptureErrorData( cd, Util::hashString("FirRegs") );
        membChip->CaptureErrorData( cd, Util::hashString("CerrRegs") );

        CenMembufDataBundle * mbdb = getMembufDataBundle( membChip );
        for ( uint32_t i = 0; i < MAX_MBA_PER_MEMBUF; i++ )
        {
            ExtensibleChip * mbaChip = mbdb->getMbaChip(i);
            if ( NULL != mbaChip )
            {
                mbaChip->CaptureErrorData( cd, Util::hashString("FirRegs") );
                mbaChip->CaptureErrorData( cd, Util::hashString("CerrRegs") );
            }
        }
    }

    // Check for a Centaur Checkstop
    int32_t o_rc = CheckCentaurCheckstop( i_mcsChip, i_sc );
    if ( SUCCESS != o_rc )
    {
        PRDF_ERR( "[Mcs::PreAnalysis] CheckCentaurCheckstop() failed" );
    }

    return o_rc;
}
PRDF_PLUGIN_DEFINE( Mcs, PreAnalysis );

/**
 * @brief  Plugin function called after analysis is complete but before PRD
 *         exits.
 * @param  i_mcsChip MCS chip
 * @param  i_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_mcsChip,
                      STEP_CODE_DATA_STRUCT & i_sc )
{
    int32_t l_rc = SUCCESS;

    if ( i_sc.service_data->GetFlag(ServiceDataCollector::UNIT_CS) )
    {
        P8McsDataBundle * mcsdb = getMcsDataBundle( i_mcsChip );
        ExtensibleChip * membChip = mcsdb->getMembChip();
        if ( NULL != membChip )
        {
            // Mask attentions from the Centaur
            SCAN_COMM_REGISTER_CLASS * l_tpfirmask   = NULL;
            SCAN_COMM_REGISTER_CLASS * l_nestfirmask = NULL;
            SCAN_COMM_REGISTER_CLASS * l_memfirmask  = NULL;
            SCAN_COMM_REGISTER_CLASS * l_memspamask  = NULL;

            l_tpfirmask   = membChip->getRegister("TP_CHIPLET_FIR_MASK");
            l_nestfirmask = membChip->getRegister("NEST_CHIPLET_FIR_MASK");
            l_memfirmask  = membChip->getRegister("MEM_CHIPLET_FIR_MASK");
            l_memspamask  = membChip->getRegister("MEM_CHIPLET_SPA_MASK");

            l_tpfirmask->setAllBits();   l_rc |= l_tpfirmask->Write();
            l_nestfirmask->setAllBits(); l_rc |= l_nestfirmask->Write();
            l_memfirmask->setAllBits();  l_rc |= l_memfirmask->Write();
            l_memspamask->setAllBits();  l_rc |= l_memspamask->Write();
        }
    }

    return SUCCESS;
}
PRDF_PLUGIN_DEFINE( Mcs, PostAnalysis );

/**
 * @brief  Checks if spare deployed bit for DMI bus for this MCS is set.
 * @param  i_mcsChip MCS chip
 * @param  i_sc      The step code data struct.
 * @return SUCCESS if bit is on, FAIL otherwise.
 */
int32_t checkSpareBit( ExtensibleChip * i_mcsChip,
                       STEP_CODE_DATA_STRUCT & i_sc )
{
    using namespace LaneRepair;
    int32_t l_rc = FAIL;

    ExtensibleChip * mbChip = getMcsDataBundle( i_mcsChip )->getMembChip();

    if ( true == isSpareBitOnDMIBus( i_mcsChip, mbChip ))
    {
        l_rc = SUCCESS;
    }

    return l_rc;
}
PRDF_PLUGIN_DEFINE( Mcs, checkSpareBit );

} // end namespace Mcs
} // end namespace PRDF

OpenPOWER on IntegriCloud