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: src/sys/dev/mly/mly_tables.h,v 1.1.2.1 2000/10/27 10:06:56 msmith Exp $ 28 * $DragonFly: src/sys/dev/raid/mly/mly_tables.h,v 1.2 2003/06/17 04:28:28 dillon Exp $ 29 */ 30 31 /* 32 * Lookup table for code-to-text translations. 33 */ 34 struct mly_code_lookup { 35 char *string; 36 u_int32_t code; 37 }; 38 39 extern char *mly_describe_code(struct mly_code_lookup *table, u_int32_t code); 40 41 #ifndef MLY_DEFINE_TABLES 42 extern struct mly_code_lookup mly_table_bustype[]; 43 extern struct mly_code_lookup mly_table_controllertype[]; 44 extern struct mly_code_lookup mly_table_oemname[]; 45 extern struct mly_code_lookup mly_table_memorytype[]; 46 extern struct mly_code_lookup mly_table_cputype[]; 47 extern struct mly_code_lookup mly_table_event[]; 48 extern struct mly_code_lookup mly_table_device_state[]; 49 extern struct mly_code_lookup mly_table_device_type[]; 50 extern struct mly_code_lookup mly_table_stripe_size[]; 51 extern struct mly_code_lookup mly_table_cacheline_size[]; 52 53 #else /* MLY_DEFINE_TABLES */ 54 55 /******************************************************************************** 56 * Look up a text description of a numeric code and return a pointer to same. 57 */ 58 char * 59 mly_describe_code(struct mly_code_lookup *table, u_int32_t code) 60 { 61 int i; 62 63 for (i = 0; table[i].string != NULL; i++) 64 if (table[i].code == code) 65 return(table[i].string); 66 return(table[i+1].string); 67 } 68 69 struct mly_code_lookup mly_table_bustype[] = { 70 {"SCSI", 0x00}, 71 {"FC-AL", 0x01}, 72 {"PCI", 0x03}, 73 {NULL, 0}, 74 {"unknown bus", 0} 75 }; 76 77 struct mly_code_lookup mly_table_controllertype[] = { 78 #if 0 /* not supported by this driver */ 79 {"DAC960E", 0x01}, /* EISA */ 80 {"DAC960M", 0x08}, /* MCA */ 81 {"DAC960PD", 0x10}, /* PCI Dual */ 82 {"DAC960PL", 0x11}, /* PCU low-cost */ 83 {"DAC960PDU", 0x12}, /* PD Ultra */ 84 {"DAC960PE", 0x13}, /* Peregrine low-cost */ 85 {"DAC960PG", 0x14}, /* Peregrine high-performance */ 86 {"DAC960PJ", 0x15}, /* Road Runner */ 87 {"DAC960PTL0", 0x16}, /* Jaguar */ 88 {"DAC960PR", 0x17}, /* Road Runner (again?) */ 89 {"DAC960PRL", 0x18}, /* Tomcat */ 90 {"DAC960PT", 0x19}, /* Road Runner (yet again?) */ 91 {"DAC1164P", 0x1a}, /* Little Apple */ 92 {"DAC960PTL1", 0x1b}, /* Jaguar+ */ 93 #endif 94 {"EXR2000P", 0x1c}, /* Big Apple */ 95 {"EXR3000P", 0x1d}, /* Fibre Apple */ 96 {"AcceleRAID 352", 0x1e}, /* Leopard */ 97 {"AcceleRAID 170", 0x1f}, /* Lynx */ 98 {"AcceleRAID 160", 0x20}, /* Bobcat */ 99 {NULL, 0}, 100 {"unknown adapter", 0} 101 }; 102 103 struct mly_code_lookup mly_table_oemname[] = { 104 {"Mylex", MLY_OEM_MYLEX}, 105 {"IBM", MLY_OEM_IBM}, 106 {"Hewlett-Packard", MLY_OEM_HP}, 107 {"DEC/Compaq", MLY_OEM_DEC}, 108 {"Siemens", MLY_OEM_SIEMENS}, 109 {"Intel", MLY_OEM_INTEL}, 110 {NULL, 0}, 111 {"unknown OEM", 0} 112 }; 113 114 struct mly_code_lookup mly_table_memorytype[] = { 115 {"DRAM", 0x01}, 116 {"EDRAM", 0x02}, 117 {"EDO RAM", 0x03}, 118 {"SDRAM", 0x04}, 119 {NULL, 0}, 120 {"unknown memory", 0} 121 }; 122 123 struct mly_code_lookup mly_table_cputype[] = { 124 {"i960CA", 0x01}, 125 {"i960RD", 0x02}, 126 {"i960RN", 0x03}, 127 {"i960RP", 0x04}, 128 {"NorthBay(?)", 0x05}, 129 {"StrongArm", 0x06}, 130 {"i960RM", 0x07}, 131 {NULL, 0}, 132 {"unknown CPU", 0} 133 }; 134 135 /* 136 * This table is directly derived from the corresponding table in the 137 * Linux driver, and uses a derivative encoding for simplicity's sake. 138 * 139 * The first character of the string determines the format of the message. 140 * 141 * p "physical device <channel>:<target> <text>" (physical device status) 142 * s "physical device <channel>:<target> <text>" (scsi message or error) 143 * " sense key <key> asc <asc> ascq <ascq>" 144 * " info <info> csi <csi>" 145 * l "logical drive <unit>: <text>" (logical device status) 146 * m "logical drive <unit>: <text>" (logical device message) 147 * 148 * Messages which are typically suppressed have the first character capitalised. 149 * These messages will only be printed if bootverbose is set. 150 * 151 * The second character in the string indicates an action to be taken as a 152 * result of the event. 153 * 154 * r rescan the device for possible state change 155 * 156 */ 157 struct mly_code_lookup mly_table_event[] = { 158 /* physical device events (0x0000 - 0x007f) */ 159 {"pr online", 0x0001}, 160 {"pr standby", 0x0002}, 161 {"p automatic rebuild started", 0x0005}, 162 {"p manual rebuild started", 0x0006}, 163 {"pr rebuild completed", 0x0007}, 164 {"pr rebuild cancelled", 0x0008}, 165 {"pr rebuild failed for unknown reasons", 0x0009}, 166 {"pr rebuild failed due to new physical device", 0x000a}, 167 {"pr rebuild failed due to logical drive failure", 0x000b}, 168 {"sr offline", 0x000c}, 169 {"pr found", 0x000d}, 170 {"pr gone", 0x000e}, 171 {"p unconfigured", 0x000f}, 172 {"p expand capacity started", 0x0010}, 173 {"pr expand capacity completed", 0x0011}, 174 {"pr expand capacity failed", 0x0012}, 175 {"p parity error", 0x0016}, 176 {"p soft error", 0x0017}, 177 {"p miscellaneous error", 0x0018}, 178 {"p reset", 0x0019}, 179 {"p active spare found", 0x001a}, 180 {"p warm spare found", 0x001b}, 181 {"s sense data received", 0x001c}, 182 {"p initialization started", 0x001d}, 183 {"pr initialization completed", 0x001e}, 184 {"pr initialization failed", 0x001f}, 185 {"pr initialization cancelled", 0x0020}, 186 {"P write recovery failed", 0x0021}, 187 {"p scsi bus reset failed", 0x0022}, 188 {"p double check condition", 0x0023}, 189 {"p device cannot be accessed", 0x0024}, 190 {"p gross error on scsi processor", 0x0025}, 191 {"p bad tag from device", 0x0026}, 192 {"p command timeout", 0x0027}, 193 {"pr system reset", 0x0028}, 194 {"p busy status or parity error", 0x0029}, 195 {"pr host set device to failed state", 0x002a}, 196 {"pr selection timeout", 0x002b}, 197 {"p scsi bus phase error", 0x002c}, 198 {"pr device returned unknown status", 0x002d}, 199 {"pr device not ready", 0x002e}, 200 {"p device not found at startup", 0x002f}, 201 {"p COD write operation failed", 0x0030}, 202 {"p BDT write operation failed", 0x0031}, 203 {"p missing at startup", 0x0039}, 204 {"p start rebuild failed due to physical drive too small", 0x003a}, 205 /* logical device events (0x0080 - 0x00ff) */ 206 {"m consistency check started", 0x0080}, 207 {"mr consistency check completed", 0x0081}, 208 {"mr consistency check cancelled", 0x0082}, 209 {"mr consistency check completed with errors", 0x0083}, 210 {"mr consistency check failed due to logical drive failure", 0x0084}, 211 {"mr consistency check failed due to physical device failure", 0x0085}, 212 {"lr offline", 0x0086}, 213 {"lr critical", 0x0087}, 214 {"lr online", 0x0088}, 215 {"m automatic rebuild started", 0x0089}, 216 {"m manual rebuild started", 0x008a}, 217 {"mr rebuild completed", 0x008b}, 218 {"mr rebuild cancelled", 0x008c}, 219 {"mr rebuild failed for unknown reasons", 0x008d}, 220 {"mr rebuild failed due to new physical device", 0x008e}, 221 {"mr rebuild failed due to logical drive failure", 0x008f}, 222 {"l initialization started", 0x0090}, 223 {"lr initialization completed", 0x0091}, 224 {"lr initialization cancelled", 0x0092}, 225 {"lr initialization failed", 0x0093}, 226 {"lr found", 0x0094}, 227 {"lr gone", 0x0095}, 228 {"l expand capacity started", 0x0096}, 229 {"lr expand capacity completed", 0x0097}, 230 {"lr expand capacity failed", 0x0098}, 231 {"l bad block found", 0x0099}, 232 {"lr size changed", 0x009a}, 233 {"lr type changed", 0x009b}, 234 {"l bad data block found", 0x009c}, 235 {"l read of data block in bdt", 0x009e}, 236 {"l write back data for disk block lost", 0x009f}, 237 /* enclosure management events (0x0100 - 0x017f) */ 238 {"e enclosure %d fan %d failed", 0x0140}, 239 {"e enclosure %d fan %d ok", 0x0141}, 240 {"e enclosure %d fan %d not present", 0x0142}, 241 {"e enclosure %d power supply %d failed", 0x0143}, 242 {"e enclosure %d power supply %d ok", 0x0144}, 243 {"e enclosure %d power supply %d not present", 0x0145}, 244 {"e enclosure %d temperature sensor %d failed", 0x0146}, 245 {"e enclosure %d temperature sensor %d critical", 0x0147}, 246 {"e enclosure %d temperature sensor %d ok", 0x0148}, 247 {"e enclosure %d temperature sensor %d not present", 0x0149}, 248 {"e enclosure %d unit %d access critical", 0x014a}, 249 {"e enclosure %d unit %d access ok", 0x014b}, 250 {"e enclosure %d unit %d access offline", 0x014c}, 251 /* controller events (0x0180 - 0x01ff) */ 252 {"c cache write back error", 0x0181}, 253 {"c battery backup unit found", 0x0188}, 254 {"c battery backup unit charge level low", 0x0189}, 255 {"c battery backup unit charge level ok", 0x018a}, 256 {"c installation aborted", 0x0193}, 257 {"c mirror race recovery in progress", 0x0195}, 258 {"c mirror race on critical drive", 0x0196}, 259 {"c memory soft ecc error", 0x019e}, 260 {"c memory hard ecc error", 0x019f}, 261 {"c battery backup unit failed", 0x01a2}, 262 {NULL, 0}, 263 {"? unknown event code", 0} 264 }; 265 266 /* 267 * Values here must be 16 characters or less, as they are packed into 268 * the 'product' field in the SCSI inquiry data. 269 */ 270 struct mly_code_lookup mly_table_device_state[] = { 271 {"offline", MLY_DEVICE_STATE_OFFLINE}, 272 {"unconfigured", MLY_DEVICE_STATE_UNCONFIGURED}, 273 {"online", MLY_DEVICE_STATE_ONLINE}, 274 {"critical", MLY_DEVICE_STATE_CRITICAL}, 275 {"writeonly", MLY_DEVICE_STATE_WRITEONLY}, 276 {"standby", MLY_DEVICE_STATE_STANDBY}, 277 {"missing", MLY_DEVICE_STATE_MISSING}, 278 {NULL, 0}, 279 {"unknown state", 0} 280 }; 281 282 /* 283 * Values here must be 8 characters or less, as they are packed into 284 * the 'vendor' field in the SCSI inquiry data. 285 */ 286 struct mly_code_lookup mly_table_device_type[] = { 287 {"RAID 0", MLY_DEVICE_TYPE_RAID0}, 288 {"RAID 1", MLY_DEVICE_TYPE_RAID1}, 289 {"RAID 3", MLY_DEVICE_TYPE_RAID3}, /* right asymmetric parity */ 290 {"RAID 5", MLY_DEVICE_TYPE_RAID5}, /* right asymmetric parity */ 291 {"RAID 6", MLY_DEVICE_TYPE_RAID6}, /* Mylex RAID 6 */ 292 {"RAID 7", MLY_DEVICE_TYPE_RAID7}, /* JBOD */ 293 {"SPAN", MLY_DEVICE_TYPE_NEWSPAN}, /* New Mylex SPAN */ 294 {"RAID 3", MLY_DEVICE_TYPE_RAID3F}, /* fixed parity */ 295 {"RAID 3", MLY_DEVICE_TYPE_RAID3L}, /* left symmetric parity */ 296 {"SPAN", MLY_DEVICE_TYPE_SPAN}, /* current spanning implementation */ 297 {"RAID 5", MLY_DEVICE_TYPE_RAID5L}, /* left symmetric parity */ 298 {"RAID E", MLY_DEVICE_TYPE_RAIDE}, /* concatenation */ 299 {"PHYSICAL", MLY_DEVICE_TYPE_PHYSICAL}, /* physical device */ 300 {NULL, 0}, 301 {"UNKNOWN", 0} 302 }; 303 304 struct mly_code_lookup mly_table_stripe_size[] = { 305 {"NONE", MLY_STRIPE_ZERO}, 306 {"512B", MLY_STRIPE_512b}, 307 {"1k", MLY_STRIPE_1k}, 308 {"2k", MLY_STRIPE_2k}, 309 {"4k", MLY_STRIPE_4k}, 310 {"8k", MLY_STRIPE_8k}, 311 {"16k", MLY_STRIPE_16k}, 312 {"32k", MLY_STRIPE_32k}, 313 {"64k", MLY_STRIPE_64k}, 314 {"128k", MLY_STRIPE_128k}, 315 {"256k", MLY_STRIPE_256k}, 316 {"512k", MLY_STRIPE_512k}, 317 {"1M", MLY_STRIPE_1m}, 318 {NULL, 0}, 319 {"unknown", 0} 320 }; 321 322 struct mly_code_lookup mly_table_cacheline_size[] = { 323 {"NONE", MLY_CACHELINE_ZERO}, 324 {"512B", MLY_CACHELINE_512b}, 325 {"1k", MLY_CACHELINE_1k}, 326 {"2k", MLY_CACHELINE_2k}, 327 {"4k", MLY_CACHELINE_4k}, 328 {"8k", MLY_CACHELINE_8k}, 329 {"16k", MLY_CACHELINE_16k}, 330 {"32k", MLY_CACHELINE_32k}, 331 {"64k", MLY_CACHELINE_64k}, 332 {NULL, 0}, 333 {"unknown", 0} 334 }; 335 336 #endif /* MLY_DEFINE_TABLES */ 337