Merge from vendor branch AWK:
[dragonfly.git] / sys / dev / raid / twa / twa_globals.c
1 /*-
2  * Copyright (c) 2003-04 3ware, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  *      $FreeBSD$
27  * $DragonFly: src/sys/dev/raid/twa/twa_globals.c,v 1.1 2004/04/16 20:13:17 drhodus Exp $
28  */
29
30 /*
31  * 3ware driver for 9000 series storage controllers.
32  *
33  * Author: Vinod Kashyap
34  */
35
36
37 #include "twa_includes.h"
38
39 /* AEN messages. */
40 struct twa_message      twa_aen_table[] = {
41         {0x0000, "AEN queue empty"},
42         {0x0001, "Controller reset occurred"},
43         {0x0002, "Degraded unit detected"},
44         {0x0003, "Controller error occured"},
45         {0x0004, "Background rebuild failed"},
46         {0x0005, "Background rebuild done"},
47         {0x0006, "Incomplete unit detected"},
48         {0x0007, "Background initialize done"},
49         {0x0008, "Unclean shutdown detected"},
50         {0x0009, "Drive timeout detected"},
51         {0x000A, "Drive error detected"},
52         {0x000B, "Rebuild started"},
53         {0x000C, "Background initialize started"},
54         {0x000D, "Entire logical unit was deleted"},
55         {0x000E, "Background initialize failed"},
56         {0x000F, "SMART attribute exceeded threshold"},
57         {0x0010, "Power supply reported AC under range"},
58         {0x0011, "Power supply reported DC out of range"},
59         {0x0012, "Power supply reported a malfunction"},
60         {0x0013, "Power supply predicted malfunction"},
61         {0x0014, "Battery charge is below threshold"},
62         {0x0015, "Fan speed is below threshold"},
63         {0x0016, "Temperature sensor is above threshold"},
64         {0x0017, "Power supply was removed"},
65         {0x0018, "Power supply was inserted"},
66         {0x0019, "Drive was removed from a bay"},
67         {0x001A, "Drive was inserted into a bay"},
68         {0x001B, "Drive bay cover door was opened"},
69         {0x001C, "Drive bay cover door was closed"},
70         {0x001D, "Product case was opened"},
71         {0x0020, "Prepare for shutdown (power-off)"},
72         {0x0021, "Downgrade UDMA mode to lower speed"},
73         {0x0022, "Upgrade UDMA mode to higher speed"},
74         {0x0023, "Sector repair completed"},
75         {0x0024, "Sbuf memory test failed"},
76         {0x0025, "Error flushing cached write data to array"},
77         {0x0026, "Drive reported data ECC error"},
78         {0x0027, "DCB has checksum error"},
79         {0x0028, "DCB version is unsupported"},
80         {0x0029, "Background verify started"},
81         {0x002A, "Background verify failed"},
82         {0x002B, "Background verify done"},
83         {0x002C, "Bad sector overwritten during rebuild"},
84         {0x002E, "Replace failed because replacement drive too small"},
85         {0x002F, "Verify failed because array was never initialized"},
86         {0x0030, "Unsupported ATA drive"},
87         {0x0031, "Synchronize host/controller time"},
88         {0x0032, "Spare capacity is inadequate for some units"},
89         {0x0033, "Background migration started"},
90         {0x0034, "Background migration failed"},
91         {0x0035, "Background migration done"},
92         {0x0036, "Verify detected and fixed data/parity mismatch"},
93         {0x0037, "SO-DIMM incompatible"},
94         {0x0038, "SO-DIMM not detected"},
95         {0x0039, "Corrected Sbuf ECC error"},
96         {0x003A, "Drive power on reset detected"},
97         {0x003B, "Background rebuild paused"},
98         {0x003C, "Background initialize paused"},
99         {0x003D, "Background verify paused"},
100         {0x003E, "Background migration paused"},
101         {0x003F, "Corrupt flash file system detected"},
102         {0x0040, "Flash file system repaired"},
103         {0x0041, "Unit number assignments were lost"},
104         {0x0042, "Error during read of primary DCB"},
105         {0x0043, "Latent error found in backup DCB"},
106         {0x00FC, "Recovered/finished array membership update"},
107         {0x00FD, "Handler lockup"},
108         {0x00FE, "Retrying PCI transfer"},
109         {0x00FF, "AEN queue is full"},
110         {0xFFFFFFFF, (char *)NULL}
111 };
112
113 /* AEN severity table. */
114 char    *twa_aen_severity_table[] = {
115         "None",
116         "ERROR",
117         "WARNING",
118         "INFO",
119         "DEBUG",
120         (char *)NULL
121 };
122
123 /* Error messages. */
124 struct twa_message      twa_error_table[] = {
125         {0x0100, "SGL entry contains zero data"},
126         {0x0101, "Invalid command opcode"},
127         {0x0102, "SGL entry has unaligned address"},
128         {0x0103, "SGL size does not match command"},
129         {0x0104, "SGL entry has illegal length"},
130         {0x0105, "Command packet is not aligned"},
131         {0x0106, "Invalid request ID"},
132         {0x0107, "Duplicate request ID"},
133         {0x0108, "ID not locked"},
134         {0x0109, "LBA out of range"},
135         {0x010A, "Logical unit not supported"},
136         {0x010B, "Parameter table does not exist"},
137         {0x010C, "Parameter index does not exist"},
138         {0x010D, "Invalid field in CDB"},
139         {0x010E, "Specified port has invalid drive"},
140         {0x010F, "Parameter item size mismatch"},
141         {0x0110, "Failed memory allocation"},
142         {0x0111, "Memory request too large"},
143         {0x0112, "Out of memory segments"},
144         {0x0113, "Invalid address to deallocate"},
145         {0x0114, "Out of memory"},
146         {0x0115, "Out of heap"},
147         {0x0120, "Double degrade"},
148         {0x0121, "Drive not degraded"},
149         {0x0122, "Reconstruct error"},
150         {0x0123, "Replace not accepted"},
151         {0x0124, "Replace drive capacity too small"},
152         {0x0125, "Sector count not allowed"},
153         {0x0126, "No spares left"},
154         {0x0127, "Reconstruct error"},
155         {0x0128, "Unit is offline"},
156         {0x0129, "Cannot update status to DCB"},
157         {0x0130, "Invalid stripe handle"},
158         {0x0131, "Handle that was not locked"},
159         {0x0132, "Handle that was not empy"},
160         {0x0133, "Handle has different owner"},
161         {0x0140, "IPR has parent"},
162         {0x0150, "Illegal Pbuf address alignment"},
163         {0x0151, "Illegal Pbuf transfer length"},
164         {0x0152, "Illegal Sbuf address alignment"},
165         {0x0153, "Illegal Sbuf transfer length"},
166         {0x0160, "Command packet too large"},
167         {0x0161, "SGL exceeds maximum length"},
168         {0x0162, "SGL has too many entries"},
169         {0x0170, "Insufficient resources for rebuilder"},
170         {0x0171, "Verify error (data != parity)"},
171         {0x0180, "Requested segment not in directory of this DCB"},
172         {0x0181, "DCB segment has unsupported version"},
173         {0x0182, "DCB segment has checksum error"},
174         {0x0183, "DCB support (settings) segment invalid"},
175         {0x0184, "DCB UDB (unit descriptor block) segment invalid"},
176         {0x0185, "DCB GUID (globally unique identifier) segment invalid"},
177         {0x01A0, "Could not clear Sbuf"},
178         {0x01C0, "Flash identify failed"},
179         {0x01C1, "Flash out of bounds"},
180         {0x01C2, "Flash verify error"},
181         {0x01C3, "Flash file object not found"},
182         {0x01C4, "Flash file already present"},
183         {0x01C5, "Flash file system full"},
184         {0x01C6, "Flash file not present"},
185         {0x01C7, "Flash file size error"},
186         {0x01C8, "Bad flash file checksum"},
187         {0x01CA, "Corrupt flash file system detected"},
188         {0x01D0, "Invalid field in parameter list"},
189         {0x01D1, "Parameter list length error"},
190         {0x01D2, "Parameter item is not changeable"},
191         {0x01D3, "Parameter item is not saveable"},
192         {0x0200, "UDMA CRC error"},
193         {0x0201, "Internal CRC error"},
194         {0x0202, "Data ECC error"},
195         {0x0203, "ADP level 1 error"},
196         {0x0204, "Port timeout"},
197         {0x0205, "Drive power on reset"},
198         {0x0206, "ADP level 2 error"},
199         {0x0207, "Soft reset failed"},
200         {0x0208, "Drive not ready"},
201         {0x0209, "Unclassified port error"},
202         {0x020A, "Drive aborted command"},
203         {0x0210, "Internal CRC error"},
204         {0x0211, "Host PCI bus abort"},
205         {0x0212, "Host PCI parity error"},
206         {0x0213, "Port handler error"},
207         {0x0214, "Token interrupt count error"},
208         {0x0215, "Timeout waiting for PCI transfer"},
209         {0x0216, "Corrected buffer ECC"},
210         {0x0217, "Uncorrected buffer ECC"},
211         {0x0230, "Unsupported command during flash recovery"},
212         {0x0231, "Next image buffer expected"},
213         {0x0232, "Binary image architecture incompatible"},
214         {0x0233, "Binary image has no signature"},
215         {0x0234, "Binary image has bad checksum"},
216         {0x0235, "Image downloaded overflowed buffer"},
217         {0x0240, "I2C device not found"},
218         {0x0241, "I2C transaction aborted"},
219         {0x0242, "SO-DIMM parameter(s) incompatible using defaults"},
220         {0x0243, "SO-DIMM unsupported"},
221         {0x0248, "SPI transfer status error"},
222         {0x0249, "SPI transfer timeout error"},
223         {0x0250, "Invalid unit descriptor size in CreateUnit"},
224         {0x0251, "Unit descriptor size exceeds data buffer in CreateUnit"},
225         {0x0252, "Invalid value in CreateUnit descriptor"},
226         {0x0253, "Inadequate disk space to support descriptor in CreateUnit"},
227         {0x0254, "Unable to create data channel for this unit descriptor"},
228         {0x0255, "CreateUnit descriptor specifies a drive already in use"},
229         {0x0256, "Unable to write configuration to all disks during CreateUnit"},
230         {0x0257, "CreateUnit does not support this descriptor version"},
231         {0x0258, "Invalid subunit for RAID 0 or 5 in CreateUnit"},
232         {0x0259, "Too many descriptors in CreateUnit"},
233         {0x025A, "Invalid configuration specified in CreateUnit descriptor"},
234         {0x025B, "Invalid LBA offset specified in CreateUnit descriptor"},
235         {0x025C, "Invalid stripelet size specified in CreateUnit descriptor"},
236         {0x0260, "SMART attribute exceeded threshold"},
237         {0xFFFFFFFF, (char *)NULL}
238 };
239     
240 #ifdef TWA_DEBUG
241 /*
242  * Save the debug levels in global variables, so that
243  * their values can be changed from the debugger.
244  */
245 u_int8_t        twa_dbg_level = TWA_DEBUG;
246 u_int8_t        twa_call_dbg_level = TWA_DEBUG;
247
248 #endif /* TWA_DEBUG */