xref: /dragonfly/sys/dev/raid/mly/mly_tables.h (revision 3170ffd7)
1 /*-
2  * Copyright (c) 2000 Michael Smith
3  * Copyright (c) 2000 BSDi
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
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.
14  *
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
25  * SUCH DAMAGE.
26  *
27  *	$FreeBSD: src/sys/dev/mly/mly_tables.h,v 1.3 2002/02/27 23:57:18 peter Exp $
28  */
29 
30 /*
31  * Lookup table for code-to-text translations.
32  */
33 struct mly_code_lookup {
34     char	*string;
35     u_int32_t	code;
36 };
37 
38 static char	*mly_describe_code(struct mly_code_lookup *table, u_int32_t code);
39 
40 /********************************************************************************
41  * Look up a text description of a numeric code and return a pointer to same.
42  */
43 static char *
44 mly_describe_code(struct mly_code_lookup *table, u_int32_t code)
45 {
46     int		i;
47 
48     for (i = 0; table[i].string != NULL; i++)
49 	if (table[i].code == code)
50 	    return(table[i].string);
51     return(table[i+1].string);
52 }
53 
54 #if 0
55 static struct mly_code_lookup mly_table_bustype[] = {
56     {"SCSI",		0x00},
57     {"FC-AL",		0x01},
58     {"PCI",		0x03},
59     {NULL,		0},
60     {"unknown bus",	0}
61 };
62 #endif
63 
64 static struct mly_code_lookup mly_table_controllertype[] = {
65 #if 0	/* not supported by this driver */
66     {"DAC960E",		0x01},	/* EISA */
67     {"DAC960M",		0x08},	/* MCA */
68     {"DAC960PD",	0x10},	/* PCI Dual */
69     {"DAC960PL",	0x11},	/* PCU low-cost */
70     {"DAC960PDU",	0x12},	/* PD Ultra */
71     {"DAC960PE",	0x13},	/* Peregrine low-cost */
72     {"DAC960PG",	0x14},	/* Peregrine high-performance */
73     {"DAC960PJ",	0x15},	/* Road Runner */
74     {"DAC960PTL0",	0x16},	/* Jaguar */
75     {"DAC960PR",	0x17},	/* Road Runner (again?) */
76     {"DAC960PRL",	0x18},	/* Tomcat */
77     {"DAC960PT",	0x19},	/* Road Runner (yet again?) */
78     {"DAC1164P",	0x1a},	/* Little Apple */
79     {"DAC960PTL1",	0x1b},	/* Jaguar+ */
80 #endif
81     {"EXR2000P",	0x1c},	/* Big Apple */
82     {"EXR3000P",	0x1d},	/* Fibre Apple */
83     {"AcceleRAID 352",	0x1e},	/* Leopard */
84     {"AcceleRAID 170",	0x1f},	/* Lynx */
85     {"AcceleRAID 160",	0x20},	/* Bobcat */
86     {NULL,		0},
87     {"unknown adapter",	0}
88 };
89 
90 static struct mly_code_lookup mly_table_oemname[] = {
91     {"Mylex",		MLY_OEM_MYLEX},
92     {"IBM",		MLY_OEM_IBM},
93     {"Hewlett-Packard",	MLY_OEM_HP},
94     {"DEC/Compaq",	MLY_OEM_DEC},
95     {"Siemens",		MLY_OEM_SIEMENS},
96     {"Intel",		MLY_OEM_INTEL},
97     {NULL,		0},
98     {"unknown OEM",	0}
99 };
100 
101 static struct mly_code_lookup mly_table_memorytype[] = {
102     {"DRAM",		0x01},
103     {"EDRAM",		0x02},
104     {"EDO RAM",		0x03},
105     {"SDRAM",		0x04},
106     {NULL,		0},
107     {"unknown memory",	0}
108 };
109 
110 static struct mly_code_lookup mly_table_cputype[] = {
111     {"i960CA",		0x01},
112     {"i960RD",		0x02},
113     {"i960RN",		0x03},
114     {"i960RP",		0x04},
115     {"NorthBay(?)",	0x05},
116     {"StrongArm",	0x06},
117     {"i960RM",		0x07},
118     {NULL,		0},
119     {"unknown CPU",	0}
120 };
121 
122 /*
123  * This table is directly derived from the corresponding table in the
124  * Linux driver, and uses a derivative encoding for simplicity's sake.
125  *
126  * The first character of the string determines the format of the message.
127  *
128  * p  "physical device <channel>:<target> <text>"	(physical device status)
129  * s  "physical device <channel>:<target> <text>"	(scsi message or error)
130  *    "  sense key <key>  asc <asc>  ascq <ascq>"
131  *    "  info <info>   csi <csi>"
132  * l  "logical drive <unit>: <text>"			(logical device status)
133  * m  "logical drive <unit>: <text>"			(logical device message)
134  *
135  * Messages which are typically suppressed have the first character capitalised.
136  * These messages will only be printed if bootverbose is set.
137  *
138  * The second character in the string indicates an action to be taken as a
139  * result of the event.
140  *
141  * r	rescan the device for possible state change
142  *
143  */
144 static struct mly_code_lookup mly_table_event[] = {
145     /* physical device events (0x0000 - 0x007f) */
146     {"pr online",							0x0001},
147     {"pr standby",							0x0002},
148     {"p  automatic rebuild started",					0x0005},
149     {"p  manual rebuild started",					0x0006},
150     {"pr rebuild completed",						0x0007},
151     {"pr rebuild cancelled",						0x0008},
152     {"pr rebuild failed for unknown reasons",				0x0009},
153     {"pr rebuild failed due to new physical device",			0x000a},
154     {"pr rebuild failed due to logical drive failure",			0x000b},
155     {"sr offline",							0x000c},
156     {"pr found",							0x000d},
157     {"pr gone",								0x000e},
158     {"p  unconfigured",							0x000f},
159     {"p  expand capacity started",					0x0010},
160     {"pr expand capacity completed",					0x0011},
161     {"pr expand capacity failed",					0x0012},
162     {"p  parity error",							0x0016},
163     {"p  soft error",							0x0017},
164     {"p  miscellaneous error",						0x0018},
165     {"p  reset",							0x0019},
166     {"p  active spare found",						0x001a},
167     {"p  warm spare found",						0x001b},
168     {"s  sense data received",						0x001c},
169     {"p  initialization started",					0x001d},
170     {"pr initialization completed",					0x001e},
171     {"pr initialization failed",					0x001f},
172     {"pr initialization cancelled",					0x0020},
173     {"P  write recovery failed",					0x0021},
174     {"p  scsi bus reset failed",					0x0022},
175     {"p  double check condition",					0x0023},
176     {"p  device cannot be accessed",					0x0024},
177     {"p  gross error on scsi processor",				0x0025},
178     {"p  bad tag from device",						0x0026},
179     {"p  command timeout",						0x0027},
180     {"pr system reset",							0x0028},
181     {"p  busy status or parity error",					0x0029},
182     {"pr host set device to failed state",				0x002a},
183     {"pr selection timeout",						0x002b},
184     {"p  scsi bus phase error",						0x002c},
185     {"pr device returned unknown status",				0x002d},
186     {"pr device not ready",						0x002e},
187     {"p  device not found at startup",					0x002f},
188     {"p  COD write operation failed",					0x0030},
189     {"p  BDT write operation failed",					0x0031},
190     {"p  missing at startup",						0x0039},
191     {"p  start rebuild failed due to physical drive too small",		0x003a},
192     /* logical device events (0x0080 - 0x00ff) */
193     {"m  consistency check started",					0x0080},
194     {"mr consistency check completed",					0x0081},
195     {"mr consistency check cancelled",					0x0082},
196     {"mr consistency check completed with errors",			0x0083},
197     {"mr consistency check failed due to logical drive failure",	0x0084},
198     {"mr consistency check failed due to physical device failure",	0x0085},
199     {"lr offline",							0x0086},
200     {"lr critical",							0x0087},
201     {"lr online",							0x0088},
202     {"m  automatic rebuild started",					0x0089},
203     {"m  manual rebuild started",					0x008a},
204     {"mr rebuild completed",						0x008b},
205     {"mr rebuild cancelled",						0x008c},
206     {"mr rebuild failed for unknown reasons",				0x008d},
207     {"mr rebuild failed due to new physical device",			0x008e},
208     {"mr rebuild failed due to logical drive failure",			0x008f},
209     {"l  initialization started",					0x0090},
210     {"lr initialization completed",					0x0091},
211     {"lr initialization cancelled",					0x0092},
212     {"lr initialization failed",					0x0093},
213     {"lr found",							0x0094},
214     {"lr gone",								0x0095},
215     {"l  expand capacity started",					0x0096},
216     {"lr expand capacity completed",					0x0097},
217     {"lr expand capacity failed",					0x0098},
218     {"l  bad block found",						0x0099},
219     {"lr size changed",							0x009a},
220     {"lr type changed",							0x009b},
221     {"l  bad data block found",						0x009c},
222     {"l  read of data block in bdt",					0x009e},
223     {"l  write back data for disk block lost",				0x009f},
224     /* enclosure management events (0x0100 - 0x017f) */
225     {"e  enclosure %d fan %d failed",					0x0140},
226     {"e  enclosure %d fan %d ok",					0x0141},
227     {"e  enclosure %d fan %d not present",				0x0142},
228     {"e  enclosure %d power supply %d failed",				0x0143},
229     {"e  enclosure %d power supply %d ok",				0x0144},
230     {"e  enclosure %d power supply %d not present",			0x0145},
231     {"e  enclosure %d temperature sensor %d failed",			0x0146},
232     {"e  enclosure %d temperature sensor %d critical",			0x0147},
233     {"e  enclosure %d temperature sensor %d ok",			0x0148},
234     {"e  enclosure %d temperature sensor %d not present",		0x0149},
235     {"e  enclosure %d unit %d access critical",				0x014a},
236     {"e  enclosure %d unit %d access ok",				0x014b},
237     {"e  enclosure %d unit %d access offline",				0x014c},
238     /* controller events (0x0180 - 0x01ff) */
239     {"c  cache write back error",					0x0181},
240     {"c  battery backup unit found",					0x0188},
241     {"c  battery backup unit charge level low",				0x0189},
242     {"c  battery backup unit charge level ok",				0x018a},
243     {"c  installation aborted",						0x0193},
244     {"c  mirror race recovery in progress",				0x0195},
245     {"c  mirror race on critical drive",				0x0196},
246     {"c  memory soft ecc error",					0x019e},
247     {"c  memory hard ecc error",					0x019f},
248     {"c  battery backup unit failed",					0x01a2},
249     {NULL, 0},
250     {"?  unknown event code",						0}
251 };
252 
253 /*
254  * Values here must be 16 characters or less, as they are packed into
255  * the 'product' field in the SCSI inquiry data.
256  */
257 static struct mly_code_lookup mly_table_device_state[] = {
258     {"offline",		MLY_DEVICE_STATE_OFFLINE},
259     {"unconfigured",	MLY_DEVICE_STATE_UNCONFIGURED},
260     {"online",		MLY_DEVICE_STATE_ONLINE},
261     {"critical",	MLY_DEVICE_STATE_CRITICAL},
262     {"writeonly",	MLY_DEVICE_STATE_WRITEONLY},
263     {"standby",		MLY_DEVICE_STATE_STANDBY},
264     {"missing",		MLY_DEVICE_STATE_MISSING},
265     {NULL, 0},
266     {"unknown state",	0}
267 };
268 
269 /*
270  * Values here must be 8 characters or less, as they are packed into
271  * the 'vendor' field in the SCSI inquiry data.
272  */
273 static struct mly_code_lookup mly_table_device_type[] = {
274     {"MLYRAID0",	MLY_DEVICE_TYPE_RAID0},
275     {"MLYRAID1",	MLY_DEVICE_TYPE_RAID1},
276     {"MLYRAID3",	MLY_DEVICE_TYPE_RAID3},		/* right asymmetric parity */
277     {"MLYRAID5",	MLY_DEVICE_TYPE_RAID5},		/* right asymmetric parity */
278     {"MLYRAID6",	MLY_DEVICE_TYPE_RAID6},		/* Mylex RAID 6 */
279     {"MLYRAID7",	MLY_DEVICE_TYPE_RAID7},		/* JBOD */
280     {"MLY SPAN",	MLY_DEVICE_TYPE_NEWSPAN},	/* New Mylex SPAN */
281     {"MLYRAID3",	MLY_DEVICE_TYPE_RAID3F},	/* fixed parity */
282     {"MLYRAID3",	MLY_DEVICE_TYPE_RAID3L},	/* left symmetric parity */
283     {"MLY SPAN",	MLY_DEVICE_TYPE_SPAN},		/* current spanning implementation */
284     {"MLYRAID5",	MLY_DEVICE_TYPE_RAID5L},	/* left symmetric parity */
285     {"MLYRAIDE",	MLY_DEVICE_TYPE_RAIDE},		/* concatenation */
286     {"MLY PHYS",	MLY_DEVICE_TYPE_PHYSICAL},	/* physical device */
287     {NULL, 0},
288     {"MLY UNKN",	0}
289 };
290 
291 #if 0
292 static struct mly_code_lookup mly_table_stripe_size[] = {
293     {"NONE",		MLY_STRIPE_ZERO},
294     {"512B",		MLY_STRIPE_512b},
295     {"1k",		MLY_STRIPE_1k},
296     {"2k",		MLY_STRIPE_2k},
297     {"4k",		MLY_STRIPE_4k},
298     {"8k",		MLY_STRIPE_8k},
299     {"16k",		MLY_STRIPE_16k},
300     {"32k",		MLY_STRIPE_32k},
301     {"64k",		MLY_STRIPE_64k},
302     {"128k",		MLY_STRIPE_128k},
303     {"256k",		MLY_STRIPE_256k},
304     {"512k",		MLY_STRIPE_512k},
305     {"1M",		MLY_STRIPE_1m},
306     {NULL, 0},
307     {"unknown",		0}
308 };
309 
310 static struct mly_code_lookup mly_table_cacheline_size[] = {
311     {"NONE",		MLY_CACHELINE_ZERO},
312     {"512B",		MLY_CACHELINE_512b},
313     {"1k",		MLY_CACHELINE_1k},
314     {"2k",		MLY_CACHELINE_2k},
315     {"4k",		MLY_CACHELINE_4k},
316     {"8k",		MLY_CACHELINE_8k},
317     {"16k",		MLY_CACHELINE_16k},
318     {"32k",		MLY_CACHELINE_32k},
319     {"64k",		MLY_CACHELINE_64k},
320     {NULL, 0},
321     {"unknown",		0}
322 };
323 #endif
324