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

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

#include <prdfCenMbaDataBundle.H>

namespace PRDF
{
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( PrdfExtensibleChip * i_mbaChip )
{
    i_mbaChip->getDataBundle() = new CenMbaDataBundle( i_mbaChip );
    return SUCCESS;
}
PRDF_PLUGIN_DEFINE( Mba, Initialize );

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

/**
 * @brief  Plugin function called after analysis is complete but before PRD
 *         exits.
 * @param  i_mbaChip A Centaur MBA 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( PrdfExtensibleChip * i_mbaChip,
                      STEP_CODE_DATA_STRUCT & i_sc )
{
    #ifdef __HOSTBOOT_MODULE

    using namespace TARGETING;

    // In hostboot, we need to clear MCI Fir bits. Do we will get the mcs
    // chiplet connected with Mba and call its plugin to clear those FIR bits
    int32_t l_rc = MemUtil::clearHostAttns( i_mbaChip, i_sc );
    if ( SUCCESS != l_rc )
        PRDF_ERR( "[Mba::PostAnalysis] MemUtil::clearHostAttns failed" );

    // Send command complete to MDIA.
    // This must be done in post analysis after attentions have been cleared.
    if ( PlatServices::isInMdiaMode() )
    {
        TargetHandle_t mbaTarget = i_mbaChip->GetChipHandle();
        CenMbaDataBundle * mbadb = getMbaDataBundle( i_mbaChip );

        mbadb->iv_sendCmdCompleteMsg = false;
        PlatServices::mdiaSendCmdComplete( mbaTarget );
    }

    #endif // __HOSTBOOT_MODULE

    return SUCCESS;
}
PRDF_PLUGIN_DEFINE( Mba, PostAnalysis );

//##############################################################################
//
//                                   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( PrdfExtensibleChip * i_mbaChip,
                          STEP_CODE_DATA_STRUCT & i_sc )
{
    using namespace TARGETING;

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

    do
    {
        #ifdef __HOSTBOOT_MODULE

        // TODO: Will need to change design once this for error path.
        CenMbaDataBundle * mbadb = getMbaDataBundle( i_mbaChip );
        mbadb->iv_sendCmdCompleteMsg = true;

        #endif // __HOSTBOOT_MODULE

    } while (0);

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

    return SUCCESS;
}
PRDF_PLUGIN_DEFINE( Mba, MaintCmdComplete );

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