summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/plat/mem/prdfP9McaDataBundle.H
blob: 07a6b7b92ad42aad475b99de5769245dd5c62fbc (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
216
217
218
219
220
221
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/plat/mem/prdfP9McaDataBundle.H $     */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2018                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

#ifndef __prdfP9McaDataBundle_H
#define __prdfP9McaDataBundle_H

// Framework includes
#include <prdfExtensibleChip.H>
#include <prdfThresholdUtils.H>

// Platform includes
#include <prdfMemCeTable.H>
#include <prdfMemUeTable.H>
#include <prdfPlatServices.H>

#ifdef __HOSTBOOT_MODULE

  #include <prdfMemTdFalseAlarm.H>
  #include <prdfMemThresholds.H>
  #include <prdfP9McbistDataBundle.H>

  #ifndef __HOSTBOOT_RUNTIME
    #include <prdfMemIplCeStats.H>
  #endif

#endif

namespace PRDF
{

/** @brief P9 MCA data bundle. */
class McaDataBundle : public DataBundle
{
  public: // functions

    /**
     * @brief Constructor
     * @param i_chip An MCA chip.
     */
    explicit McaDataBundle( ExtensibleChip * i_chip ) :
        iv_chip(i_chip), iv_ceTable(i_chip), iv_ueTable(i_chip)
    {}

    /** @brief Destructor */
    ~McaDataBundle()
    {
        #ifdef __HOSTBOOT_MODULE
            delete iv_impeThresholdCounter;
            #ifdef __HOSTBOOT_RUNTIME
                delete iv_vcmFalseAlarmCounter;
                delete iv_tpsFalseAlarmCounter;
            #else
                delete iv_iplCeStats;
            #endif
        #endif
    }

    #ifdef __HOSTBOOT_MODULE

    /** @return Wrapper to get Targeted Diagnostics controller from MCBIST. */
    MemTdCtlr<TARGETING::TYPE_MCBIST> * getTdCtlr()
    {
        using namespace TARGETING;
        using namespace PlatServices;

        ExtensibleChip * mcbChip = getConnectedParent( iv_chip, TYPE_MCBIST );
        McbistDataBundle * mcbdb = getMcbistDataBundle( mcbChip );
        return mcbdb->getTdCtlr();
    }

    /** @return The VCM false alarm counter. */
    VcmFalseAlarm * getImpeThresholdCounter()
    {
        if ( nullptr == iv_impeThresholdCounter )
        {
            iv_impeThresholdCounter = new VcmFalseAlarm(
                                           TimeBasedThreshold { getImpeTh() } );
        }

        return iv_impeThresholdCounter;
    }

    #ifdef __HOSTBOOT_RUNTIME

    /** @return The VCM false alarm counter. */
    VcmFalseAlarm * getVcmFalseAlarmCounter()
    {
        if ( nullptr == iv_vcmFalseAlarmCounter )
        {
            iv_vcmFalseAlarmCounter = new VcmFalseAlarm(
                       TimeBasedThreshold { 4, ThresholdResolution::ONE_DAY } );
        }

        return iv_vcmFalseAlarmCounter;
    }

    /** @return The TPS false alarm counter. */
    TpsFalseAlarm * getTpsFalseAlarmCounter()
    {
        if ( nullptr == iv_tpsFalseAlarmCounter )
        {
            iv_tpsFalseAlarmCounter = new TpsFalseAlarm(
                TimeBasedThreshold{ 3, ThresholdResolution::ONE_DAY } );
        }

        return iv_tpsFalseAlarmCounter;
    }

    #else // IPL only

    /** @return The IPL CE statistics object. */
    MemIplCeStats<TARGETING::TYPE_MCA> * getIplCeStats()
    {
        if ( nullptr == iv_iplCeStats )
        {
            iv_iplCeStats = new MemIplCeStats<TARGETING::TYPE_MCA>( iv_chip );
        }

        return iv_iplCeStats;
    }

    #endif // __HOSTBOOT_RUNTIME

    #endif // __HOSTBOOT_MODULE

  private: // functions

    // Don't allow copy or assignment.
    McaDataBundle( const McaDataBundle & ) = delete;
    const McaDataBundle & operator=( const McaDataBundle & ) = delete;

  private: // instance variables

    ExtensibleChip * iv_chip; // This MCA.

    #ifdef __HOSTBOOT_MODULE

    /** IMPE threshold counter. */
    VcmFalseAlarm * iv_impeThresholdCounter = nullptr;

    #ifdef __HOSTBOOT_RUNTIME

    /** VCM false alarm counter. */
    VcmFalseAlarm * iv_vcmFalseAlarmCounter = nullptr;

    /** TPS false alarm counter. */
    TpsFalseAlarm * iv_tpsFalseAlarmCounter = nullptr;

    #else // IPL only

    /** MNFG IPL CE statistics. */
    MemIplCeStats<TARGETING::TYPE_MCA> * iv_iplCeStats = nullptr;

    #endif // __HOSTBOOT_RUNTIME

    #endif // __HOSTBOOT_MODULE

  public: // instance variables

    MemCeTable<TARGETING::TYPE_MCA> iv_ceTable; ///< CE table for FFDC
    MemUeTable iv_ueTable;                      ///< UE table for FFDC

    #ifdef __HOSTBOOT_MODULE

    /** Threshold table for RCD parity errors. */
    TimeBasedThreshold iv_rcdParityTh = TimeBasedThreshold( getRcdParityTh() );

    /** Threshold table for IUEs. Threshold per DIMM */
    std::map<uint8_t, TimeBasedThreshold> iv_iueTh;

    /** Bool to indicate if we've triggered a port fail because of IUEs. */
    bool iv_iuePortFail = false;

    #endif

    #ifdef __HOSTBOOT_RUNTIME

    /** Set to true if mainline NCEs and TCEs should be permanently masked. This
     *  is checked at the end of targeted diagnostics before background
     *  scrubbing is resumed. */
    bool iv_maskMainlineNceTce = false;

    #endif
};

/**
 * @brief  Wrapper function for the McaDataBundle.
 * @param  i_chip An MCA chip.
 * @return This MBA's data bundle.
 */
inline McaDataBundle * getMcaDataBundle( ExtensibleChip * i_chip )
{
    return static_cast<McaDataBundle *>(i_chip->getDataBundle());
}

} // end namespace PRDF

#endif // __prdfP9McaDataBundle_H

OpenPOWER on IntegriCloud