summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/plat/pegasus/prdfCenMba.C
blob: 318df04b6692e7ff091d1abb68936580906255ca (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
/* 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,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  prdfCenMba.C
 *  @brief Contains all the plugin code for the PRD Centaur MBA
 */

#include <iipServiceDataCollector.h>
#include <prdfCalloutUtil.H>
#include <prdfExtensibleChip.H>
#include <prdfPlatServices.H>
#include <prdfPluginMap.H>

#include <prdfCenAddress.H>
#include <prdfCenMbaCaptureData.H>
#include <prdfCenMbaDataBundle.H>

namespace PRDF
{

using namespace PlatServices;

namespace Mba
{

//##############################################################################
//
//                             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] "

    using namespace TARGETING;

    int32_t l_rc = SUCCESS;
    TargetHandle_t mbaTarget = i_mbaChip->GetChipHandle();

    do
    {
        #ifdef __HOSTBOOT_MODULE

        if ( isInMdiaMode() )
        {
            // Immediately inform mdia that the command
            // has finished.

            l_rc = mdiaSendEventMsg( mbaTarget, MDIA::RESET_TIMER );

            if(l_rc)
            {
                PRDF_ERR( PRDF_FUNC"PlatServices::mdiaSendEventMsg() failed" );
                // keep going
            }

            // Determine for mdia whether or not the command
            // finished at the end of the last rank or if
            // the command will need to be restarted.
            // Tuck this away until PostAnalysis.

            CenAddr startAddr, endAddr;
            l_rc  = cenGetMaintAddr( i_mbaChip, MAINT_START_ADDR, startAddr );
            l_rc |= cenGetMaintAddr( i_mbaChip, MAINT_END_ADDR,   endAddr   );
            if ( SUCCESS != l_rc )
            {
                PRDF_ERR( PRDF_FUNC"cenGetMbaAddr() failed" );
                break;
            }

            CenMbaDataBundle * mbadb = getMbaDataBundle( i_mbaChip );
            mbadb->iv_sendCmdCompleteMsg = true;
            mbadb->iv_cmdCompleteMsgData =
                        startAddr == endAddr ? MDIA::COMMAND_COMPLETE
                                             : MDIA::COMMAND_STOPPED;
            // Do not commit error log for a successful command complete.
            if ( MDIA::COMMAND_COMPLETE == mbadb->iv_cmdCompleteMsgData )
                 i_sc.service_data->DontCommitErrorLog();
        }

        #endif // __HOSTBOOT_MODULE

        // Get DRAM repairs capture data
        CenMbaCaptureData::addDramRepairsData( mbaTarget, i_sc );

    } while (0);

    if ( SUCCESS != l_rc )
    {
        PRDF_ERR( PRDF_FUNC"failed on MBA 0x%08x", getHuid(mbaTarget) );
        CalloutUtil::defaultError( i_sc );
    }

    return l_rc;

    #undef PRDF_FUNC
}
PRDF_PLUGIN_DEFINE( Mba, MaintCmdComplete );

} // end namespace Mba
} // end namespace PRDF
OpenPOWER on IntegriCloud