mly_tables.h revision 1.6 1 1.6 martin /* $NetBSD: mly_tables.h,v 1.6 2008/04/28 20:23:55 martin Exp $ */
2 1.1 ad
3 1.1 ad /*-
4 1.1 ad * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 1.1 ad * All rights reserved.
6 1.1 ad *
7 1.1 ad * This code is derived from software contributed to The NetBSD Foundation
8 1.1 ad * by Andrew Doran, Thor Lancelot Simon, and Eric Haszlakiewicz.
9 1.1 ad *
10 1.1 ad * Redistribution and use in source and binary forms, with or without
11 1.1 ad * modification, are permitted provided that the following conditions
12 1.1 ad * are met:
13 1.1 ad * 1. Redistributions of source code must retain the above copyright
14 1.1 ad * notice, this list of conditions and the following disclaimer.
15 1.1 ad * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 ad * notice, this list of conditions and the following disclaimer in the
17 1.1 ad * documentation and/or other materials provided with the distribution.
18 1.1 ad *
19 1.1 ad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 ad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 ad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 ad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 ad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 ad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 ad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 ad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 ad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 ad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 ad * POSSIBILITY OF SUCH DAMAGE.
30 1.1 ad */
31 1.1 ad
32 1.1 ad /*-
33 1.1 ad * Copyright (c) 2000 Michael Smith
34 1.1 ad * Copyright (c) 2000 BSDi
35 1.1 ad * All rights reserved.
36 1.1 ad *
37 1.1 ad * Redistribution and use in source and binary forms, with or without
38 1.1 ad * modification, are permitted provided that the following conditions
39 1.1 ad * are met:
40 1.1 ad * 1. Redistributions of source code must retain the above copyright
41 1.1 ad * notice, this list of conditions and the following disclaimer.
42 1.1 ad * 2. Redistributions in binary form must reproduce the above copyright
43 1.1 ad * notice, this list of conditions and the following disclaimer in the
44 1.1 ad * documentation and/or other materials provided with the distribution.
45 1.1 ad *
46 1.1 ad * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
47 1.1 ad * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 1.1 ad * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 1.1 ad * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
50 1.1 ad * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 1.1 ad * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 1.1 ad * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 1.1 ad * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 1.1 ad * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 1.1 ad * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 1.1 ad * SUCH DAMAGE.
57 1.1 ad *
58 1.1 ad * from FreeBSD: mly_tables.h,v 1.2 2001/07/14 00:12:22 msmith Exp
59 1.1 ad */
60 1.1 ad
61 1.1 ad #ifndef _PCI_MLY_TABLES_H_
62 1.1 ad #define _PCI_MLY_TABLES_H_
63 1.1 ad
64 1.1 ad struct mly_code_lookup {
65 1.1 ad const char *string;
66 1.1 ad u_int code;
67 1.1 ad };
68 1.1 ad
69 1.1 ad static const char *mly_describe_code(const struct mly_code_lookup *,
70 1.1 ad u_int32_t);
71 1.1 ad
72 1.1 ad /*
73 1.1 ad * Look up a text description of a numeric code and return a pointer to same.
74 1.1 ad */
75 1.1 ad static const char *
76 1.1 ad mly_describe_code(const struct mly_code_lookup *table, u_int32_t code)
77 1.1 ad {
78 1.1 ad int i;
79 1.1 ad
80 1.1 ad for (i = 0; table[i].string != NULL; i++)
81 1.1 ad if (table[i].code == code)
82 1.1 ad return (table[i].string);
83 1.1 ad
84 1.1 ad return (table[i + 1].string);
85 1.1 ad }
86 1.1 ad
87 1.1 ad /*
88 1.1 ad * This table is directly derived from the corresponding table in the Linux
89 1.1 ad * driver, and uses a derivative encoding for simplicity's sake.
90 1.1 ad *
91 1.1 ad * The first character of the string determines the format of the message.
92 1.1 ad *
93 1.1 ad * p "physical device <channel>:<target> <text>" (physical device status)
94 1.1 ad * s "physical device <channel>:<target> <text>" (scsi message or error)
95 1.1 ad * " sense key <key> asc <asc> ascq <ascq>"
96 1.1 ad * " info <info> csi <csi>"
97 1.1 ad * l "logical drive <unit>: <text>" (logical device status)
98 1.1 ad * m "logical drive <unit>: <text>" (logical device message)
99 1.1 ad *
100 1.1 ad * Messages which are typically suppressed have the first character
101 1.1 ad * capitalised. These messages will only be printed if bootverbose is set.
102 1.1 ad *
103 1.1 ad * The second character in the string indicates an action to be taken as a
104 1.1 ad * result of the event.
105 1.1 ad *
106 1.1 ad * r rescan the device for possible state change
107 1.1 ad *
108 1.1 ad */
109 1.1 ad static const struct mly_code_lookup mly_table_event[] = {
110 1.1 ad /*
111 1.1 ad * Physical device events (0x0000 - 0x007f).
112 1.1 ad */
113 1.1 ad { "pr online", 0x0001 },
114 1.1 ad { "pr standby", 0x0002 },
115 1.1 ad { "p automatic rebuild started", 0x0005 },
116 1.1 ad { "p manual rebuild started", 0x0006 },
117 1.1 ad { "pr rebuild completed", 0x0007 },
118 1.3 perry { "pr rebuild cancelled", 0x0008 },
119 1.1 ad { "pr rebuild failed for unknown reasons", 0x0009 },
120 1.1 ad { "pr rebuild failed due to new physical device", 0x000a },
121 1.1 ad { "pr rebuild failed due to logical drive failure", 0x000b },
122 1.1 ad { "sr offline", 0x000c },
123 1.1 ad { "pr found", 0x000d },
124 1.1 ad { "pr gone", 0x000e },
125 1.1 ad { "p unconfigured", 0x000f },
126 1.1 ad { "p expand capacity started", 0x0010 },
127 1.1 ad { "pr expand capacity completed", 0x0011 },
128 1.1 ad { "pr expand capacity failed", 0x0012 },
129 1.1 ad { "p parity error", 0x0016 },
130 1.1 ad { "p soft error", 0x0017 },
131 1.1 ad { "p miscellaneous error", 0x0018 },
132 1.1 ad { "p reset", 0x0019 },
133 1.1 ad { "p active spare found", 0x001a },
134 1.1 ad { "p warm spare found", 0x001b },
135 1.1 ad { "s sense data received", 0x001c },
136 1.1 ad { "p initialization started", 0x001d },
137 1.1 ad { "pr initialization completed", 0x001e },
138 1.1 ad { "pr initialization failed", 0x001f },
139 1.3 perry { "pr initialization cancelled", 0x0020 },
140 1.1 ad { "P write recovery failed", 0x0021 },
141 1.1 ad { "p scsi bus reset failed", 0x0022 },
142 1.1 ad { "p double check condition", 0x0023 },
143 1.1 ad { "p device cannot be accessed", 0x0024 },
144 1.1 ad { "p gross error on scsi processor", 0x0025 },
145 1.1 ad { "p bad tag from device", 0x0026 },
146 1.1 ad { "p command timeout", 0x0027 },
147 1.1 ad { "pr system reset", 0x0028 },
148 1.1 ad { "p busy status or parity error", 0x0029 },
149 1.1 ad { "pr host set device to failed state", 0x002a },
150 1.1 ad { "pr selection timeout", 0x002b },
151 1.1 ad { "p scsi bus phase error", 0x002c },
152 1.1 ad { "pr device returned unknown status", 0x002d },
153 1.1 ad { "pr device not ready", 0x002e },
154 1.1 ad { "p device not found at startup", 0x002f },
155 1.1 ad { "p COD write operation failed", 0x0030 },
156 1.1 ad { "p BDT write operation failed", 0x0031 },
157 1.1 ad { "p missing at startup", 0x0039 },
158 1.1 ad { "p start rebuild failed (physical drive too small)", 0x003a },
159 1.1 ad
160 1.1 ad /*
161 1.1 ad * Logical device events (0x0080 - 0x00ff).
162 1.1 ad */
163 1.1 ad { "m consistency check started", 0x0080 },
164 1.1 ad { "mr consistency check completed", 0x0081 },
165 1.3 perry { "mr consistency check cancelled", 0x0082 },
166 1.1 ad { "mr consistency check completed with errors", 0x0083 },
167 1.1 ad { "mr consistency check failed (logical drive failure)",0x0084 },
168 1.1 ad { "mr consistency check failed (physical device failure)",0x0085 },
169 1.1 ad { "lr offline", 0x0086 },
170 1.1 ad { "lr critical", 0x0087 },
171 1.1 ad { "lr online", 0x0088 },
172 1.1 ad { "m automatic rebuild started", 0x0089 },
173 1.1 ad { "m manual rebuild started", 0x008a },
174 1.1 ad { "mr rebuild completed", 0x008b },
175 1.3 perry { "mr rebuild cancelled", 0x008c },
176 1.1 ad { "mr rebuild failed for unknown reasons", 0x008d },
177 1.1 ad { "mr rebuild failed due to new physical device", 0x008e },
178 1.1 ad { "mr rebuild failed due to logical drive failure", 0x008f },
179 1.1 ad { "l initialization started", 0x0090 },
180 1.1 ad { "lr initialization completed", 0x0091 },
181 1.3 perry { "lr initialization cancelled", 0x0092 },
182 1.1 ad { "lr initialization failed", 0x0093 },
183 1.1 ad { "lr found", 0x0094 },
184 1.1 ad { "lr gone", 0x0095 },
185 1.1 ad { "l expand capacity started", 0x0096 },
186 1.1 ad { "lr expand capacity completed", 0x0097 },
187 1.1 ad { "lr expand capacity failed", 0x0098 },
188 1.1 ad { "l bad block found", 0x0099 },
189 1.1 ad { "lr size changed", 0x009a },
190 1.1 ad { "lr type changed", 0x009b },
191 1.1 ad { "l bad data block found", 0x009c },
192 1.1 ad { "l read of data block in bdt", 0x009e },
193 1.1 ad { "l write back data for disk block lost", 0x009f },
194 1.1 ad
195 1.1 ad /*
196 1.1 ad * Enclosure management events (0x0100 - 0x017f).
197 1.1 ad */
198 1.1 ad { "e enclosure %d fan %d failed", 0x0140 },
199 1.1 ad { "e enclosure %d fan %d ok", 0x0141 },
200 1.1 ad { "e enclosure %d fan %d not present", 0x0142 },
201 1.1 ad { "e enclosure %d power supply %d failed", 0x0143 },
202 1.1 ad { "e enclosure %d power supply %d ok", 0x0144 },
203 1.1 ad { "e enclosure %d power supply %d not present", 0x0145 },
204 1.1 ad { "e enclosure %d temperature sensor %d failed", 0x0146 },
205 1.1 ad { "e enclosure %d temperature sensor %d critical", 0x0147 },
206 1.1 ad { "e enclosure %d temperature sensor %d ok", 0x0148 },
207 1.1 ad { "e enclosure %d temperature sensor %d not present", 0x0149 },
208 1.1 ad { "e enclosure %d unit %d access critical", 0x014a },
209 1.1 ad { "e enclosure %d unit %d access ok", 0x014b },
210 1.1 ad { "e enclosure %d unit %d access offline", 0x014c },
211 1.1 ad
212 1.1 ad /*
213 1.1 ad * Controller events (0x0180 - 0x01ff).
214 1.1 ad */
215 1.1 ad { "c cache write back error", 0x0181 },
216 1.1 ad { "c battery backup unit found", 0x0188 },
217 1.1 ad { "c battery backup unit charge level low", 0x0189 },
218 1.1 ad { "c battery backup unit charge level ok", 0x018a },
219 1.1 ad { "c installation aborted", 0x0193 },
220 1.1 ad { "c mirror race recovery in progress", 0x0195 },
221 1.1 ad { "c mirror race on critical drive", 0x0196 },
222 1.1 ad { "c memory soft ecc error", 0x019e },
223 1.1 ad { "c memory hard ecc error", 0x019f },
224 1.1 ad { "c battery backup unit failed", 0x01a2 },
225 1.1 ad
226 1.1 ad { NULL, 0 },
227 1.1 ad { "? unknown event code", 0 }
228 1.1 ad };
229 1.1 ad
230 1.1 ad /*
231 1.1 ad * Values here must be 16 characters or less, as they are packed into
232 1.1 ad * the 'product' field in the SCSI inquiry data.
233 1.1 ad */
234 1.1 ad static const struct mly_code_lookup mly_table_device_state[] = {
235 1.1 ad { "OFLN", MLY_DEVICE_STATE_OFFLINE },
236 1.1 ad { "UNCF", MLY_DEVICE_STATE_UNCONFIGURED },
237 1.1 ad { "ONLN", MLY_DEVICE_STATE_ONLINE },
238 1.1 ad { "CRIT", MLY_DEVICE_STATE_CRITICAL },
239 1.1 ad { "NORD", MLY_DEVICE_STATE_WRITEONLY },
240 1.1 ad { "STBY", MLY_DEVICE_STATE_STANDBY },
241 1.1 ad { "MISS", MLY_DEVICE_STATE_MISSING },
242 1.1 ad { NULL, 0 },
243 1.1 ad { "????", 0 }
244 1.1 ad };
245 1.1 ad
246 1.1 ad /*
247 1.1 ad * Values here must be 8 characters or less, as they are packed into the
248 1.1 ad * 'vendor' field in the SCSI inquiry data.
249 1.1 ad */
250 1.1 ad static const struct mly_code_lookup mly_table_device_type[] = {
251 1.1 ad { "RAID 0", MLY_DEVICE_TYPE_RAID0 },
252 1.1 ad { "RAID 1", MLY_DEVICE_TYPE_RAID1 },
253 1.1 ad { "RAID 3", MLY_DEVICE_TYPE_RAID3 },
254 1.1 ad { "RAID 5", MLY_DEVICE_TYPE_RAID5 },
255 1.1 ad { "RAID 6", MLY_DEVICE_TYPE_RAID6 },
256 1.1 ad { "RAID 7", MLY_DEVICE_TYPE_RAID7 },
257 1.1 ad { "SPAN", MLY_DEVICE_TYPE_NEWSPAN },
258 1.1 ad { "RAID 3", MLY_DEVICE_TYPE_RAID3F },
259 1.1 ad { "RAID 3", MLY_DEVICE_TYPE_RAID3L },
260 1.1 ad { "SPAN", MLY_DEVICE_TYPE_SPAN },
261 1.1 ad { "RAID 5", MLY_DEVICE_TYPE_RAID5L },
262 1.1 ad { "RAID E", MLY_DEVICE_TYPE_RAIDE },
263 1.1 ad { "PHYSICAL", MLY_DEVICE_TYPE_PHYSICAL },
264 1.1 ad { NULL, 0 },
265 1.1 ad { "UNKNOWN", 0 }
266 1.1 ad };
267 1.1 ad
268 1.1 ad #ifdef notused
269 1.1 ad static struct mly_code_lookup mly_table_bustype[] = {
270 1.1 ad { "SCSI", 0x00 },
271 1.1 ad { "FC-AL", 0x01 },
272 1.1 ad { "PCI", 0x03 },
273 1.1 ad { NULL, 0 },
274 1.1 ad { "unknown bus", 0}
275 1.1 ad };
276 1.1 ad
277 1.1 ad static const struct mly_code_lookup mly_table_controllertype[] = {
278 1.1 ad #if 0 /* not supported by this driver */
279 1.1 ad { "DAC960E", 0x01 }, /* EISA */
280 1.1 ad { "DAC960M", 0x08 }, /* MCA */
281 1.1 ad { "DAC960PD", 0x10 }, /* PCI Dual */
282 1.1 ad { "DAC960PL", 0x11 }, /* PCU low-cost */
283 1.1 ad { "DAC960PDU", 0x12 }, /* PD Ultra */
284 1.1 ad { "DAC960PE", 0x13 }, /* Peregrine low-cost */
285 1.1 ad { "DAC960PG", 0x14 }, /* Peregrine high-performance */
286 1.1 ad { "DAC960PJ", 0x15 }, /* Road Runner */
287 1.1 ad { "DAC960PTL0", 0x16 }, /* Jaguar */
288 1.1 ad { "DAC960PR", 0x17 }, /* Road Runner (again?) */
289 1.1 ad { "DAC960PRL", 0x18 }, /* Tomcat */
290 1.1 ad { "DAC960PT", 0x19 }, /* Road Runner (yet again?) */
291 1.1 ad { "DAC1164P", 0x1a }, /* Little Apple */
292 1.1 ad { "DAC960PTL1", 0x1b }, /* Jaguar+ */
293 1.1 ad #endif
294 1.1 ad { "EXR2000P", 0x1c }, /* Big Apple */
295 1.1 ad { "EXR3000P", 0x1d }, /* Fibre Apple */
296 1.1 ad { "AcceleRAID 352", 0x1e }, /* Leopard */
297 1.1 ad { "AcceleRAID 170", 0x1f }, /* Lynx */
298 1.1 ad { "AcceleRAID 160", 0x20 }, /* Bobcat */
299 1.1 ad { NULL, 0 },
300 1.1 ad { "unknown adapter", 0 }
301 1.4 perry };
302 1.1 ad
303 1.1 ad static const struct mly_code_lookup mly_table_oemname[] = {
304 1.1 ad { "Mylex", MLY_OEM_MYLEX },
305 1.1 ad { "IBM", MLY_OEM_IBM },
306 1.1 ad { "Hewlett-Packard", MLY_OEM_HP },
307 1.1 ad { "DEC/Compaq", MLY_OEM_DEC },
308 1.1 ad { "Siemens", MLY_OEM_SIEMENS },
309 1.1 ad { "Intel", MLY_OEM_INTEL },
310 1.1 ad { NULL, 0 },
311 1.1 ad { "unknown OEM", 0 }
312 1.1 ad };
313 1.1 ad
314 1.1 ad static const struct mly_code_lookup mly_table_memorytype[] = {
315 1.1 ad { "DRAM", 0x01 },
316 1.1 ad { "EDRAM", 0x02 },
317 1.1 ad { "EDO RAM", 0x03 },
318 1.1 ad { "SDRAM", 0x04 },
319 1.1 ad { NULL, 0 },
320 1.1 ad { "unknown memory", 0 }
321 1.1 ad };
322 1.1 ad
323 1.1 ad static const struct mly_code_lookup mly_table_cputype[] = {
324 1.1 ad { "i960CA", 0x01 },
325 1.1 ad { "i960RD", 0x02 },
326 1.1 ad { "i960RN", 0x03 },
327 1.1 ad { "i960RP", 0x04 },
328 1.1 ad { "NorthBay(?)", 0x05 },
329 1.1 ad { "StrongArm", 0x06 },
330 1.1 ad { "i960RM", 0x07 },
331 1.1 ad { NULL, 0 },
332 1.1 ad { "unknown CPU", 0 }
333 1.1 ad };
334 1.1 ad
335 1.1 ad static const struct mly_code_lookup mly_table_stripe_size[] = {
336 1.1 ad { "NONE", MLY_STRIPE_ZERO },
337 1.1 ad { "512B", MLY_STRIPE_512b },
338 1.1 ad { "1k", MLY_STRIPE_1k },
339 1.1 ad { "2k", MLY_STRIPE_2k },
340 1.1 ad { "4k", MLY_STRIPE_4k },
341 1.1 ad { "8k", MLY_STRIPE_8k },
342 1.1 ad { "16k", MLY_STRIPE_16k },
343 1.1 ad { "32k", MLY_STRIPE_32k },
344 1.1 ad { "64k", MLY_STRIPE_64k },
345 1.1 ad { "128k", MLY_STRIPE_128k },
346 1.1 ad { "256k", MLY_STRIPE_256k },
347 1.1 ad { "512k", MLY_STRIPE_512k },
348 1.1 ad { "1M", MLY_STRIPE_1m },
349 1.1 ad { NULL, 0 },
350 1.1 ad { "unknown", 0 }
351 1.1 ad };
352 1.1 ad
353 1.1 ad static const struct mly_code_lookup mly_table_cacheline_size[] = {
354 1.1 ad { "NONE", MLY_CACHELINE_ZERO },
355 1.1 ad { "512B", MLY_CACHELINE_512b },
356 1.1 ad { "1k", MLY_CACHELINE_1k },
357 1.1 ad { "2k", MLY_CACHELINE_2k },
358 1.1 ad { "4k", MLY_CACHELINE_4k },
359 1.1 ad { "8k", MLY_CACHELINE_8k },
360 1.1 ad { "16k", MLY_CACHELINE_16k },
361 1.1 ad { "32k", MLY_CACHELINE_32k },
362 1.1 ad { "64k", MLY_CACHELINE_64k },
363 1.1 ad { NULL, 0 },
364 1.1 ad { "unknown", 0 }
365 1.1 ad };
366 1.1 ad #endif /* notused */
367 1.1 ad
368 1.1 ad #endif /* !defined _PCI_MLY_TABLES_H_ */
369