summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/register/iipErrorRegister.h
blob: e89026ed228f2ee85bd2c8fdfda1d0296e5fc202 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegister.h $ */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1996,2014              */
/*                                                                        */
/* 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                                                     */

/**
 @file iipErrorRegister.h
 @brief ErrorRegister class declaration
*/
#ifndef iipErrorRegister_h
#define iipErrorRegister_h

// Class Description *************************************************
//
//  Name:  ErrorRegister
//  Base class:  ErrorRegisterType
//  Concrete class that can be used as a base class
//
//  Description: Error register declairation
//  Usage:
//
//  foo(SCAN_COMM_REGISTER &scr, ResolutionMap &resMap,
//      STEP_CODE_DATA_STRUCT &error_data)
//  {
//    ErrorRegister er(scr,resMap);
//    .
//    .
//    SINT32 rc = er.Analyze(error_data);
//  }
//
//  Notes:
//
//
// End Class Description *********************************************
//--------------------------------------------------------------------
// Includes
//--------------------------------------------------------------------

#if !defined(iipErrorRegisterType_h)
#include "iipErrorRegisterType.h"
#endif

//--------------------------------------------------------------------
//  Forward References
//--------------------------------------------------------------------

namespace PRDF
{

class SCAN_COMM_REGISTER_CLASS;
class ResolutionMap;

class ErrorRegister : public ErrorRegisterType
{
public:
  /**
   Constructor
   <ul>
   <br><b>Parameter:   </b> Scan comm register
   <br><b>Parameter:   </b> Resolution Map
   <br><b>Parameter:   </b> Opt: ScrId [0 to 0xfe] - used with ErrorSignature
   <br><b>Notes:       </b> If no ScrId is provided then the scan
                            Comm register address is used
   </ul><br>
   */
  ErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, uint16_t scrId = 0x0fff);

  // Function Specification ********************************************
  //
  // Purpose:      Destruction
  // Parameters:   None.
  // Returns:      No value returned
  // Requirements: None.
  // Promises:     None.
  // Exceptions:   None.
  // Concurrency:  Reentrant
  // Notes:        Compiler default is ok
  // Objects do not not own ptr to scan comm register and table
  //
  // End Function Specification ****************************************
  // ~ErrorRegister();

  /**
   Analyse the error register
   <ul>
   <br><b>Parameters:  </b> ServiceData object (error.service_data)
   <br><b>Returns:     </b> return code
   <br><b>Requirements:</b> NoErrorOnZeroRead() if don't want rc == DD02 when no bits on in scr
   <br><b>Promises:    </b> error.service_data points to completed serviceData
   <br><b>Exceptions:  </b> None.
   <br><b>Notes:       </b> optional
   </ul><br>
   */
  virtual int32_t Analyze(STEP_CODE_DATA_STRUCT & error);

  /**
   Make is so Analyze() does not consider a Scr bit string of all zeros an error
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> Analyze() == SUCCESS when scr data has no bits on
   <br><b>Exceptions:  </b> None.
   <br><b>Notes:       </b> Normaly Anayze() returns DD02 if scr data is zero
   </ul><br>
   */
  void NoErrorOnZeroScrRead(void) { xNoErrorOnZeroScr = true; }


protected:

  /**
   Read the scan comm register, apply any masks, and return the resulting bit string
   <ul>
   <br><b>Parameters:  </b> None
   <br><b>Returns:     </b> a Bit String
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> Bit string contains data from hardware with masked bits zeroed
   <br><b>Exceptions:  </b> None.
   <br><b>Notes:       </b> Any class that overides Read() but does not
                            override Analyze() should set src_rc
                            return code from mops scr access
   </ul><br>
   */
  virtual const BIT_STRING_CLASS & Read(ATTENTION_TYPE i_attn);

  /**
   Filter the bit string (if a filter is provided) & convert it to a BitList
   <ul>
   <br><b>Parameters:  </b> Bit String
   <br><b>Returns:     </b> Bit List
   <br><b>Requirements:</b> Read()
   <br><b>Promises:    </b> Bit list representation of the (filtered) bit string
   <br><b>Exceptions:  </b> None.
   <br><b>Notes:       </b> The default implementation does not have a filter
   </ul><br>
   */
  virtual BIT_LIST_CLASS Filter(const BIT_STRING_CLASS & bs);

  virtual bool FilterUndo(BitKey & i_bit_list) { return false; }
  /**
   Find a resolution for the Bit List
   <ul>
   <br><b>Parameters:  </b> reference to ServiceDataCollector to act on
   <br><b>Parameter:   </b> Bit List
   <br><b>Requirements:</b> Filter()
   <br><b>Promises:    </b> The bit list may be modified if the search
                            algoithm modified it to find a match. (as in a fuzzy search)
   <br><b>Exceptions:  </b> None.
   <br><b>Notes:       </b> If no match for the Bit List is found in the
                            Resolution Map then the ResolutionMap default is used
   </ul><br>
   */
  virtual int32_t Lookup(STEP_CODE_DATA_STRUCT & scd, BIT_LIST_CLASS & bl); // dg02c - pass bl by value

  /**
   Reset the hardware (if needed)
   <ul>
   <br><b>Parameters:  </b> Bit List, ServiceData (error.service_data)
   <br><b>Returns:     </b> return code
   <br><b>Requirements:</b> LookUp()
   <br><b>Promises:    </b> Hardware may be modified, internal Mask may be modified
   <br><b>Exceptions:  </b> None.
   <br><b>Notes:       </b> Default implementation does nothing
   </ul><br>
   */
  virtual int32_t Reset(const BIT_LIST_CLASS & bit_list,STEP_CODE_DATA_STRUCT & error);

private:  // functions

  int32_t SetErrorSignature(STEP_CODE_DATA_STRUCT & error, BIT_LIST_CLASS & bl); // dg02a
  /**
   Copy forbidden
   */
  ErrorRegister(const ErrorRegister & er);
  /**
   Assignment forbidden
   */
  ErrorRegister & operator=(const ErrorRegister & er);

protected: // Data

  SCAN_COMM_REGISTER_CLASS & scr;
  int32_t scr_rc;

private:  // Data

  ResolutionMap & rMap;
  bool xNoErrorOnZeroScr;
  uint16_t xScrId;

};

} // end namespace PRDF

#endif /* iipErrorRegister_h */

OpenPOWER on IntegriCloud