Deleted Added
full compact
twe_tables.h (91790) twe_tables.h (118508)
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
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.
14 *
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
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
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.
14 *
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
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/dev/twe/twe_tables.h 91790 2002-03-07 09:55:41Z msmith $
27 * $FreeBSD: head/sys/dev/twe/twe_tables.h 118508 2003-08-05 19:55:21Z ps $
28 */
29
30/*
31 * Lookup table for code-to-text translations.
32 */
33struct twe_code_lookup {
34 char *string;
35 u_int32_t code;
36};
37
38extern char *twe_describe_code(struct twe_code_lookup *table, u_int32_t code);
39
40#ifndef TWE_DEFINE_TABLES
41extern struct twe_code_lookup twe_table_status[];
42extern struct twe_code_lookup twe_table_unitstate[];
43extern struct twe_code_lookup twe_table_unittype[];
44extern struct twe_code_lookup twe_table_aen[];
45extern struct twe_code_lookup twe_table_opcode[];
46#else /* TWE_DEFINE_TABLES */
47
48/********************************************************************************
49 * Look up a text description of a numeric code and return a pointer to same.
50 */
51char *
52twe_describe_code(struct twe_code_lookup *table, u_int32_t code)
53{
54 int i;
55
56 for (i = 0; table[i].string != NULL; i++)
57 if (table[i].code == code)
58 return(table[i].string);
59 return(table[i+1].string);
60}
61
62
63struct twe_code_lookup twe_table_status[] = {
64 /* success */
65 {"successful completion", 0x00},
66 /* info */
67 {"command in progress", 0x42},
68 {"retrying interface CRC error from UDMA command", 0x6c},
69 /* warning */
70 {"redundant/inconsequential request ignored", 0x81},
71 {"failed to write zeroes to LBA 0", 0x8e},
72 {"failed to profile TwinStor zones", 0x8f},
73 /* fatal */
74 {"aborted due to system command or reconfiguration", 0xc1},
75 {"aborted", 0xc4},
76 {"access error", 0xc5},
77 {"access violation", 0xc6},
78 {"device failure", 0xc7}, /* high byte may be port number */
79 {"controller error", 0xc8},
80 {"timed out", 0xc9},
81 {"invalid unit number", 0xcb},
82 {"unit not available", 0xcf},
83 {"undefined opcode", 0xd2},
84 {"request incompatible with unit", 0xdb},
85 {"invalid request", 0xdc},
86 {"firmware error, reset requested", 0xff},
87 {NULL, 0},
88 {"unknown status", 0}
89};
90
91struct twe_code_lookup twe_table_unitstate[] = {
92 {"Normal", TWE_PARAM_UNITSTATUS_Normal},
93 {"Initialising", TWE_PARAM_UNITSTATUS_Initialising},
94 {"Degraded", TWE_PARAM_UNITSTATUS_Degraded},
95 {"Rebuilding", TWE_PARAM_UNITSTATUS_Rebuilding},
96 {"Verifying", TWE_PARAM_UNITSTATUS_Verifying},
97 {"Corrupt", TWE_PARAM_UNITSTATUS_Corrupt},
98 {"Missing", TWE_PARAM_UNITSTATUS_Missing},
99 {NULL, 0},
100 {"unknown state", 0}
101};
102
103struct twe_code_lookup twe_table_unittype[] = {
104 {"RAID0", TWE_UD_CONFIG_RAID0},
105 {"RAID1", TWE_UD_CONFIG_RAID1},
106 {"TwinStor", TWE_UD_CONFIG_TwinStor},
107 {"RAID5", TWE_UD_CONFIG_RAID5},
108 {"RAID10", TWE_UD_CONFIG_RAID10},
109 {"CBOD", TWE_UD_CONFIG_CBOD},
110 {"SPARE", TWE_UD_CONFIG_SPARE},
111 {"SUBUNIT", TWE_UD_CONFIG_SUBUNIT},
112 {"JBOD", TWE_UD_CONFIG_JBOD},
113 {NULL, 0},
114 {"unknown type", 0}
115};
116
117struct twe_code_lookup twe_table_aen[] = {
118 {"q queue empty", 0x00},
119 {"q soft reset", 0x01},
120 {"c degraded mirror", 0x02},
121 {"a controller error", 0x03},
122 {"c rebuild fail", 0x04},
123 {"c rebuild done", 0x05},
124 {"c incomplete unit", 0x06},
125 {"c initialisation done", 0x07},
126 {"c unclean shutdown detected", 0x08},
127 {"c drive timeout", 0x09},
128 {"c drive error", 0x0a},
129 {"c rebuild started", 0x0b},
130 {"c init started", 0x0c},
131 {"c logical unit deleted", 0x0d},
132 {"p SMART threshold exceeded", 0x0f},
133 {"p ATA UDMA downgrade", 0x21},
134 {"p ATA UDMA upgrade", 0x22},
135 {"p sector repair occurred", 0x23},
136 {"a SBUF integrity check failure", 0x24},
137 {"p lost cached write", 0x25},
138 {"p drive ECC error detected", 0x26},
139 {"p DCB checksum error", 0x27},
140 {"p DCB unsupported version", 0x28},
141 {"c verify started", 0x29},
142 {"c verify failed", 0x2a},
143 {"c verify complete", 0x2b},
144 {"p overwrote bad sector during rebuild", 0x2c},
145 {"p encountered bad sector during rebuild", 0x2d},
28 */
29
30/*
31 * Lookup table for code-to-text translations.
32 */
33struct twe_code_lookup {
34 char *string;
35 u_int32_t code;
36};
37
38extern char *twe_describe_code(struct twe_code_lookup *table, u_int32_t code);
39
40#ifndef TWE_DEFINE_TABLES
41extern struct twe_code_lookup twe_table_status[];
42extern struct twe_code_lookup twe_table_unitstate[];
43extern struct twe_code_lookup twe_table_unittype[];
44extern struct twe_code_lookup twe_table_aen[];
45extern struct twe_code_lookup twe_table_opcode[];
46#else /* TWE_DEFINE_TABLES */
47
48/********************************************************************************
49 * Look up a text description of a numeric code and return a pointer to same.
50 */
51char *
52twe_describe_code(struct twe_code_lookup *table, u_int32_t code)
53{
54 int i;
55
56 for (i = 0; table[i].string != NULL; i++)
57 if (table[i].code == code)
58 return(table[i].string);
59 return(table[i+1].string);
60}
61
62
63struct twe_code_lookup twe_table_status[] = {
64 /* success */
65 {"successful completion", 0x00},
66 /* info */
67 {"command in progress", 0x42},
68 {"retrying interface CRC error from UDMA command", 0x6c},
69 /* warning */
70 {"redundant/inconsequential request ignored", 0x81},
71 {"failed to write zeroes to LBA 0", 0x8e},
72 {"failed to profile TwinStor zones", 0x8f},
73 /* fatal */
74 {"aborted due to system command or reconfiguration", 0xc1},
75 {"aborted", 0xc4},
76 {"access error", 0xc5},
77 {"access violation", 0xc6},
78 {"device failure", 0xc7}, /* high byte may be port number */
79 {"controller error", 0xc8},
80 {"timed out", 0xc9},
81 {"invalid unit number", 0xcb},
82 {"unit not available", 0xcf},
83 {"undefined opcode", 0xd2},
84 {"request incompatible with unit", 0xdb},
85 {"invalid request", 0xdc},
86 {"firmware error, reset requested", 0xff},
87 {NULL, 0},
88 {"unknown status", 0}
89};
90
91struct twe_code_lookup twe_table_unitstate[] = {
92 {"Normal", TWE_PARAM_UNITSTATUS_Normal},
93 {"Initialising", TWE_PARAM_UNITSTATUS_Initialising},
94 {"Degraded", TWE_PARAM_UNITSTATUS_Degraded},
95 {"Rebuilding", TWE_PARAM_UNITSTATUS_Rebuilding},
96 {"Verifying", TWE_PARAM_UNITSTATUS_Verifying},
97 {"Corrupt", TWE_PARAM_UNITSTATUS_Corrupt},
98 {"Missing", TWE_PARAM_UNITSTATUS_Missing},
99 {NULL, 0},
100 {"unknown state", 0}
101};
102
103struct twe_code_lookup twe_table_unittype[] = {
104 {"RAID0", TWE_UD_CONFIG_RAID0},
105 {"RAID1", TWE_UD_CONFIG_RAID1},
106 {"TwinStor", TWE_UD_CONFIG_TwinStor},
107 {"RAID5", TWE_UD_CONFIG_RAID5},
108 {"RAID10", TWE_UD_CONFIG_RAID10},
109 {"CBOD", TWE_UD_CONFIG_CBOD},
110 {"SPARE", TWE_UD_CONFIG_SPARE},
111 {"SUBUNIT", TWE_UD_CONFIG_SUBUNIT},
112 {"JBOD", TWE_UD_CONFIG_JBOD},
113 {NULL, 0},
114 {"unknown type", 0}
115};
116
117struct twe_code_lookup twe_table_aen[] = {
118 {"q queue empty", 0x00},
119 {"q soft reset", 0x01},
120 {"c degraded mirror", 0x02},
121 {"a controller error", 0x03},
122 {"c rebuild fail", 0x04},
123 {"c rebuild done", 0x05},
124 {"c incomplete unit", 0x06},
125 {"c initialisation done", 0x07},
126 {"c unclean shutdown detected", 0x08},
127 {"c drive timeout", 0x09},
128 {"c drive error", 0x0a},
129 {"c rebuild started", 0x0b},
130 {"c init started", 0x0c},
131 {"c logical unit deleted", 0x0d},
132 {"p SMART threshold exceeded", 0x0f},
133 {"p ATA UDMA downgrade", 0x21},
134 {"p ATA UDMA upgrade", 0x22},
135 {"p sector repair occurred", 0x23},
136 {"a SBUF integrity check failure", 0x24},
137 {"p lost cached write", 0x25},
138 {"p drive ECC error detected", 0x26},
139 {"p DCB checksum error", 0x27},
140 {"p DCB unsupported version", 0x28},
141 {"c verify started", 0x29},
142 {"c verify failed", 0x2a},
143 {"c verify complete", 0x2b},
144 {"p overwrote bad sector during rebuild", 0x2c},
145 {"p encountered bad sector during rebuild", 0x2d},
146 {"a replacement drive too small", 0x2e},
147 {"c array not previously initialized", 0x2f},
148 {"p drive not supported", 0x30},
146 {"a aen queue full", 0xff},
147 {NULL, 0},
148 {"x unknown AEN", 0}
149};
150
151struct twe_code_lookup twe_table_opcode[] = {
152 {"NOP", 0x00},
153 {"INIT_CONNECTION", 0x01},
154 {"READ", 0x02},
155 {"WRITE", 0x03},
156 {"READVERIFY", 0x04},
157 {"VERIFY", 0x05},
158 {"ZEROUNIT", 0x08},
159 {"REPLACEUNIT", 0x09},
160 {"HOTSWAP", 0x0a},
161 {"SETATAFEATURE", 0x0c},
162 {"FLUSH", 0x0e},
163 {"ABORT", 0x0f},
164 {"CHECKSTATUS", 0x10},
165 {"GET_PARAM", 0x12},
166 {"SET_PARAM", 0x13},
167 {"CREATEUNIT", 0x14},
168 {"DELETEUNIT", 0x15},
169 {"REBUILDUNIT", 0x17},
170 {"SECTOR_INFO", 0x1a},
171 {"AEN_LISTEN", 0x1c},
172 {"CMD_PACKET", 0x1d},
173 {NULL, 0},
174 {"unknown opcode", 0}
175};
176
177#endif
149 {"a aen queue full", 0xff},
150 {NULL, 0},
151 {"x unknown AEN", 0}
152};
153
154struct twe_code_lookup twe_table_opcode[] = {
155 {"NOP", 0x00},
156 {"INIT_CONNECTION", 0x01},
157 {"READ", 0x02},
158 {"WRITE", 0x03},
159 {"READVERIFY", 0x04},
160 {"VERIFY", 0x05},
161 {"ZEROUNIT", 0x08},
162 {"REPLACEUNIT", 0x09},
163 {"HOTSWAP", 0x0a},
164 {"SETATAFEATURE", 0x0c},
165 {"FLUSH", 0x0e},
166 {"ABORT", 0x0f},
167 {"CHECKSTATUS", 0x10},
168 {"GET_PARAM", 0x12},
169 {"SET_PARAM", 0x13},
170 {"CREATEUNIT", 0x14},
171 {"DELETEUNIT", 0x15},
172 {"REBUILDUNIT", 0x17},
173 {"SECTOR_INFO", 0x1a},
174 {"AEN_LISTEN", 0x1c},
175 {"CMD_PACKET", 0x1d},
176 {NULL, 0},
177 {"unknown opcode", 0}
178};
179
180#endif