summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/plat/prdfRasServices_common.H
blob: 6aa0055d4c95363a59a7c4f938bb893deacc9939 (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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/plat/prdfRasServices_common.H $      */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2017                        */
/* [+] 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 __prdfRasServices_common_H
#define __prdfRasServices_common_H

/** @file  prdfRasServices_common.H
 *  @brief Utility code to parse an SDC and produce the appropriate error log.
 */

#include <xspprdService.h>
#include <errlentry.H>
#include <iipServiceDataCollector.h>
#include <prdfPfa5Data.h>

#include <hwas/common/hwasCallout.H>

namespace PRDF
{

#ifndef __HOSTBOOT_MODULE
  const uint32_t sdcBufferSize = CaptureDataSize + 200;
#endif

enum sdcSaveFlagsEnum
{
    SDC_NO_SAVE_FLAGS           = 0x00,
    SDC_ANALYSIS_SAVE_FLAG      = 0x08,
};

class ErrDataService
{
  public:

    /** @brief Constructor */
    ErrDataService() :
        iv_serviceActionCounter(0),
        iv_errl(NULL)
    {}

    /** @brief Destructor */
    virtual ~ErrDataService() {}

    /** @brief Initializer */
    virtual void Initialize();

    /**
     * @brief  Creates an SRC, PFA data, and error log from the SDC provided.
     * @param  i_attnType Analysis attention type.
     * @param  io_sdc     Target SDC.
     * @param  o_initiateHwudump whether or not to initiate hwudump
     * @param  o_dumpTrgt The DUMP target
     * @param  o_dumpErrl The DUMP error handle
     * @param  o_dumpErrlActions DUMP error action flags
     * @return A non-NULL error log indicates a system termination is required.
     *         Otherwise, PRD will commit the error log generated.
     * @pre    The Time of Error must be set in the given SDC.
     */
    virtual errlHndl_t GenerateSrcPfa( ATTENTION_TYPE i_attnType,
                                       ServiceDataCollector & io_sdc,
                                       bool & o_initiateHwudump,
                                       TARGETING::TargetHandle_t & o_dumpTrgt,
                                       errlHndl_t & o_dumpErrl,
                                       uint32_t & o_dumpErrlActions );

    /**
      @brief Add the Service Data Collector Capture Data to the User Data of the Error Log.
      @param[in] Service Data Collector
      @param[in,out] Error Log
      @return None.
      @pre None.
      @post None.
      @exception None.
      */
    static void AddCapData( CaptureData & i_cd, errlHndl_t i_errHdl);

    /**
     * @brief Add trace data to file for Manufacturing.
     * @param i_esig    Error signature.
     * @param i_pfaData The PFA data.
     */
    void MnfgTrace( ErrorSignature * i_esig, const PfaData & i_pfaData );

    /**
     * @brief Creates the initial error log for PRDF::main() analysis path.
     * @param i_attnType Analysis attention type.
     */
    void createInitialErrl( ATTENTION_TYPE i_attnType );

    /**
     * @brief Update SRC section for initial error log.
     * @param i_user1    User data word 1.
     * @param i_user2    User data word 2.
     * @param i_user3    User data word 3.
     * @param i_user4    User data word 4.
     * @param i_rc       Reason code.
     */
    void updateSrc( uint32_t i_user1, uint32_t i_user2,
                    uint32_t i_user3, uint32_t i_user4,
                    uint16_t i_rc );

    /**
     * @brief  Return error log associated with current analysis flow.
     * @note   For normal analysis paths only. Will return NULL if
               createInitialErrl() has not been called in PRDF::main().
     * @return An error log.
     */
    errlHndl_t getErrl() const { return iv_errl; }

  private:

    /** @brief Disable copy. */
    ErrDataService(const ErrDataService &);

    /** @brief Disable assignment. */
    ErrDataService & operator=(const ErrDataService &);

    /**
     * @brief Initializes the PFA data.
     * @param i_sdc      The service data collector.
     * @param o_pfa      The PFA data struct.
     * @param o_dumpTrgt The DUMP target.
     */
    void initPfaData( const ServiceDataCollector & i_sdc,
                      uint32_t i_attnType, bool i_deferDeconfig,
                      uint32_t i_errlAct, uint32_t i_errlSev,
                      uint32_t i_prdGardType,
                      PfaData & o_pfa, TARGETING::TargetHandle_t & o_dumpTrgt );

    /**
     * @brief Adds a callout to the PFA data MRU list.
     * @param io_pfa     The PFA data struct.
     * @param i_callout  Target callout.
     * @param i_priority Target callout priority.
     * @param i_gardType Target callout GARD type.
     */
    void addCalloutToPfaData( PfaData & io_pfa,
                              PRDcallout i_callout, PRDpriority i_priority,
                              HWAS::GARD_ErrorType i_gardType );

    /**
     * @brief Deallocate DIMMS represented in mru list.
     *
     * This function will get all DIMMS behind MCS, MEMBUF, MBA
     * in callout list. It will find unique DIMMS per DIMM pair
     * and send message to PHYP to deallocate memory behind these DIMMS.
     *
     * @param i_mruList   MRU callout list.
     */
    void deallocateDimms( const SDC_MRU_LIST & i_mruList );

    /**
     * @brief Checks for terminate conditions during non mnfg conditions.
     * @param i_sdc       The service data collector.
     * @param i_dumpTrgt  Dump Target.
     * @param io_pfa      The PFA data struct.
     * @return  True if PRD should terminate system, False otherwise.
     */
    bool checkForceTerm( const ServiceDataCollector & i_sdc,
                         TARGETING::TargetHandle_t i_dumpTrgt,
                         PfaData &io_pfaData );

    /**
     * @brief Handles unit checkstops.
     * @param i_sdc             The service data collector.
     * @param i_unitCsTarget    Chip(let) target.
     * @param o_initiateHwudump Whether or not to initiate hwudump
     */
    void handleUnitCS( const ServiceDataCollector & i_sdc,
                       TARGETING::TargetHandle_t i_unitCsTarget,
                       bool & o_initiateHwudump );

    /**
     * @brief Handles Centaur checkstop.
     * @param i_memTarget memory chip(let) target.
     */
    void handleChannelFail( TARGETING::TargetHandle_t i_memTarget );

    /**
     * @brief Handles Core checkstop.
     * @param i_exTarget EX target.
     * @param o_initiateHwudump whether or not to initiate hwudump
     */
    void handleCoreUnitCS( TARGETING::TargetHandle_t i_exTarget,
                           bool & o_initiateHwudump );

    /**
     * @brief Handles NX checkstops.
     * @param i_nxTarget NX target.
     */
    void handleNxUnitCS( TARGETING::TargetHandle_t i_nxTarget );

    /**
     * @brief commits error log based on platform.
     * @param io_errl       reference to error log handle.
     * @param i_pfaData     Pfa struct
     */
    void commitErrLog( errlHndl_t & io_errl, const PfaData & i_pfaData );

  private:

    uint32_t iv_serviceActionCounter;

    errlHndl_t iv_errl;

};

/** Interface to RAS services provided to PRD */
class RasServices : public ServiceGeneratorClass
{
  public:

    /** @brief Constructor */
    RasServices();

    /** @brief Destructor */
    ~RasServices();

    /** @brief Initializer */
    virtual void Initialize();

    /**
     * @brief Sets the ErrDataService to be used.
     * @param i_eds Target ErrDataService.
     */
    virtual void setErrDataService( ErrDataService & i_eds );

    /**
     * @brief  Creates an SRC, PFA data, and error log from the SDC provided.
     * @param  i_attnType Analysis attention type.
     * @param  io_sdc     Target SDC.
     * @param  o_initiateHwudump whether or not to initiate hwudump
     * @param  o_dumpTrgt The DUMP target
     * @param  o_dumpErrl The DUMP error handle
     * @param  o_dumpErrlActions DUMP error action flags
     * @return A non-NULL error log indicates a system termination is required.
     *         Otherwise, PRD will commit the error log generated.
     * @pre    The Time of Error must be set in the given SDC.
     */
    virtual errlHndl_t GenerateSrcPfa( ATTENTION_TYPE i_attnType,
                                       ServiceDataCollector & io_sdc,
                                       bool & o_initiateHwudump,
                                       TARGETING::TargetHandle_t & o_dumpTrgt,
                                       errlHndl_t & o_dumpErrl,
                                       uint32_t & o_dumpErrlActions );

    /**
     * @brief Creates the initial error log for PRDF::main() analysis path.
     * @param i_attnType Analysis attention type.
     */
    virtual void createInitialErrl( ATTENTION_TYPE i_attnType );

    /**
     * @brief  Return error log associated with current analysis flow.
     * @note   For normal analysis paths only. Will return NULL if
               createInitialErrl() has not been called in PRDF::main().
     * @return An error log.
     */
    virtual errlHndl_t getErrl() const;

  private: // instance variables

    ErrDataService * iv_eds; ///< Actual or simulated ErrDataService.

};

} // End namespace PRDF

#endif // __prdfRasServices_common_H
OpenPOWER on IntegriCloud