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/twe/twe_tables.h,v 1.1.2.2 2002/03/07 09:57:02 msmith Exp $
28 * $DragonFly: src/sys/dev/raid/twe/twe_tables.h,v 1.2 2003/06/17 04:28:32 dillon Exp $
32 * Lookup table for code-to-text translations.
34 struct twe_code_lookup {
39 extern char *twe_describe_code(struct twe_code_lookup *table, u_int32_t code);
41 #ifndef TWE_DEFINE_TABLES
42 extern struct twe_code_lookup twe_table_status[];
43 extern struct twe_code_lookup twe_table_unitstate[];
44 extern struct twe_code_lookup twe_table_unittype[];
45 extern struct twe_code_lookup twe_table_aen[];
46 extern struct twe_code_lookup twe_table_opcode[];
47 #else /* TWE_DEFINE_TABLES */
49 /********************************************************************************
50 * Look up a text description of a numeric code and return a pointer to same.
53 twe_describe_code(struct twe_code_lookup *table, u_int32_t code)
57 for (i = 0; table[i].string != NULL; i++)
58 if (table[i].code == code)
59 return(table[i].string);
60 return(table[i+1].string);
64 struct twe_code_lookup twe_table_status[] = {
66 {"successful completion", 0x00},
68 {"command in progress", 0x42},
69 {"retrying interface CRC error from UDMA command", 0x6c},
71 {"redundant/inconsequential request ignored", 0x81},
72 {"failed to write zeroes to LBA 0", 0x8e},
73 {"failed to profile TwinStor zones", 0x8f},
75 {"aborted due to system command or reconfiguration", 0xc1},
77 {"access error", 0xc5},
78 {"access violation", 0xc6},
79 {"device failure", 0xc7}, /* high byte may be port number */
80 {"controller error", 0xc8},
82 {"invalid unit number", 0xcb},
83 {"unit not available", 0xcf},
84 {"undefined opcode", 0xd2},
85 {"request incompatible with unit", 0xdb},
86 {"invalid request", 0xdc},
87 {"firmware error, reset requested", 0xff},
92 struct twe_code_lookup twe_table_unitstate[] = {
93 {"Normal", TWE_PARAM_UNITSTATUS_Normal},
94 {"Initialising", TWE_PARAM_UNITSTATUS_Initialising},
95 {"Degraded", TWE_PARAM_UNITSTATUS_Degraded},
96 {"Rebuilding", TWE_PARAM_UNITSTATUS_Rebuilding},
97 {"Verifying", TWE_PARAM_UNITSTATUS_Verifying},
98 {"Corrupt", TWE_PARAM_UNITSTATUS_Corrupt},
99 {"Missing", TWE_PARAM_UNITSTATUS_Missing},
104 struct twe_code_lookup twe_table_unittype[] = {
105 {"RAID0", TWE_UD_CONFIG_RAID0},
106 {"RAID1", TWE_UD_CONFIG_RAID1},
107 {"TwinStor", TWE_UD_CONFIG_TwinStor},
108 {"RAID5", TWE_UD_CONFIG_RAID5},
109 {"RAID10", TWE_UD_CONFIG_RAID10},
110 {"CBOD", TWE_UD_CONFIG_CBOD},
111 {"SPARE", TWE_UD_CONFIG_SPARE},
112 {"SUBUNIT", TWE_UD_CONFIG_SUBUNIT},
113 {"JBOD", TWE_UD_CONFIG_JBOD},
118 struct twe_code_lookup twe_table_aen[] = {
119 {"q queue empty", 0x00},
120 {"q soft reset", 0x01},
121 {"c degraded mirror", 0x02},
122 {"a controller error", 0x03},
123 {"c rebuild fail", 0x04},
124 {"c rebuild done", 0x05},
125 {"c incomplete unit", 0x06},
126 {"c initialisation done", 0x07},
127 {"c unclean shutdown detected", 0x08},
128 {"c drive timeout", 0x09},
129 {"c drive error", 0x0a},
130 {"c rebuild started", 0x0b},
131 {"c init started", 0x0c},
132 {"c logical unit deleted", 0x0d},
133 {"p SMART threshold exceeded", 0x0f},
134 {"p ATA UDMA downgrade", 0x21},
135 {"p ATA UDMA upgrade", 0x22},
136 {"p sector repair occurred", 0x23},
137 {"a SBUF integrity check failure", 0x24},
138 {"p lost cached write", 0x25},
139 {"p drive ECC error detected", 0x26},
140 {"p DCB checksum error", 0x27},
141 {"p DCB unsupported version", 0x28},
142 {"c verify started", 0x29},
143 {"c verify failed", 0x2a},
144 {"c verify complete", 0x2b},
145 {"p overwrote bad sector during rebuild", 0x2c},
146 {"p encountered bad sector during rebuild", 0x2d},
147 {"a aen queue full", 0xff},
152 struct twe_code_lookup twe_table_opcode[] = {
154 {"INIT_CONNECTION", 0x01},
157 {"READVERIFY", 0x04},
160 {"REPLACEUNIT", 0x09},
162 {"SETATAFEATURE", 0x0c},
165 {"CHECKSTATUS", 0x10},
168 {"CREATEUNIT", 0x14},
169 {"DELETEUNIT", 0x15},
170 {"REBUILDUNIT", 0x17},
171 {"SECTOR_INFO", 0x1a},
172 {"AEN_LISTEN", 0x1c},
173 {"CMD_PACKET", 0x1d},
175 {"unknown opcode", 0}