summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/plat/pegasus/prdfCenMbaTdCtlr.H
blob: 807211e30f1ec8c436d1100fa2082bf9c26b0e54 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/plat/pegasus/prdfCenMbaTdCtlr.H $           */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 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  prdfCenMbaTdCtlr.H
 *  @brief The Hostboot implementation of the MBA TD Controller.
 */

#ifndef __prdfCenMbaTdCtlr_H
#define __prdfCenMbaTdCtlr_H

#include <prdfCenMbaTdCtlr_common.H>

namespace PRDF
{

/**
 * @brief A state machine for memory targeted diagnostics during Hostboot MDIA.
 */
class CenMbaTdCtlr : public CenMbaTdCtlrCommon
{
  private: // constants, enums

    /**
     * @brief Lists all possible states of TD controller
     * @note  These enums are used as array indexes to cv_cmdCompleteFuncs and
     *        the last entry will be used to get the size of the array.
     */
    enum TdState
    {
        NO_OP = 0,       ///< No TD procedures in place.
        VCM_PHASE_1,     ///< Verify Chip Mark phase 1.
        VCM_PHASE_2,     ///< Verify Chip Mark phase 2.
        DSD_PHASE_1,     ///< DRAM Spare Deploy phase 1.
        DSD_PHASE_2,     ///< DRAM Spare Deploy phase 2.
        MAX_TD_STATE     ///< The maximum number of TD states.
    };

    // Function pointers for maintenance command complete events.
    typedef int32_t (CenMbaTdCtlr::*CMD_COMPLETE_FUNCS)
                                            ( STEP_CODE_DATA_STRUCT & io_sc );

  public: // functions

    /**
     * @brief Constructor
     *
     * This contructor will be called in the MBA data bundle code. Therefore,
     * no register reads/writes can be done in this constructor. Anything needed
     * to initialize the instance variables that requires register reads/writes
     * or is non-trivial should be done in initialize().
     *
     * @param i_mbaChip An MBA chip.
     */
    explicit CenMbaTdCtlr( ExtensibleChip * i_mbaChip ) :
        CenMbaTdCtlrCommon(i_mbaChip), iv_tdState(NO_OP)
    {}

  public: // Overloaded functions

    int32_t handleCmdCompleteEvent( STEP_CODE_DATA_STRUCT & io_sc );

  private: // Overloaded functions

    int32_t initialize();

    int32_t analyzeCmdComplete( STEP_CODE_DATA_STRUCT & io_sc );
    int32_t analyzeVcmPhase1( STEP_CODE_DATA_STRUCT & io_sc );
    int32_t analyzeVcmPhase2( STEP_CODE_DATA_STRUCT & io_sc );
    int32_t analyzeDsdPhase1( STEP_CODE_DATA_STRUCT & io_sc );
    int32_t analyzeDsdPhase2( STEP_CODE_DATA_STRUCT & io_sc );

    int32_t startVcmPhase1();
    int32_t startVcmPhase2();
    int32_t startDsdPhase1();
    int32_t startDsdPhase2();

    bool isInTdMode();

  private: // functions

    /**
     * @brief  Checks if ECC errors have occurred during a maintenance command.
     * @param  o_eccErrorMask Bitwise mask indicating which ECC errors have
     *         occurred.
     * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
     */
    int32_t checkEccErrors( uint8_t & o_eccErrorMask );

    /**
     * @brief  Handle UEs during TD analysis.
     * @param  io_sc Service data collector.
     * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
     */
    int32_t handleUE( STEP_CODE_DATA_STRUCT & io_sc );

    /**
     * @brief  Handle MCE event during VCM Phase 2
     * @param  io_sc Service data collector.
     * @note   This will update bad bits information in VPD, set callouts, and
     *         start the DRAM sparing procedure, if possible.
     * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
     */
    int32_t handleMCE_VCM2( STEP_CODE_DATA_STRUCT & io_sc );

    /**
     * @brief  Handle MCE event during DSD Phase 2
     * @param  io_sc Service data collector.
     * @note   This will update bad bits information in VPD and set callouts.
     * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
     */
    int32_t handleMCE_DSD2( STEP_CODE_DATA_STRUCT & io_sc );

    /**
     * @brief  Handle cleanup when TD sequence is complete and TD state machine
     *         will reset.
     * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
     */
    int32_t exitTdSequence();

    /**
     * @brief  Preforms cleanup tasks that need to be done before starting the
     *         next maintenance command (i.e. clear scrub counter).
     * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
     */
    int32_t prepareNextCmd();

    /**
     * @brief  Sends a message to MDIA that a maintenance command has completed.
     * @note   If for some reason PRD needed to do some targeted diagnotics and
     *         on a rank that was not the last rank behind the MBA, this
     *         function will need to send a message to MDIA indicating that the
     *         command stopped and MDIA will need to restart the pattern testing
     *         from the next address to the end of memory.
     * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise.
     */
    int32_t signalMdiaCmdComplete();

  private: // instance variables

    /** The targeted diagnostics state variable (see enum TdState). */
    TdState iv_tdState;

    /** Array of functions pointers for TD controller states. This is used to
     *  determine the next course of action after a maintenance command complete
     *  attention.
     */
    static CMD_COMPLETE_FUNCS cv_cmdCompleteFuncs[MAX_TD_STATE];

}; // CenMbaTdCtlr

} // end namespace PRDF

#endif // __prdfCenMbaTdCtlr_H

OpenPOWER on IntegriCloud