2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * $FreeBSD: src/sys/dev/mly/mly_tables.h,v 1.1.2.1 2000/10/27 10:06:56 msmith Exp $
28 * $DragonFly: src/sys/dev/raid/mly/mly_tables.h,v 1.3 2008/01/21 02:27:37 pavalos Exp $
32 * Lookup table for code-to-text translations.
34 struct mly_code_lookup {
39 static char *mly_describe_code(struct mly_code_lookup *table, u_int32_t code);
41 /********************************************************************************
42 * Look up a text description of a numeric code and return a pointer to same.
45 mly_describe_code(struct mly_code_lookup *table, u_int32_t code)
49 for (i = 0; table[i].string != NULL; i++)
50 if (table[i].code == code)
51 return(table[i].string);
52 return(table[i+1].string);
56 static struct mly_code_lookup mly_table_bustype[] = {
65 static struct mly_code_lookup mly_table_controllertype[] = {
66 #if 0 /* not supported by this driver */
67 {"DAC960E", 0x01}, /* EISA */
68 {"DAC960M", 0x08}, /* MCA */
69 {"DAC960PD", 0x10}, /* PCI Dual */
70 {"DAC960PL", 0x11}, /* PCU low-cost */
71 {"DAC960PDU", 0x12}, /* PD Ultra */
72 {"DAC960PE", 0x13}, /* Peregrine low-cost */
73 {"DAC960PG", 0x14}, /* Peregrine high-performance */
74 {"DAC960PJ", 0x15}, /* Road Runner */
75 {"DAC960PTL0", 0x16}, /* Jaguar */
76 {"DAC960PR", 0x17}, /* Road Runner (again?) */
77 {"DAC960PRL", 0x18}, /* Tomcat */
78 {"DAC960PT", 0x19}, /* Road Runner (yet again?) */
79 {"DAC1164P", 0x1a}, /* Little Apple */
80 {"DAC960PTL1", 0x1b}, /* Jaguar+ */
82 {"EXR2000P", 0x1c}, /* Big Apple */
83 {"EXR3000P", 0x1d}, /* Fibre Apple */
84 {"AcceleRAID 352", 0x1e}, /* Leopard */
85 {"AcceleRAID 170", 0x1f}, /* Lynx */
86 {"AcceleRAID 160", 0x20}, /* Bobcat */
88 {"unknown adapter", 0}
91 static struct mly_code_lookup mly_table_oemname[] = {
92 {"Mylex", MLY_OEM_MYLEX},
94 {"Hewlett-Packard", MLY_OEM_HP},
95 {"DEC/Compaq", MLY_OEM_DEC},
96 {"Siemens", MLY_OEM_SIEMENS},
97 {"Intel", MLY_OEM_INTEL},
102 static struct mly_code_lookup mly_table_memorytype[] = {
108 {"unknown memory", 0}
111 static struct mly_code_lookup mly_table_cputype[] = {
116 {"NorthBay(?)", 0x05},
124 * This table is directly derived from the corresponding table in the
125 * Linux driver, and uses a derivative encoding for simplicity's sake.
127 * The first character of the string determines the format of the message.
129 * p "physical device <channel>:<target> <text>" (physical device status)
130 * s "physical device <channel>:<target> <text>" (scsi message or error)
131 * " sense key <key> asc <asc> ascq <ascq>"
132 * " info <info> csi <csi>"
133 * l "logical drive <unit>: <text>" (logical device status)
134 * m "logical drive <unit>: <text>" (logical device message)
136 * Messages which are typically suppressed have the first character capitalised.
137 * These messages will only be printed if bootverbose is set.
139 * The second character in the string indicates an action to be taken as a
140 * result of the event.
142 * r rescan the device for possible state change
145 static struct mly_code_lookup mly_table_event[] = {
146 /* physical device events (0x0000 - 0x007f) */
147 {"pr online", 0x0001},
148 {"pr standby", 0x0002},
149 {"p automatic rebuild started", 0x0005},
150 {"p manual rebuild started", 0x0006},
151 {"pr rebuild completed", 0x0007},
152 {"pr rebuild cancelled", 0x0008},
153 {"pr rebuild failed for unknown reasons", 0x0009},
154 {"pr rebuild failed due to new physical device", 0x000a},
155 {"pr rebuild failed due to logical drive failure", 0x000b},
156 {"sr offline", 0x000c},
157 {"pr found", 0x000d},
159 {"p unconfigured", 0x000f},
160 {"p expand capacity started", 0x0010},
161 {"pr expand capacity completed", 0x0011},
162 {"pr expand capacity failed", 0x0012},
163 {"p parity error", 0x0016},
164 {"p soft error", 0x0017},
165 {"p miscellaneous error", 0x0018},
167 {"p active spare found", 0x001a},
168 {"p warm spare found", 0x001b},
169 {"s sense data received", 0x001c},
170 {"p initialization started", 0x001d},
171 {"pr initialization completed", 0x001e},
172 {"pr initialization failed", 0x001f},
173 {"pr initialization cancelled", 0x0020},
174 {"P write recovery failed", 0x0021},
175 {"p scsi bus reset failed", 0x0022},
176 {"p double check condition", 0x0023},
177 {"p device cannot be accessed", 0x0024},
178 {"p gross error on scsi processor", 0x0025},
179 {"p bad tag from device", 0x0026},
180 {"p command timeout", 0x0027},
181 {"pr system reset", 0x0028},
182 {"p busy status or parity error", 0x0029},
183 {"pr host set device to failed state", 0x002a},
184 {"pr selection timeout", 0x002b},
185 {"p scsi bus phase error", 0x002c},
186 {"pr device returned unknown status", 0x002d},
187 {"pr device not ready", 0x002e},
188 {"p device not found at startup", 0x002f},
189 {"p COD write operation failed", 0x0030},
190 {"p BDT write operation failed", 0x0031},
191 {"p missing at startup", 0x0039},
192 {"p start rebuild failed due to physical drive too small", 0x003a},
193 /* logical device events (0x0080 - 0x00ff) */
194 {"m consistency check started", 0x0080},
195 {"mr consistency check completed", 0x0081},
196 {"mr consistency check cancelled", 0x0082},
197 {"mr consistency check completed with errors", 0x0083},
198 {"mr consistency check failed due to logical drive failure", 0x0084},
199 {"mr consistency check failed due to physical device failure", 0x0085},
200 {"lr offline", 0x0086},
201 {"lr critical", 0x0087},
202 {"lr online", 0x0088},
203 {"m automatic rebuild started", 0x0089},
204 {"m manual rebuild started", 0x008a},
205 {"mr rebuild completed", 0x008b},
206 {"mr rebuild cancelled", 0x008c},
207 {"mr rebuild failed for unknown reasons", 0x008d},
208 {"mr rebuild failed due to new physical device", 0x008e},
209 {"mr rebuild failed due to logical drive failure", 0x008f},
210 {"l initialization started", 0x0090},
211 {"lr initialization completed", 0x0091},
212 {"lr initialization cancelled", 0x0092},
213 {"lr initialization failed", 0x0093},
214 {"lr found", 0x0094},
216 {"l expand capacity started", 0x0096},
217 {"lr expand capacity completed", 0x0097},
218 {"lr expand capacity failed", 0x0098},
219 {"l bad block found", 0x0099},
220 {"lr size changed", 0x009a},
221 {"lr type changed", 0x009b},
222 {"l bad data block found", 0x009c},
223 {"l read of data block in bdt", 0x009e},
224 {"l write back data for disk block lost", 0x009f},
225 /* enclosure management events (0x0100 - 0x017f) */
226 {"e enclosure %d fan %d failed", 0x0140},
227 {"e enclosure %d fan %d ok", 0x0141},
228 {"e enclosure %d fan %d not present", 0x0142},
229 {"e enclosure %d power supply %d failed", 0x0143},
230 {"e enclosure %d power supply %d ok", 0x0144},
231 {"e enclosure %d power supply %d not present", 0x0145},
232 {"e enclosure %d temperature sensor %d failed", 0x0146},
233 {"e enclosure %d temperature sensor %d critical", 0x0147},
234 {"e enclosure %d temperature sensor %d ok", 0x0148},
235 {"e enclosure %d temperature sensor %d not present", 0x0149},
236 {"e enclosure %d unit %d access critical", 0x014a},
237 {"e enclosure %d unit %d access ok", 0x014b},
238 {"e enclosure %d unit %d access offline", 0x014c},
239 /* controller events (0x0180 - 0x01ff) */
240 {"c cache write back error", 0x0181},
241 {"c battery backup unit found", 0x0188},
242 {"c battery backup unit charge level low", 0x0189},
243 {"c battery backup unit charge level ok", 0x018a},
244 {"c installation aborted", 0x0193},
245 {"c mirror race recovery in progress", 0x0195},
246 {"c mirror race on critical drive", 0x0196},
247 {"c memory soft ecc error", 0x019e},
248 {"c memory hard ecc error", 0x019f},
249 {"c battery backup unit failed", 0x01a2},
251 {"? unknown event code", 0}
255 * Values here must be 16 characters or less, as they are packed into
256 * the 'product' field in the SCSI inquiry data.
258 static struct mly_code_lookup mly_table_device_state[] = {
259 {"offline", MLY_DEVICE_STATE_OFFLINE},
260 {"unconfigured", MLY_DEVICE_STATE_UNCONFIGURED},
261 {"online", MLY_DEVICE_STATE_ONLINE},
262 {"critical", MLY_DEVICE_STATE_CRITICAL},
263 {"writeonly", MLY_DEVICE_STATE_WRITEONLY},
264 {"standby", MLY_DEVICE_STATE_STANDBY},
265 {"missing", MLY_DEVICE_STATE_MISSING},
271 * Values here must be 8 characters or less, as they are packed into
272 * the 'vendor' field in the SCSI inquiry data.
274 static struct mly_code_lookup mly_table_device_type[] = {
275 {"RAID 0", MLY_DEVICE_TYPE_RAID0},
276 {"RAID 1", MLY_DEVICE_TYPE_RAID1},
277 {"RAID 3", MLY_DEVICE_TYPE_RAID3}, /* right asymmetric parity */
278 {"RAID 5", MLY_DEVICE_TYPE_RAID5}, /* right asymmetric parity */
279 {"RAID 6", MLY_DEVICE_TYPE_RAID6}, /* Mylex RAID 6 */
280 {"RAID 7", MLY_DEVICE_TYPE_RAID7}, /* JBOD */
281 {"SPAN", MLY_DEVICE_TYPE_NEWSPAN}, /* New Mylex SPAN */
282 {"RAID 3", MLY_DEVICE_TYPE_RAID3F}, /* fixed parity */
283 {"RAID 3", MLY_DEVICE_TYPE_RAID3L}, /* left symmetric parity */
284 {"SPAN", MLY_DEVICE_TYPE_SPAN}, /* current spanning implementation */
285 {"RAID 5", MLY_DEVICE_TYPE_RAID5L}, /* left symmetric parity */
286 {"RAID E", MLY_DEVICE_TYPE_RAIDE}, /* concatenation */
287 {"PHYSICAL", MLY_DEVICE_TYPE_PHYSICAL}, /* physical device */
293 static struct mly_code_lookup mly_table_stripe_size[] = {
294 {"NONE", MLY_STRIPE_ZERO},
295 {"512B", MLY_STRIPE_512b},
296 {"1k", MLY_STRIPE_1k},
297 {"2k", MLY_STRIPE_2k},
298 {"4k", MLY_STRIPE_4k},
299 {"8k", MLY_STRIPE_8k},
300 {"16k", MLY_STRIPE_16k},
301 {"32k", MLY_STRIPE_32k},
302 {"64k", MLY_STRIPE_64k},
303 {"128k", MLY_STRIPE_128k},
304 {"256k", MLY_STRIPE_256k},
305 {"512k", MLY_STRIPE_512k},
306 {"1M", MLY_STRIPE_1m},
311 static struct mly_code_lookup mly_table_cacheline_size[] = {
312 {"NONE", MLY_CACHELINE_ZERO},
313 {"512B", MLY_CACHELINE_512b},
314 {"1k", MLY_CACHELINE_1k},
315 {"2k", MLY_CACHELINE_2k},
316 {"4k", MLY_CACHELINE_4k},
317 {"8k", MLY_CACHELINE_8k},
318 {"16k", MLY_CACHELINE_16k},
319 {"32k", MLY_CACHELINE_32k},
320 {"64k", MLY_CACHELINE_64k},