summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/plat/mem/prdfOcmbDataBundle.H
blob: 499baf00c51c1b2a75116ffcb9b305695692ae3c (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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/plat/mem/prdfOcmbDataBundle.H $      */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2019                             */
/* [+] 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 __prdfOcmbDataBundle_H
#define __prdfOcmbDataBundle_H

/** @file  prdfOcmbDataBundle.H
 *  @brief Contains the data bundle for a P9 OCMB_CHIP object.
 */

// Framework includes
#include <prdfExtensibleChip.H>

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

#ifdef __HOSTBOOT_MODULE

#include <prdfMemScrubUtils.H>
#include <prdfMemTdFalseAlarm.H>
#include <prdfMemThresholds.H>
#include <prdfMemTdCtlr.H>

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

#endif // __HOSTBOOT_MODULE

namespace PRDF
{

/** @brief P9 OCMB data bundle. */
class OcmbDataBundle : public DataBundle
{
  public: // functions

    /**
     * @brief Constructor.
     * @param i_ocmbChip The OCMB chip.
     */
    explicit OcmbDataBundle( ExtensibleChip * i_ocmbChip ) :
        iv_chip(i_ocmbChip), iv_ceTable(i_ocmbChip), iv_ueTable(i_ocmbChip)
    {}

    /** @brief Destructor. */
    ~OcmbDataBundle()
    {
        #ifdef __HOSTBOOT_MODULE
            #ifdef __HOSTBOOT_RUNTIME
                delete iv_vcmFalseAlarmCounter;
                delete iv_tpsFalseAlarmCounter;
            #else // IPL only
                delete iv_iplCeStats;
            #endif
        delete iv_tdCtlr; iv_tdCtlr = nullptr;
        #endif // __HOSTBOOT_MODULE
    }

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

    #ifdef __HOSTBOOT_MODULE

    /** @return The Targeted Diagnostics controller. */
    MemTdCtlr<TARGETING::TYPE_OCMB_CHIP> * getTdCtlr()
    {
        if ( nullptr == iv_tdCtlr )
        {
            iv_tdCtlr = new MemTdCtlr<TARGETING::TYPE_OCMB_CHIP>{iv_chip};
        }

        return iv_tdCtlr;
    }

    /** @return The IMPE threshold 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_OCMB_CHIP> * getIplCeStats()
    {
        if ( nullptr == iv_iplCeStats )
        {
            iv_iplCeStats =
                new MemIplCeStats<TARGETING::TYPE_OCMB_CHIP>( iv_chip );
        }

        return iv_iplCeStats;
    }

    #endif

    #endif // __HOSTBOOT_MODULE

  private: // instance variables

    /** The OCMB chip associated with this data bundle. */
    ExtensibleChip * const iv_chip;

    #ifdef __HOSTBOOT_MODULE

    /** The Targeted Diagnostics controller. */
    MemTdCtlr<TARGETING::TYPE_OCMB_CHIP> * iv_tdCtlr = nullptr;

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

    #endif // __HOSTBOOT_MODULE

  public: // instance variables

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

    /** If there is a channel failure detected on this bus, there will be some
     *  required cleanup after analysis to mask off all further attentions from
     *  the bus. A channel failure could occur on either side of the bus and it
     *  is possible the cleanup function could be called in multiple
     *  PostAnalysis plugins depending on where the channel failure occurred.
     *  Since we only want to do one cleanup, we will use this variable to
     *  indicate if a cleanup is still required or has already been done. */
    bool iv_doChnlFailCleanup = false;

    #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;

    #ifdef __HOSTBOOT_RUNTIME

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

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

    /** 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;

    // These are used to limit the number of times a scrub command will stop
    // on a UE or CE on a rank. This is to prevent potential flooding of
    // maintenance UEs or CEs. The threshold will be 16 per rank for each.
    ScrubResumeCounter iv_ueScrubStopCounter;
    ScrubResumeCounter iv_ceScrubStopCounter;

    #else // IPL only

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

    #endif

    #endif // __HOSTBOOT_MODULE

};

/**
 * @brief  Wrapper function for the OcmbDataBundle.
 * @param i_ocmbChip The OCMB chip.
 * @return This MBA's data bundle.
 */
inline OcmbDataBundle * getOcmbDataBundle( ExtensibleChip * i_ocmbChip )
{
    return static_cast<OcmbDataBundle *>(i_ocmbChip->getDataBundle());
}

} // end namespace PRDF

#endif // __prdfOcmbDataBundle_H

OpenPOWER on IntegriCloud