~ubuntu-branches/ubuntu/intrepid/raidutils/intrepid

« back to all changes in this revision

Viewing changes to lib/hba_log.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Barak Pearlmutter
  • Date: 2004-05-18 11:33:42 UTC
  • Revision ID: james.westby@ubuntu.com-20040518113342-tyqavmso5q351xi2
Tags: upstream-0.0.4
ImportĀ upstreamĀ versionĀ 0.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 1996-2004, Adaptec Corporation
 
2
 * All rights reserved.
 
3
 *
 
4
 * Redistribution and use in source and binary forms, with or without
 
5
 * modification, are permitted provided that the following conditions are met:
 
6
 *
 
7
 * - Redistributions of source code must retain the above copyright notice, this
 
8
 *   list of conditions and the following disclaimer.
 
9
 * - Redistributions in binary form must reproduce the above copyright notice,
 
10
 *   this list of conditions and the following disclaimer in the documentation
 
11
 *   and/or other materials provided with the distribution.
 
12
 * - Neither the name of the Adaptec Corporation nor the names of its
 
13
 *   contributors may be used to endorse or promote products derived from this
 
14
 *   software without specific prior written permission.
 
15
 *
 
16
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
17
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
18
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
19
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 
20
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
21
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
22
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
23
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
24
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
25
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
26
 * POSSIBILITY OF SUCH DAMAGE.
 
27
 */
 
28
 
 
29
//File - HBA_LOG.CPP
 
30
//***************************************************************************
 
31
//
 
32
//Description:
 
33
//
 
34
//    This file contains the function definitions for the dptHBAlog_C
 
35
//class.
 
36
//
 
37
//Author:       Doug Anderson
 
38
//Date:         5/6/93
 
39
//
 
40
//Editors:
 
41
//
 
42
//Remarks:
 
43
//
 
44
//
 
45
//***************************************************************************
 
46
 
 
47
 
 
48
//Include Files -------------------------------------------------------------
 
49
 
 
50
#include        "hba_log.hpp"
 
51
 
 
52
//Function - dptHBAlog_C::dptHBAlog_C() - start
 
53
//===========================================================================
 
54
//
 
55
//Description:
 
56
//
 
57
//    This function is called to initialize the new object.
 
58
//
 
59
//Parameters:
 
60
//
 
61
//Return Value:
 
62
//
 
63
//Global Variables Affected:
 
64
//
 
65
//Remarks: (Side effects, Assumptions, Warnings...)
 
66
//
 
67
//
 
68
//---------------------------------------------------------------------------
 
69
 
 
70
dptHBAlog_C::dptHBAlog_C()
 
71
{
 
72
    param_P = (logParam_S *)(header_P = (logHeader_S *)NULL);
 
73
    validBytes = paramBytes = 0;
 
74
    curEventBytes = 0;
 
75
}
 
76
//dptHBAlog_C::dptHBAlog_C() - end
 
77
 
 
78
 
 
79
//Function - dptHBAlog_C::reverseParam() - start
 
80
//===========================================================================
 
81
//
 
82
//Description:
 
83
//
 
84
//    This function is called from reverseAllParams() to provide an
 
85
//opportunity to reverse the data portion of the log parameters.
 
86
//
 
87
//Parameters:
 
88
//
 
89
//Return Value:
 
90
//
 
91
//Global Variables Affected:
 
92
//
 
93
//Remarks: (Side effects, Assumptions, Warnings...)
 
94
//
 
95
//
 
96
//---------------------------------------------------------------------------
 
97
 
 
98
void    dptHBAlog_C::reverseParam()
 
99
{
 
100
 
 
101
  // Reverse the first long word (All parameter codes - usually event time)
 
102
 
 
103
  // Ignore the severity level, reverse parameter specific fields
 
104
switch (code() & 0x0fff) {
 
105
   case 0x001:  ((hl_Header_S *)(param_P->getData()))->scsiSwap();
 
106
                break;
 
107
   case 0x002:  ((hl_Overflow_S *)(param_P->getData()))->scsiSwap();
 
108
                break;
 
109
   case 0x003:  ((hl_SCSIstat_S *)(param_P->getData()))->scsiSwap();
 
110
                break;
 
111
   case 0x004:  ((hl_ReqSense_S *)(param_P->getData()))->scsiSwap();
 
112
                break;
 
113
   case 0x005:  ((hl_HBAerr_S *)(param_P->getData()))->scsiSwap();
 
114
                break;
 
115
   case 0x006:  ((hl_Reassign_S *)(param_P->getData()))->scsiSwap();
 
116
                break;
 
117
   case 0x007:  ((hl_RAMerr_S *)(param_P->getData()))->scsiSwap();
 
118
                break;
 
119
   case 0x008:  ((hl_Time_S *)(param_P->getData()))->scsiSwap();
 
120
                break;
 
121
   case 0x009:  ((hl_ArrayCfg_S *)(param_P->getData()))->scsiSwap();
 
122
                break;
 
123
   case 0x00b:  ((hl_MajorStat_S *)(param_P->getData()))->scsiSwap();
 
124
                break;
 
125
   case 0x00c:  ((hl_DataIC_S *)(param_P->getData()))->scsiSwap();
 
126
                break;
 
127
   case 0x00d:  ((hl_HCrcved_S *)(param_P->getData()))->scsiSwap();
 
128
                break;
 
129
   case 0x00e:  ((hl_SCSIcmd_S *)(param_P->getData()))->scsiSwap();
 
130
                break;
 
131
   case 0x00f:  ((hl_Lock_S *)(param_P->getData()))->scsiSwap();
 
132
                break;
 
133
   case 0x010:  ((hl_decArray_S *)(param_P->getData()))->scsiSwap();
 
134
                break;
 
135
   case 0x012:  ((hl_driveFailure_S *)(param_P->getData()))->scsiSwap();
 
136
                break;
 
137
   case 0x013:
 
138
   case 0x014:
 
139
   case 0x015:  ((hl_voltage_S *)(param_P->getData()))->scsiSwap();
 
140
                break;
 
141
   case 0x016:
 
142
   case 0x017:
 
143
   case 0x018:  ((hl_temperature_S *)(param_P->getData()))->scsiSwap();
 
144
                break;
 
145
   case 0x01a:  ((hl_diagStartStop_S *)(param_P->getData()))->scsiSwap();
 
146
                break;
 
147
   case 0x01b:  ((hl_smartThreshold_S *)(param_P->getData()))->scsiSwap();
 
148
                break;
 
149
   case 0x01c:  ((hl_scheduledDiag_S *)(param_P->getData()))->scsiSwap();
 
150
                break;
 
151
   case 0x01d:  ((hl_debug_S *)(param_P->getData()))->scsiSwap();
 
152
                break;
 
153
   case 0x01f:  ((hl_expandArray_S *)(param_P->getData()))->scsiSwap();
 
154
                break;
 
155
   case 0x020:
 
156
   case 0x021:  ((hl_serverStatus_S *)(param_P->getData()))->scsiSwap();
 
157
                break;
 
158
   case 0x022:  ((hl_formatDone_S *)(param_P->getData()))->scsiSwap();
 
159
                break;
 
160
   case 0x024:
 
161
   case 0x025:  ((SafTe_S *)(param_P->getData()))->scsiSwap();
 
162
                break;
 
163
   case 0x026:
 
164
   case 0x027:  ((Ses_S *)(param_P->getData()))->scsiSwap();
 
165
                break;
 
166
   case 0x028:  ((SesTemp_S *)(param_P->getData()))->scsiSwap();
 
167
                break;
 
168
   case 0x031:  ((ResetDataRetention_S *)(param_P->getData()))->scsiSwap();
 
169
                break;
 
170
   case 0x03e:
 
171
   case 0x03f:
 
172
   case 0x040:
 
173
   case 0x041:  ((BlockList_S *)(param_P->getData()))->scsiSwap();
 
174
                break;
 
175
   case 0x042:  ((WriteBackFailue_S *)(param_P->getData()))->scsiSwap();
 
176
                break;
 
177
   case 0x043:  ((BatteryEvent_S *)(param_P->getData()))->scsiSwap();
 
178
                break;
 
179
   case 0x044:  ((CacheChangeEvent_S *)(param_P->getData()))->scsiSwap();
 
180
                break;
 
181
   case 0x045:  ((BusReset_S *)(param_P->getData()))->scsiSwap();
 
182
                break;
 
183
   case 0x046:  ((FibreLoop_S *)(param_P->getData()))->scsiSwap();
 
184
                break;
 
185
   case 0x050:  ((BatteryCalibrate_S *)(param_P->getData()))->scsiSwap();
 
186
                break;
 
187
   case 0x051:  ((HdmIspChannel_S *)(param_P->getData()))->scsiSwap();
 
188
                break;
 
189
   case 0x052:  ((SpcDownSpeed_S *)(param_P->getData()))->scsiSwap();
 
190
                break;
 
191
   case 0x053:  ((EnclosureExist_S *)(param_P->getData()))->scsiSwap();
 
192
                break;
 
193
   default:     ((hl_Standard_S *)(param_P->getData()))->scsiSwap();
 
194
                break;
 
195
}
 
196
 
 
197
}
 
198
//dptHBAlog_C::reverseParam() - end
 
199
 
 
200
 
 
201
//Function - dptHBAlog_C::calcInit() - start
 
202
//===========================================================================
 
203
//
 
204
//Description:
 
205
//
 
206
//    This function Initialize log page specific variables
 
207
//
 
208
//Parameters:
 
209
//
 
210
//Return Value:
 
211
//
 
212
//Global Variables Affected:
 
213
//
 
214
//Remarks: (Side effects, Assumptions, Warnings...)
 
215
//
 
216
//---------------------------------------------------------------------------
 
217
 
 
218
void    dptHBAlog_C::calcInit()
 
219
{
 
220
 
 
221
    fwEventBytes = 0;
 
222
 
 
223
}
 
224
//dptHBAlog_C::calcInit() - end
 
225
 
 
226
 
 
227
//Function - dptHBAlog_C::calcInfo() - start
 
228
//===========================================================================
 
229
//
 
230
//Description:
 
231
//
 
232
//    This function calculates the # of FW event bytes read from the
 
233
//log buffer.
 
234
//
 
235
//Parameters:
 
236
//
 
237
//Return Value:
 
238
//
 
239
//Global Variables Affected:
 
240
//
 
241
//Remarks: (Side effects, Assumptions, Warnings...)
 
242
//
 
243
//---------------------------------------------------------------------------
 
244
 
 
245
void    dptHBAlog_C::calcInfo()
 
246
{
 
247
 
 
248
if ((code() & 0xf000)!=0xf000)
 
249
   fwEventBytes += 4 + param_P->getLength();
 
250
 
 
251
}
 
252
//dptHBAlog_C::calcInfo() - end
 
253
 
 
254
 
 
255
//Function - dptHBAlog_C::curOffsetInit() - start
 
256
//===========================================================================
 
257
//
 
258
//Description:
 
259
//
 
260
//    This function initializes the current offset.
 
261
//log buffer.
 
262
//
 
263
//Parameters:
 
264
//
 
265
//Return Value:
 
266
//
 
267
//Global Variables Affected:
 
268
//
 
269
//Remarks: (Side effects, Assumptions, Warnings...)
 
270
//
 
271
//---------------------------------------------------------------------------
 
272
 
 
273
void    dptHBAlog_C::curOffsetInit()
 
274
{
 
275
 
 
276
    curEventBytes = 0;
 
277
 
 
278
}
 
279
//dptHBAlog_C::curOffsetInit() - end
 
280
 
 
281
 
 
282
//Function - dptHBAlog_C::calcCurOffset() - start
 
283
//===========================================================================
 
284
//
 
285
//Description:
 
286
//
 
287
//    This function calculates the byte offset of the current parameter.
 
288
//
 
289
//Parameters:
 
290
//
 
291
//Return Value:
 
292
//
 
293
//Global Variables Affected:
 
294
//
 
295
//Remarks: (Side effects, Assumptions, Warnings...)
 
296
//
 
297
//---------------------------------------------------------------------------
 
298
 
 
299
void    dptHBAlog_C::calcCurOffset()
 
300
{
 
301
 
 
302
if ((code() & 0xf000)!=0xf000)
 
303
   curEventBytes += 4 + param_P->getLength();
 
304
 
 
305
}
 
306
//dptHBAlog_C::calcCurOffset() - end
 
307
 
 
308