summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/plat/pegasus/prdfCenMba.C
blob: 0aee4193c17e6307ec307941272e546ff66812e7 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfCenMba.C $          */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2014              */
/*                                                                        */
/* 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  prdfCenMba.C
 *  @brief Contains all common plugin code for the Centaur MBA
 */

// Framework includes
#include <iipServiceDataCollector.h>
#include <prdfExtensibleChip.H>
#include <prdfPlatServices.H>
#include <prdfPluginMap.H>

// Pegasus includes
#include <prdfCalloutUtil.H>
#include <prdfCenMbaCaptureData.H>
#include <prdfCenMbaDataBundle.H>

using namespace TARGETING;

namespace PRDF
{

using namespace PlatServices;

namespace Mba
{
// Forward Declarations

int32_t CalloutMbaAndDimm( ExtensibleChip * i_chip,
                           STEP_CODE_DATA_STRUCT & i_sc, uint32_t i_port );

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

/**
 * @brief  Plugin that initializes the P8 Centaur MBA data bundle.
 * @param  i_mbaChip A Centaur MBA chip.
 * @return SUCCESS
 */
int32_t Initialize( ExtensibleChip * i_mbaChip )
{
    i_mbaChip->getDataBundle() = new CenMbaDataBundle( i_mbaChip );
    return SUCCESS;
}
PRDF_PLUGIN_DEFINE( Mba, Initialize );

//##############################################################################
//
//                                   MBASPA
//
//##############################################################################

/**
 * @brief  MBASPA[0] - Maintenance command complete.
 * @param  i_mbaChip A Centaur MBA chip.
 * @param  i_sc      The step code data struct.
 * @return SUCCESS
 */
int32_t MaintCmdComplete( ExtensibleChip * i_mbaChip,
                          STEP_CODE_DATA_STRUCT & i_sc )
{
    #define PRDF_FUNC "[Mba::MaintCmdComplete] "

    int32_t l_rc = SUCCESS;

    CenMbaDataBundle * mbadb = getMbaDataBundle( i_mbaChip );

    // Tell the TD controller that a maintenance command complete occurred.
    l_rc = mbadb->iv_tdCtlr.handleCmdCompleteEvent( i_sc );
    if ( SUCCESS != l_rc )
    {
        PRDF_ERR( PRDF_FUNC"Failed: i_mbaChip=0x%08x", i_mbaChip->GetId() );
        CalloutUtil::defaultError( i_sc );
    }

    // Gather capture data even if something failed above.
    // NOTE: There is no need to capture if the maintenance command complete was
    //       successful with no errors because the error log will not be
    //       committed.
    if ( !i_sc.service_data->IsDontCommitErrl() )
        CenMbaCaptureData::addMemEccData( i_mbaChip, i_sc );

    return PRD_NO_CLEAR_FIR_BITS; // FIR bits are cleared by this plugin

    #undef PRDF_FUNC
}
PRDF_PLUGIN_DEFINE( Mba, MaintCmdComplete );

/**
 * @brief  Plugin to add MBA and Dimms behind port 0 to callout list.
 * @param  i_chip   mba chip
 * @param  i_sc     The step code data struct.
 * @return SUCCESS
 */
int32_t CalloutMbaAndDimmOnPort0( ExtensibleChip * i_chip,
                           STEP_CODE_DATA_STRUCT & i_sc )
{
    return CalloutMbaAndDimm( i_chip, i_sc, 0);
}
PRDF_PLUGIN_DEFINE( Mba, CalloutMbaAndDimmOnPort0 );

/**
 * @brief  Plugin to add MBA and Dimms behind port 1 to callout list.
 * @param  i_chip   mba chip
 * @param  i_sc     The step code data struct.
 * @return SUCCESS
 */
int32_t CalloutMbaAndDimmOnPort1( ExtensibleChip * i_chip,
                           STEP_CODE_DATA_STRUCT & i_sc )
{
    return CalloutMbaAndDimm( i_chip, i_sc, 1);
}
PRDF_PLUGIN_DEFINE( Mba, CalloutMbaAndDimmOnPort1 );

/**
 * @brief  Plugin to add MBA and Dimms behind given port to callout list.
 * @param  i_chip   mba chip
 * @param  i_sc     The step code data struct.
 * @param  i_port   Port Number.
 * @return SUCCESS
 */
int32_t CalloutMbaAndDimm( ExtensibleChip * i_chip,
                           STEP_CODE_DATA_STRUCT & i_sc, uint32_t i_port )
{
    using namespace TARGETING;
    using namespace CalloutUtil;
    int32_t o_rc = SUCCESS;
    TargetHandle_t mbaTarget = i_chip->GetChipHandle();

    TargetHandleList calloutList = getConnectedDimms( mbaTarget, i_port );
    i_sc.service_data->SetCallout( mbaTarget, MRU_LOW );

    for ( TargetHandleList::iterator it = calloutList.begin();
          it != calloutList.end(); it++)
    {
       i_sc.service_data->SetCallout( *it,MRU_HIGH );
    }
    return o_rc;
}

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

/**
 * @brief   When not in MNFG mode, clear the service call flag so that
 *          thresholding will still be done, but no visible error log committed.
 * @param   i_chip MBA chip
 * @param   i_sc   Step code data struct
 * @returns SUCCESS always
 */
int32_t ClearServiceCallFlag( ExtensibleChip * i_chip,
                              STEP_CODE_DATA_STRUCT & i_sc )
{
    if ( i_sc.service_data->IsAtThreshold() && !mfgMode() )
    {
        i_sc.service_data->ClearFlag(ServiceDataCollector::SERVICE_CALL);
    }

    return SUCCESS;
}
PRDF_PLUGIN_DEFINE( Mba, ClearServiceCallFlag );

} // end namespace Mba

} // end namespace PRDF
OpenPOWER on IntegriCloud