2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2003 Paul Saab
4 * Copyright (c) 2003 Vinod Kashyap
5 * Copyright (c) 2000 BSDi
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
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.
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
29 * $FreeBSD: src/sys/dev/twe/twe_tables.h,v 1.1.2.4 2004/04/07 22:18:01 vkashyap Exp $
30 * $DragonFly: src/sys/dev/raid/twe/twe_tables.h,v 1.4 2005/08/22 21:16:20 hmp Exp $
34 * Lookup table for code-to-text translations.
36 struct twe_code_lookup {
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 struct twe_code_lookup twe_table_status[] = {
51 {"successful completion", 0x00},
53 {"command in progress", 0x42},
54 {"retrying interface CRC error from UDMA command", 0x6c},
56 {"redundant/inconsequential request ignored", 0x81},
57 {"failed to write zeroes to LBA 0", 0x8e},
58 {"failed to profile TwinStor zones", 0x8f},
60 {"aborted due to system command or reconfiguration", 0xc1},
62 {"access error", 0xc5},
63 {"access violation", 0xc6},
64 {"device failure", 0xc7}, /* high byte may be port number */
65 {"controller error", 0xc8},
67 {"invalid unit number", 0xcb},
68 {"unit not available", 0xcf},
69 {"undefined opcode", 0xd2},
70 {"request incompatible with unit", 0xdb},
71 {"invalid request", 0xdc},
72 {"firmware error, reset requested", 0xff},
77 struct twe_code_lookup twe_table_unitstate[] = {
78 {"Normal", TWE_PARAM_UNITSTATUS_Normal},
79 {"Initialising", TWE_PARAM_UNITSTATUS_Initialising},
80 {"Degraded", TWE_PARAM_UNITSTATUS_Degraded},
81 {"Rebuilding", TWE_PARAM_UNITSTATUS_Rebuilding},
82 {"Verifying", TWE_PARAM_UNITSTATUS_Verifying},
83 {"Corrupt", TWE_PARAM_UNITSTATUS_Corrupt},
84 {"Missing", TWE_PARAM_UNITSTATUS_Missing},
89 struct twe_code_lookup twe_table_unittype[] = {
90 {"RAID0", TWE_UD_CONFIG_RAID0},
91 {"RAID1", TWE_UD_CONFIG_RAID1},
92 {"TwinStor", TWE_UD_CONFIG_TwinStor},
93 {"RAID5", TWE_UD_CONFIG_RAID5},
94 {"RAID10", TWE_UD_CONFIG_RAID10},
95 {"CBOD", TWE_UD_CONFIG_CBOD},
96 {"SPARE", TWE_UD_CONFIG_SPARE},
97 {"SUBUNIT", TWE_UD_CONFIG_SUBUNIT},
98 {"JBOD", TWE_UD_CONFIG_JBOD},
103 struct twe_code_lookup twe_table_aen[] = {
104 {"q queue empty", 0x00},
105 {"q soft reset", 0x01},
106 {"c degraded unit", 0x02},
107 {"a controller error", 0x03},
108 {"c rebuild fail", 0x04},
109 {"c rebuild done", 0x05},
110 {"c incomplete unit", 0x06},
111 {"c initialisation done", 0x07},
112 {"c unclean shutdown detected", 0x08},
113 {"c drive timeout", 0x09},
114 {"c drive error", 0x0a},
115 {"c rebuild started", 0x0b},
116 {"c init started", 0x0c},
117 {"c logical unit deleted", 0x0d},
118 {"p SMART threshold exceeded", 0x0f},
119 {"p ATA UDMA downgrade", 0x21},
120 {"p ATA UDMA upgrade", 0x22},
121 {"p sector repair occurred", 0x23},
122 {"a SBUF integrity check failure", 0x24},
123 {"p lost cached write", 0x25},
124 {"p drive ECC error detected", 0x26},
125 {"p DCB checksum error", 0x27},
126 {"p DCB unsupported version", 0x28},
127 {"c verify started", 0x29},
128 {"c verify failed", 0x2a},
129 {"c verify complete", 0x2b},
130 {"p overwrote bad sector during rebuild", 0x2c},
131 {"p encountered bad sector during rebuild", 0x2d},
132 {"a replacement drive too small", 0x2e},
133 {"c array not previously initialized", 0x2f},
134 {"p drive not supported", 0x30},
135 {"a aen queue full", 0xff},
140 struct twe_code_lookup twe_table_opcode[] = {
142 {"INIT_CONNECTION", 0x01},
145 {"READVERIFY", 0x04},
148 {"REPLACEUNIT", 0x09},
150 {"SETATAFEATURE", 0x0c},
153 {"CHECKSTATUS", 0x10},
156 {"CREATEUNIT", 0x14},
157 {"DELETEUNIT", 0x15},
158 {"REBUILDUNIT", 0x17},
159 {"SECTOR_INFO", 0x1a},
160 {"AEN_LISTEN", 0x1c},
161 {"CMD_PACKET", 0x1d},
163 {"unknown opcode", 0}