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