summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/service/prdfRasServices_common.H
blob: a6e5f53a1901c9731848839f200e3f98458e12b8 (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
292
293
294
295
296
297
298
299
300
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/service/prdfRasServices_common.H $ */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2002,2014              */
/*                                                                        */
/* 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                                                     */

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

#ifndef __HOSTBOOT_MODULE
  #include <tmgt.H>
#endif

namespace PRDF
{

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

enum sdcSaveFlagsEnum
{
    SDC_NO_SAVE_FLAGS           = 0x00,
    SDC_ANALYSIS_SAVE_FLAG      = 0x08,
    SDC_THERMAL_SAVE_FLAG       = 0x04,
    SDC_SAVE_UE_FLAG            = 0x02,
    SDC_SAVE_SUE_FLAG           = 0x01
};

class ErrDataService
{
  public:

    /**
     * @brief ctor
     */
    inline ErrDataService() :
        loggingBufferFull(false),
        iv_serviceActionCounter(0),
        savedPrdReturnCode(0)
    {}

    /**
     * @brief dtor
     */
    inline virtual ~ErrDataService() {}

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

    /**
     @brief Create an SRC, PFA data, and Error log for the ServiceData provided
     @param[in] attn_type  (see iipsdbug.h)
     @param[in,out] sdc  (see iipServiceData.h)
     @return Error Log - Null if successfully committed
     @pre SetErrorTod()?
     @post Error log(s) build and logged, SRC built, etc.
     @exception None.
     @note
     */
    virtual errlHndl_t GenerateSrcPfa(ATTENTION_TYPE attn_type, ServiceDataCollector & sdc);

    /**
      @brief Set the TOD of the current error
      @param[in] the_attention (see iipsdbug.h)
      @param[in,out] sdc
      @pre None.
      @post Error timestamped with TOD, latency state modifed
      @note Uses the SPC interface to get the TOD
      */
    virtual void SetErrorTod( ATTENTION_TYPE the_attention,
                              ServiceDataCollector & sdc );

    /**
      @brief Query if logging buffer full - indicates attention flooding
      @return [true | false]
      @pre None.
      @post None.
      */
    virtual bool QueryLoggingBufferFull(void) const;

    /**
      @brief Save a return code for inclusion in the SRC (something failed)
      @param[in] a return code
      @return none.
      @pre None.
      @post Rc stored
      */
    virtual void SaveRcForSrc(int32_t the_rc);

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

    static void SetTerminateOnCheckstop(bool setting)
    {
        terminateOnCheckstop = setting;
    }

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

  private:

    /**
     * @brief disable copy
     */
    ErrDataService(const ErrDataService &);

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

    #ifndef __HOSTBOOT_MODULE

    /**
     @brief Write the Flattened SDC to a File to save for later use. Will also
     immediate sync the File to the Redundant FSP. Update Registry
     value with UE or SUE save status. Note, the Registry is immediately
     synced to the Redundand FSP automatically.
     @param[in] sdcSaveFlagsEnum
     @param[in,out] sdc  (see iipServiceData.h)
     @return return FALSE if success and TRUE if failure
     @pre None.
     @post None.
     @exception None.
     @note
     */
    bool SdcSave(sdcSaveFlagsEnum i_saveFlag, ServiceDataCollector & i_saveSdc);

    /**
      @brief Read the Flattened SDC File based on the sdc Save Flag input.
      @param[in] sdcSaveFlagsEnum
      @param[in,out] buffer data is output to
      @return return FALSE if success and TRUE if failure
      @pre None.
      @post None.
      @exception None.
      @note
      */
    bool SdcRetrieve(sdcSaveFlagsEnum i_saveFlag, void * o_buffer);

    #endif // end if not __HOSTBOOT_MODULE

    /**
     * @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( 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 Prints debug traces
     */
    void printDebugTraces();

  private:

    bool loggingBufferFull;

    uint32_t iv_serviceActionCounter;

    int32_t savedPrdReturnCode;

    ServiceDataCollector sdc;

    static bool terminateOnCheckstop;

};

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

  /**
   @brief Default ctor
   */
  RasServices(void);

  /**
   @brief Default dtor
   */
  ~RasServices();

  // Compiler generated dtor is sufficient

  virtual void Initialize();

  /**
   * @brief set the err data service to be used
   *
   * @param[in] i_ErrDataService new err data service
   */
  virtual void setErrDataService(ErrDataService & i_ErrDataService);

  /**
   @brief Set the TOD of the current error and check for Machine check
   @param[in] the_attention (see iipsdbug.h)
   @param[in,out] sdc
   @pre None.
   @post Error timestamped with TOD, latency state modifed
   @note Uses the SPC interface to get the TOD
   */
  virtual void SetErrorTod( ATTENTION_TYPE the_attention,
                            ServiceDataCollector & sdc );

  /**
   @brief Query if logging buffer full - indicates attention flooding
   @param none.
   @return [true | false]
   @pre None.
   @post None.
   */
  virtual bool QueryLoggingBufferFull(void) const;

  /**
   @brief Save a return code for inclusion in the SRC (something failed)
   @param[in] a return code
   @return none.
   @pre None.
   @post Rc stored
   */
  virtual void SaveRcForSrc(int32_t the_rc);

  /**
   @brief Create an SRC, PFA data, and Error log for the ServiceData provided
   @param[in] attn_type  (see iipsdbug.h)
   @param[in,out] sdc  (see iipServiceData.h)
   @return Error Log - Null if successfully committed
   @pre SetErrorTod()?
   @post Error log(s) build and logged, SRC built, etc.
   @exception None.
   */
  virtual errlHndl_t GenerateSrcPfa( ATTENTION_TYPE attn_type,
                                    ServiceDataCollector & sdc );

  static void SetTerminateOnCheckstop(bool setting)
  {
      ErrDataService::SetTerminateOnCheckstop(setting);
  }


private:  // Data
  // actual or sim err data service
  ErrDataService * iv_ErrDataService;

};

} // End namespace PRDF

#endif // __prdfRasServices_common_H
OpenPOWER on IntegriCloud