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