summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/register/prdfErrorRegister.C
blob: 83227ad882f70b85cc3bc4820b86d120acb966cb (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/register/prdfErrorRegister.C $ */
/*                                                                        */
/* 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.C
 @brief ErrorRegister class definition
*/
// Module Description **************************************************
//
// Description: Definition of ErrorRegister class
//
// End Module Description **********************************************
//----------------------------------------------------------------------
//  Includes
//----------------------------------------------------------------------
#define iipErrorRegister_C

#include <prdfMain.H>
#include <prdfAssert.h>
#include <iipstep.h>
#include <iipbits.h>
#include <iipResolution.h>
#include <iipscr.h>
#include <prdfErrorSignature.H>
#include <iipServiceDataCollector.h>
#include <prdfResolutionMap.H>
#include <iipErrorRegister.h>

#include <iipconst.h>
#include <prdfGlobal.H>
#undef iipErrorRegister_C

namespace PRDF
{

//----------------------------------------------------------------------
//  User Types
//----------------------------------------------------------------------

//----------------------------------------------------------------------
//  Constants
//----------------------------------------------------------------------

//----------------------------------------------------------------------
//  Macros
//----------------------------------------------------------------------

//----------------------------------------------------------------------
//  Internal Function Prototypes
//----------------------------------------------------------------------

//----------------------------------------------------------------------
//  Global Variables
//----------------------------------------------------------------------

//---------------------------------------------------------------------
// Member Function Specifications
//---------------------------------------------------------------------

int32_t ErrorRegister::SetErrorSignature( STEP_CODE_DATA_STRUCT & error,
                                          BitKey & bl )
{
  int32_t rc = SUCCESS;
  ErrorSignature * esig = error.service_data->GetErrorSignature();
  uint32_t blen = bl.size();
  switch(blen)
  {
    case 0:
      (error.service_data->GetErrorSignature())->setErrCode(PRD_SCAN_COMM_REGISTER_ZERO);
      if(xNoErrorOnZeroScr != true) rc = PRD_SCAN_COMM_REGISTER_ZERO;
      break;

    case 1:
      esig->setErrCode(bl.getListValue(0));
      break;

    default:
      for(uint32_t index = 0; index < blen; ++index)  //dg01a
      {                                                             //dg01a
        esig->setErrCode(bl.getListValue(index));                 //dg01a
      }                                                             //dg01a
      esig->setErrCode(PRD_MULTIPLE_ERRORS);
  };
  return rc;
}

/*---------------------------------------------------------------------*/

ErrorRegister::ErrorRegister( SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm,
                              uint16_t scrId ) :
    ErrorRegisterType(), scr(r), scr_rc(SUCCESS), rMap(rm),
    xNoErrorOnZeroScr(false), xScrId(scrId)
{
    PRDF_ASSERT( &r  != NULL );
    PRDF_ASSERT( &rm != NULL );
}

/*---------------------------------------------------------------------*/

int32_t ErrorRegister::Analyze(STEP_CODE_DATA_STRUCT & error)
{
  int32_t rc = SUCCESS;

  uint32_t l_savedErrSig = 0;  // @pw01

  if(xScrId == 0x0fff)
  {
    (error.service_data->GetErrorSignature())->setRegId(scr.GetAddress());
  }
  else
  {
    (error.service_data->GetErrorSignature())->setRegId(xScrId);
  }

  // Get Data from hardware
  const BIT_STRING_CLASS &bs = Read(error.service_data->GetCauseAttentionType()); // @pw02
  BitKey bl;     // null bit list has length 0

  if (scr_rc == SUCCESS)
  {
    bl = Filter(bs);
    rc = SetErrorSignature(error,bl);  //dg02c - made function of this block of code
    // @pw01
    // Save signature to determine if it changes during resolution execution.
    l_savedErrSig = (error.service_data->GetErrorSignature())->getSigId();
  }

  uint32_t res_rc = Lookup(error, bl); // lookup and execute the resolutions
  if(SUCCESS == rc) rc = res_rc; // previous rc has prioity over res_rc


  // @pw01
  // If we had a DD02 and the signature changes, ignore DD02.
  if ((rc == PRD_SCAN_COMM_REGISTER_ZERO) &&
      ((error.service_data->GetErrorSignature())->getSigId()
        != l_savedErrSig)
     )
  {
      // Found a better answer during the DD02 analysis.
      rc = res_rc;
  }


  if(scr_rc == SUCCESS)
  {
    FilterUndo(bl); // dg03a
    // NOTE:  This is an unusual work-a-round for NOT clearing
    //        particular FIR bits in a register because they are cleared
    //        in another part of the plugin code.  jl01
    if(rc == PRD_NO_CLEAR_FIR_BITS)
    {
        rc = SUCCESS;  //Return success to indicate that we understand the DDFF
    }
    else
    {
        int32_t reset_rc;
        reset_rc = Reset(bl,error);
        if(rc == SUCCESS)rc = reset_rc;
    }
  }
  else // scr read failed
  {
    (error.service_data->GetErrorSignature())->setErrCode(PRD_SCANCOM_FAILURE);
    rc = scr_rc;
  }

  return(rc);
}

/*---------------------------------------------------------------------*/

const BIT_STRING_CLASS & ErrorRegister::Read(ATTENTION_TYPE i_attn)
{
  scr_rc = scr.Read();
  return (*scr.GetBitString(i_attn));
}

/*---------------------------------------------------------------------*/

BitKey ErrorRegister::Filter
(const BIT_STRING_CLASS & bs)
{
  BitKey bit_list;
  bit_list = bs;
  return(bit_list);
}

/*---------------------------------------------------------------------*/

int32_t ErrorRegister::Lookup(STEP_CODE_DATA_STRUCT & sdc, BitKey & bl) // dg02c dg03c
{
  int32_t rc = SUCCESS;
//  if (bl.GetListLength() == 0) return(rMap.GetDefault());  /dg00d
  ResolutionList rList;
  rMap.LookUp(rList,bl,sdc); // dg04c
  // SetErrorSignature(sdc,bl);   // LookUp may have changed bl dg02a dg04d
  for(ResolutionList::iterator i = rList.begin(); i != rList.end(); ++i)
  {
    rc |= (*i)->Resolve(sdc);
  }
  return rc;
}

/*---------------------------------------------------------------------*/

int32_t ErrorRegister::Reset(const BitKey & bit_list, STEP_CODE_DATA_STRUCT & error)
{
  return(SUCCESS);
}

} // end namespace PRDF

OpenPOWER on IntegriCloud