1 /* $NetBSD: mly_tables.h,v 1.1 2001/07/30 19:59:07 ad Exp $ */ 2 3 /*- 4 * Copyright (c) 2001 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Andrew Doran, Thor Lancelot Simon, and Eric Haszlakiewicz. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the NetBSD 21 * Foundation, Inc. and its contributors. 22 * 4. Neither the name of The NetBSD Foundation nor the names of its 23 * contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 */ 38 39 /*- 40 * Copyright (c) 2000 Michael Smith 41 * Copyright (c) 2000 BSDi 42 * All rights reserved. 43 * 44 * Redistribution and use in source and binary forms, with or without 45 * modification, are permitted provided that the following conditions 46 * are met: 47 * 1. Redistributions of source code must retain the above copyright 48 * notice, this list of conditions and the following disclaimer. 49 * 2. Redistributions in binary form must reproduce the above copyright 50 * notice, this list of conditions and the following disclaimer in the 51 * documentation and/or other materials provided with the distribution. 52 * 53 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 54 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 56 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 63 * SUCH DAMAGE. 64 * 65 * from FreeBSD: mly_tables.h,v 1.2 2001/07/14 00:12:22 msmith Exp 66 */ 67 68 #ifndef _PCI_MLY_TABLES_H_ 69 #define _PCI_MLY_TABLES_H_ 70 71 struct mly_code_lookup { 72 const char *string; 73 u_int code; 74 }; 75 76 static const char *mly_describe_code(const struct mly_code_lookup *, 77 u_int32_t); 78 79 /* 80 * Look up a text description of a numeric code and return a pointer to same. 81 */ 82 static const char * 83 mly_describe_code(const struct mly_code_lookup *table, u_int32_t code) 84 { 85 int i; 86 87 for (i = 0; table[i].string != NULL; i++) 88 if (table[i].code == code) 89 return (table[i].string); 90 91 return (table[i + 1].string); 92 } 93 94 /* 95 * This table is directly derived from the corresponding table in the Linux 96 * driver, and uses a derivative encoding for simplicity's sake. 97 * 98 * The first character of the string determines the format of the message. 99 * 100 * p "physical device <channel>:<target> <text>" (physical device status) 101 * s "physical device <channel>:<target> <text>" (scsi message or error) 102 * " sense key <key> asc <asc> ascq <ascq>" 103 * " info <info> csi <csi>" 104 * l "logical drive <unit>: <text>" (logical device status) 105 * m "logical drive <unit>: <text>" (logical device message) 106 * 107 * Messages which are typically suppressed have the first character 108 * capitalised. These messages will only be printed if bootverbose is set. 109 * 110 * The second character in the string indicates an action to be taken as a 111 * result of the event. 112 * 113 * r rescan the device for possible state change 114 * 115 */ 116 static const struct mly_code_lookup mly_table_event[] = { 117 /* 118 * Physical device events (0x0000 - 0x007f). 119 */ 120 { "pr online", 0x0001 }, 121 { "pr standby", 0x0002 }, 122 { "p automatic rebuild started", 0x0005 }, 123 { "p manual rebuild started", 0x0006 }, 124 { "pr rebuild completed", 0x0007 }, 125 { "pr rebuild cancelled", 0x0008 }, 126 { "pr rebuild failed for unknown reasons", 0x0009 }, 127 { "pr rebuild failed due to new physical device", 0x000a }, 128 { "pr rebuild failed due to logical drive failure", 0x000b }, 129 { "sr offline", 0x000c }, 130 { "pr found", 0x000d }, 131 { "pr gone", 0x000e }, 132 { "p unconfigured", 0x000f }, 133 { "p expand capacity started", 0x0010 }, 134 { "pr expand capacity completed", 0x0011 }, 135 { "pr expand capacity failed", 0x0012 }, 136 { "p parity error", 0x0016 }, 137 { "p soft error", 0x0017 }, 138 { "p miscellaneous error", 0x0018 }, 139 { "p reset", 0x0019 }, 140 { "p active spare found", 0x001a }, 141 { "p warm spare found", 0x001b }, 142 { "s sense data received", 0x001c }, 143 { "p initialization started", 0x001d }, 144 { "pr initialization completed", 0x001e }, 145 { "pr initialization failed", 0x001f }, 146 { "pr initialization cancelled", 0x0020 }, 147 { "P write recovery failed", 0x0021 }, 148 { "p scsi bus reset failed", 0x0022 }, 149 { "p double check condition", 0x0023 }, 150 { "p device cannot be accessed", 0x0024 }, 151 { "p gross error on scsi processor", 0x0025 }, 152 { "p bad tag from device", 0x0026 }, 153 { "p command timeout", 0x0027 }, 154 { "pr system reset", 0x0028 }, 155 { "p busy status or parity error", 0x0029 }, 156 { "pr host set device to failed state", 0x002a }, 157 { "pr selection timeout", 0x002b }, 158 { "p scsi bus phase error", 0x002c }, 159 { "pr device returned unknown status", 0x002d }, 160 { "pr device not ready", 0x002e }, 161 { "p device not found at startup", 0x002f }, 162 { "p COD write operation failed", 0x0030 }, 163 { "p BDT write operation failed", 0x0031 }, 164 { "p missing at startup", 0x0039 }, 165 { "p start rebuild failed (physical drive too small)", 0x003a }, 166 167 /* 168 * Logical device events (0x0080 - 0x00ff). 169 */ 170 { "m consistency check started", 0x0080 }, 171 { "mr consistency check completed", 0x0081 }, 172 { "mr consistency check cancelled", 0x0082 }, 173 { "mr consistency check completed with errors", 0x0083 }, 174 { "mr consistency check failed (logical drive failure)",0x0084 }, 175 { "mr consistency check failed (physical device failure)",0x0085 }, 176 { "lr offline", 0x0086 }, 177 { "lr critical", 0x0087 }, 178 { "lr online", 0x0088 }, 179 { "m automatic rebuild started", 0x0089 }, 180 { "m manual rebuild started", 0x008a }, 181 { "mr rebuild completed", 0x008b }, 182 { "mr rebuild cancelled", 0x008c }, 183 { "mr rebuild failed for unknown reasons", 0x008d }, 184 { "mr rebuild failed due to new physical device", 0x008e }, 185 { "mr rebuild failed due to logical drive failure", 0x008f }, 186 { "l initialization started", 0x0090 }, 187 { "lr initialization completed", 0x0091 }, 188 { "lr initialization cancelled", 0x0092 }, 189 { "lr initialization failed", 0x0093 }, 190 { "lr found", 0x0094 }, 191 { "lr gone", 0x0095 }, 192 { "l expand capacity started", 0x0096 }, 193 { "lr expand capacity completed", 0x0097 }, 194 { "lr expand capacity failed", 0x0098 }, 195 { "l bad block found", 0x0099 }, 196 { "lr size changed", 0x009a }, 197 { "lr type changed", 0x009b }, 198 { "l bad data block found", 0x009c }, 199 { "l read of data block in bdt", 0x009e }, 200 { "l write back data for disk block lost", 0x009f }, 201 202 /* 203 * Enclosure management events (0x0100 - 0x017f). 204 */ 205 { "e enclosure %d fan %d failed", 0x0140 }, 206 { "e enclosure %d fan %d ok", 0x0141 }, 207 { "e enclosure %d fan %d not present", 0x0142 }, 208 { "e enclosure %d power supply %d failed", 0x0143 }, 209 { "e enclosure %d power supply %d ok", 0x0144 }, 210 { "e enclosure %d power supply %d not present", 0x0145 }, 211 { "e enclosure %d temperature sensor %d failed", 0x0146 }, 212 { "e enclosure %d temperature sensor %d critical", 0x0147 }, 213 { "e enclosure %d temperature sensor %d ok", 0x0148 }, 214 { "e enclosure %d temperature sensor %d not present", 0x0149 }, 215 { "e enclosure %d unit %d access critical", 0x014a }, 216 { "e enclosure %d unit %d access ok", 0x014b }, 217 { "e enclosure %d unit %d access offline", 0x014c }, 218 219 /* 220 * Controller events (0x0180 - 0x01ff). 221 */ 222 { "c cache write back error", 0x0181 }, 223 { "c battery backup unit found", 0x0188 }, 224 { "c battery backup unit charge level low", 0x0189 }, 225 { "c battery backup unit charge level ok", 0x018a }, 226 { "c installation aborted", 0x0193 }, 227 { "c mirror race recovery in progress", 0x0195 }, 228 { "c mirror race on critical drive", 0x0196 }, 229 { "c memory soft ecc error", 0x019e }, 230 { "c memory hard ecc error", 0x019f }, 231 { "c battery backup unit failed", 0x01a2 }, 232 233 { NULL, 0 }, 234 { "? unknown event code", 0 } 235 }; 236 237 /* 238 * Values here must be 16 characters or less, as they are packed into 239 * the 'product' field in the SCSI inquiry data. 240 */ 241 static const struct mly_code_lookup mly_table_device_state[] = { 242 { "OFLN", MLY_DEVICE_STATE_OFFLINE }, 243 { "UNCF", MLY_DEVICE_STATE_UNCONFIGURED }, 244 { "ONLN", MLY_DEVICE_STATE_ONLINE }, 245 { "CRIT", MLY_DEVICE_STATE_CRITICAL }, 246 { "NORD", MLY_DEVICE_STATE_WRITEONLY }, 247 { "STBY", MLY_DEVICE_STATE_STANDBY }, 248 { "MISS", MLY_DEVICE_STATE_MISSING }, 249 { NULL, 0 }, 250 { "????", 0 } 251 }; 252 253 /* 254 * Values here must be 8 characters or less, as they are packed into the 255 * 'vendor' field in the SCSI inquiry data. 256 */ 257 static const struct mly_code_lookup mly_table_device_type[] = { 258 { "RAID 0", MLY_DEVICE_TYPE_RAID0 }, 259 { "RAID 1", MLY_DEVICE_TYPE_RAID1 }, 260 { "RAID 3", MLY_DEVICE_TYPE_RAID3 }, 261 { "RAID 5", MLY_DEVICE_TYPE_RAID5 }, 262 { "RAID 6", MLY_DEVICE_TYPE_RAID6 }, 263 { "RAID 7", MLY_DEVICE_TYPE_RAID7 }, 264 { "SPAN", MLY_DEVICE_TYPE_NEWSPAN }, 265 { "RAID 3", MLY_DEVICE_TYPE_RAID3F }, 266 { "RAID 3", MLY_DEVICE_TYPE_RAID3L }, 267 { "SPAN", MLY_DEVICE_TYPE_SPAN }, 268 { "RAID 5", MLY_DEVICE_TYPE_RAID5L }, 269 { "RAID E", MLY_DEVICE_TYPE_RAIDE }, 270 { "PHYSICAL", MLY_DEVICE_TYPE_PHYSICAL }, 271 { NULL, 0 }, 272 { "UNKNOWN", 0 } 273 }; 274 275 #ifdef notused 276 static struct mly_code_lookup mly_table_bustype[] = { 277 { "SCSI", 0x00 }, 278 { "FC-AL", 0x01 }, 279 { "PCI", 0x03 }, 280 { NULL, 0 }, 281 { "unknown bus", 0} 282 }; 283 284 static const struct mly_code_lookup mly_table_controllertype[] = { 285 #if 0 /* not supported by this driver */ 286 { "DAC960E", 0x01 }, /* EISA */ 287 { "DAC960M", 0x08 }, /* MCA */ 288 { "DAC960PD", 0x10 }, /* PCI Dual */ 289 { "DAC960PL", 0x11 }, /* PCU low-cost */ 290 { "DAC960PDU", 0x12 }, /* PD Ultra */ 291 { "DAC960PE", 0x13 }, /* Peregrine low-cost */ 292 { "DAC960PG", 0x14 }, /* Peregrine high-performance */ 293 { "DAC960PJ", 0x15 }, /* Road Runner */ 294 { "DAC960PTL0", 0x16 }, /* Jaguar */ 295 { "DAC960PR", 0x17 }, /* Road Runner (again?) */ 296 { "DAC960PRL", 0x18 }, /* Tomcat */ 297 { "DAC960PT", 0x19 }, /* Road Runner (yet again?) */ 298 { "DAC1164P", 0x1a }, /* Little Apple */ 299 { "DAC960PTL1", 0x1b }, /* Jaguar+ */ 300 #endif 301 { "EXR2000P", 0x1c }, /* Big Apple */ 302 { "EXR3000P", 0x1d }, /* Fibre Apple */ 303 { "AcceleRAID 352", 0x1e }, /* Leopard */ 304 { "AcceleRAID 170", 0x1f }, /* Lynx */ 305 { "AcceleRAID 160", 0x20 }, /* Bobcat */ 306 { NULL, 0 }, 307 { "unknown adapter", 0 } 308 }; 309 310 static const struct mly_code_lookup mly_table_oemname[] = { 311 { "Mylex", MLY_OEM_MYLEX }, 312 { "IBM", MLY_OEM_IBM }, 313 { "Hewlett-Packard", MLY_OEM_HP }, 314 { "DEC/Compaq", MLY_OEM_DEC }, 315 { "Siemens", MLY_OEM_SIEMENS }, 316 { "Intel", MLY_OEM_INTEL }, 317 { NULL, 0 }, 318 { "unknown OEM", 0 } 319 }; 320 321 static const struct mly_code_lookup mly_table_memorytype[] = { 322 { "DRAM", 0x01 }, 323 { "EDRAM", 0x02 }, 324 { "EDO RAM", 0x03 }, 325 { "SDRAM", 0x04 }, 326 { NULL, 0 }, 327 { "unknown memory", 0 } 328 }; 329 330 static const struct mly_code_lookup mly_table_cputype[] = { 331 { "i960CA", 0x01 }, 332 { "i960RD", 0x02 }, 333 { "i960RN", 0x03 }, 334 { "i960RP", 0x04 }, 335 { "NorthBay(?)", 0x05 }, 336 { "StrongArm", 0x06 }, 337 { "i960RM", 0x07 }, 338 { NULL, 0 }, 339 { "unknown CPU", 0 } 340 }; 341 342 static const struct mly_code_lookup mly_table_stripe_size[] = { 343 { "NONE", MLY_STRIPE_ZERO }, 344 { "512B", MLY_STRIPE_512b }, 345 { "1k", MLY_STRIPE_1k }, 346 { "2k", MLY_STRIPE_2k }, 347 { "4k", MLY_STRIPE_4k }, 348 { "8k", MLY_STRIPE_8k }, 349 { "16k", MLY_STRIPE_16k }, 350 { "32k", MLY_STRIPE_32k }, 351 { "64k", MLY_STRIPE_64k }, 352 { "128k", MLY_STRIPE_128k }, 353 { "256k", MLY_STRIPE_256k }, 354 { "512k", MLY_STRIPE_512k }, 355 { "1M", MLY_STRIPE_1m }, 356 { NULL, 0 }, 357 { "unknown", 0 } 358 }; 359 360 static const struct mly_code_lookup mly_table_cacheline_size[] = { 361 { "NONE", MLY_CACHELINE_ZERO }, 362 { "512B", MLY_CACHELINE_512b }, 363 { "1k", MLY_CACHELINE_1k }, 364 { "2k", MLY_CACHELINE_2k }, 365 { "4k", MLY_CACHELINE_4k }, 366 { "8k", MLY_CACHELINE_8k }, 367 { "16k", MLY_CACHELINE_16k }, 368 { "32k", MLY_CACHELINE_32k }, 369 { "64k", MLY_CACHELINE_64k }, 370 { NULL, 0 }, 371 { "unknown", 0 } 372 }; 373 #endif /* notused */ 374 375 #endif /* !defined _PCI_MLY_TABLES_H_ */ 376