Merge branch 'vendor/GREP'
[dragonfly.git] / sys / dev / raid / twe / twe_tables.h
1 /*-
2  * Copyright (c) 2000 Michael Smith
3  * Copyright (c) 2003 Paul Saab
4  * Copyright (c) 2003 Vinod Kashyap
5  * Copyright (c) 2000 BSDi
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  *      $FreeBSD: src/sys/dev/twe/twe_tables.h,v 1.4 2003/12/02 07:57:20 ps Exp $
30  */
31
32 /*
33  * Lookup table for code-to-text translations.
34  */
35 struct twe_code_lookup {
36     char        *string;
37     u_int32_t   code;
38 };
39
40 extern char     *twe_describe_code(struct twe_code_lookup *table, u_int32_t code);
41
42 #ifndef TWE_DEFINE_TABLES
43 extern struct twe_code_lookup twe_table_status[];
44 extern struct twe_code_lookup twe_table_unitstate[];
45 extern struct twe_code_lookup twe_table_unittype[];
46 extern struct twe_code_lookup twe_table_aen[];
47 extern struct twe_code_lookup twe_table_opcode[];
48 #else /* TWE_DEFINE_TABLES */
49
50 struct twe_code_lookup twe_table_status[] = {
51     /* success */
52     {"successful completion",                                   0x00},
53     /* info */
54     {"command in progress",                                     0x42},
55     {"retrying interface CRC error from UDMA command",          0x6c},
56     /* warning */
57     {"redundant/inconsequential request ignored",               0x81},
58     {"failed to write zeroes to LBA 0",                         0x8e},
59     {"failed to profile TwinStor zones",                        0x8f},
60     /* fatal */
61     {"aborted due to system command or reconfiguration",        0xc1},
62     {"aborted",                                                 0xc4},
63     {"access error",                                            0xc5},
64     {"access violation",                                        0xc6},
65     {"device failure",                                          0xc7},  /* high byte may be port number */
66     {"controller error",                                        0xc8},
67     {"timed out",                                               0xc9},
68     {"invalid unit number",                                     0xcb},
69     {"unit not available",                                      0xcf},
70     {"undefined opcode",                                        0xd2},
71     {"request incompatible with unit",                          0xdb},
72     {"invalid request",                                         0xdc},
73     {"firmware error, reset requested",                         0xff},
74     {NULL,      0},
75     {"unknown status",  0}
76 };
77
78 struct twe_code_lookup twe_table_unitstate[] = {
79     {"Normal",          TWE_PARAM_UNITSTATUS_Normal},
80     {"Initialising",    TWE_PARAM_UNITSTATUS_Initialising},
81     {"Degraded",        TWE_PARAM_UNITSTATUS_Degraded},
82     {"Rebuilding",      TWE_PARAM_UNITSTATUS_Rebuilding},
83     {"Verifying",       TWE_PARAM_UNITSTATUS_Verifying},
84     {"Corrupt",         TWE_PARAM_UNITSTATUS_Corrupt},
85     {"Missing",         TWE_PARAM_UNITSTATUS_Missing},
86     {NULL, 0},
87     {"unknown state",   0}
88 };
89
90 struct twe_code_lookup twe_table_unittype[] = {
91     {"RAID0",           TWE_UD_CONFIG_RAID0},
92     {"RAID1",           TWE_UD_CONFIG_RAID1},
93     {"TwinStor",        TWE_UD_CONFIG_TwinStor},
94     {"RAID5",           TWE_UD_CONFIG_RAID5},
95     {"RAID10",          TWE_UD_CONFIG_RAID10},
96     {"CBOD",            TWE_UD_CONFIG_CBOD},
97     {"SPARE",           TWE_UD_CONFIG_SPARE},
98     {"SUBUNIT",         TWE_UD_CONFIG_SUBUNIT},
99     {"JBOD",            TWE_UD_CONFIG_JBOD},
100     {NULL, 0},
101     {"unknown type",    0}
102 };
103
104 struct twe_code_lookup twe_table_aen[] = {
105     {"q queue empty",                   0x00},
106     {"q soft reset",                    0x01},
107     {"c degraded unit",                 0x02},
108     {"a controller error",              0x03},
109     {"c rebuild fail",                  0x04},
110     {"c rebuild done",                  0x05},
111     {"c incomplete unit",               0x06},
112     {"c initialisation done",           0x07},
113     {"c unclean shutdown detected",     0x08},
114     {"c drive timeout",                 0x09},
115     {"c drive error",                   0x0a},
116     {"c rebuild started",               0x0b},
117     {"c init started",                  0x0c},
118     {"c logical unit deleted",          0x0d},
119     {"p SMART threshold exceeded",      0x0f},
120     {"p ATA UDMA downgrade",            0x21},
121     {"p ATA UDMA upgrade",              0x22},
122     {"p sector repair occurred",        0x23},
123     {"a SBUF integrity check failure",  0x24},
124     {"p lost cached write",             0x25},
125     {"p drive ECC error detected",      0x26},
126     {"p DCB checksum error",            0x27},
127     {"p DCB unsupported version",       0x28},
128     {"c verify started",                0x29},
129     {"c verify failed",                 0x2a},
130     {"c verify complete",               0x2b},
131     {"p overwrote bad sector during rebuild",   0x2c},
132     {"p encountered bad sector during rebuild", 0x2d},
133     {"a replacement drive too small", 0x2e},
134     {"c array not previously initialized", 0x2f},
135     {"p drive not supported", 0x30},
136     {"a aen queue full",                0xff},
137     {NULL, 0},
138     {"x unknown AEN",           0}
139 };
140
141 struct twe_code_lookup twe_table_opcode[] = {
142     {"NOP",                     0x00},
143     {"INIT_CONNECTION",         0x01},
144     {"READ",                    0x02},
145     {"WRITE",                   0x03},
146     {"READVERIFY",              0x04},
147     {"VERIFY",                  0x05},
148     {"ZEROUNIT",                0x08},
149     {"REPLACEUNIT",             0x09},
150     {"HOTSWAP",                 0x0a},
151     {"SETATAFEATURE",           0x0c},
152     {"FLUSH",                   0x0e},
153     {"ABORT",                   0x0f},
154     {"CHECKSTATUS",             0x10},
155     {"GET_PARAM",               0x12},
156     {"SET_PARAM",               0x13},
157     {"CREATEUNIT",              0x14},
158     {"DELETEUNIT",              0x15},
159     {"REBUILDUNIT",             0x17},
160     {"SECTOR_INFO",             0x1a},
161     {"AEN_LISTEN",              0x1c},
162     {"CMD_PACKET",              0x1d},
163     {NULL, 0},
164     {"unknown opcode",          0}
165 };    
166     
167 #endif