-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcciss_events.h
224 lines (195 loc) · 6.28 KB
/
cciss_events.h
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
/*
* cciss_events.h
* Copyright (C) 2003 Hugo Trippaers
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* $Header$
*/
#define BYTE __u8
#define WORD __u16
#define DWORD __u32
#define QWORD __u64
/* from cciss_cmd.h */
#define CISS_MAX_LUN 16
#define CISS_MAX_PHYS_LUN 1024
#define CompareEvent(event,par_class,par_subclass,par_detail) \
((event.class.class==par_class) && \
(event.class.subclass == par_subclass) && \
(event.class.detail == par_detail))
#pragma pack(1) /* these structures must be byte aligned */
typedef struct _cciss_event_physicaldrivechange {
WORD physicaldrivenumber;
BYTE configureddriveflag;
BYTE sparedriveflag;
BYTE bigphysicaldrivenumber;
BYTE enclosurebaynumber;
} cciss_event_physicaldrivechange;
typedef struct _cciss_event_powersupplydetail {
WORD port;
WORD psubid;
WORD box;
} cciss_event_powersupplydetail;
typedef struct _cciss_event_fandatadetail {
WORD port;
WORD fanid;
WORD box;
} cciss_event_fandatadetail;
typedef struct _cciss_event_upsdetail {
WORD port;
WORD psupid;
} cciss_event_upsdetail;
typedef struct _cciss_event_redctrlrdetail {
WORD slot;
} cciss_event_redctrldetail;
typedef struct _cciss_event_temperaturedatadetail {
WORD port;
WORD sensorid;
WORD box;
} cciss_event_temperaturedetail;
typedef struct _cciss_event_chassisdetail {
WORD port;
WORD reserved;
WORD box;
} cciss_event_chassisdetail;
typedef struct _cciss_event_phystatchange {
WORD physicaldrivenumber;
BYTE failurereason;
BYTE configureddriveflag;
BYTE sparedriveflag;
BYTE bigphysicaldrivenumber;
BYTE enclosurebaynumber;
} cciss_event_phystatchange;
typedef struct _cciss_event_logstatchange {
WORD logicaldrivenumber;
BYTE previouslogicaldrivestate;
BYTE newlogicaldrivestate;
BYTE currentsparestatus;
} cciss_event_logstatchange;
typedef struct _cciss_event_rebuildaborted {
WORD logicaldrivenumber;
BYTE replacementdrive;
BYTE errordrive;
BYTE bigreplacementdrive;
BYTE bigerrordrive;
} cciss_event_rebuildaborted;
typedef struct _cciss_event_logfatalerrorio {
WORD logicaldrivenumber;
DWORD logicalblockaddress;
WORD logicalblockcount;
BYTE logicalcommand;
BYTE fataldrivebus;
BYTE fataldriveid;
QWORD biglogicalblockaddress;
} cciss_event_logfatalerrorio;
typedef struct _cciss_event_surfacedata {
WORD logicaldrivenumber;
} cciss_event_surfacedata;
typedef struct _cciss_event_redstatchange {
BYTE preferredslotcontrol;
BYTE currentredundancymode;
BYTE redundantcontrollerstatus;
BYTE redundantfailurereason;
BYTE previousslotcontrol;
BYTE previousredundancymode;
BYTE previousredundantctrlrstatus;
BYTE previousredundantfailurereason;
} cciss_event_redstatchange;
typedef struct _cciss_event_loophwinfo {
WORD bus;
} cciss_event_loophwinfo;
typedef union _cciss_event_detail_type {
cciss_event_physicaldrivechange physicaldrivechange;
cciss_event_powersupplydetail powersupplydetail;
cciss_event_fandatadetail fandatadetail;
cciss_event_upsdetail upsdetail;
cciss_event_redctrldetail redctrldetail;
cciss_event_temperaturedetail temperaturedetail;
cciss_event_chassisdetail chassisdetail;
cciss_event_phystatchange phystatchange;
cciss_event_logstatchange logstatchange;
cciss_event_rebuildaborted rebuildaborted;
cciss_event_logfatalerrorio logfatalerrorio;
cciss_event_surfacedata surfacedata;
cciss_event_redstatchange redstatchange;
cciss_event_loophwinfo loophwinfo;
BYTE data[64];
} cciss_event_detail_type;
typedef struct _cciss_event_time_type {
BYTE month;
BYTE day;
WORD year;
DWORD seconds;
} cciss_event_time_type;
typedef struct _cciss_event_class_type {
WORD class;
WORD subclass;
WORD detail;
} cciss_event_class_type;
typedef struct _cciss_event_type {
DWORD timestamp; /* Relative Controller Time byte 0-3 */
cciss_event_class_type class; /* Event Class byte 4-9 */
cciss_event_detail_type detail; /* Event Specific Data Fields byte 10-73 */
unsigned char mesgstring[80]; /* Null Terminated ASCII Mesg byte 74-153 */
DWORD tag; /* Event Tag byte 154-157 */
cciss_event_time_type time; /* Event Time byte 158-165 */
WORD prepowertime; /* Pre power up Time (sec) byte 166-167 */
LUNAddr_struct deviceaddr; /* Device address byte 168-175 */
unsigned char padding[335]; /* padding byte 176-511 */
} cciss_event_type;
typedef struct _cciss_report_logicallun_struct
{
BYTE LUNlist_len[4];
DWORD reserved;
LUNAddr_struct luns[CISS_MAX_LUN];
} cciss_report_logicallun_struct;
#pragma pack() /* normal alignment */
const char *logicaldrivestatusstr[] = {
"Logical drive is ok",
"Logical drive is failing",
"Logical drive is not configured",
"Logical drive is using interim recovery mode",
"Logical drive is ready for recovery operation",
"Logical drive is is currently recovering",
"Wrong physical drive was replaced",
"A physical drive is not properly connected",
"Hardware is overheating",
"Hardware has overheated",
"Logical drive is currently expanding",
"Logical drive is not yet available",
"Logical drive is queued for expansion",
};
#define SEV_CRITICAL 2
#define SEV_WARNING 1
#define SEV_NORMAL 0
const int logicaldrivestatusseverity[] = {
SEV_NORMAL,
SEV_CRITICAL,
SEV_WARNING,
SEV_CRITICAL,
SEV_WARNING,
SEV_WARNING,
SEV_CRITICAL,
SEV_CRITICAL,
SEV_CRITICAL,
SEV_CRITICAL,
SEV_WARNING,
SEV_WARNING,
SEV_WARNING
};
const char *sparestatusstr[] = {
"online",
};