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