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