1 /* 2 * Implementation of Utility functions for all SCSI device types. 3 * 4 * Copyright (c) 1997, 1998 Justin T. Gibbs. 5 * Copyright (c) 1997, 1998, 2003 Kenneth D. Merry. 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 * without modification, immediately at the beginning of the file. 14 * 2. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 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 FOR 21 * 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: src/sys/cam/scsi/scsi_all.c,v 1.53 2008/08/16 21:26:58 ken Exp $ 30 * $DragonFly: src/sys/bus/cam/scsi/scsi_all.c,v 1.29 2008/11/16 18:43:59 swildner Exp $ 31 */ 32 33 #include <sys/param.h> 34 35 #ifdef _KERNEL 36 37 #include <opt_scsi.h> 38 #include <sys/systm.h> 39 #include <sys/libkern.h> 40 #include <sys/kernel.h> 41 #include <sys/sysctl.h> 42 43 #else 44 45 #include <errno.h> 46 #include <stdio.h> 47 #include <stdlib.h> 48 #include <string.h> 49 50 #define ksnprintf snprintf /* ick, userland uses us too */ 51 #define kprintf printf 52 #define kbsearch bsearch 53 54 #endif 55 56 #include "../cam.h" 57 #include "../cam_ccb.h" 58 #include "../cam_xpt.h" 59 #include "scsi_all.h" 60 #include <sys/sbuf.h> 61 #ifndef _KERNEL 62 #include <sys/camlib.h> 63 64 #ifndef FALSE 65 #define FALSE 0 66 #endif /* FALSE */ 67 #ifndef TRUE 68 #define TRUE 1 69 #endif /* TRUE */ 70 #define ERESTART -1 /* restart syscall */ 71 #define EJUSTRETURN -2 /* don't modify regs, just return */ 72 #endif /* !_KERNEL */ 73 74 /* 75 * This is the default number of milliseconds we wait for devices to settle 76 * after a SCSI bus reset. 77 */ 78 #ifndef SCSI_DELAY 79 #define SCSI_DELAY 2000 80 #endif 81 /* 82 * All devices need _some_ sort of bus settle delay, so we'll set it to 83 * a minimum value of 100ms. Note that this is pertinent only for SPI- 84 * not transport like Fibre Channel or iSCSI where 'delay' is completely 85 * meaningless. 86 */ 87 #ifndef SCSI_MIN_DELAY 88 #define SCSI_MIN_DELAY 100 89 #endif 90 /* 91 * Make sure the user isn't using seconds instead of milliseconds. 92 */ 93 #if (SCSI_DELAY < SCSI_MIN_DELAY && SCSI_DELAY != 0) 94 #error "SCSI_DELAY is in milliseconds, not seconds! Please use a larger value" 95 #endif 96 97 int scsi_delay; 98 99 static int ascentrycomp(const void *key, const void *member); 100 static int senseentrycomp(const void *key, const void *member); 101 static void fetchtableentries(int sense_key, int asc, int ascq, 102 struct scsi_inquiry_data *, 103 const struct sense_key_table_entry **, 104 const struct asc_table_entry **); 105 #ifdef _KERNEL 106 static void init_scsi_delay(void); 107 static int sysctl_scsi_delay(SYSCTL_HANDLER_ARGS); 108 static int set_scsi_delay(int delay); 109 #endif 110 111 #if !defined(SCSI_NO_OP_STRINGS) 112 113 #define D (1 << T_DIRECT) 114 #define T (1 << T_SEQUENTIAL) 115 #define L (1 << T_PRINTER) 116 #define P (1 << T_PROCESSOR) 117 #define W (1 << T_WORM) 118 #define R (1 << T_CDROM) 119 #define O (1 << T_OPTICAL) 120 #define M (1 << T_CHANGER) 121 #define A (1 << T_STORARRAY) 122 #define E (1 << T_ENCLOSURE) 123 #define B (1 << T_RBC) 124 #define K (1 << T_OCRW) 125 #define V (1 << T_ADC) 126 #define F (1 << T_OSD) 127 #define S (1 << T_SCANNER) 128 #define C (1 << T_COMM) 129 130 #define ALL (D | T | L | P | W | R | O | M | A | E | B | K | V | F | S | C) 131 132 static struct op_table_entry plextor_cd_ops[] = { 133 { 0xD8, R, "CD-DA READ" } 134 }; 135 136 static struct scsi_op_quirk_entry scsi_op_quirk_table[] = { 137 { 138 /* 139 * I believe that 0xD8 is the Plextor proprietary command 140 * to read CD-DA data. I'm not sure which Plextor CDROM 141 * models support the command, though. I know for sure 142 * that the 4X, 8X, and 12X models do, and presumably the 143 * 12-20X does. I don't know about any earlier models, 144 * though. If anyone has any more complete information, 145 * feel free to change this quirk entry. 146 */ 147 {T_CDROM, SIP_MEDIA_REMOVABLE, "PLEXTOR", "CD-ROM PX*", "*"}, 148 sizeof(plextor_cd_ops)/sizeof(struct op_table_entry), 149 plextor_cd_ops 150 } 151 }; 152 153 static struct op_table_entry scsi_op_codes[] = { 154 /* 155 * From: http://www.t10.org/lists/op-num.txt 156 * Modifications by Kenneth Merry (ken@FreeBSD.ORG) 157 * and Jung-uk Kim (jkim@FreeBSD.org) 158 * 159 * Note: order is important in this table, scsi_op_desc() currently 160 * depends on the opcodes in the table being in order to save 161 * search time. 162 * Note: scanner and comm. devices are carried over from the previous 163 * version because they were removed in the latest spec. 164 */ 165 /* File: OP-NUM.TXT 166 * 167 * SCSI Operation Codes 168 * Numeric Sorted Listing 169 * as of 3/11/08 170 * 171 * D - DIRECT ACCESS DEVICE (SBC-2) device column key 172 * .T - SEQUENTIAL ACCESS DEVICE (SSC-2) ----------------- 173 * . L - PRINTER DEVICE (SSC) M = Mandatory 174 * . P - PROCESSOR DEVICE (SPC) O = Optional 175 * . .W - WRITE ONCE READ MULTIPLE DEVICE (SBC-2) V = Vendor spec. 176 * . . R - CD/DVE DEVICE (MMC-3) Z = Obsolete 177 * . . O - OPTICAL MEMORY DEVICE (SBC-2) 178 * . . .M - MEDIA CHANGER DEVICE (SMC-2) 179 * . . . A - STORAGE ARRAY DEVICE (SCC-2) 180 * . . . .E - ENCLOSURE SERVICES DEVICE (SES) 181 * . . . .B - SIMPLIFIED DIRECT-ACCESS DEVICE (RBC) 182 * . . . . K - OPTICAL CARD READER/WRITER DEVICE (OCRW) 183 * . . . . V - AUTOMATION/DRIVE INTERFACE (ADC) 184 * . . . . .F - OBJECT-BASED STORAGE (OSD) 185 * OP DTLPWROMAEBKVF Description 186 * -- -------------- ---------------------------------------------- */ 187 /* 00 MMMMMMMMMMMMMM TEST UNIT READY */ 188 { 0x00, ALL, "TEST UNIT READY" }, 189 /* 01 M REWIND */ 190 { 0x01, T, "REWIND" }, 191 /* 01 Z V ZZZZ REZERO UNIT */ 192 { 0x01, D | W | R | O | M, "REZERO UNIT" }, 193 /* 02 VVVVVV V */ 194 /* 03 MMMMMMMMMMOMMM REQUEST SENSE */ 195 { 0x03, ALL, "REQUEST SENSE" }, 196 /* 04 M OO FORMAT UNIT */ 197 { 0x04, D | R | O, "FORMAT UNIT" }, 198 /* 04 O FORMAT MEDIUM */ 199 { 0x04, T, "FORMAT MEDIUM" }, 200 /* 04 O FORMAT */ 201 { 0x04, L, "FORMAT" }, 202 /* 05 VMVVVV V READ BLOCK LIMITS */ 203 { 0x05, T, "READ BLOCK LIMITS" }, 204 /* 06 VVVVVV V */ 205 /* 07 OVV O OV REASSIGN BLOCKS */ 206 { 0x07, D | W | O, "REASSIGN BLOCKS" }, 207 /* 07 O INITIALIZE ELEMENT STATUS */ 208 { 0x07, M, "INITIALIZE ELEMENT STATUS" }, 209 /* 08 MOV O OV READ(6) */ 210 { 0x08, D | T | W | O, "READ(6)" }, 211 /* 08 O RECEIVE */ 212 { 0x08, P, "RECEIVE" }, 213 /* 08 GET MESSAGE(6) */ 214 { 0x08, C, "GET MESSAGE(6)" }, 215 /* 09 VVVVVV V */ 216 /* 0A OO O OV WRITE(6) */ 217 { 0x0A, D | T | W | O, "WRITE(6)" }, 218 /* 0A M SEND(6) */ 219 { 0x0A, P, "SEND(6)" }, 220 /* 0A SEND MESSAGE(6) */ 221 { 0x0A, C, "SEND MESSAGE(6)" }, 222 /* 0A M PRINT */ 223 { 0x0A, L, "PRINT" }, 224 /* 0B Z ZOZV SEEK(6) */ 225 { 0x0B, D | W | R | O, "SEEK(6)" }, 226 /* 0B O SET CAPACITY */ 227 { 0x0B, T, "SET CAPACITY" }, 228 /* 0B O SLEW AND PRINT */ 229 { 0x0B, L, "SLEW AND PRINT" }, 230 /* 0C VVVVVV V */ 231 /* 0D VVVVVV V */ 232 /* 0E VVVVVV V */ 233 /* 0F VOVVVV V READ REVERSE(6) */ 234 { 0x0F, T, "READ REVERSE(6)" }, 235 /* 10 VM VVV WRITE FILEMARKS(6) */ 236 { 0x10, T, "WRITE FILEMARKS(6)" }, 237 /* 10 O SYNCHRONIZE BUFFER */ 238 { 0x10, L, "SYNCHRONIZE BUFFER" }, 239 /* 11 VMVVVV SPACE(6) */ 240 { 0x11, T, "SPACE(6)" }, 241 /* 12 MMMMMMMMMMMMMM INQUIRY */ 242 { 0x12, ALL, "INQUIRY" }, 243 /* 13 V VVVV */ 244 /* 13 O VERIFY(6) */ 245 { 0x13, T, "VERIFY(6)" }, 246 /* 14 VOOVVV RECOVER BUFFERED DATA */ 247 { 0x14, T | L, "RECOVER BUFFERED DATA" }, 248 /* 15 OMO O OOOO OO MODE SELECT(6) */ 249 { 0x15, ALL & ~(P | R | B | F), "MODE SELECT(6)" }, 250 /* 16 ZZMZO OOOZ O RESERVE(6) */ 251 { 0x16, ALL & ~(R | B | V | F | C), "RESERVE(6)" }, 252 /* 16 Z RESERVE ELEMENT(6) */ 253 { 0x16, M, "RESERVE ELEMENT(6)" }, 254 /* 17 ZZMZO OOOZ O RELEASE(6) */ 255 { 0x17, ALL & ~(R | B | V | F | C), "RELEASE(6)" }, 256 /* 17 Z RELEASE ELEMENT(6) */ 257 { 0x17, M, "RELEASE ELEMENT(6)" }, 258 /* 18 ZZZZOZO Z COPY */ 259 { 0x18, D | T | L | P | W | R | O | K | S, "COPY" }, 260 /* 19 VMVVVV ERASE(6) */ 261 { 0x19, T, "ERASE(6)" }, 262 /* 1A OMO O OOOO OO MODE SENSE(6) */ 263 { 0x1A, ALL & ~(P | R | B | F), "MODE SENSE(6)" }, 264 /* 1B O OOO O MO O START STOP UNIT */ 265 { 0x1B, D | W | R | O | A | B | K | F, "START STOP UNIT" }, 266 /* 1B O M LOAD UNLOAD */ 267 { 0x1B, T | V, "LOAD UNLOAD" }, 268 /* 1B SCAN */ 269 { 0x1B, S, "SCAN" }, 270 /* 1B O STOP PRINT */ 271 { 0x1B, L, "STOP PRINT" }, 272 /* 1B O OPEN/CLOSE IMPORT/EXPORT ELEMENT */ 273 { 0x1B, M, "OPEN/CLOSE IMPORT/EXPORT ELEMENT" }, 274 /* 1C OOOOO OOOM OOO RECEIVE DIAGNOSTIC RESULTS */ 275 { 0x1C, ALL & ~(R | B), "RECEIVE DIAGNOSTIC RESULTS" }, 276 /* 1D MMMMM MMOM MMM SEND DIAGNOSTIC */ 277 { 0x1D, ALL & ~(R | B), "SEND DIAGNOSTIC" }, 278 /* 1E OO OOOO O O PREVENT ALLOW MEDIUM REMOVAL */ 279 { 0x1E, D | T | W | R | O | M | K | F, "PREVENT ALLOW MEDIUM REMOVAL" }, 280 /* 1F */ 281 /* 20 V VVV V */ 282 /* 21 V VVV V */ 283 /* 22 V VVV V */ 284 /* 23 V V V V */ 285 /* 23 O READ FORMAT CAPACITIES */ 286 { 0x23, R, "READ FORMAT CAPACITIES" }, 287 /* 24 V VV SET WINDOW */ 288 { 0x24, S, "SET WINDOW" }, 289 /* 25 M M M M READ CAPACITY(10) */ 290 { 0x25, D | W | O | B, "READ CAPACITY(10)" }, 291 /* 25 O READ CAPACITY */ 292 { 0x25, R, "READ CAPACITY" }, 293 /* 25 M READ CARD CAPACITY */ 294 { 0x25, K, "READ CARD CAPACITY" }, 295 /* 25 GET WINDOW */ 296 { 0x25, S, "GET WINDOW" }, 297 /* 26 V VV */ 298 /* 27 V VV */ 299 /* 28 M MOM MM READ(10) */ 300 { 0x28, D | W | R | O | B | K | S, "READ(10)" }, 301 /* 28 GET MESSAGE(10) */ 302 { 0x28, C, "GET MESSAGE(10)" }, 303 /* 29 V VVO READ GENERATION */ 304 { 0x29, O, "READ GENERATION" }, 305 /* 2A O MOM MO WRITE(10) */ 306 { 0x2A, D | W | R | O | B | K, "WRITE(10)" }, 307 /* 2A SEND(10) */ 308 { 0x2A, S, "SEND(10)" }, 309 /* 2A SEND MESSAGE(10) */ 310 { 0x2A, C, "SEND MESSAGE(10)" }, 311 /* 2B Z OOO O SEEK(10) */ 312 { 0x2B, D | W | R | O | K, "SEEK(10)" }, 313 /* 2B O LOCATE(10) */ 314 { 0x2B, T, "LOCATE(10)" }, 315 /* 2B O POSITION TO ELEMENT */ 316 { 0x2B, M, "POSITION TO ELEMENT" }, 317 /* 2C V OO ERASE(10) */ 318 { 0x2C, R | O, "ERASE(10)" }, 319 /* 2D O READ UPDATED BLOCK */ 320 { 0x2D, O, "READ UPDATED BLOCK" }, 321 /* 2D V */ 322 /* 2E O OOO MO WRITE AND VERIFY(10) */ 323 { 0x2E, D | W | R | O | B | K, "WRITE AND VERIFY(10)" }, 324 /* 2F O OOO VERIFY(10) */ 325 { 0x2F, D | W | R | O, "VERIFY(10)" }, 326 /* 30 Z ZZZ SEARCH DATA HIGH(10) */ 327 { 0x30, D | W | R | O, "SEARCH DATA HIGH(10)" }, 328 /* 31 Z ZZZ SEARCH DATA EQUAL(10) */ 329 { 0x31, D | W | R | O, "SEARCH DATA EQUAL(10)" }, 330 /* 31 OBJECT POSITION */ 331 { 0x31, S, "OBJECT POSITION" }, 332 /* 32 Z ZZZ SEARCH DATA LOW(10) */ 333 { 0x32, D | W | R | O, "SEARCH DATA LOW(10)" }, 334 /* 33 Z OZO SET LIMITS(10) */ 335 { 0x33, D | W | R | O, "SET LIMITS(10)" }, 336 /* 34 O O O O PRE-FETCH(10) */ 337 { 0x34, D | W | O | K, "PRE-FETCH(10)" }, 338 /* 34 M READ POSITION */ 339 { 0x34, T, "READ POSITION" }, 340 /* 34 GET DATA BUFFER STATUS */ 341 { 0x34, S, "GET DATA BUFFER STATUS" }, 342 /* 35 O OOO MO SYNCHRONIZE CACHE(10) */ 343 { 0x35, D | W | R | O | B | K, "SYNCHRONIZE CACHE(10)" }, 344 /* 36 Z O O O LOCK UNLOCK CACHE(10) */ 345 { 0x36, D | W | O | K, "LOCK UNLOCK CACHE(10)" }, 346 /* 37 O O READ DEFECT DATA(10) */ 347 { 0x37, D | O, "READ DEFECT DATA(10)" }, 348 /* 37 O INITIALIZE ELEMENT STATUS WITH RANGE */ 349 { 0x37, M, "INITIALIZE ELEMENT STATUS WITH RANGE" }, 350 /* 38 O O O MEDIUM SCAN */ 351 { 0x38, W | O | K, "MEDIUM SCAN" }, 352 /* 39 ZZZZOZO Z COMPARE */ 353 { 0x39, D | T | L | P | W | R | O | K | S, "COMPARE" }, 354 /* 3A ZZZZOZO Z COPY AND VERIFY */ 355 { 0x3A, D | T | L | P | W | R | O | K | S, "COPY AND VERIFY" }, 356 /* 3B OOOOOOOOOOMOOO WRITE BUFFER */ 357 { 0x3B, ALL, "WRITE BUFFER" }, 358 /* 3C OOOOOOOOOO OOO READ BUFFER */ 359 { 0x3C, ALL & ~(B), "READ BUFFER" }, 360 /* 3D O UPDATE BLOCK */ 361 { 0x3D, O, "UPDATE BLOCK" }, 362 /* 3E O O O READ LONG(10) */ 363 { 0x3E, D | W | O, "READ LONG(10)" }, 364 /* 3F O O O WRITE LONG(10) */ 365 { 0x3F, D | W | O, "WRITE LONG(10)" }, 366 /* 40 ZZZZOZOZ CHANGE DEFINITION */ 367 { 0x40, D | T | L | P | W | R | O | M | S | C, "CHANGE DEFINITION" }, 368 /* 41 O WRITE SAME(10) */ 369 { 0x41, D, "WRITE SAME(10)" }, 370 /* 42 O READ SUB-CHANNEL */ 371 { 0x42, R, "READ SUB-CHANNEL" }, 372 /* 43 O READ TOC/PMA/ATIP */ 373 { 0x43, R, "READ TOC/PMA/ATIP" }, 374 /* 44 M M REPORT DENSITY SUPPORT */ 375 { 0x44, T | V, "REPORT DENSITY SUPPORT" }, 376 /* 44 READ HEADER */ 377 /* 45 O PLAY AUDIO(10) */ 378 { 0x45, R, "PLAY AUDIO(10)" }, 379 /* 46 M GET CONFIGURATION */ 380 { 0x46, R, "GET CONFIGURATION" }, 381 /* 47 O PLAY AUDIO MSF */ 382 { 0x47, R, "PLAY AUDIO MSF" }, 383 /* 48 */ 384 /* 49 */ 385 /* 4A M GET EVENT STATUS NOTIFICATION */ 386 { 0x4A, R, "GET EVENT STATUS NOTIFICATION" }, 387 /* 4B O PAUSE/RESUME */ 388 { 0x4B, R, "PAUSE/RESUME" }, 389 /* 4C OOOOO OOOO OOO LOG SELECT */ 390 { 0x4C, ALL & ~(R | B), "LOG SELECT" }, 391 /* 4D OOOOO OOOO OMO LOG SENSE */ 392 { 0x4D, ALL & ~(R | B), "LOG SENSE" }, 393 /* 4E O STOP PLAY/SCAN */ 394 { 0x4E, R, "STOP PLAY/SCAN" }, 395 /* 4F */ 396 /* 50 O XDWRITE(10) */ 397 { 0x50, D, "XDWRITE(10)" }, 398 /* 51 O XPWRITE(10) */ 399 { 0x51, D, "XPWRITE(10)" }, 400 /* 51 O READ DISC INFORMATION */ 401 { 0x51, R, "READ DISC INFORMATION" }, 402 /* 52 O XDREAD(10) */ 403 { 0x52, D, "XDREAD(10)" }, 404 /* 52 O READ TRACK INFORMATION */ 405 { 0x52, R, "READ TRACK INFORMATION" }, 406 /* 53 O RESERVE TRACK */ 407 { 0x53, R, "RESERVE TRACK" }, 408 /* 54 O SEND OPC INFORMATION */ 409 { 0x54, R, "SEND OPC INFORMATION" }, 410 /* 55 OOO OMOOOOMOMO MODE SELECT(10) */ 411 { 0x55, ALL & ~(P), "MODE SELECT(10)" }, 412 /* 56 ZZMZO OOOZ RESERVE(10) */ 413 { 0x56, ALL & ~(R | B | K | V | F | C), "RESERVE(10)" }, 414 /* 56 Z RESERVE ELEMENT(10) */ 415 { 0x56, M, "RESERVE ELEMENT(10)" }, 416 /* 57 ZZMZO OOOZ RELEASE(10) */ 417 { 0x57, ALL & ~(R | B | K | V | F | C), "RELEASE(10)" }, 418 /* 57 Z RELEASE ELEMENT(10) */ 419 { 0x57, M, "RELEASE ELEMENT(10)" }, 420 /* 58 O REPAIR TRACK */ 421 { 0x58, R, "REPAIR TRACK" }, 422 /* 59 */ 423 /* 5A OOO OMOOOOMOMO MODE SENSE(10) */ 424 { 0x5A, ALL & ~(P), "MODE SENSE(10)" }, 425 /* 5B O CLOSE TRACK/SESSION */ 426 { 0x5B, R, "CLOSE TRACK/SESSION" }, 427 /* 5C O READ BUFFER CAPACITY */ 428 { 0x5C, R, "READ BUFFER CAPACITY" }, 429 /* 5D O SEND CUE SHEET */ 430 { 0x5D, R, "SEND CUE SHEET" }, 431 /* 5E OOOOO OOOO M PERSISTENT RESERVE IN */ 432 { 0x5E, ALL & ~(R | B | K | V | C), "PERSISTENT RESERVE IN" }, 433 /* 5F OOOOO OOOO M PERSISTENT RESERVE OUT */ 434 { 0x5F, ALL & ~(R | B | K | V | C), "PERSISTENT RESERVE OUT" }, 435 /* 7E OO O OOOO O extended CDB */ 436 { 0x7E, D | T | R | M | A | E | B | V, "extended CDB" }, 437 /* 7F O M variable length CDB (more than 16 bytes) */ 438 { 0x7F, D | F, "variable length CDB (more than 16 bytes)" }, 439 /* 80 Z XDWRITE EXTENDED(16) */ 440 { 0x80, D, "XDWRITE EXTENDED(16)" }, 441 /* 80 M WRITE FILEMARKS(16) */ 442 { 0x80, T, "WRITE FILEMARKS(16)" }, 443 /* 81 Z REBUILD(16) */ 444 { 0x81, D, "REBUILD(16)" }, 445 /* 81 O READ REVERSE(16) */ 446 { 0x81, T, "READ REVERSE(16)" }, 447 /* 82 Z REGENERATE(16) */ 448 { 0x82, D, "REGENERATE(16)" }, 449 /* 83 OOOOO O OO EXTENDED COPY */ 450 { 0x83, D | T | L | P | W | O | K | V, "EXTENDED COPY" }, 451 /* 84 OOOOO O OO RECEIVE COPY RESULTS */ 452 { 0x84, D | T | L | P | W | O | K | V, "RECEIVE COPY RESULTS" }, 453 /* 85 O O O ATA COMMAND PASS THROUGH(16) */ 454 { 0x85, D | R | B, "ATA COMMAND PASS THROUGH(16)" }, 455 /* 86 OO OO OOOOOOO ACCESS CONTROL IN */ 456 { 0x86, ALL & ~(L | R | F), "ACCESS CONTROL IN" }, 457 /* 87 OO OO OOOOOOO ACCESS CONTROL OUT */ 458 { 0x87, ALL & ~(L | R | F), "ACCESS CONTROL OUT" }, 459 /* 460 * XXX READ(16)/WRITE(16) were not listed for CD/DVE in op-num.txt 461 * but we had it since r1.40. Do we really want them? 462 */ 463 /* 88 MM O O O READ(16) */ 464 { 0x88, D | T | W | O | B, "READ(16)" }, 465 /* 89 */ 466 /* 8A OM O O O WRITE(16) */ 467 { 0x8A, D | T | W | O | B, "WRITE(16)" }, 468 /* 8B O ORWRITE */ 469 { 0x8B, D, "ORWRITE" }, 470 /* 8C OO O OO O M READ ATTRIBUTE */ 471 { 0x8C, D | T | W | O | M | B | V, "READ ATTRIBUTE" }, 472 /* 8D OO O OO O O WRITE ATTRIBUTE */ 473 { 0x8D, D | T | W | O | M | B | V, "WRITE ATTRIBUTE" }, 474 /* 8E O O O O WRITE AND VERIFY(16) */ 475 { 0x8E, D | W | O | B, "WRITE AND VERIFY(16)" }, 476 /* 8F OO O O O VERIFY(16) */ 477 { 0x8F, D | T | W | O | B, "VERIFY(16)" }, 478 /* 90 O O O O PRE-FETCH(16) */ 479 { 0x90, D | W | O | B, "PRE-FETCH(16)" }, 480 /* 91 O O O O SYNCHRONIZE CACHE(16) */ 481 { 0x91, D | W | O | B, "SYNCHRONIZE CACHE(16)" }, 482 /* 91 O SPACE(16) */ 483 { 0x91, T, "SPACE(16)" }, 484 /* 92 Z O O LOCK UNLOCK CACHE(16) */ 485 { 0x92, D | W | O, "LOCK UNLOCK CACHE(16)" }, 486 /* 92 O LOCATE(16) */ 487 { 0x92, T, "LOCATE(16)" }, 488 /* 93 O WRITE SAME(16) */ 489 { 0x93, D, "WRITE SAME(16)" }, 490 /* 93 M ERASE(16) */ 491 { 0x93, T, "ERASE(16)" }, 492 /* 94 [usage proposed by SCSI Socket Services project] */ 493 /* 95 [usage proposed by SCSI Socket Services project] */ 494 /* 96 [usage proposed by SCSI Socket Services project] */ 495 /* 97 [usage proposed by SCSI Socket Services project] */ 496 /* 98 */ 497 /* 99 */ 498 /* 9A */ 499 /* 9B */ 500 /* 9C */ 501 /* 9D */ 502 /* XXX KDM ALL for this? op-num.txt defines it for none.. */ 503 /* 9E SERVICE ACTION IN(16) */ 504 { 0x9E, ALL, "SERVICE ACTION IN(16)" }, 505 /* XXX KDM ALL for this? op-num.txt defines it for ADC.. */ 506 /* 9F M SERVICE ACTION OUT(16) */ 507 { 0x9F, ALL, "SERVICE ACTION OUT(16)" }, 508 /* A0 MMOOO OMMM OMO REPORT LUNS */ 509 { 0xA0, ALL & ~(R | B), "REPORT LUNS" }, 510 /* A1 O BLANK */ 511 { 0xA1, R, "BLANK" }, 512 /* A1 O O ATA COMMAND PASS THROUGH(12) */ 513 { 0xA1, D | B, "ATA COMMAND PASS THROUGH(12)" }, 514 /* A2 OO O O SECURITY PROTOCOL IN */ 515 { 0xA2, D | T | R | V, "SECURITY PROTOCOL IN" }, 516 /* A3 OOO O OOMOOOM MAINTENANCE (IN) */ 517 { 0xA3, ALL & ~(P | R | F), "MAINTENANCE (IN)" }, 518 /* A3 O SEND KEY */ 519 { 0xA3, R, "SEND KEY" }, 520 /* A4 OOO O OOOOOOO MAINTENANCE (OUT) */ 521 { 0xA4, ALL & ~(P | R | F), "MAINTENANCE (OUT)" }, 522 /* A4 O REPORT KEY */ 523 { 0xA4, R, "REPORT KEY" }, 524 /* A5 O O OM MOVE MEDIUM */ 525 { 0xA5, T | W | O | M, "MOVE MEDIUM" }, 526 /* A5 O PLAY AUDIO(12) */ 527 { 0xA5, R, "PLAY AUDIO(12)" }, 528 /* A6 O EXCHANGE MEDIUM */ 529 { 0xA6, M, "EXCHANGE MEDIUM" }, 530 /* A6 O LOAD/UNLOAD C/DVD */ 531 { 0xA6, R, "LOAD/UNLOAD C/DVD" }, 532 /* A7 ZZ O O MOVE MEDIUM ATTACHED */ 533 { 0xA7, D | T | W | O, "MOVE MEDIUM ATTACHED" }, 534 /* A7 O SET READ AHEAD */ 535 { 0xA7, R, "SET READ AHEAD" }, 536 /* A8 O OOO READ(12) */ 537 { 0xA8, D | W | R | O, "READ(12)" }, 538 /* A8 GET MESSAGE(12) */ 539 { 0xA8, C, "GET MESSAGE(12)" }, 540 /* A9 O SERVICE ACTION OUT(12) */ 541 { 0xA9, V, "SERVICE ACTION OUT(12)" }, 542 /* AA O OOO WRITE(12) */ 543 { 0xAA, D | W | R | O, "WRITE(12)" }, 544 /* AA SEND MESSAGE(12) */ 545 { 0xAA, C, "SEND MESSAGE(12)" }, 546 /* AB O O SERVICE ACTION IN(12) */ 547 { 0xAB, R | V, "SERVICE ACTION IN(12)" }, 548 /* AC O ERASE(12) */ 549 { 0xAC, O, "ERASE(12)" }, 550 /* AC O GET PERFORMANCE */ 551 { 0xAC, R, "GET PERFORMANCE" }, 552 /* AD O READ DVD STRUCTURE */ 553 { 0xAD, R, "READ DVD STRUCTURE" }, 554 /* AE O O O WRITE AND VERIFY(12) */ 555 { 0xAE, D | W | O, "WRITE AND VERIFY(12)" }, 556 /* AF O OZO VERIFY(12) */ 557 { 0xAF, D | W | R | O, "VERIFY(12)" }, 558 /* B0 ZZZ SEARCH DATA HIGH(12) */ 559 { 0xB0, W | R | O, "SEARCH DATA HIGH(12)" }, 560 /* B1 ZZZ SEARCH DATA EQUAL(12) */ 561 { 0xB1, W | R | O, "SEARCH DATA EQUAL(12)" }, 562 /* B2 ZZZ SEARCH DATA LOW(12) */ 563 { 0xB2, W | R | O, "SEARCH DATA LOW(12)" }, 564 /* B3 Z OZO SET LIMITS(12) */ 565 { 0xB3, D | W | R | O, "SET LIMITS(12)" }, 566 /* B4 ZZ OZO READ ELEMENT STATUS ATTACHED */ 567 { 0xB4, D | T | W | R | O, "READ ELEMENT STATUS ATTACHED" }, 568 /* B5 OO O O SECURITY PROTOCOL OUT */ 569 { 0xB5, D | T | R | V, "SECURITY PROTOCOL OUT" }, 570 /* B5 O REQUEST VOLUME ELEMENT ADDRESS */ 571 { 0xB5, M, "REQUEST VOLUME ELEMENT ADDRESS" }, 572 /* B6 O SEND VOLUME TAG */ 573 { 0xB6, M, "SEND VOLUME TAG" }, 574 /* B6 O SET STREAMING */ 575 { 0xB6, R, "SET STREAMING" }, 576 /* B7 O O READ DEFECT DATA(12) */ 577 { 0xB7, D | O, "READ DEFECT DATA(12)" }, 578 /* B8 O OZOM READ ELEMENT STATUS */ 579 { 0xB8, T | W | R | O | M, "READ ELEMENT STATUS" }, 580 /* B9 O READ CD MSF */ 581 { 0xB9, R, "READ CD MSF" }, 582 /* BA O O OOMO REDUNDANCY GROUP (IN) */ 583 { 0xBA, D | W | O | M | A | E, "REDUNDANCY GROUP (IN)" }, 584 /* BA O SCAN */ 585 { 0xBA, R, "SCAN" }, 586 /* BB O O OOOO REDUNDANCY GROUP (OUT) */ 587 { 0xBB, D | W | O | M | A | E, "REDUNDANCY GROUP (OUT)" }, 588 /* BB O SET CD SPEED */ 589 { 0xBB, R, "SET CD SPEED" }, 590 /* BC O O OOMO SPARE (IN) */ 591 { 0xBC, D | W | O | M | A | E, "SPARE (IN)" }, 592 /* BD O O OOOO SPARE (OUT) */ 593 { 0xBD, D | W | O | M | A | E, "SPARE (OUT)" }, 594 /* BD O MECHANISM STATUS */ 595 { 0xBD, R, "MECHANISM STATUS" }, 596 /* BE O O OOMO VOLUME SET (IN) */ 597 { 0xBE, D | W | O | M | A | E, "VOLUME SET (IN)" }, 598 /* BE O READ CD */ 599 { 0xBE, R, "READ CD" }, 600 /* BF O O OOOO VOLUME SET (OUT) */ 601 { 0xBF, D | W | O | M | A | E, "VOLUME SET (OUT)" }, 602 /* BF O SEND DVD STRUCTURE */ 603 { 0xBF, R, "SEND DVD STRUCTURE" } 604 }; 605 606 const char * 607 scsi_op_desc(u_int16_t opcode, struct scsi_inquiry_data *inq_data) 608 { 609 caddr_t match; 610 int i, j; 611 u_int32_t opmask; 612 u_int16_t pd_type; 613 int num_ops[2]; 614 struct op_table_entry *table[2]; 615 int num_tables; 616 617 pd_type = SID_TYPE(inq_data); 618 619 match = cam_quirkmatch((caddr_t)inq_data, 620 (caddr_t)scsi_op_quirk_table, 621 sizeof(scsi_op_quirk_table)/ 622 sizeof(*scsi_op_quirk_table), 623 sizeof(*scsi_op_quirk_table), 624 scsi_inquiry_match); 625 626 if (match != NULL) { 627 table[0] = ((struct scsi_op_quirk_entry *)match)->op_table; 628 num_ops[0] = ((struct scsi_op_quirk_entry *)match)->num_ops; 629 table[1] = scsi_op_codes; 630 num_ops[1] = sizeof(scsi_op_codes)/sizeof(scsi_op_codes[0]); 631 num_tables = 2; 632 } else { 633 /* 634 * If this is true, we have a vendor specific opcode that 635 * wasn't covered in the quirk table. 636 */ 637 if ((opcode > 0xBF) || ((opcode > 0x5F) && (opcode < 0x80))) 638 return("Vendor Specific Command"); 639 640 table[0] = scsi_op_codes; 641 num_ops[0] = sizeof(scsi_op_codes)/sizeof(scsi_op_codes[0]); 642 num_tables = 1; 643 } 644 645 /* RBC is 'Simplified' Direct Access Device */ 646 if (pd_type == T_RBC) 647 pd_type = T_DIRECT; 648 649 opmask = 1 << pd_type; 650 651 for (j = 0; j < num_tables; j++) { 652 for (i = 0;i < num_ops[j] && table[j][i].opcode <= opcode; i++){ 653 if ((table[j][i].opcode == opcode) 654 && ((table[j][i].opmask & opmask) != 0)) 655 return(table[j][i].desc); 656 } 657 } 658 659 /* 660 * If we can't find a match for the command in the table, we just 661 * assume it's a vendor specifc command. 662 */ 663 return("Vendor Specific Command"); 664 665 } 666 667 #else /* SCSI_NO_OP_STRINGS */ 668 669 const char * 670 scsi_op_desc(u_int16_t opcode, struct scsi_inquiry_data *inq_data) 671 { 672 return(""); 673 } 674 675 #endif 676 677 678 #if !defined(SCSI_NO_SENSE_STRINGS) 679 #define SST(asc, ascq, action, desc) \ 680 asc, ascq, action, desc 681 #else 682 const char empty_string[] = ""; 683 684 #define SST(asc, ascq, action, desc) \ 685 asc, ascq, action, empty_string 686 #endif 687 688 const struct sense_key_table_entry sense_key_table[] = 689 { 690 { SSD_KEY_NO_SENSE, SS_NOP, "NO SENSE" }, 691 { SSD_KEY_RECOVERED_ERROR, SS_NOP|SSQ_PRINT_SENSE, "RECOVERED ERROR" }, 692 { 693 SSD_KEY_NOT_READY, SS_TUR|SSQ_MANY|SSQ_DECREMENT_COUNT|EBUSY, 694 "NOT READY" 695 }, 696 { SSD_KEY_MEDIUM_ERROR, SS_RDEF, "MEDIUM ERROR" }, 697 { SSD_KEY_HARDWARE_ERROR, SS_RDEF, "HARDWARE FAILURE" }, 698 { SSD_KEY_ILLEGAL_REQUEST, SS_FATAL|EINVAL, "ILLEGAL REQUEST" }, 699 { SSD_KEY_UNIT_ATTENTION, SS_FATAL|ENXIO, "UNIT ATTENTION" }, 700 { SSD_KEY_DATA_PROTECT, SS_FATAL|EACCES, "DATA PROTECT" }, 701 { SSD_KEY_BLANK_CHECK, SS_FATAL|ENOSPC, "BLANK CHECK" }, 702 { SSD_KEY_Vendor_Specific, SS_FATAL|EIO, "Vendor Specific" }, 703 { SSD_KEY_COPY_ABORTED, SS_FATAL|EIO, "COPY ABORTED" }, 704 { SSD_KEY_ABORTED_COMMAND, SS_RDEF, "ABORTED COMMAND" }, 705 { SSD_KEY_EQUAL, SS_NOP, "EQUAL" }, 706 { SSD_KEY_VOLUME_OVERFLOW, SS_FATAL|EIO, "VOLUME OVERFLOW" }, 707 { SSD_KEY_MISCOMPARE, SS_NOP, "MISCOMPARE" }, 708 { SSD_KEY_RESERVED, SS_FATAL|EIO, "RESERVED" } 709 }; 710 711 const int sense_key_table_size = 712 sizeof(sense_key_table)/sizeof(sense_key_table[0]); 713 714 static struct asc_table_entry quantum_fireball_entries[] = { 715 { SST(0x04, 0x0b, SS_START | SSQ_DECREMENT_COUNT | ENXIO, 716 "Logical unit not ready, initializing cmd. required") } 717 }; 718 719 static struct asc_table_entry sony_mo_entries[] = { 720 { SST(0x04, 0x00, SS_START | SSQ_DECREMENT_COUNT | ENXIO, 721 "Logical unit not ready, cause not reportable") } 722 }; 723 724 static struct scsi_sense_quirk_entry sense_quirk_table[] = { 725 { 726 /* 727 * XXX The Quantum Fireball ST and SE like to return 0x04 0x0b 728 * when they really should return 0x04 0x02. 729 */ 730 {T_DIRECT, SIP_MEDIA_FIXED, "QUANTUM", "FIREBALL S*", "*"}, 731 /*num_sense_keys*/0, 732 sizeof(quantum_fireball_entries)/sizeof(struct asc_table_entry), 733 /*sense key entries*/NULL, 734 quantum_fireball_entries 735 }, 736 { 737 /* 738 * This Sony MO drive likes to return 0x04, 0x00 when it 739 * isn't spun up. 740 */ 741 {T_DIRECT, SIP_MEDIA_REMOVABLE, "SONY", "SMO-*", "*"}, 742 /*num_sense_keys*/0, 743 sizeof(sony_mo_entries)/sizeof(struct asc_table_entry), 744 /*sense key entries*/NULL, 745 sony_mo_entries 746 } 747 }; 748 749 const int sense_quirk_table_size = 750 sizeof(sense_quirk_table)/sizeof(sense_quirk_table[0]); 751 752 static struct asc_table_entry asc_table[] = { 753 /* 754 * From: http://www.t10.org/lists/asc-num.txt 755 * Modifications by Jung-uk Kim (jkim@FreeBSD.org) 756 */ 757 /* 758 * File: ASC-NUM.TXT 759 * 760 * SCSI ASC/ASCQ Assignments 761 * Numeric Sorted Listing 762 * as of 7/29/08 763 * 764 * D - DIRECT ACCESS DEVICE (SBC-2) device column key 765 * .T - SEQUENTIAL ACCESS DEVICE (SSC) ------------------- 766 * . L - PRINTER DEVICE (SSC) blank = reserved 767 * . P - PROCESSOR DEVICE (SPC) not blank = allowed 768 * . .W - WRITE ONCE READ MULTIPLE DEVICE (SBC-2) 769 * . . R - CD DEVICE (MMC) 770 * . . O - OPTICAL MEMORY DEVICE (SBC-2) 771 * . . .M - MEDIA CHANGER DEVICE (SMC) 772 * . . . A - STORAGE ARRAY DEVICE (SCC) 773 * . . . E - ENCLOSURE SERVICES DEVICE (SES) 774 * . . . .B - SIMPLIFIED DIRECT-ACCESS DEVICE (RBC) 775 * . . . . K - OPTICAL CARD READER/WRITER DEVICE (OCRW) 776 * . . . . V - AUTOMATION/DRIVE INTERFACE (ADC) 777 * . . . . .F - OBJECT-BASED STORAGE (OSD) 778 * DTLPWROMAEBKVF 779 * ASC ASCQ Action 780 * Description 781 */ 782 /* DTLPWROMAEBKVF */ 783 { SST(0x00, 0x00, SS_NOP, 784 "No additional sense information") }, 785 /* T */ 786 { SST(0x00, 0x01, SS_RDEF, 787 "Filemark detected") }, 788 /* T */ 789 { SST(0x00, 0x02, SS_RDEF, 790 "End-of-partition/medium detected") }, 791 /* T */ 792 { SST(0x00, 0x03, SS_RDEF, 793 "Setmark detected") }, 794 /* T */ 795 { SST(0x00, 0x04, SS_RDEF, 796 "Beginning-of-partition/medium detected") }, 797 /* TL */ 798 { SST(0x00, 0x05, SS_RDEF, 799 "End-of-data detected") }, 800 /* DTLPWROMAEBKVF */ 801 { SST(0x00, 0x06, SS_RDEF, 802 "I/O process terminated") }, 803 /* T */ 804 { SST(0x00, 0x07, SS_RDEF, /* XXX TBD */ 805 "Programmable early warning detected") }, 806 /* R */ 807 { SST(0x00, 0x11, SS_FATAL | EBUSY, 808 "Audio play operation in progress") }, 809 /* R */ 810 { SST(0x00, 0x12, SS_NOP, 811 "Audio play operation paused") }, 812 /* R */ 813 { SST(0x00, 0x13, SS_NOP, 814 "Audio play operation successfully completed") }, 815 /* R */ 816 { SST(0x00, 0x14, SS_RDEF, 817 "Audio play operation stopped due to error") }, 818 /* R */ 819 { SST(0x00, 0x15, SS_NOP, 820 "No current audio status to return") }, 821 /* DTLPWROMAEBKVF */ 822 { SST(0x00, 0x16, SS_FATAL | EBUSY, 823 "Operation in progress") }, 824 /* DTL WROMAEBKVF */ 825 { SST(0x00, 0x17, SS_RDEF, 826 "Cleaning requested") }, 827 /* T */ 828 { SST(0x00, 0x18, SS_RDEF, /* XXX TBD */ 829 "Erase operation in progress") }, 830 /* T */ 831 { SST(0x00, 0x19, SS_RDEF, /* XXX TBD */ 832 "Locate operation in progress") }, 833 /* T */ 834 { SST(0x00, 0x1A, SS_RDEF, /* XXX TBD */ 835 "Rewind operation in progress") }, 836 /* T */ 837 { SST(0x00, 0x1B, SS_RDEF, /* XXX TBD */ 838 "Set capacity operation in progress") }, 839 /* T */ 840 { SST(0x00, 0x1C, SS_RDEF, /* XXX TBD */ 841 "Verify operation in progress") }, 842 /* DT B */ 843 { SST(0x00, 0x1D, SS_RDEF, /* XXX TBD */ 844 "ATA pass through information available") }, 845 /* DT R MAEBKV */ 846 { SST(0x00, 0x1E, SS_RDEF, /* XXX TBD */ 847 "Conflicting SA creation request") }, 848 /* D W O BK */ 849 { SST(0x01, 0x00, SS_RDEF, 850 "No index/sector signal") }, 851 /* D WRO BK */ 852 { SST(0x02, 0x00, SS_RDEF, 853 "No seek complete") }, 854 /* DTL W O BK */ 855 { SST(0x03, 0x00, SS_RDEF, 856 "Peripheral device write fault") }, 857 /* T */ 858 { SST(0x03, 0x01, SS_RDEF, 859 "No write current") }, 860 /* T */ 861 { SST(0x03, 0x02, SS_RDEF, 862 "Excessive write errors") }, 863 /* DTLPWROMAEBKVF */ 864 { SST(0x04, 0x00, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | EIO, 865 "Logical unit not ready, cause not reportable") }, 866 /* DTLPWROMAEBKVF */ 867 { SST(0x04, 0x01, SS_TUR | SSQ_MANY | SSQ_DECREMENT_COUNT | EBUSY, 868 "Logical unit is in process of becoming ready") }, 869 /* DTLPWROMAEBKVF */ 870 { SST(0x04, 0x02, SS_START | SSQ_DECREMENT_COUNT | ENXIO, 871 "Logical unit not ready, initializing command required") }, 872 /* DTLPWROMAEBKVF */ 873 { SST(0x04, 0x03, SS_FATAL | ENXIO, 874 "Logical unit not ready, manual intervention required") }, 875 /* DTL RO B */ 876 { SST(0x04, 0x04, SS_FATAL | EBUSY, 877 "Logical unit not ready, format in progress") }, 878 /* DT W O A BK F */ 879 { SST(0x04, 0x05, SS_FATAL | EBUSY, 880 "Logical unit not ready, rebuild in progress") }, 881 /* DT W O A BK */ 882 { SST(0x04, 0x06, SS_FATAL | EBUSY, 883 "Logical unit not ready, recalculation in progress") }, 884 /* DTLPWROMAEBKVF */ 885 { SST(0x04, 0x07, SS_FATAL | EBUSY, 886 "Logical unit not ready, operation in progress") }, 887 /* R */ 888 { SST(0x04, 0x08, SS_FATAL | EBUSY, 889 "Logical unit not ready, long write in progress") }, 890 /* DTLPWROMAEBKVF */ 891 { SST(0x04, 0x09, SS_RDEF, /* XXX TBD */ 892 "Logical unit not ready, self-test in progress") }, 893 /* DTLPWROMAEBKVF */ 894 { SST(0x04, 0x0A, SS_RDEF, /* XXX TBD */ 895 "Logical unit not accessible, asymmetric access state transition")}, 896 /* DTLPWROMAEBKVF */ 897 { SST(0x04, 0x0B, SS_RDEF, /* XXX TBD */ 898 "Logical unit not accessible, target port in standby state") }, 899 /* DTLPWROMAEBKVF */ 900 { SST(0x04, 0x0C, SS_RDEF, /* XXX TBD */ 901 "Logical unit not accessible, target port in unavailable state") }, 902 /* F */ 903 { SST(0x04, 0x0D, SS_RDEF, /* XXX TBD */ 904 "Logical unit not ready, structure check required") }, 905 /* DT WROM B */ 906 { SST(0x04, 0x10, SS_RDEF, /* XXX TBD */ 907 "Logical unit not ready, auxiliary memory not accessible") }, 908 /* DT WRO AEB VF */ 909 { SST(0x04, 0x11, SS_RDEF, /* XXX TBD */ 910 "Logical unit not ready, notify (enable spinup) required") }, 911 /* M V */ 912 { SST(0x04, 0x12, SS_RDEF, /* XXX TBD */ 913 "Logical unit not ready, offline") }, 914 /* DT R MAEBKV */ 915 { SST(0x04, 0x13, SS_RDEF, /* XXX TBD */ 916 "Logical unit not ready, SA creation in progress") }, 917 /* DTL WROMAEBKVF */ 918 { SST(0x05, 0x00, SS_RDEF, 919 "Logical unit does not respond to selection") }, 920 /* D WROM BK */ 921 { SST(0x06, 0x00, SS_RDEF, 922 "No reference position found") }, 923 /* DTL WROM BK */ 924 { SST(0x07, 0x00, SS_RDEF, 925 "Multiple peripheral devices selected") }, 926 /* DTL WROMAEBKVF */ 927 { SST(0x08, 0x00, SS_RDEF, 928 "Logical unit communication failure") }, 929 /* DTL WROMAEBKVF */ 930 { SST(0x08, 0x01, SS_RDEF, 931 "Logical unit communication time-out") }, 932 /* DTL WROMAEBKVF */ 933 { SST(0x08, 0x02, SS_RDEF, 934 "Logical unit communication parity error") }, 935 /* DT ROM BK */ 936 { SST(0x08, 0x03, SS_RDEF, 937 "Logical unit communication CRC error (Ultra-DMA/32)") }, 938 /* DTLPWRO K */ 939 { SST(0x08, 0x04, SS_RDEF, /* XXX TBD */ 940 "Unreachable copy target") }, 941 /* DT WRO B */ 942 { SST(0x09, 0x00, SS_RDEF, 943 "Track following error") }, 944 /* WRO K */ 945 { SST(0x09, 0x01, SS_RDEF, 946 "Tracking servo failure") }, 947 /* WRO K */ 948 { SST(0x09, 0x02, SS_RDEF, 949 "Focus servo failure") }, 950 /* WRO */ 951 { SST(0x09, 0x03, SS_RDEF, 952 "Spindle servo failure") }, 953 /* DT WRO B */ 954 { SST(0x09, 0x04, SS_RDEF, 955 "Head select fault") }, 956 /* DTLPWROMAEBKVF */ 957 { SST(0x0A, 0x00, SS_FATAL | ENOSPC, 958 "Error log overflow") }, 959 /* DTLPWROMAEBKVF */ 960 { SST(0x0B, 0x00, SS_RDEF, 961 "Warning") }, 962 /* DTLPWROMAEBKVF */ 963 { SST(0x0B, 0x01, SS_RDEF, 964 "Warning - specified temperature exceeded") }, 965 /* DTLPWROMAEBKVF */ 966 { SST(0x0B, 0x02, SS_RDEF, 967 "Warning - enclosure degraded") }, 968 /* DTLPWROMAEBKVF */ 969 { SST(0x0B, 0x03, SS_RDEF, /* XXX TBD */ 970 "Warning - background self-test failed") }, 971 /* DTLPWRO AEBKVF */ 972 { SST(0x0B, 0x04, SS_RDEF, /* XXX TBD */ 973 "Warning - background pre-scan detected medium error") }, 974 /* DTLPWRO AEBKVF */ 975 { SST(0x0B, 0x05, SS_RDEF, /* XXX TBD */ 976 "Warning - background medium scan detected medium error") }, 977 /* DTLPWROMAEBKVF */ 978 { SST(0x0B, 0x06, SS_RDEF, /* XXX TBD */ 979 "Warning - non-volatile cache now volatile") }, 980 /* DTLPWROMAEBKVF */ 981 { SST(0x0B, 0x07, SS_RDEF, /* XXX TBD */ 982 "Warning - degraded power to non-volatile cache") }, 983 /* T R */ 984 { SST(0x0C, 0x00, SS_RDEF, 985 "Write error") }, 986 /* K */ 987 { SST(0x0C, 0x01, SS_NOP | SSQ_PRINT_SENSE, 988 "Write error - recovered with auto reallocation") }, 989 /* D W O BK */ 990 { SST(0x0C, 0x02, SS_RDEF, 991 "Write error - auto reallocation failed") }, 992 /* D W O BK */ 993 { SST(0x0C, 0x03, SS_RDEF, 994 "Write error - recommend reassignment") }, 995 /* DT W O B */ 996 { SST(0x0C, 0x04, SS_RDEF, 997 "Compression check miscompare error") }, 998 /* DT W O B */ 999 { SST(0x0C, 0x05, SS_RDEF, 1000 "Data expansion occurred during compression") }, 1001 /* DT W O B */ 1002 { SST(0x0C, 0x06, SS_RDEF, 1003 "Block not compressible") }, 1004 /* R */ 1005 { SST(0x0C, 0x07, SS_RDEF, 1006 "Write error - recovery needed") }, 1007 /* R */ 1008 { SST(0x0C, 0x08, SS_RDEF, 1009 "Write error - recovery failed") }, 1010 /* R */ 1011 { SST(0x0C, 0x09, SS_RDEF, 1012 "Write error - loss of streaming") }, 1013 /* R */ 1014 { SST(0x0C, 0x0A, SS_RDEF, 1015 "Write error - padding blocks added") }, 1016 /* DT WROM B */ 1017 { SST(0x0C, 0x0B, SS_RDEF, /* XXX TBD */ 1018 "Auxiliary memory write error") }, 1019 /* DTLPWRO AEBKVF */ 1020 { SST(0x0C, 0x0C, SS_RDEF, /* XXX TBD */ 1021 "Write error - unexpected unsolicited data") }, 1022 /* DTLPWRO AEBKVF */ 1023 { SST(0x0C, 0x0D, SS_RDEF, /* XXX TBD */ 1024 "Write error - not enough unsolicited data") }, 1025 /* R */ 1026 { SST(0x0C, 0x0F, SS_RDEF, /* XXX TBD */ 1027 "Defects in error window") }, 1028 /* DTLPWRO A K */ 1029 { SST(0x0D, 0x00, SS_RDEF, /* XXX TBD */ 1030 "Error detected by third party temporary initiator") }, 1031 /* DTLPWRO A K */ 1032 { SST(0x0D, 0x01, SS_RDEF, /* XXX TBD */ 1033 "Third party device failure") }, 1034 /* DTLPWRO A K */ 1035 { SST(0x0D, 0x02, SS_RDEF, /* XXX TBD */ 1036 "Copy target device not reachable") }, 1037 /* DTLPWRO A K */ 1038 { SST(0x0D, 0x03, SS_RDEF, /* XXX TBD */ 1039 "Incorrect copy target device type") }, 1040 /* DTLPWRO A K */ 1041 { SST(0x0D, 0x04, SS_RDEF, /* XXX TBD */ 1042 "Copy target device data underrun") }, 1043 /* DTLPWRO A K */ 1044 { SST(0x0D, 0x05, SS_RDEF, /* XXX TBD */ 1045 "Copy target device data overrun") }, 1046 /* DT PWROMAEBK F */ 1047 { SST(0x0E, 0x00, SS_RDEF, /* XXX TBD */ 1048 "Invalid information unit") }, 1049 /* DT PWROMAEBK F */ 1050 { SST(0x0E, 0x01, SS_RDEF, /* XXX TBD */ 1051 "Information unit too short") }, 1052 /* DT PWROMAEBK F */ 1053 { SST(0x0E, 0x02, SS_RDEF, /* XXX TBD */ 1054 "Information unit too long") }, 1055 /* DT P R MAEBK F */ 1056 { SST(0x0E, 0x03, SS_RDEF, /* XXX TBD */ 1057 "Invalid field in command information unit") }, 1058 /* D W O BK */ 1059 { SST(0x10, 0x00, SS_RDEF, 1060 "ID CRC or ECC error") }, 1061 /* DT W O */ 1062 { SST(0x10, 0x01, SS_RDEF, /* XXX TBD */ 1063 "Logical block guard check failed") }, 1064 /* DT W O */ 1065 { SST(0x10, 0x02, SS_RDEF, /* XXX TBD */ 1066 "Logical block application tag check failed") }, 1067 /* DT W O */ 1068 { SST(0x10, 0x03, SS_RDEF, /* XXX TBD */ 1069 "Logical block reference tag check failed") }, 1070 /* DT WRO BK */ 1071 { SST(0x11, 0x00, SS_RDEF, 1072 "Unrecovered read error") }, 1073 /* DT WRO BK */ 1074 { SST(0x11, 0x01, SS_RDEF, 1075 "Read retries exhausted") }, 1076 /* DT WRO BK */ 1077 { SST(0x11, 0x02, SS_RDEF, 1078 "Error too long to correct") }, 1079 /* DT W O BK */ 1080 { SST(0x11, 0x03, SS_RDEF, 1081 "Multiple read errors") }, 1082 /* D W O BK */ 1083 { SST(0x11, 0x04, SS_RDEF, 1084 "Unrecovered read error - auto reallocate failed") }, 1085 /* WRO B */ 1086 { SST(0x11, 0x05, SS_RDEF, 1087 "L-EC uncorrectable error") }, 1088 /* WRO B */ 1089 { SST(0x11, 0x06, SS_RDEF, 1090 "CIRC unrecovered error") }, 1091 /* W O B */ 1092 { SST(0x11, 0x07, SS_RDEF, 1093 "Data re-synchronization error") }, 1094 /* T */ 1095 { SST(0x11, 0x08, SS_RDEF, 1096 "Incomplete block read") }, 1097 /* T */ 1098 { SST(0x11, 0x09, SS_RDEF, 1099 "No gap found") }, 1100 /* DT O BK */ 1101 { SST(0x11, 0x0A, SS_RDEF, 1102 "Miscorrected error") }, 1103 /* D W O BK */ 1104 { SST(0x11, 0x0B, SS_RDEF, 1105 "Unrecovered read error - recommend reassignment") }, 1106 /* D W O BK */ 1107 { SST(0x11, 0x0C, SS_RDEF, 1108 "Unrecovered read error - recommend rewrite the data") }, 1109 /* DT WRO B */ 1110 { SST(0x11, 0x0D, SS_RDEF, 1111 "De-compression CRC error") }, 1112 /* DT WRO B */ 1113 { SST(0x11, 0x0E, SS_RDEF, 1114 "Cannot decompress using declared algorithm") }, 1115 /* R */ 1116 { SST(0x11, 0x0F, SS_RDEF, 1117 "Error reading UPC/EAN number") }, 1118 /* R */ 1119 { SST(0x11, 0x10, SS_RDEF, 1120 "Error reading ISRC number") }, 1121 /* R */ 1122 { SST(0x11, 0x11, SS_RDEF, 1123 "Read error - loss of streaming") }, 1124 /* DT WROM B */ 1125 { SST(0x11, 0x12, SS_RDEF, /* XXX TBD */ 1126 "Auxiliary memory read error") }, 1127 /* DTLPWRO AEBKVF */ 1128 { SST(0x11, 0x13, SS_RDEF, /* XXX TBD */ 1129 "Read error - failed retransmission request") }, 1130 /* D */ 1131 { SST(0x11, 0x14, SS_RDEF, /* XXX TBD */ 1132 "Read error - LBA marked bad by application client") }, 1133 /* D W O BK */ 1134 { SST(0x12, 0x00, SS_RDEF, 1135 "Address mark not found for ID field") }, 1136 /* D W O BK */ 1137 { SST(0x13, 0x00, SS_RDEF, 1138 "Address mark not found for data field") }, 1139 /* DTL WRO BK */ 1140 { SST(0x14, 0x00, SS_RDEF, 1141 "Recorded entity not found") }, 1142 /* DT WRO BK */ 1143 { SST(0x14, 0x01, SS_RDEF, 1144 "Record not found") }, 1145 /* T */ 1146 { SST(0x14, 0x02, SS_RDEF, 1147 "Filemark or setmark not found") }, 1148 /* T */ 1149 { SST(0x14, 0x03, SS_RDEF, 1150 "End-of-data not found") }, 1151 /* T */ 1152 { SST(0x14, 0x04, SS_RDEF, 1153 "Block sequence error") }, 1154 /* DT W O BK */ 1155 { SST(0x14, 0x05, SS_RDEF, 1156 "Record not found - recommend reassignment") }, 1157 /* DT W O BK */ 1158 { SST(0x14, 0x06, SS_RDEF, 1159 "Record not found - data auto-reallocated") }, 1160 /* T */ 1161 { SST(0x14, 0x07, SS_RDEF, /* XXX TBD */ 1162 "Locate operation failure") }, 1163 /* DTL WROM BK */ 1164 { SST(0x15, 0x00, SS_RDEF, 1165 "Random positioning error") }, 1166 /* DTL WROM BK */ 1167 { SST(0x15, 0x01, SS_RDEF, 1168 "Mechanical positioning error") }, 1169 /* DT WRO BK */ 1170 { SST(0x15, 0x02, SS_RDEF, 1171 "Positioning error detected by read of medium") }, 1172 /* D W O BK */ 1173 { SST(0x16, 0x00, SS_RDEF, 1174 "Data synchronization mark error") }, 1175 /* D W O BK */ 1176 { SST(0x16, 0x01, SS_RDEF, 1177 "Data sync error - data rewritten") }, 1178 /* D W O BK */ 1179 { SST(0x16, 0x02, SS_RDEF, 1180 "Data sync error - recommend rewrite") }, 1181 /* D W O BK */ 1182 { SST(0x16, 0x03, SS_NOP | SSQ_PRINT_SENSE, 1183 "Data sync error - data auto-reallocated") }, 1184 /* D W O BK */ 1185 { SST(0x16, 0x04, SS_RDEF, 1186 "Data sync error - recommend reassignment") }, 1187 /* DT WRO BK */ 1188 { SST(0x17, 0x00, SS_NOP | SSQ_PRINT_SENSE, 1189 "Recovered data with no error correction applied") }, 1190 /* DT WRO BK */ 1191 { SST(0x17, 0x01, SS_NOP | SSQ_PRINT_SENSE, 1192 "Recovered data with retries") }, 1193 /* DT WRO BK */ 1194 { SST(0x17, 0x02, SS_NOP | SSQ_PRINT_SENSE, 1195 "Recovered data with positive head offset") }, 1196 /* DT WRO BK */ 1197 { SST(0x17, 0x03, SS_NOP | SSQ_PRINT_SENSE, 1198 "Recovered data with negative head offset") }, 1199 /* WRO B */ 1200 { SST(0x17, 0x04, SS_NOP | SSQ_PRINT_SENSE, 1201 "Recovered data with retries and/or CIRC applied") }, 1202 /* D WRO BK */ 1203 { SST(0x17, 0x05, SS_NOP | SSQ_PRINT_SENSE, 1204 "Recovered data using previous sector ID") }, 1205 /* D W O BK */ 1206 { SST(0x17, 0x06, SS_NOP | SSQ_PRINT_SENSE, 1207 "Recovered data without ECC - data auto-reallocated") }, 1208 /* D WRO BK */ 1209 { SST(0x17, 0x07, SS_NOP | SSQ_PRINT_SENSE, 1210 "Recovered data without ECC - recommend reassignment") }, 1211 /* D WRO BK */ 1212 { SST(0x17, 0x08, SS_NOP | SSQ_PRINT_SENSE, 1213 "Recovered data without ECC - recommend rewrite") }, 1214 /* D WRO BK */ 1215 { SST(0x17, 0x09, SS_NOP | SSQ_PRINT_SENSE, 1216 "Recovered data without ECC - data rewritten") }, 1217 /* DT WRO BK */ 1218 { SST(0x18, 0x00, SS_NOP | SSQ_PRINT_SENSE, 1219 "Recovered data with error correction applied") }, 1220 /* D WRO BK */ 1221 { SST(0x18, 0x01, SS_NOP | SSQ_PRINT_SENSE, 1222 "Recovered data with error corr. & retries applied") }, 1223 /* D WRO BK */ 1224 { SST(0x18, 0x02, SS_NOP | SSQ_PRINT_SENSE, 1225 "Recovered data - data auto-reallocated") }, 1226 /* R */ 1227 { SST(0x18, 0x03, SS_NOP | SSQ_PRINT_SENSE, 1228 "Recovered data with CIRC") }, 1229 /* R */ 1230 { SST(0x18, 0x04, SS_NOP | SSQ_PRINT_SENSE, 1231 "Recovered data with L-EC") }, 1232 /* D WRO BK */ 1233 { SST(0x18, 0x05, SS_NOP | SSQ_PRINT_SENSE, 1234 "Recovered data - recommend reassignment") }, 1235 /* D WRO BK */ 1236 { SST(0x18, 0x06, SS_NOP | SSQ_PRINT_SENSE, 1237 "Recovered data - recommend rewrite") }, 1238 /* D W O BK */ 1239 { SST(0x18, 0x07, SS_NOP | SSQ_PRINT_SENSE, 1240 "Recovered data with ECC - data rewritten") }, 1241 /* R */ 1242 { SST(0x18, 0x08, SS_RDEF, /* XXX TBD */ 1243 "Recovered data with linking") }, 1244 /* D O K */ 1245 { SST(0x19, 0x00, SS_RDEF, 1246 "Defect list error") }, 1247 /* D O K */ 1248 { SST(0x19, 0x01, SS_RDEF, 1249 "Defect list not available") }, 1250 /* D O K */ 1251 { SST(0x19, 0x02, SS_RDEF, 1252 "Defect list error in primary list") }, 1253 /* D O K */ 1254 { SST(0x19, 0x03, SS_RDEF, 1255 "Defect list error in grown list") }, 1256 /* DTLPWROMAEBKVF */ 1257 { SST(0x1A, 0x00, SS_RDEF, 1258 "Parameter list length error") }, 1259 /* DTLPWROMAEBKVF */ 1260 { SST(0x1B, 0x00, SS_RDEF, 1261 "Synchronous data transfer error") }, 1262 /* D O BK */ 1263 { SST(0x1C, 0x00, SS_RDEF, 1264 "Defect list not found") }, 1265 /* D O BK */ 1266 { SST(0x1C, 0x01, SS_RDEF, 1267 "Primary defect list not found") }, 1268 /* D O BK */ 1269 { SST(0x1C, 0x02, SS_RDEF, 1270 "Grown defect list not found") }, 1271 /* DT WRO BK */ 1272 { SST(0x1D, 0x00, SS_FATAL, 1273 "Miscompare during verify operation") }, 1274 /* D W O BK */ 1275 { SST(0x1E, 0x00, SS_NOP | SSQ_PRINT_SENSE, 1276 "Recovered ID with ECC correction") }, 1277 /* D O K */ 1278 { SST(0x1F, 0x00, SS_RDEF, 1279 "Partial defect list transfer") }, 1280 /* DTLPWROMAEBKVF */ 1281 { SST(0x20, 0x00, SS_FATAL | EINVAL, 1282 "Invalid command operation code") }, 1283 /* DT PWROMAEBK */ 1284 { SST(0x20, 0x01, SS_RDEF, /* XXX TBD */ 1285 "Access denied - initiator pending-enrolled") }, 1286 /* DT PWROMAEBK */ 1287 { SST(0x20, 0x02, SS_RDEF, /* XXX TBD */ 1288 "Access denied - no access rights") }, 1289 /* DT PWROMAEBK */ 1290 { SST(0x20, 0x03, SS_RDEF, /* XXX TBD */ 1291 "Access denied - invalid mgmt ID key") }, 1292 /* T */ 1293 { SST(0x20, 0x04, SS_RDEF, /* XXX TBD */ 1294 "Illegal command while in write capable state") }, 1295 /* T */ 1296 { SST(0x20, 0x05, SS_RDEF, /* XXX TBD */ 1297 "Obsolete") }, 1298 /* T */ 1299 { SST(0x20, 0x06, SS_RDEF, /* XXX TBD */ 1300 "Illegal command while in explicit address mode") }, 1301 /* T */ 1302 { SST(0x20, 0x07, SS_RDEF, /* XXX TBD */ 1303 "Illegal command while in implicit address mode") }, 1304 /* DT PWROMAEBK */ 1305 { SST(0x20, 0x08, SS_RDEF, /* XXX TBD */ 1306 "Access denied - enrollment conflict") }, 1307 /* DT PWROMAEBK */ 1308 { SST(0x20, 0x09, SS_RDEF, /* XXX TBD */ 1309 "Access denied - invalid LU identifier") }, 1310 /* DT PWROMAEBK */ 1311 { SST(0x20, 0x0A, SS_RDEF, /* XXX TBD */ 1312 "Access denied - invalid proxy token") }, 1313 /* DT PWROMAEBK */ 1314 { SST(0x20, 0x0B, SS_RDEF, /* XXX TBD */ 1315 "Access denied - ACL LUN conflict") }, 1316 /* DT WRO BK */ 1317 { SST(0x21, 0x00, SS_FATAL | EINVAL, 1318 "Logical block address out of range") }, 1319 /* DT WROM BK */ 1320 { SST(0x21, 0x01, SS_FATAL | EINVAL, 1321 "Invalid element address") }, 1322 /* R */ 1323 { SST(0x21, 0x02, SS_RDEF, /* XXX TBD */ 1324 "Invalid address for write") }, 1325 /* R */ 1326 { SST(0x21, 0x03, SS_RDEF, /* XXX TBD */ 1327 "Invalid write crossing layer jump") }, 1328 /* D */ 1329 { SST(0x22, 0x00, SS_FATAL | EINVAL, 1330 "Illegal function (use 20 00, 24 00, or 26 00)") }, 1331 /* DTLPWROMAEBKVF */ 1332 { SST(0x24, 0x00, SS_FATAL | EINVAL, 1333 "Invalid field in CDB") }, 1334 /* DTLPWRO AEBKVF */ 1335 { SST(0x24, 0x01, SS_RDEF, /* XXX TBD */ 1336 "CDB decryption error") }, 1337 /* T */ 1338 { SST(0x24, 0x02, SS_RDEF, /* XXX TBD */ 1339 "Obsolete") }, 1340 /* T */ 1341 { SST(0x24, 0x03, SS_RDEF, /* XXX TBD */ 1342 "Obsolete") }, 1343 /* F */ 1344 { SST(0x24, 0x04, SS_RDEF, /* XXX TBD */ 1345 "Security audit value frozen") }, 1346 /* F */ 1347 { SST(0x24, 0x05, SS_RDEF, /* XXX TBD */ 1348 "Security working key frozen") }, 1349 /* F */ 1350 { SST(0x24, 0x06, SS_RDEF, /* XXX TBD */ 1351 "NONCE not unique") }, 1352 /* F */ 1353 { SST(0x24, 0x07, SS_RDEF, /* XXX TBD */ 1354 "NONCE timestamp out of range") }, 1355 /* DT R MAEBKV */ 1356 { SST(0x24, 0x08, SS_RDEF, /* XXX TBD */ 1357 "Invalid XCDB") }, 1358 /* DTLPWROMAEBKVF */ 1359 { SST(0x25, 0x00, SS_FATAL | ENXIO, 1360 "Logical unit not supported") }, 1361 /* DTLPWROMAEBKVF */ 1362 { SST(0x26, 0x00, SS_FATAL | EINVAL, 1363 "Invalid field in parameter list") }, 1364 /* DTLPWROMAEBKVF */ 1365 { SST(0x26, 0x01, SS_FATAL | EINVAL, 1366 "Parameter not supported") }, 1367 /* DTLPWROMAEBKVF */ 1368 { SST(0x26, 0x02, SS_FATAL | EINVAL, 1369 "Parameter value invalid") }, 1370 /* DTLPWROMAE K */ 1371 { SST(0x26, 0x03, SS_FATAL | EINVAL, 1372 "Threshold parameters not supported") }, 1373 /* DTLPWROMAEBKVF */ 1374 { SST(0x26, 0x04, SS_FATAL | EINVAL, 1375 "Invalid release of persistent reservation") }, 1376 /* DTLPWRO A BK */ 1377 { SST(0x26, 0x05, SS_RDEF, /* XXX TBD */ 1378 "Data decryption error") }, 1379 /* DTLPWRO K */ 1380 { SST(0x26, 0x06, SS_RDEF, /* XXX TBD */ 1381 "Too many target descriptors") }, 1382 /* DTLPWRO K */ 1383 { SST(0x26, 0x07, SS_RDEF, /* XXX TBD */ 1384 "Unsupported target descriptor type code") }, 1385 /* DTLPWRO K */ 1386 { SST(0x26, 0x08, SS_RDEF, /* XXX TBD */ 1387 "Too many segment descriptors") }, 1388 /* DTLPWRO K */ 1389 { SST(0x26, 0x09, SS_RDEF, /* XXX TBD */ 1390 "Unsupported segment descriptor type code") }, 1391 /* DTLPWRO K */ 1392 { SST(0x26, 0x0A, SS_RDEF, /* XXX TBD */ 1393 "Unexpected inexact segment") }, 1394 /* DTLPWRO K */ 1395 { SST(0x26, 0x0B, SS_RDEF, /* XXX TBD */ 1396 "Inline data length exceeded") }, 1397 /* DTLPWRO K */ 1398 { SST(0x26, 0x0C, SS_RDEF, /* XXX TBD */ 1399 "Invalid operation for copy source or destination") }, 1400 /* DTLPWRO K */ 1401 { SST(0x26, 0x0D, SS_RDEF, /* XXX TBD */ 1402 "Copy segment granularity violation") }, 1403 /* DT PWROMAEBK */ 1404 { SST(0x26, 0x0E, SS_RDEF, /* XXX TBD */ 1405 "Invalid parameter while port is enabled") }, 1406 /* F */ 1407 { SST(0x26, 0x0F, SS_RDEF, /* XXX TBD */ 1408 "Invalid data-out buffer integrity check value") }, 1409 /* T */ 1410 { SST(0x26, 0x10, SS_RDEF, /* XXX TBD */ 1411 "Data decryption key fail limit reached") }, 1412 /* T */ 1413 { SST(0x26, 0x11, SS_RDEF, /* XXX TBD */ 1414 "Incomplete key-associated data set") }, 1415 /* T */ 1416 { SST(0x26, 0x12, SS_RDEF, /* XXX TBD */ 1417 "Vendor specific key reference not found") }, 1418 /* DT WRO BK */ 1419 { SST(0x27, 0x00, SS_FATAL | EACCES, 1420 "Write protected") }, 1421 /* DT WRO BK */ 1422 { SST(0x27, 0x01, SS_FATAL | EACCES, 1423 "Hardware write protected") }, 1424 /* DT WRO BK */ 1425 { SST(0x27, 0x02, SS_FATAL | EACCES, 1426 "Logical unit software write protected") }, 1427 /* T R */ 1428 { SST(0x27, 0x03, SS_FATAL | EACCES, 1429 "Associated write protect") }, 1430 /* T R */ 1431 { SST(0x27, 0x04, SS_FATAL | EACCES, 1432 "Persistent write protect") }, 1433 /* T R */ 1434 { SST(0x27, 0x05, SS_FATAL | EACCES, 1435 "Permanent write protect") }, 1436 /* R F */ 1437 { SST(0x27, 0x06, SS_RDEF, /* XXX TBD */ 1438 "Conditional write protect") }, 1439 /* DTLPWROMAEBKVF */ 1440 { SST(0x28, 0x00, SS_FATAL | ENXIO, 1441 "Not ready to ready change, medium may have changed") }, 1442 /* DT WROM B */ 1443 { SST(0x28, 0x01, SS_FATAL | ENXIO, 1444 "Import or export element accessed") }, 1445 /* R */ 1446 { SST(0x28, 0x02, SS_RDEF, /* XXX TBD */ 1447 "Format-layer may have changed") }, 1448 /* M */ 1449 { SST(0x28, 0x03, SS_RDEF, /* XXX TBD */ 1450 "Import/export element accessed, medium changed") }, 1451 /* 1452 * XXX JGibbs - All of these should use the same errno, but I don't 1453 * think ENXIO is the correct choice. Should we borrow from 1454 * the networking errnos? ECONNRESET anyone? 1455 */ 1456 /* DTLPWROMAEBKVF */ 1457 { SST(0x29, 0x00, SS_FATAL | ENXIO, 1458 "Power on, reset, or bus device reset occurred") }, 1459 /* DTLPWROMAEBKVF */ 1460 { SST(0x29, 0x01, SS_RDEF, 1461 "Power on occurred") }, 1462 /* DTLPWROMAEBKVF */ 1463 { SST(0x29, 0x02, SS_RDEF, 1464 "SCSI bus reset occurred") }, 1465 /* DTLPWROMAEBKVF */ 1466 { SST(0x29, 0x03, SS_RDEF, 1467 "Bus device reset function occurred") }, 1468 /* DTLPWROMAEBKVF */ 1469 { SST(0x29, 0x04, SS_RDEF, 1470 "Device internal reset") }, 1471 /* DTLPWROMAEBKVF */ 1472 { SST(0x29, 0x05, SS_RDEF, 1473 "Transceiver mode changed to single-ended") }, 1474 /* DTLPWROMAEBKVF */ 1475 { SST(0x29, 0x06, SS_RDEF, 1476 "Transceiver mode changed to LVD") }, 1477 /* DTLPWROMAEBKVF */ 1478 { SST(0x29, 0x07, SS_RDEF, /* XXX TBD */ 1479 "I_T nexus loss occurred") }, 1480 /* DTL WROMAEBKVF */ 1481 { SST(0x2A, 0x00, SS_RDEF, 1482 "Parameters changed") }, 1483 /* DTL WROMAEBKVF */ 1484 { SST(0x2A, 0x01, SS_RDEF, 1485 "Mode parameters changed") }, 1486 /* DTL WROMAE K */ 1487 { SST(0x2A, 0x02, SS_RDEF, 1488 "Log parameters changed") }, 1489 /* DTLPWROMAE K */ 1490 { SST(0x2A, 0x03, SS_RDEF, 1491 "Reservations preempted") }, 1492 /* DTLPWROMAE */ 1493 { SST(0x2A, 0x04, SS_RDEF, /* XXX TBD */ 1494 "Reservations released") }, 1495 /* DTLPWROMAE */ 1496 { SST(0x2A, 0x05, SS_RDEF, /* XXX TBD */ 1497 "Registrations preempted") }, 1498 /* DTLPWROMAEBKVF */ 1499 { SST(0x2A, 0x06, SS_RDEF, /* XXX TBD */ 1500 "Asymmetric access state changed") }, 1501 /* DTLPWROMAEBKVF */ 1502 { SST(0x2A, 0x07, SS_RDEF, /* XXX TBD */ 1503 "Implicit asymmetric access state transition failed") }, 1504 /* DT WROMAEBKVF */ 1505 { SST(0x2A, 0x08, SS_RDEF, /* XXX TBD */ 1506 "Priority changed") }, 1507 /* D */ 1508 { SST(0x2A, 0x09, SS_RDEF, /* XXX TBD */ 1509 "Capacity data has changed") }, 1510 /* DT */ 1511 { SST(0x2A, 0x0A, SS_RDEF, /* XXX TBD */ 1512 "Error history I_T nexus cleared") }, 1513 /* DT */ 1514 { SST(0x2A, 0x0B, SS_RDEF, /* XXX TBD */ 1515 "Error history snapshot released") }, 1516 /* F */ 1517 { SST(0x2A, 0x0C, SS_RDEF, /* XXX TBD */ 1518 "Error recovery attributes have changed") }, 1519 /* T */ 1520 { SST(0x2A, 0x0D, SS_RDEF, /* XXX TBD */ 1521 "Data encryption capabilities changed") }, 1522 /* DT M E V */ 1523 { SST(0x2A, 0x10, SS_RDEF, /* XXX TBD */ 1524 "Timestamp changed") }, 1525 /* T */ 1526 { SST(0x2A, 0x11, SS_RDEF, /* XXX TBD */ 1527 "Data encryption parameters changed by another I_T nexus") }, 1528 /* T */ 1529 { SST(0x2A, 0x12, SS_RDEF, /* XXX TBD */ 1530 "Data encryption parameters changed by vendor specific event") }, 1531 /* T */ 1532 { SST(0x2A, 0x13, SS_RDEF, /* XXX TBD */ 1533 "Data encryption key instance counter has changed") }, 1534 /* DT R MAEBKV */ 1535 { SST(0x2A, 0x14, SS_RDEF, /* XXX TBD */ 1536 "SA creation capabilities data has changed") }, 1537 /* DTLPWRO K */ 1538 { SST(0x2B, 0x00, SS_RDEF, 1539 "Copy cannot execute since host cannot disconnect") }, 1540 /* DTLPWROMAEBKVF */ 1541 { SST(0x2C, 0x00, SS_RDEF, 1542 "Command sequence error") }, 1543 /* */ 1544 { SST(0x2C, 0x01, SS_RDEF, 1545 "Too many windows specified") }, 1546 /* */ 1547 { SST(0x2C, 0x02, SS_RDEF, 1548 "Invalid combination of windows specified") }, 1549 /* R */ 1550 { SST(0x2C, 0x03, SS_RDEF, 1551 "Current program area is not empty") }, 1552 /* R */ 1553 { SST(0x2C, 0x04, SS_RDEF, 1554 "Current program area is empty") }, 1555 /* B */ 1556 { SST(0x2C, 0x05, SS_RDEF, /* XXX TBD */ 1557 "Illegal power condition request") }, 1558 /* R */ 1559 { SST(0x2C, 0x06, SS_RDEF, /* XXX TBD */ 1560 "Persistent prevent conflict") }, 1561 /* DTLPWROMAEBKVF */ 1562 { SST(0x2C, 0x07, SS_RDEF, /* XXX TBD */ 1563 "Previous busy status") }, 1564 /* DTLPWROMAEBKVF */ 1565 { SST(0x2C, 0x08, SS_RDEF, /* XXX TBD */ 1566 "Previous task set full status") }, 1567 /* DTLPWROM EBKVF */ 1568 { SST(0x2C, 0x09, SS_RDEF, /* XXX TBD */ 1569 "Previous reservation conflict status") }, 1570 /* F */ 1571 { SST(0x2C, 0x0A, SS_RDEF, /* XXX TBD */ 1572 "Partition or collection contains user objects") }, 1573 /* T */ 1574 { SST(0x2C, 0x0B, SS_RDEF, /* XXX TBD */ 1575 "Not reserved") }, 1576 /* T */ 1577 { SST(0x2D, 0x00, SS_RDEF, 1578 "Overwrite error on update in place") }, 1579 /* R */ 1580 { SST(0x2E, 0x00, SS_RDEF, /* XXX TBD */ 1581 "Insufficient time for operation") }, 1582 /* DTLPWROMAEBKVF */ 1583 { SST(0x2F, 0x00, SS_RDEF, 1584 "Commands cleared by another initiator") }, 1585 /* D */ 1586 { SST(0x2F, 0x01, SS_RDEF, /* XXX TBD */ 1587 "Commands cleared by power loss notification") }, 1588 /* DTLPWROMAEBKVF */ 1589 { SST(0x2F, 0x02, SS_RDEF, /* XXX TBD */ 1590 "Commands cleared by device server") }, 1591 /* DT WROM BK */ 1592 { SST(0x30, 0x00, SS_RDEF, 1593 "Incompatible medium installed") }, 1594 /* DT WRO BK */ 1595 { SST(0x30, 0x01, SS_RDEF, 1596 "Cannot read medium - unknown format") }, 1597 /* DT WRO BK */ 1598 { SST(0x30, 0x02, SS_RDEF, 1599 "Cannot read medium - incompatible format") }, 1600 /* DT R K */ 1601 { SST(0x30, 0x03, SS_RDEF, 1602 "Cleaning cartridge installed") }, 1603 /* DT WRO BK */ 1604 { SST(0x30, 0x04, SS_RDEF, 1605 "Cannot write medium - unknown format") }, 1606 /* DT WRO BK */ 1607 { SST(0x30, 0x05, SS_RDEF, 1608 "Cannot write medium - incompatible format") }, 1609 /* DT WRO B */ 1610 { SST(0x30, 0x06, SS_RDEF, 1611 "Cannot format medium - incompatible medium") }, 1612 /* DTL WROMAEBKVF */ 1613 { SST(0x30, 0x07, SS_RDEF, 1614 "Cleaning failure") }, 1615 /* R */ 1616 { SST(0x30, 0x08, SS_RDEF, 1617 "Cannot write - application code mismatch") }, 1618 /* R */ 1619 { SST(0x30, 0x09, SS_RDEF, 1620 "Current session not fixated for append") }, 1621 /* DT WRO AEBK */ 1622 { SST(0x30, 0x0A, SS_RDEF, /* XXX TBD */ 1623 "Cleaning request rejected") }, 1624 /* T */ 1625 { SST(0x30, 0x0C, SS_RDEF, /* XXX TBD */ 1626 "WORM medium - overwrite attempted") }, 1627 /* T */ 1628 { SST(0x30, 0x0D, SS_RDEF, /* XXX TBD */ 1629 "WORM medium - integrity check") }, 1630 /* R */ 1631 { SST(0x30, 0x10, SS_RDEF, /* XXX TBD */ 1632 "Medium not formatted") }, 1633 /* M */ 1634 { SST(0x30, 0x11, SS_RDEF, /* XXX TBD */ 1635 "Incompatible volume type") }, 1636 /* M */ 1637 { SST(0x30, 0x12, SS_RDEF, /* XXX TBD */ 1638 "Incompatible volume qualifier") }, 1639 /* DT WRO BK */ 1640 { SST(0x31, 0x00, SS_RDEF, 1641 "Medium format corrupted") }, 1642 /* D L RO B */ 1643 { SST(0x31, 0x01, SS_RDEF, 1644 "Format command failed") }, 1645 /* R */ 1646 { SST(0x31, 0x02, SS_RDEF, /* XXX TBD */ 1647 "Zoned formatting failed due to spare linking") }, 1648 /* D W O BK */ 1649 { SST(0x32, 0x00, SS_RDEF, 1650 "No defect spare location available") }, 1651 /* D W O BK */ 1652 { SST(0x32, 0x01, SS_RDEF, 1653 "Defect list update failure") }, 1654 /* T */ 1655 { SST(0x33, 0x00, SS_RDEF, 1656 "Tape length error") }, 1657 /* DTLPWROMAEBKVF */ 1658 { SST(0x34, 0x00, SS_RDEF, 1659 "Enclosure failure") }, 1660 /* DTLPWROMAEBKVF */ 1661 { SST(0x35, 0x00, SS_RDEF, 1662 "Enclosure services failure") }, 1663 /* DTLPWROMAEBKVF */ 1664 { SST(0x35, 0x01, SS_RDEF, 1665 "Unsupported enclosure function") }, 1666 /* DTLPWROMAEBKVF */ 1667 { SST(0x35, 0x02, SS_RDEF, 1668 "Enclosure services unavailable") }, 1669 /* DTLPWROMAEBKVF */ 1670 { SST(0x35, 0x03, SS_RDEF, 1671 "Enclosure services transfer failure") }, 1672 /* DTLPWROMAEBKVF */ 1673 { SST(0x35, 0x04, SS_RDEF, 1674 "Enclosure services transfer refused") }, 1675 /* DTL WROMAEBKVF */ 1676 { SST(0x35, 0x05, SS_RDEF, /* XXX TBD */ 1677 "Enclosure services checksum error") }, 1678 /* L */ 1679 { SST(0x36, 0x00, SS_RDEF, 1680 "Ribbon, ink, or toner failure") }, 1681 /* DTL WROMAEBKVF */ 1682 { SST(0x37, 0x00, SS_RDEF, 1683 "Rounded parameter") }, 1684 /* B */ 1685 { SST(0x38, 0x00, SS_RDEF, /* XXX TBD */ 1686 "Event status notification") }, 1687 /* B */ 1688 { SST(0x38, 0x02, SS_RDEF, /* XXX TBD */ 1689 "ESN - power management class event") }, 1690 /* B */ 1691 { SST(0x38, 0x04, SS_RDEF, /* XXX TBD */ 1692 "ESN - media class event") }, 1693 /* B */ 1694 { SST(0x38, 0x06, SS_RDEF, /* XXX TBD */ 1695 "ESN - device busy class event") }, 1696 /* DTL WROMAE K */ 1697 { SST(0x39, 0x00, SS_RDEF, 1698 "Saving parameters not supported") }, 1699 /* DTL WROM BK */ 1700 { SST(0x3A, 0x00, SS_FATAL | ENXIO, 1701 "Medium not present") }, 1702 /* DT WROM BK */ 1703 { SST(0x3A, 0x01, SS_FATAL | ENXIO, 1704 "Medium not present - tray closed") }, 1705 /* DT WROM BK */ 1706 { SST(0x3A, 0x02, SS_FATAL | ENXIO, 1707 "Medium not present - tray open") }, 1708 /* DT WROM B */ 1709 { SST(0x3A, 0x03, SS_RDEF, /* XXX TBD */ 1710 "Medium not present - loadable") }, 1711 /* DT WRO B */ 1712 { SST(0x3A, 0x04, SS_RDEF, /* XXX TBD */ 1713 "Medium not present - medium auxiliary memory accessible") }, 1714 /* TL */ 1715 { SST(0x3B, 0x00, SS_RDEF, 1716 "Sequential positioning error") }, 1717 /* T */ 1718 { SST(0x3B, 0x01, SS_RDEF, 1719 "Tape position error at beginning-of-medium") }, 1720 /* T */ 1721 { SST(0x3B, 0x02, SS_RDEF, 1722 "Tape position error at end-of-medium") }, 1723 /* L */ 1724 { SST(0x3B, 0x03, SS_RDEF, 1725 "Tape or electronic vertical forms unit not ready") }, 1726 /* L */ 1727 { SST(0x3B, 0x04, SS_RDEF, 1728 "Slew failure") }, 1729 /* L */ 1730 { SST(0x3B, 0x05, SS_RDEF, 1731 "Paper jam") }, 1732 /* L */ 1733 { SST(0x3B, 0x06, SS_RDEF, 1734 "Failed to sense top-of-form") }, 1735 /* L */ 1736 { SST(0x3B, 0x07, SS_RDEF, 1737 "Failed to sense bottom-of-form") }, 1738 /* T */ 1739 { SST(0x3B, 0x08, SS_RDEF, 1740 "Reposition error") }, 1741 /* */ 1742 { SST(0x3B, 0x09, SS_RDEF, 1743 "Read past end of medium") }, 1744 /* */ 1745 { SST(0x3B, 0x0A, SS_RDEF, 1746 "Read past beginning of medium") }, 1747 /* */ 1748 { SST(0x3B, 0x0B, SS_RDEF, 1749 "Position past end of medium") }, 1750 /* T */ 1751 { SST(0x3B, 0x0C, SS_RDEF, 1752 "Position past beginning of medium") }, 1753 /* DT WROM BK */ 1754 { SST(0x3B, 0x0D, SS_FATAL | ENOSPC, 1755 "Medium destination element full") }, 1756 /* DT WROM BK */ 1757 { SST(0x3B, 0x0E, SS_RDEF, 1758 "Medium source element empty") }, 1759 /* R */ 1760 { SST(0x3B, 0x0F, SS_RDEF, 1761 "End of medium reached") }, 1762 /* DT WROM BK */ 1763 { SST(0x3B, 0x11, SS_RDEF, 1764 "Medium magazine not accessible") }, 1765 /* DT WROM BK */ 1766 { SST(0x3B, 0x12, SS_RDEF, 1767 "Medium magazine removed") }, 1768 /* DT WROM BK */ 1769 { SST(0x3B, 0x13, SS_RDEF, 1770 "Medium magazine inserted") }, 1771 /* DT WROM BK */ 1772 { SST(0x3B, 0x14, SS_RDEF, 1773 "Medium magazine locked") }, 1774 /* DT WROM BK */ 1775 { SST(0x3B, 0x15, SS_RDEF, 1776 "Medium magazine unlocked") }, 1777 /* R */ 1778 { SST(0x3B, 0x16, SS_RDEF, /* XXX TBD */ 1779 "Mechanical positioning or changer error") }, 1780 /* F */ 1781 { SST(0x3B, 0x17, SS_RDEF, /* XXX TBD */ 1782 "Read past end of user object") }, 1783 /* M */ 1784 { SST(0x3B, 0x18, SS_RDEF, /* XXX TBD */ 1785 "Element disabled") }, 1786 /* M */ 1787 { SST(0x3B, 0x19, SS_RDEF, /* XXX TBD */ 1788 "Element enabled") }, 1789 /* M */ 1790 { SST(0x3B, 0x1A, SS_RDEF, /* XXX TBD */ 1791 "Data transfer device removed") }, 1792 /* M */ 1793 { SST(0x3B, 0x1B, SS_RDEF, /* XXX TBD */ 1794 "Data transfer device inserted") }, 1795 /* DTLPWROMAE K */ 1796 { SST(0x3D, 0x00, SS_RDEF, 1797 "Invalid bits in IDENTIFY message") }, 1798 /* DTLPWROMAEBKVF */ 1799 { SST(0x3E, 0x00, SS_RDEF, 1800 "Logical unit has not self-configured yet") }, 1801 /* DTLPWROMAEBKVF */ 1802 { SST(0x3E, 0x01, SS_RDEF, 1803 "Logical unit failure") }, 1804 /* DTLPWROMAEBKVF */ 1805 { SST(0x3E, 0x02, SS_RDEF, 1806 "Timeout on logical unit") }, 1807 /* DTLPWROMAEBKVF */ 1808 { SST(0x3E, 0x03, SS_RDEF, /* XXX TBD */ 1809 "Logical unit failed self-test") }, 1810 /* DTLPWROMAEBKVF */ 1811 { SST(0x3E, 0x04, SS_RDEF, /* XXX TBD */ 1812 "Logical unit unable to update self-test log") }, 1813 /* DTLPWROMAEBKVF */ 1814 { SST(0x3F, 0x00, SS_RDEF, 1815 "Target operating conditions have changed") }, 1816 /* DTLPWROMAEBKVF */ 1817 { SST(0x3F, 0x01, SS_RDEF, 1818 "Microcode has been changed") }, 1819 /* DTLPWROM BK */ 1820 { SST(0x3F, 0x02, SS_RDEF, 1821 "Changed operating definition") }, 1822 /* DTLPWROMAEBKVF */ 1823 { SST(0x3F, 0x03, SS_RDEF, 1824 "INQUIRY data has changed") }, 1825 /* DT WROMAEBK */ 1826 { SST(0x3F, 0x04, SS_RDEF, 1827 "Component device attached") }, 1828 /* DT WROMAEBK */ 1829 { SST(0x3F, 0x05, SS_RDEF, 1830 "Device identifier changed") }, 1831 /* DT WROMAEB */ 1832 { SST(0x3F, 0x06, SS_RDEF, 1833 "Redundancy group created or modified") }, 1834 /* DT WROMAEB */ 1835 { SST(0x3F, 0x07, SS_RDEF, 1836 "Redundancy group deleted") }, 1837 /* DT WROMAEB */ 1838 { SST(0x3F, 0x08, SS_RDEF, 1839 "Spare created or modified") }, 1840 /* DT WROMAEB */ 1841 { SST(0x3F, 0x09, SS_RDEF, 1842 "Spare deleted") }, 1843 /* DT WROMAEBK */ 1844 { SST(0x3F, 0x0A, SS_RDEF, 1845 "Volume set created or modified") }, 1846 /* DT WROMAEBK */ 1847 { SST(0x3F, 0x0B, SS_RDEF, 1848 "Volume set deleted") }, 1849 /* DT WROMAEBK */ 1850 { SST(0x3F, 0x0C, SS_RDEF, 1851 "Volume set deassigned") }, 1852 /* DT WROMAEBK */ 1853 { SST(0x3F, 0x0D, SS_RDEF, 1854 "Volume set reassigned") }, 1855 /* DTLPWROMAE */ 1856 { SST(0x3F, 0x0E, SS_RDEF, /* XXX TBD */ 1857 "Reported LUNs data has changed") }, 1858 /* DTLPWROMAEBKVF */ 1859 { SST(0x3F, 0x0F, SS_RDEF, /* XXX TBD */ 1860 "Echo buffer overwritten") }, 1861 /* DT WROM B */ 1862 { SST(0x3F, 0x10, SS_RDEF, /* XXX TBD */ 1863 "Medium loadable") }, 1864 /* DT WROM B */ 1865 { SST(0x3F, 0x11, SS_RDEF, /* XXX TBD */ 1866 "Medium auxiliary memory accessible") }, 1867 /* DTLPWR MAEBK F */ 1868 { SST(0x3F, 0x12, SS_RDEF, /* XXX TBD */ 1869 "iSCSI IP address added") }, 1870 /* DTLPWR MAEBK F */ 1871 { SST(0x3F, 0x13, SS_RDEF, /* XXX TBD */ 1872 "iSCSI IP address removed") }, 1873 /* DTLPWR MAEBK F */ 1874 { SST(0x3F, 0x14, SS_RDEF, /* XXX TBD */ 1875 "iSCSI IP address changed") }, 1876 /* D */ 1877 { SST(0x40, 0x00, SS_RDEF, 1878 "RAM failure") }, /* deprecated - use 40 NN instead */ 1879 /* DTLPWROMAEBKVF */ 1880 { SST(0x40, 0x80, SS_RDEF, 1881 "Diagnostic failure: ASCQ = Component ID") }, 1882 /* DTLPWROMAEBKVF */ 1883 { SST(0x40, 0xFF, SS_RDEF | SSQ_RANGE, 1884 NULL) }, /* Range 0x80->0xFF */ 1885 /* D */ 1886 { SST(0x41, 0x00, SS_RDEF, 1887 "Data path failure") }, /* deprecated - use 40 NN instead */ 1888 /* D */ 1889 { SST(0x42, 0x00, SS_RDEF, 1890 "Power-on or self-test failure") }, 1891 /* deprecated - use 40 NN instead */ 1892 /* DTLPWROMAEBKVF */ 1893 { SST(0x43, 0x00, SS_RDEF, 1894 "Message error") }, 1895 /* DTLPWROMAEBKVF */ 1896 { SST(0x44, 0x00, SS_RDEF, 1897 "Internal target failure") }, 1898 /* DT B */ 1899 { SST(0x44, 0x71, SS_RDEF, /* XXX TBD */ 1900 "ATA device failed set features") }, 1901 /* DTLPWROMAEBKVF */ 1902 { SST(0x45, 0x00, SS_RDEF, 1903 "Select or reselect failure") }, 1904 /* DTLPWROM BK */ 1905 { SST(0x46, 0x00, SS_RDEF, 1906 "Unsuccessful soft reset") }, 1907 /* DTLPWROMAEBKVF */ 1908 { SST(0x47, 0x00, SS_RDEF, 1909 "SCSI parity error") }, 1910 /* DTLPWROMAEBKVF */ 1911 { SST(0x47, 0x01, SS_RDEF, /* XXX TBD */ 1912 "Data phase CRC error detected") }, 1913 /* DTLPWROMAEBKVF */ 1914 { SST(0x47, 0x02, SS_RDEF, /* XXX TBD */ 1915 "SCSI parity error detected during ST data phase") }, 1916 /* DTLPWROMAEBKVF */ 1917 { SST(0x47, 0x03, SS_RDEF, /* XXX TBD */ 1918 "Information unit iuCRC error detected") }, 1919 /* DTLPWROMAEBKVF */ 1920 { SST(0x47, 0x04, SS_RDEF, /* XXX TBD */ 1921 "Asynchronous information protection error detected") }, 1922 /* DTLPWROMAEBKVF */ 1923 { SST(0x47, 0x05, SS_RDEF, /* XXX TBD */ 1924 "Protocol service CRC error") }, 1925 /* DT MAEBKVF */ 1926 { SST(0x47, 0x06, SS_RDEF, /* XXX TBD */ 1927 "PHY test function in progress") }, 1928 /* DT PWROMAEBK */ 1929 { SST(0x47, 0x7F, SS_RDEF, /* XXX TBD */ 1930 "Some commands cleared by iSCSI protocol event") }, 1931 /* DTLPWROMAEBKVF */ 1932 { SST(0x48, 0x00, SS_RDEF, 1933 "Initiator detected error message received") }, 1934 /* DTLPWROMAEBKVF */ 1935 { SST(0x49, 0x00, SS_RDEF, 1936 "Invalid message error") }, 1937 /* DTLPWROMAEBKVF */ 1938 { SST(0x4A, 0x00, SS_RDEF, 1939 "Command phase error") }, 1940 /* DTLPWROMAEBKVF */ 1941 { SST(0x4B, 0x00, SS_RDEF, 1942 "Data phase error") }, 1943 /* DT PWROMAEBK */ 1944 { SST(0x4B, 0x01, SS_RDEF, /* XXX TBD */ 1945 "Invalid target port transfer tag received") }, 1946 /* DT PWROMAEBK */ 1947 { SST(0x4B, 0x02, SS_RDEF, /* XXX TBD */ 1948 "Too much write data") }, 1949 /* DT PWROMAEBK */ 1950 { SST(0x4B, 0x03, SS_RDEF, /* XXX TBD */ 1951 "ACK/NAK timeout") }, 1952 /* DT PWROMAEBK */ 1953 { SST(0x4B, 0x04, SS_RDEF, /* XXX TBD */ 1954 "NAK received") }, 1955 /* DT PWROMAEBK */ 1956 { SST(0x4B, 0x05, SS_RDEF, /* XXX TBD */ 1957 "Data offset error") }, 1958 /* DT PWROMAEBK */ 1959 { SST(0x4B, 0x06, SS_RDEF, /* XXX TBD */ 1960 "Initiator response timeout") }, 1961 /* DTLPWROMAEBKVF */ 1962 { SST(0x4C, 0x00, SS_RDEF, 1963 "Logical unit failed self-configuration") }, 1964 /* DTLPWROMAEBKVF */ 1965 { SST(0x4D, 0x00, SS_RDEF, 1966 "Tagged overlapped commands: ASCQ = Queue tag ID") }, 1967 /* DTLPWROMAEBKVF */ 1968 { SST(0x4D, 0xFF, SS_RDEF | SSQ_RANGE, 1969 NULL) }, /* Range 0x00->0xFF */ 1970 /* DTLPWROMAEBKVF */ 1971 { SST(0x4E, 0x00, SS_RDEF, 1972 "Overlapped commands attempted") }, 1973 /* T */ 1974 { SST(0x50, 0x00, SS_RDEF, 1975 "Write append error") }, 1976 /* T */ 1977 { SST(0x50, 0x01, SS_RDEF, 1978 "Write append position error") }, 1979 /* T */ 1980 { SST(0x50, 0x02, SS_RDEF, 1981 "Position error related to timing") }, 1982 /* T RO */ 1983 { SST(0x51, 0x00, SS_RDEF, 1984 "Erase failure") }, 1985 /* R */ 1986 { SST(0x51, 0x01, SS_RDEF, /* XXX TBD */ 1987 "Erase failure - incomplete erase operation detected") }, 1988 /* T */ 1989 { SST(0x52, 0x00, SS_RDEF, 1990 "Cartridge fault") }, 1991 /* DTL WROM BK */ 1992 { SST(0x53, 0x00, SS_RDEF, 1993 "Media load or eject failed") }, 1994 /* T */ 1995 { SST(0x53, 0x01, SS_RDEF, 1996 "Unload tape failure") }, 1997 /* DT WROM BK */ 1998 { SST(0x53, 0x02, SS_RDEF, 1999 "Medium removal prevented") }, 2000 /* M */ 2001 { SST(0x53, 0x03, SS_RDEF, /* XXX TBD */ 2002 "Medium removal prevented by data transfer element") }, 2003 /* T */ 2004 { SST(0x53, 0x04, SS_RDEF, /* XXX TBD */ 2005 "Medium thread or unthread failure") }, 2006 /* P */ 2007 { SST(0x54, 0x00, SS_RDEF, 2008 "SCSI to host system interface failure") }, 2009 /* P */ 2010 { SST(0x55, 0x00, SS_RDEF, 2011 "System resource failure") }, 2012 /* D O BK */ 2013 { SST(0x55, 0x01, SS_FATAL | ENOSPC, 2014 "System buffer full") }, 2015 /* DTLPWROMAE K */ 2016 { SST(0x55, 0x02, SS_RDEF, /* XXX TBD */ 2017 "Insufficient reservation resources") }, 2018 /* DTLPWROMAE K */ 2019 { SST(0x55, 0x03, SS_RDEF, /* XXX TBD */ 2020 "Insufficient resources") }, 2021 /* DTLPWROMAE K */ 2022 { SST(0x55, 0x04, SS_RDEF, /* XXX TBD */ 2023 "Insufficient registration resources") }, 2024 /* DT PWROMAEBK */ 2025 { SST(0x55, 0x05, SS_RDEF, /* XXX TBD */ 2026 "Insufficient access control resources") }, 2027 /* DT WROM B */ 2028 { SST(0x55, 0x06, SS_RDEF, /* XXX TBD */ 2029 "Auxiliary memory out of space") }, 2030 /* F */ 2031 { SST(0x55, 0x07, SS_RDEF, /* XXX TBD */ 2032 "Quota error") }, 2033 /* T */ 2034 { SST(0x55, 0x08, SS_RDEF, /* XXX TBD */ 2035 "Maximum number of supplemental decryption keys exceeded") }, 2036 /* M */ 2037 { SST(0x55, 0x09, SS_RDEF, /* XXX TBD */ 2038 "Medium auxiliary memory not accessible") }, 2039 /* M */ 2040 { SST(0x55, 0x0A, SS_RDEF, /* XXX TBD */ 2041 "Data currently unavailable") }, 2042 /* R */ 2043 { SST(0x57, 0x00, SS_RDEF, 2044 "Unable to recover table-of-contents") }, 2045 /* O */ 2046 { SST(0x58, 0x00, SS_RDEF, 2047 "Generation does not exist") }, 2048 /* O */ 2049 { SST(0x59, 0x00, SS_RDEF, 2050 "Updated block read") }, 2051 /* DTLPWRO BK */ 2052 { SST(0x5A, 0x00, SS_RDEF, 2053 "Operator request or state change input") }, 2054 /* DT WROM BK */ 2055 { SST(0x5A, 0x01, SS_RDEF, 2056 "Operator medium removal request") }, 2057 /* DT WRO A BK */ 2058 { SST(0x5A, 0x02, SS_RDEF, 2059 "Operator selected write protect") }, 2060 /* DT WRO A BK */ 2061 { SST(0x5A, 0x03, SS_RDEF, 2062 "Operator selected write permit") }, 2063 /* DTLPWROM K */ 2064 { SST(0x5B, 0x00, SS_RDEF, 2065 "Log exception") }, 2066 /* DTLPWROM K */ 2067 { SST(0x5B, 0x01, SS_RDEF, 2068 "Threshold condition met") }, 2069 /* DTLPWROM K */ 2070 { SST(0x5B, 0x02, SS_RDEF, 2071 "Log counter at maximum") }, 2072 /* DTLPWROM K */ 2073 { SST(0x5B, 0x03, SS_RDEF, 2074 "Log list codes exhausted") }, 2075 /* D O */ 2076 { SST(0x5C, 0x00, SS_RDEF, 2077 "RPL status change") }, 2078 /* D O */ 2079 { SST(0x5C, 0x01, SS_NOP | SSQ_PRINT_SENSE, 2080 "Spindles synchronized") }, 2081 /* D O */ 2082 { SST(0x5C, 0x02, SS_RDEF, 2083 "Spindles not synchronized") }, 2084 /* DTLPWROMAEBKVF */ 2085 { SST(0x5D, 0x00, SS_RDEF, 2086 "Failure prediction threshold exceeded") }, 2087 /* R B */ 2088 { SST(0x5D, 0x01, SS_RDEF, /* XXX TBD */ 2089 "Media failure prediction threshold exceeded") }, 2090 /* R */ 2091 { SST(0x5D, 0x02, SS_RDEF, /* XXX TBD */ 2092 "Logical unit failure prediction threshold exceeded") }, 2093 /* R */ 2094 { SST(0x5D, 0x03, SS_RDEF, /* XXX TBD */ 2095 "Spare area exhaustion prediction threshold exceeded") }, 2096 /* D B */ 2097 { SST(0x5D, 0x10, SS_RDEF, /* XXX TBD */ 2098 "Hardware impending failure general hard drive failure") }, 2099 /* D B */ 2100 { SST(0x5D, 0x11, SS_RDEF, /* XXX TBD */ 2101 "Hardware impending failure drive error rate too high") }, 2102 /* D B */ 2103 { SST(0x5D, 0x12, SS_RDEF, /* XXX TBD */ 2104 "Hardware impending failure data error rate too high") }, 2105 /* D B */ 2106 { SST(0x5D, 0x13, SS_RDEF, /* XXX TBD */ 2107 "Hardware impending failure seek error rate too high") }, 2108 /* D B */ 2109 { SST(0x5D, 0x14, SS_RDEF, /* XXX TBD */ 2110 "Hardware impending failure too many block reassigns") }, 2111 /* D B */ 2112 { SST(0x5D, 0x15, SS_RDEF, /* XXX TBD */ 2113 "Hardware impending failure access times too high") }, 2114 /* D B */ 2115 { SST(0x5D, 0x16, SS_RDEF, /* XXX TBD */ 2116 "Hardware impending failure start unit times too high") }, 2117 /* D B */ 2118 { SST(0x5D, 0x17, SS_RDEF, /* XXX TBD */ 2119 "Hardware impending failure channel parametrics") }, 2120 /* D B */ 2121 { SST(0x5D, 0x18, SS_RDEF, /* XXX TBD */ 2122 "Hardware impending failure controller detected") }, 2123 /* D B */ 2124 { SST(0x5D, 0x19, SS_RDEF, /* XXX TBD */ 2125 "Hardware impending failure throughput performance") }, 2126 /* D B */ 2127 { SST(0x5D, 0x1A, SS_RDEF, /* XXX TBD */ 2128 "Hardware impending failure seek time performance") }, 2129 /* D B */ 2130 { SST(0x5D, 0x1B, SS_RDEF, /* XXX TBD */ 2131 "Hardware impending failure spin-up retry count") }, 2132 /* D B */ 2133 { SST(0x5D, 0x1C, SS_RDEF, /* XXX TBD */ 2134 "Hardware impending failure drive calibration retry count") }, 2135 /* D B */ 2136 { SST(0x5D, 0x20, SS_RDEF, /* XXX TBD */ 2137 "Controller impending failure general hard drive failure") }, 2138 /* D B */ 2139 { SST(0x5D, 0x21, SS_RDEF, /* XXX TBD */ 2140 "Controller impending failure drive error rate too high") }, 2141 /* D B */ 2142 { SST(0x5D, 0x22, SS_RDEF, /* XXX TBD */ 2143 "Controller impending failure data error rate too high") }, 2144 /* D B */ 2145 { SST(0x5D, 0x23, SS_RDEF, /* XXX TBD */ 2146 "Controller impending failure seek error rate too high") }, 2147 /* D B */ 2148 { SST(0x5D, 0x24, SS_RDEF, /* XXX TBD */ 2149 "Controller impending failure too many block reassigns") }, 2150 /* D B */ 2151 { SST(0x5D, 0x25, SS_RDEF, /* XXX TBD */ 2152 "Controller impending failure access times too high") }, 2153 /* D B */ 2154 { SST(0x5D, 0x26, SS_RDEF, /* XXX TBD */ 2155 "Controller impending failure start unit times too high") }, 2156 /* D B */ 2157 { SST(0x5D, 0x27, SS_RDEF, /* XXX TBD */ 2158 "Controller impending failure channel parametrics") }, 2159 /* D B */ 2160 { SST(0x5D, 0x28, SS_RDEF, /* XXX TBD */ 2161 "Controller impending failure controller detected") }, 2162 /* D B */ 2163 { SST(0x5D, 0x29, SS_RDEF, /* XXX TBD */ 2164 "Controller impending failure throughput performance") }, 2165 /* D B */ 2166 { SST(0x5D, 0x2A, SS_RDEF, /* XXX TBD */ 2167 "Controller impending failure seek time performance") }, 2168 /* D B */ 2169 { SST(0x5D, 0x2B, SS_RDEF, /* XXX TBD */ 2170 "Controller impending failure spin-up retry count") }, 2171 /* D B */ 2172 { SST(0x5D, 0x2C, SS_RDEF, /* XXX TBD */ 2173 "Controller impending failure drive calibration retry count") }, 2174 /* D B */ 2175 { SST(0x5D, 0x30, SS_RDEF, /* XXX TBD */ 2176 "Data channel impending failure general hard drive failure") }, 2177 /* D B */ 2178 { SST(0x5D, 0x31, SS_RDEF, /* XXX TBD */ 2179 "Data channel impending failure drive error rate too high") }, 2180 /* D B */ 2181 { SST(0x5D, 0x32, SS_RDEF, /* XXX TBD */ 2182 "Data channel impending failure data error rate too high") }, 2183 /* D B */ 2184 { SST(0x5D, 0x33, SS_RDEF, /* XXX TBD */ 2185 "Data channel impending failure seek error rate too high") }, 2186 /* D B */ 2187 { SST(0x5D, 0x34, SS_RDEF, /* XXX TBD */ 2188 "Data channel impending failure too many block reassigns") }, 2189 /* D B */ 2190 { SST(0x5D, 0x35, SS_RDEF, /* XXX TBD */ 2191 "Data channel impending failure access times too high") }, 2192 /* D B */ 2193 { SST(0x5D, 0x36, SS_RDEF, /* XXX TBD */ 2194 "Data channel impending failure start unit times too high") }, 2195 /* D B */ 2196 { SST(0x5D, 0x37, SS_RDEF, /* XXX TBD */ 2197 "Data channel impending failure channel parametrics") }, 2198 /* D B */ 2199 { SST(0x5D, 0x38, SS_RDEF, /* XXX TBD */ 2200 "Data channel impending failure controller detected") }, 2201 /* D B */ 2202 { SST(0x5D, 0x39, SS_RDEF, /* XXX TBD */ 2203 "Data channel impending failure throughput performance") }, 2204 /* D B */ 2205 { SST(0x5D, 0x3A, SS_RDEF, /* XXX TBD */ 2206 "Data channel impending failure seek time performance") }, 2207 /* D B */ 2208 { SST(0x5D, 0x3B, SS_RDEF, /* XXX TBD */ 2209 "Data channel impending failure spin-up retry count") }, 2210 /* D B */ 2211 { SST(0x5D, 0x3C, SS_RDEF, /* XXX TBD */ 2212 "Data channel impending failure drive calibration retry count") }, 2213 /* D B */ 2214 { SST(0x5D, 0x40, SS_RDEF, /* XXX TBD */ 2215 "Servo impending failure general hard drive failure") }, 2216 /* D B */ 2217 { SST(0x5D, 0x41, SS_RDEF, /* XXX TBD */ 2218 "Servo impending failure drive error rate too high") }, 2219 /* D B */ 2220 { SST(0x5D, 0x42, SS_RDEF, /* XXX TBD */ 2221 "Servo impending failure data error rate too high") }, 2222 /* D B */ 2223 { SST(0x5D, 0x43, SS_RDEF, /* XXX TBD */ 2224 "Servo impending failure seek error rate too high") }, 2225 /* D B */ 2226 { SST(0x5D, 0x44, SS_RDEF, /* XXX TBD */ 2227 "Servo impending failure too many block reassigns") }, 2228 /* D B */ 2229 { SST(0x5D, 0x45, SS_RDEF, /* XXX TBD */ 2230 "Servo impending failure access times too high") }, 2231 /* D B */ 2232 { SST(0x5D, 0x46, SS_RDEF, /* XXX TBD */ 2233 "Servo impending failure start unit times too high") }, 2234 /* D B */ 2235 { SST(0x5D, 0x47, SS_RDEF, /* XXX TBD */ 2236 "Servo impending failure channel parametrics") }, 2237 /* D B */ 2238 { SST(0x5D, 0x48, SS_RDEF, /* XXX TBD */ 2239 "Servo impending failure controller detected") }, 2240 /* D B */ 2241 { SST(0x5D, 0x49, SS_RDEF, /* XXX TBD */ 2242 "Servo impending failure throughput performance") }, 2243 /* D B */ 2244 { SST(0x5D, 0x4A, SS_RDEF, /* XXX TBD */ 2245 "Servo impending failure seek time performance") }, 2246 /* D B */ 2247 { SST(0x5D, 0x4B, SS_RDEF, /* XXX TBD */ 2248 "Servo impending failure spin-up retry count") }, 2249 /* D B */ 2250 { SST(0x5D, 0x4C, SS_RDEF, /* XXX TBD */ 2251 "Servo impending failure drive calibration retry count") }, 2252 /* D B */ 2253 { SST(0x5D, 0x50, SS_RDEF, /* XXX TBD */ 2254 "Spindle impending failure general hard drive failure") }, 2255 /* D B */ 2256 { SST(0x5D, 0x51, SS_RDEF, /* XXX TBD */ 2257 "Spindle impending failure drive error rate too high") }, 2258 /* D B */ 2259 { SST(0x5D, 0x52, SS_RDEF, /* XXX TBD */ 2260 "Spindle impending failure data error rate too high") }, 2261 /* D B */ 2262 { SST(0x5D, 0x53, SS_RDEF, /* XXX TBD */ 2263 "Spindle impending failure seek error rate too high") }, 2264 /* D B */ 2265 { SST(0x5D, 0x54, SS_RDEF, /* XXX TBD */ 2266 "Spindle impending failure too many block reassigns") }, 2267 /* D B */ 2268 { SST(0x5D, 0x55, SS_RDEF, /* XXX TBD */ 2269 "Spindle impending failure access times too high") }, 2270 /* D B */ 2271 { SST(0x5D, 0x56, SS_RDEF, /* XXX TBD */ 2272 "Spindle impending failure start unit times too high") }, 2273 /* D B */ 2274 { SST(0x5D, 0x57, SS_RDEF, /* XXX TBD */ 2275 "Spindle impending failure channel parametrics") }, 2276 /* D B */ 2277 { SST(0x5D, 0x58, SS_RDEF, /* XXX TBD */ 2278 "Spindle impending failure controller detected") }, 2279 /* D B */ 2280 { SST(0x5D, 0x59, SS_RDEF, /* XXX TBD */ 2281 "Spindle impending failure throughput performance") }, 2282 /* D B */ 2283 { SST(0x5D, 0x5A, SS_RDEF, /* XXX TBD */ 2284 "Spindle impending failure seek time performance") }, 2285 /* D B */ 2286 { SST(0x5D, 0x5B, SS_RDEF, /* XXX TBD */ 2287 "Spindle impending failure spin-up retry count") }, 2288 /* D B */ 2289 { SST(0x5D, 0x5C, SS_RDEF, /* XXX TBD */ 2290 "Spindle impending failure drive calibration retry count") }, 2291 /* D B */ 2292 { SST(0x5D, 0x60, SS_RDEF, /* XXX TBD */ 2293 "Firmware impending failure general hard drive failure") }, 2294 /* D B */ 2295 { SST(0x5D, 0x61, SS_RDEF, /* XXX TBD */ 2296 "Firmware impending failure drive error rate too high") }, 2297 /* D B */ 2298 { SST(0x5D, 0x62, SS_RDEF, /* XXX TBD */ 2299 "Firmware impending failure data error rate too high") }, 2300 /* D B */ 2301 { SST(0x5D, 0x63, SS_RDEF, /* XXX TBD */ 2302 "Firmware impending failure seek error rate too high") }, 2303 /* D B */ 2304 { SST(0x5D, 0x64, SS_RDEF, /* XXX TBD */ 2305 "Firmware impending failure too many block reassigns") }, 2306 /* D B */ 2307 { SST(0x5D, 0x65, SS_RDEF, /* XXX TBD */ 2308 "Firmware impending failure access times too high") }, 2309 /* D B */ 2310 { SST(0x5D, 0x66, SS_RDEF, /* XXX TBD */ 2311 "Firmware impending failure start unit times too high") }, 2312 /* D B */ 2313 { SST(0x5D, 0x67, SS_RDEF, /* XXX TBD */ 2314 "Firmware impending failure channel parametrics") }, 2315 /* D B */ 2316 { SST(0x5D, 0x68, SS_RDEF, /* XXX TBD */ 2317 "Firmware impending failure controller detected") }, 2318 /* D B */ 2319 { SST(0x5D, 0x69, SS_RDEF, /* XXX TBD */ 2320 "Firmware impending failure throughput performance") }, 2321 /* D B */ 2322 { SST(0x5D, 0x6A, SS_RDEF, /* XXX TBD */ 2323 "Firmware impending failure seek time performance") }, 2324 /* D B */ 2325 { SST(0x5D, 0x6B, SS_RDEF, /* XXX TBD */ 2326 "Firmware impending failure spin-up retry count") }, 2327 /* D B */ 2328 { SST(0x5D, 0x6C, SS_RDEF, /* XXX TBD */ 2329 "Firmware impending failure drive calibration retry count") }, 2330 /* DTLPWROMAEBKVF */ 2331 { SST(0x5D, 0xFF, SS_RDEF, 2332 "Failure prediction threshold exceeded (false)") }, 2333 /* DTLPWRO A K */ 2334 { SST(0x5E, 0x00, SS_RDEF, 2335 "Low power condition on") }, 2336 /* DTLPWRO A K */ 2337 { SST(0x5E, 0x01, SS_RDEF, 2338 "Idle condition activated by timer") }, 2339 /* DTLPWRO A K */ 2340 { SST(0x5E, 0x02, SS_RDEF, 2341 "Standby condition activated by timer") }, 2342 /* DTLPWRO A K */ 2343 { SST(0x5E, 0x03, SS_RDEF, 2344 "Idle condition activated by command") }, 2345 /* DTLPWRO A K */ 2346 { SST(0x5E, 0x04, SS_RDEF, 2347 "Standby condition activated by command") }, 2348 /* B */ 2349 { SST(0x5E, 0x41, SS_RDEF, /* XXX TBD */ 2350 "Power state change to active") }, 2351 /* B */ 2352 { SST(0x5E, 0x42, SS_RDEF, /* XXX TBD */ 2353 "Power state change to idle") }, 2354 /* B */ 2355 { SST(0x5E, 0x43, SS_RDEF, /* XXX TBD */ 2356 "Power state change to standby") }, 2357 /* B */ 2358 { SST(0x5E, 0x45, SS_RDEF, /* XXX TBD */ 2359 "Power state change to sleep") }, 2360 /* BK */ 2361 { SST(0x5E, 0x47, SS_RDEF, /* XXX TBD */ 2362 "Power state change to device control") }, 2363 /* */ 2364 { SST(0x60, 0x00, SS_RDEF, 2365 "Lamp failure") }, 2366 /* */ 2367 { SST(0x61, 0x00, SS_RDEF, 2368 "Video acquisition error") }, 2369 /* */ 2370 { SST(0x61, 0x01, SS_RDEF, 2371 "Unable to acquire video") }, 2372 /* */ 2373 { SST(0x61, 0x02, SS_RDEF, 2374 "Out of focus") }, 2375 /* */ 2376 { SST(0x62, 0x00, SS_RDEF, 2377 "Scan head positioning error") }, 2378 /* R */ 2379 { SST(0x63, 0x00, SS_RDEF, 2380 "End of user area encountered on this track") }, 2381 /* R */ 2382 { SST(0x63, 0x01, SS_FATAL | ENOSPC, 2383 "Packet does not fit in available space") }, 2384 /* R */ 2385 { SST(0x64, 0x00, SS_FATAL | ENXIO, 2386 "Illegal mode for this track") }, 2387 /* R */ 2388 { SST(0x64, 0x01, SS_RDEF, 2389 "Invalid packet size") }, 2390 /* DTLPWROMAEBKVF */ 2391 { SST(0x65, 0x00, SS_RDEF, 2392 "Voltage fault") }, 2393 /* */ 2394 { SST(0x66, 0x00, SS_RDEF, 2395 "Automatic document feeder cover up") }, 2396 /* */ 2397 { SST(0x66, 0x01, SS_RDEF, 2398 "Automatic document feeder lift up") }, 2399 /* */ 2400 { SST(0x66, 0x02, SS_RDEF, 2401 "Document jam in automatic document feeder") }, 2402 /* */ 2403 { SST(0x66, 0x03, SS_RDEF, 2404 "Document miss feed automatic in document feeder") }, 2405 /* A */ 2406 { SST(0x67, 0x00, SS_RDEF, 2407 "Configuration failure") }, 2408 /* A */ 2409 { SST(0x67, 0x01, SS_RDEF, 2410 "Configuration of incapable logical units failed") }, 2411 /* A */ 2412 { SST(0x67, 0x02, SS_RDEF, 2413 "Add logical unit failed") }, 2414 /* A */ 2415 { SST(0x67, 0x03, SS_RDEF, 2416 "Modification of logical unit failed") }, 2417 /* A */ 2418 { SST(0x67, 0x04, SS_RDEF, 2419 "Exchange of logical unit failed") }, 2420 /* A */ 2421 { SST(0x67, 0x05, SS_RDEF, 2422 "Remove of logical unit failed") }, 2423 /* A */ 2424 { SST(0x67, 0x06, SS_RDEF, 2425 "Attachment of logical unit failed") }, 2426 /* A */ 2427 { SST(0x67, 0x07, SS_RDEF, 2428 "Creation of logical unit failed") }, 2429 /* A */ 2430 { SST(0x67, 0x08, SS_RDEF, /* XXX TBD */ 2431 "Assign failure occurred") }, 2432 /* A */ 2433 { SST(0x67, 0x09, SS_RDEF, /* XXX TBD */ 2434 "Multiply assigned logical unit") }, 2435 /* DTLPWROMAEBKVF */ 2436 { SST(0x67, 0x0A, SS_RDEF, /* XXX TBD */ 2437 "Set target port groups command failed") }, 2438 /* DT B */ 2439 { SST(0x67, 0x0B, SS_RDEF, /* XXX TBD */ 2440 "ATA device feature not enabled") }, 2441 /* A */ 2442 { SST(0x68, 0x00, SS_RDEF, 2443 "Logical unit not configured") }, 2444 /* A */ 2445 { SST(0x69, 0x00, SS_RDEF, 2446 "Data loss on logical unit") }, 2447 /* A */ 2448 { SST(0x69, 0x01, SS_RDEF, 2449 "Multiple logical unit failures") }, 2450 /* A */ 2451 { SST(0x69, 0x02, SS_RDEF, 2452 "Parity/data mismatch") }, 2453 /* A */ 2454 { SST(0x6A, 0x00, SS_RDEF, 2455 "Informational, refer to log") }, 2456 /* A */ 2457 { SST(0x6B, 0x00, SS_RDEF, 2458 "State change has occurred") }, 2459 /* A */ 2460 { SST(0x6B, 0x01, SS_RDEF, 2461 "Redundancy level got better") }, 2462 /* A */ 2463 { SST(0x6B, 0x02, SS_RDEF, 2464 "Redundancy level got worse") }, 2465 /* A */ 2466 { SST(0x6C, 0x00, SS_RDEF, 2467 "Rebuild failure occurred") }, 2468 /* A */ 2469 { SST(0x6D, 0x00, SS_RDEF, 2470 "Recalculate failure occurred") }, 2471 /* A */ 2472 { SST(0x6E, 0x00, SS_RDEF, 2473 "Command to logical unit failed") }, 2474 /* R */ 2475 { SST(0x6F, 0x00, SS_RDEF, /* XXX TBD */ 2476 "Copy protection key exchange failure - authentication failure") }, 2477 /* R */ 2478 { SST(0x6F, 0x01, SS_RDEF, /* XXX TBD */ 2479 "Copy protection key exchange failure - key not present") }, 2480 /* R */ 2481 { SST(0x6F, 0x02, SS_RDEF, /* XXX TBD */ 2482 "Copy protection key exchange failure - key not established") }, 2483 /* R */ 2484 { SST(0x6F, 0x03, SS_RDEF, /* XXX TBD */ 2485 "Read of scrambled sector without authentication") }, 2486 /* R */ 2487 { SST(0x6F, 0x04, SS_RDEF, /* XXX TBD */ 2488 "Media region code is mismatched to logical unit region") }, 2489 /* R */ 2490 { SST(0x6F, 0x05, SS_RDEF, /* XXX TBD */ 2491 "Drive region must be permanent/region reset count error") }, 2492 /* R */ 2493 { SST(0x6F, 0x06, SS_RDEF, /* XXX TBD */ 2494 "Insufficient block count for binding NONCE recording") }, 2495 /* R */ 2496 { SST(0x6F, 0x07, SS_RDEF, /* XXX TBD */ 2497 "Conflict in binding NONCE recording") }, 2498 /* T */ 2499 { SST(0x70, 0x00, SS_RDEF, 2500 "Decompression exception short: ASCQ = Algorithm ID") }, 2501 /* T */ 2502 { SST(0x70, 0xFF, SS_RDEF | SSQ_RANGE, 2503 NULL) }, /* Range 0x00 -> 0xFF */ 2504 /* T */ 2505 { SST(0x71, 0x00, SS_RDEF, 2506 "Decompression exception long: ASCQ = Algorithm ID") }, 2507 /* T */ 2508 { SST(0x71, 0xFF, SS_RDEF | SSQ_RANGE, 2509 NULL) }, /* Range 0x00 -> 0xFF */ 2510 /* R */ 2511 { SST(0x72, 0x00, SS_RDEF, 2512 "Session fixation error") }, 2513 /* R */ 2514 { SST(0x72, 0x01, SS_RDEF, 2515 "Session fixation error writing lead-in") }, 2516 /* R */ 2517 { SST(0x72, 0x02, SS_RDEF, 2518 "Session fixation error writing lead-out") }, 2519 /* R */ 2520 { SST(0x72, 0x03, SS_RDEF, 2521 "Session fixation error - incomplete track in session") }, 2522 /* R */ 2523 { SST(0x72, 0x04, SS_RDEF, 2524 "Empty or partially written reserved track") }, 2525 /* R */ 2526 { SST(0x72, 0x05, SS_RDEF, /* XXX TBD */ 2527 "No more track reservations allowed") }, 2528 /* R */ 2529 { SST(0x72, 0x06, SS_RDEF, /* XXX TBD */ 2530 "RMZ extension is not allowed") }, 2531 /* R */ 2532 { SST(0x72, 0x07, SS_RDEF, /* XXX TBD */ 2533 "No more test zone extensions are allowed") }, 2534 /* R */ 2535 { SST(0x73, 0x00, SS_RDEF, 2536 "CD control error") }, 2537 /* R */ 2538 { SST(0x73, 0x01, SS_RDEF, 2539 "Power calibration area almost full") }, 2540 /* R */ 2541 { SST(0x73, 0x02, SS_FATAL | ENOSPC, 2542 "Power calibration area is full") }, 2543 /* R */ 2544 { SST(0x73, 0x03, SS_RDEF, 2545 "Power calibration area error") }, 2546 /* R */ 2547 { SST(0x73, 0x04, SS_RDEF, 2548 "Program memory area update failure") }, 2549 /* R */ 2550 { SST(0x73, 0x05, SS_RDEF, 2551 "Program memory area is full") }, 2552 /* R */ 2553 { SST(0x73, 0x06, SS_RDEF, /* XXX TBD */ 2554 "RMA/PMA is almost full") }, 2555 /* R */ 2556 { SST(0x73, 0x10, SS_RDEF, /* XXX TBD */ 2557 "Current power calibration area almost full") }, 2558 /* R */ 2559 { SST(0x73, 0x11, SS_RDEF, /* XXX TBD */ 2560 "Current power calibration area is full") }, 2561 /* R */ 2562 { SST(0x73, 0x17, SS_RDEF, /* XXX TBD */ 2563 "RDZ is full") }, 2564 /* T */ 2565 { SST(0x74, 0x00, SS_RDEF, /* XXX TBD */ 2566 "Security error") }, 2567 /* T */ 2568 { SST(0x74, 0x01, SS_RDEF, /* XXX TBD */ 2569 "Unable to decrypt data") }, 2570 /* T */ 2571 { SST(0x74, 0x02, SS_RDEF, /* XXX TBD */ 2572 "Unencrypted data encountered while decrypting") }, 2573 /* T */ 2574 { SST(0x74, 0x03, SS_RDEF, /* XXX TBD */ 2575 "Incorrect data encryption key") }, 2576 /* T */ 2577 { SST(0x74, 0x04, SS_RDEF, /* XXX TBD */ 2578 "Cryptographic integrity validation failed") }, 2579 /* T */ 2580 { SST(0x74, 0x05, SS_RDEF, /* XXX TBD */ 2581 "Error decrypting data") }, 2582 /* T */ 2583 { SST(0x74, 0x06, SS_RDEF, /* XXX TBD */ 2584 "Unknown signature verification key") }, 2585 /* T */ 2586 { SST(0x74, 0x07, SS_RDEF, /* XXX TBD */ 2587 "Encryption parameters not usable") }, 2588 /* DT R M E VF */ 2589 { SST(0x74, 0x08, SS_RDEF, /* XXX TBD */ 2590 "Digital signature validation failure") }, 2591 /* T */ 2592 { SST(0x74, 0x09, SS_RDEF, /* XXX TBD */ 2593 "Encryption mode mismatch on read") }, 2594 /* T */ 2595 { SST(0x74, 0x0A, SS_RDEF, /* XXX TBD */ 2596 "Encrypted block not raw read enabled") }, 2597 /* T */ 2598 { SST(0x74, 0x0B, SS_RDEF, /* XXX TBD */ 2599 "Incorrect encryption parameters") }, 2600 /* DT R MAEBKV */ 2601 { SST(0x74, 0x0C, SS_RDEF, /* XXX TBD */ 2602 "Unable to decrypt parameter list") }, 2603 /* T */ 2604 { SST(0x74, 0x0D, SS_RDEF, /* XXX TBD */ 2605 "Encryption algorithm disabled") }, 2606 /* DT R MAEBKV */ 2607 { SST(0x74, 0x10, SS_RDEF, /* XXX TBD */ 2608 "SA creation parameter value invalid") }, 2609 /* DT R MAEBKV */ 2610 { SST(0x74, 0x11, SS_RDEF, /* XXX TBD */ 2611 "SA creation parameter value rejected") }, 2612 /* DT R MAEBKV */ 2613 { SST(0x74, 0x12, SS_RDEF, /* XXX TBD */ 2614 "Invalid SA usage") }, 2615 /* T */ 2616 { SST(0x74, 0x21, SS_RDEF, /* XXX TBD */ 2617 "Data encryption configuration prevented") }, 2618 /* DT R MAEBKV */ 2619 { SST(0x74, 0x30, SS_RDEF, /* XXX TBD */ 2620 "SA creation parameter not supported") }, 2621 /* DT R MAEBKV */ 2622 { SST(0x74, 0x40, SS_RDEF, /* XXX TBD */ 2623 "Authentication failed") }, 2624 /* V */ 2625 { SST(0x74, 0x61, SS_RDEF, /* XXX TBD */ 2626 "External data encryption key manager access error") }, 2627 /* V */ 2628 { SST(0x74, 0x62, SS_RDEF, /* XXX TBD */ 2629 "External data encryption key manager error") }, 2630 /* V */ 2631 { SST(0x74, 0x63, SS_RDEF, /* XXX TBD */ 2632 "External data encryption key not found") }, 2633 /* V */ 2634 { SST(0x74, 0x64, SS_RDEF, /* XXX TBD */ 2635 "External data encryption request not authorized") }, 2636 /* T */ 2637 { SST(0x74, 0x6E, SS_RDEF, /* XXX TBD */ 2638 "External data encryption control timeout") }, 2639 /* T */ 2640 { SST(0x74, 0x6F, SS_RDEF, /* XXX TBD */ 2641 "External data encryption control error") }, 2642 /* DT R M E V */ 2643 { SST(0x74, 0x71, SS_RDEF, /* XXX TBD */ 2644 "Logical unit access not authorized") }, 2645 /* D */ 2646 { SST(0x74, 0x79, SS_RDEF, /* XXX TBD */ 2647 "Security conflict in translated device") } 2648 }; 2649 2650 const int asc_table_size = sizeof(asc_table)/sizeof(asc_table[0]); 2651 2652 struct asc_key 2653 { 2654 int asc; 2655 int ascq; 2656 }; 2657 2658 static int 2659 ascentrycomp(const void *key, const void *member) 2660 { 2661 int asc; 2662 int ascq; 2663 const struct asc_table_entry *table_entry; 2664 2665 asc = ((const struct asc_key *)key)->asc; 2666 ascq = ((const struct asc_key *)key)->ascq; 2667 table_entry = (const struct asc_table_entry *)member; 2668 2669 if (asc >= table_entry->asc) { 2670 2671 if (asc > table_entry->asc) 2672 return (1); 2673 2674 if (ascq <= table_entry->ascq) { 2675 /* Check for ranges */ 2676 if (ascq == table_entry->ascq 2677 || ((table_entry->action & SSQ_RANGE) != 0 2678 && ascq >= (table_entry - 1)->ascq)) 2679 return (0); 2680 return (-1); 2681 } 2682 return (1); 2683 } 2684 return (-1); 2685 } 2686 2687 static int 2688 senseentrycomp(const void *key, const void *member) 2689 { 2690 int sense_key; 2691 const struct sense_key_table_entry *table_entry; 2692 2693 sense_key = *((const int *)key); 2694 table_entry = (const struct sense_key_table_entry *)member; 2695 2696 if (sense_key >= table_entry->sense_key) { 2697 if (sense_key == table_entry->sense_key) 2698 return (0); 2699 return (1); 2700 } 2701 return (-1); 2702 } 2703 2704 static void 2705 fetchtableentries(int sense_key, int asc, int ascq, 2706 struct scsi_inquiry_data *inq_data, 2707 const struct sense_key_table_entry **sense_entry, 2708 const struct asc_table_entry **asc_entry) 2709 { 2710 caddr_t match; 2711 const struct asc_table_entry *asc_tables[2]; 2712 const struct sense_key_table_entry *sense_tables[2]; 2713 struct asc_key asc_ascq; 2714 size_t asc_tables_size[2]; 2715 size_t sense_tables_size[2]; 2716 int num_asc_tables; 2717 int num_sense_tables; 2718 int i; 2719 2720 /* Default to failure */ 2721 *sense_entry = NULL; 2722 *asc_entry = NULL; 2723 match = NULL; 2724 if (inq_data != NULL) 2725 match = cam_quirkmatch((caddr_t)inq_data, 2726 (caddr_t)sense_quirk_table, 2727 sense_quirk_table_size, 2728 sizeof(*sense_quirk_table), 2729 scsi_inquiry_match); 2730 2731 if (match != NULL) { 2732 struct scsi_sense_quirk_entry *quirk; 2733 2734 quirk = (struct scsi_sense_quirk_entry *)match; 2735 asc_tables[0] = quirk->asc_info; 2736 asc_tables_size[0] = quirk->num_ascs; 2737 asc_tables[1] = asc_table; 2738 asc_tables_size[1] = asc_table_size; 2739 num_asc_tables = 2; 2740 sense_tables[0] = quirk->sense_key_info; 2741 sense_tables_size[0] = quirk->num_sense_keys; 2742 sense_tables[1] = sense_key_table; 2743 sense_tables_size[1] = sense_key_table_size; 2744 num_sense_tables = 2; 2745 } else { 2746 asc_tables[0] = asc_table; 2747 asc_tables_size[0] = asc_table_size; 2748 num_asc_tables = 1; 2749 sense_tables[0] = sense_key_table; 2750 sense_tables_size[0] = sense_key_table_size; 2751 num_sense_tables = 1; 2752 } 2753 2754 asc_ascq.asc = asc; 2755 asc_ascq.ascq = ascq; 2756 for (i = 0; i < num_asc_tables; i++) { 2757 void *found_entry; 2758 2759 found_entry = kbsearch(&asc_ascq, asc_tables[i], 2760 asc_tables_size[i], 2761 sizeof(**asc_tables), 2762 ascentrycomp); 2763 2764 if (found_entry) { 2765 *asc_entry = (struct asc_table_entry *)found_entry; 2766 break; 2767 } 2768 } 2769 2770 for (i = 0; i < num_sense_tables; i++) { 2771 void *found_entry; 2772 2773 found_entry = kbsearch(&sense_key, sense_tables[i], 2774 sense_tables_size[i], 2775 sizeof(**sense_tables), 2776 senseentrycomp); 2777 2778 if (found_entry) { 2779 *sense_entry = 2780 (struct sense_key_table_entry *)found_entry; 2781 break; 2782 } 2783 } 2784 } 2785 2786 void 2787 scsi_sense_desc(int sense_key, int asc, int ascq, 2788 struct scsi_inquiry_data *inq_data, 2789 const char **sense_key_desc, const char **asc_desc) 2790 { 2791 const struct asc_table_entry *asc_entry; 2792 const struct sense_key_table_entry *sense_entry; 2793 2794 fetchtableentries(sense_key, asc, ascq, 2795 inq_data, 2796 &sense_entry, 2797 &asc_entry); 2798 2799 *sense_key_desc = sense_entry->desc; 2800 2801 if (asc_entry != NULL) 2802 *asc_desc = asc_entry->desc; 2803 else if (asc >= 0x80 && asc <= 0xff) 2804 *asc_desc = "Vendor Specific ASC"; 2805 else if (ascq >= 0x80 && ascq <= 0xff) 2806 *asc_desc = "Vendor Specific ASCQ"; 2807 else 2808 *asc_desc = "Reserved ASC/ASCQ pair"; 2809 } 2810 2811 /* 2812 * Given sense and device type information, return the appropriate action. 2813 * If we do not understand the specific error as identified by the ASC/ASCQ 2814 * pair, fall back on the more generic actions derived from the sense key. 2815 */ 2816 scsi_sense_action 2817 scsi_error_action(struct ccb_scsiio *csio, struct scsi_inquiry_data *inq_data, 2818 u_int32_t sense_flags) 2819 { 2820 const struct asc_table_entry *asc_entry; 2821 const struct sense_key_table_entry *sense_entry; 2822 int error_code, sense_key, asc, ascq; 2823 scsi_sense_action action; 2824 2825 scsi_extract_sense(&csio->sense_data, &error_code, 2826 &sense_key, &asc, &ascq); 2827 2828 if (error_code == SSD_DEFERRED_ERROR) { 2829 /* 2830 * XXX dufault@FreeBSD.org 2831 * This error doesn't relate to the command associated 2832 * with this request sense. A deferred error is an error 2833 * for a command that has already returned GOOD status 2834 * (see SCSI2 8.2.14.2). 2835 * 2836 * By my reading of that section, it looks like the current 2837 * command has been cancelled, we should now clean things up 2838 * (hopefully recovering any lost data) and then retry the 2839 * current command. There are two easy choices, both wrong: 2840 * 2841 * 1. Drop through (like we had been doing), thus treating 2842 * this as if the error were for the current command and 2843 * return and stop the current command. 2844 * 2845 * 2. Issue a retry (like I made it do) thus hopefully 2846 * recovering the current transfer, and ignoring the 2847 * fact that we've dropped a command. 2848 * 2849 * These should probably be handled in a device specific 2850 * sense handler or punted back up to a user mode daemon 2851 */ 2852 action = SS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE; 2853 } else { 2854 fetchtableentries(sense_key, asc, ascq, 2855 inq_data, 2856 &sense_entry, 2857 &asc_entry); 2858 2859 /* 2860 * Override the 'No additional Sense' entry (0,0) 2861 * with the error action of the sense key. 2862 */ 2863 if (asc_entry != NULL 2864 && (asc != 0 || ascq != 0)) 2865 action = asc_entry->action; 2866 else 2867 action = sense_entry->action; 2868 2869 if (sense_key == SSD_KEY_RECOVERED_ERROR) { 2870 /* 2871 * The action succeeded but the device wants 2872 * the user to know that some recovery action 2873 * was required. 2874 */ 2875 action &= ~(SS_MASK|SSQ_MASK|SS_ERRMASK); 2876 action |= SS_NOP|SSQ_PRINT_SENSE; 2877 } else if (sense_key == SSD_KEY_ILLEGAL_REQUEST) { 2878 if ((sense_flags & SF_QUIET_IR) != 0) 2879 action &= ~SSQ_PRINT_SENSE; 2880 } else if (sense_key == SSD_KEY_UNIT_ATTENTION) { 2881 if ((sense_flags & SF_RETRY_UA) != 0 2882 && (action & SS_MASK) == SS_FAIL) { 2883 action &= ~(SS_MASK|SSQ_MASK); 2884 action |= SS_RETRY|SSQ_DECREMENT_COUNT| 2885 SSQ_PRINT_SENSE; 2886 } 2887 } 2888 } 2889 #ifdef KERNEL 2890 if (bootverbose) 2891 sense_flags |= SF_PRINT_ALWAYS; 2892 #endif 2893 if ((sense_flags & SF_PRINT_ALWAYS) != 0) 2894 action |= SSQ_PRINT_SENSE; 2895 else if ((sense_flags & SF_NO_PRINT) != 0) 2896 action &= ~SSQ_PRINT_SENSE; 2897 2898 return (action); 2899 } 2900 2901 char * 2902 scsi_cdb_string(u_int8_t *cdb_ptr, char *cdb_string, size_t len) 2903 { 2904 u_int8_t cdb_len; 2905 int i; 2906 2907 if (cdb_ptr == NULL) 2908 return(""); 2909 2910 /* Silence warnings */ 2911 cdb_len = 0; 2912 2913 /* 2914 * This is taken from the SCSI-3 draft spec. 2915 * (T10/1157D revision 0.3) 2916 * The top 3 bits of an opcode are the group code. The next 5 bits 2917 * are the command code. 2918 * Group 0: six byte commands 2919 * Group 1: ten byte commands 2920 * Group 2: ten byte commands 2921 * Group 3: reserved 2922 * Group 4: sixteen byte commands 2923 * Group 5: twelve byte commands 2924 * Group 6: vendor specific 2925 * Group 7: vendor specific 2926 */ 2927 switch((*cdb_ptr >> 5) & 0x7) { 2928 case 0: 2929 cdb_len = 6; 2930 break; 2931 case 1: 2932 case 2: 2933 cdb_len = 10; 2934 break; 2935 case 3: 2936 case 6: 2937 case 7: 2938 /* in this case, just print out the opcode */ 2939 cdb_len = 1; 2940 break; 2941 case 4: 2942 cdb_len = 16; 2943 break; 2944 case 5: 2945 cdb_len = 12; 2946 break; 2947 } 2948 *cdb_string = '\0'; 2949 for (i = 0; i < cdb_len; i++) 2950 ksnprintf(cdb_string + strlen(cdb_string), 2951 len - strlen(cdb_string), "%x ", cdb_ptr[i]); 2952 2953 return(cdb_string); 2954 } 2955 2956 const char * 2957 scsi_status_string(struct ccb_scsiio *csio) 2958 { 2959 switch(csio->scsi_status) { 2960 case SCSI_STATUS_OK: 2961 return("OK"); 2962 case SCSI_STATUS_CHECK_COND: 2963 return("Check Condition"); 2964 case SCSI_STATUS_BUSY: 2965 return("Busy"); 2966 case SCSI_STATUS_INTERMED: 2967 return("Intermediate"); 2968 case SCSI_STATUS_INTERMED_COND_MET: 2969 return("Intermediate-Condition Met"); 2970 case SCSI_STATUS_RESERV_CONFLICT: 2971 return("Reservation Conflict"); 2972 case SCSI_STATUS_CMD_TERMINATED: 2973 return("Command Terminated"); 2974 case SCSI_STATUS_QUEUE_FULL: 2975 return("Queue Full"); 2976 case SCSI_STATUS_ACA_ACTIVE: 2977 return("ACA Active"); 2978 case SCSI_STATUS_TASK_ABORTED: 2979 return("Task Aborted"); 2980 default: { 2981 static char unkstr[64]; 2982 ksnprintf(unkstr, sizeof(unkstr), "Unknown %#x", 2983 csio->scsi_status); 2984 return(unkstr); 2985 } 2986 } 2987 } 2988 2989 /* 2990 * scsi_command_string() returns 0 for success and -1 for failure. 2991 */ 2992 #ifdef _KERNEL 2993 int 2994 scsi_command_string(struct ccb_scsiio *csio, struct sbuf *sb) 2995 #else 2996 int 2997 scsi_command_string(struct cam_device *device, struct ccb_scsiio *csio, 2998 struct sbuf *sb) 2999 #endif 3000 { 3001 struct scsi_inquiry_data *inq_data; 3002 char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; 3003 #ifdef _KERNEL 3004 struct ccb_getdev cgd; 3005 #endif 3006 3007 #ifdef _KERNEL 3008 /* 3009 * Get the device information. 3010 */ 3011 xpt_setup_ccb(&cgd.ccb_h, 3012 csio->ccb_h.path, 3013 /*priority*/ 1); 3014 cgd.ccb_h.func_code = XPT_GDEV_TYPE; 3015 xpt_action((union ccb *)&cgd); 3016 3017 /* 3018 * If the device is unconfigured, just pretend that it is a hard 3019 * drive. scsi_op_desc() needs this. 3020 */ 3021 if (cgd.ccb_h.status == CAM_DEV_NOT_THERE) 3022 cgd.inq_data.device = T_DIRECT; 3023 3024 inq_data = &cgd.inq_data; 3025 3026 #else /* !_KERNEL */ 3027 3028 inq_data = &device->inq_data; 3029 3030 #endif /* _KERNEL/!_KERNEL */ 3031 3032 if ((csio->ccb_h.flags & CAM_CDB_POINTER) != 0) { 3033 sbuf_printf(sb, "%s. CDB: %s", 3034 scsi_op_desc(csio->cdb_io.cdb_ptr[0], inq_data), 3035 scsi_cdb_string(csio->cdb_io.cdb_ptr, cdb_str, 3036 sizeof(cdb_str))); 3037 } else { 3038 sbuf_printf(sb, "%s. CDB: %s", 3039 scsi_op_desc(csio->cdb_io.cdb_bytes[0], inq_data), 3040 scsi_cdb_string(csio->cdb_io.cdb_bytes, cdb_str, 3041 sizeof(cdb_str))); 3042 } 3043 3044 return(0); 3045 } 3046 3047 /* 3048 * scsi_sense_sbuf() returns 0 for success and -1 for failure. 3049 */ 3050 #ifdef _KERNEL 3051 int 3052 scsi_sense_sbuf(struct ccb_scsiio *csio, struct sbuf *sb, 3053 scsi_sense_string_flags flags) 3054 #else /* !_KERNEL */ 3055 int 3056 scsi_sense_sbuf(struct cam_device *device, struct ccb_scsiio *csio, 3057 struct sbuf *sb, scsi_sense_string_flags flags) 3058 #endif /* _KERNEL/!_KERNEL */ 3059 { 3060 struct scsi_sense_data *sense; 3061 struct scsi_inquiry_data *inq_data; 3062 #ifdef _KERNEL 3063 struct ccb_getdev cgd; 3064 #endif /* _KERNEL */ 3065 u_int32_t info; 3066 int error_code; 3067 int sense_key; 3068 int asc, ascq; 3069 char path_str[64]; 3070 3071 #ifndef _KERNEL 3072 if (device == NULL) 3073 return(-1); 3074 #endif /* !_KERNEL */ 3075 if ((csio == NULL) || (sb == NULL)) 3076 return(-1); 3077 3078 /* 3079 * If the CDB is a physical address, we can't deal with it.. 3080 */ 3081 if ((csio->ccb_h.flags & CAM_CDB_PHYS) != 0) 3082 flags &= ~SSS_FLAG_PRINT_COMMAND; 3083 3084 #ifdef _KERNEL 3085 xpt_path_string(csio->ccb_h.path, path_str, sizeof(path_str)); 3086 #else /* !_KERNEL */ 3087 cam_path_string(device, path_str, sizeof(path_str)); 3088 #endif /* _KERNEL/!_KERNEL */ 3089 3090 #ifdef _KERNEL 3091 /* 3092 * Get the device information. 3093 */ 3094 xpt_setup_ccb(&cgd.ccb_h, 3095 csio->ccb_h.path, 3096 /*priority*/ 1); 3097 cgd.ccb_h.func_code = XPT_GDEV_TYPE; 3098 xpt_action((union ccb *)&cgd); 3099 3100 /* 3101 * If the device is unconfigured, just pretend that it is a hard 3102 * drive. scsi_op_desc() needs this. 3103 */ 3104 if (cgd.ccb_h.status == CAM_DEV_NOT_THERE) 3105 cgd.inq_data.device = T_DIRECT; 3106 3107 inq_data = &cgd.inq_data; 3108 3109 #else /* !_KERNEL */ 3110 3111 inq_data = &device->inq_data; 3112 3113 #endif /* _KERNEL/!_KERNEL */ 3114 3115 sense = NULL; 3116 3117 if (flags & SSS_FLAG_PRINT_COMMAND) { 3118 3119 sbuf_cat(sb, path_str); 3120 3121 #ifdef _KERNEL 3122 scsi_command_string(csio, sb); 3123 #else /* !_KERNEL */ 3124 scsi_command_string(device, csio, sb); 3125 #endif /* _KERNEL/!_KERNEL */ 3126 } 3127 3128 /* 3129 * If the sense data is a physical pointer, forget it. 3130 */ 3131 if (csio->ccb_h.flags & CAM_SENSE_PTR) { 3132 if (csio->ccb_h.flags & CAM_SENSE_PHYS) 3133 return(-1); 3134 else { 3135 /* 3136 * bcopy the pointer to avoid unaligned access 3137 * errors on finicky architectures. We don't 3138 * ensure that the sense data is pointer aligned. 3139 */ 3140 bcopy(&csio->sense_data, &sense, 3141 sizeof(struct scsi_sense_data *)); 3142 } 3143 } else { 3144 /* 3145 * If the physical sense flag is set, but the sense pointer 3146 * is not also set, we assume that the user is an idiot and 3147 * return. (Well, okay, it could be that somehow, the 3148 * entire csio is physical, but we would have probably core 3149 * dumped on one of the bogus pointer deferences above 3150 * already.) 3151 */ 3152 if (csio->ccb_h.flags & CAM_SENSE_PHYS) 3153 return(-1); 3154 else 3155 sense = &csio->sense_data; 3156 } 3157 3158 3159 sbuf_cat(sb, path_str); 3160 3161 error_code = sense->error_code & SSD_ERRCODE; 3162 sense_key = sense->flags & SSD_KEY; 3163 3164 switch (error_code) { 3165 case SSD_DEFERRED_ERROR: 3166 sbuf_printf(sb, "Deferred Error: "); 3167 3168 /* FALLTHROUGH */ 3169 case SSD_CURRENT_ERROR: 3170 { 3171 const char *sense_key_desc; 3172 const char *asc_desc; 3173 3174 asc = (sense->extra_len >= 5) ? sense->add_sense_code : 0; 3175 ascq = (sense->extra_len >= 6) ? sense->add_sense_code_qual : 0; 3176 scsi_sense_desc(sense_key, asc, ascq, inq_data, 3177 &sense_key_desc, &asc_desc); 3178 sbuf_cat(sb, sense_key_desc); 3179 3180 info = scsi_4btoul(sense->info); 3181 3182 if (sense->error_code & SSD_ERRCODE_VALID) { 3183 3184 switch (sense_key) { 3185 case SSD_KEY_NOT_READY: 3186 case SSD_KEY_ILLEGAL_REQUEST: 3187 case SSD_KEY_UNIT_ATTENTION: 3188 case SSD_KEY_DATA_PROTECT: 3189 break; 3190 case SSD_KEY_BLANK_CHECK: 3191 sbuf_printf(sb, " req sz: %d (decimal)", info); 3192 break; 3193 default: 3194 if (info) { 3195 if (sense->flags & SSD_ILI) { 3196 sbuf_printf(sb, " ILI (length " 3197 "mismatch): %d", info); 3198 3199 } else { 3200 sbuf_printf(sb, " info:%x", 3201 info); 3202 } 3203 } 3204 } 3205 } else if (info) { 3206 sbuf_printf(sb, " info?:%x", info); 3207 } 3208 3209 if (sense->extra_len >= 4) { 3210 if (bcmp(sense->cmd_spec_info, "\0\0\0\0", 4)) { 3211 sbuf_printf(sb, " csi:%x,%x,%x,%x", 3212 sense->cmd_spec_info[0], 3213 sense->cmd_spec_info[1], 3214 sense->cmd_spec_info[2], 3215 sense->cmd_spec_info[3]); 3216 } 3217 } 3218 3219 sbuf_printf(sb, " asc:%x,%x\n%s%s", asc, ascq, 3220 path_str, asc_desc); 3221 3222 if (sense->extra_len >= 7 && sense->fru) { 3223 sbuf_printf(sb, " field replaceable unit: %x", 3224 sense->fru); 3225 } 3226 3227 if ((sense->extra_len >= 10) 3228 && (sense->sense_key_spec[0] & SSD_SCS_VALID) != 0) { 3229 switch(sense_key) { 3230 case SSD_KEY_ILLEGAL_REQUEST: { 3231 int bad_command; 3232 char tmpstr2[40]; 3233 3234 if (sense->sense_key_spec[0] & 0x40) 3235 bad_command = 1; 3236 else 3237 bad_command = 0; 3238 3239 tmpstr2[0] = '\0'; 3240 3241 /* Bit pointer is valid */ 3242 if (sense->sense_key_spec[0] & 0x08) 3243 ksnprintf(tmpstr2, sizeof(tmpstr2), 3244 "bit %d", 3245 sense->sense_key_spec[0] & 0x7); 3246 sbuf_printf(sb, 3247 ": %s byte %d %s is invalid", 3248 bad_command ? 3249 "Command" : "Data", 3250 scsi_2btoul( 3251 &sense->sense_key_spec[1]), 3252 tmpstr2); 3253 break; 3254 } 3255 case SSD_KEY_RECOVERED_ERROR: 3256 case SSD_KEY_HARDWARE_ERROR: 3257 case SSD_KEY_MEDIUM_ERROR: 3258 sbuf_printf(sb, " actual retry count: %d", 3259 scsi_2btoul( 3260 &sense->sense_key_spec[1])); 3261 break; 3262 default: 3263 sbuf_printf(sb, " sks:%#x,%#x", 3264 sense->sense_key_spec[0], 3265 scsi_2btoul( 3266 &sense->sense_key_spec[1])); 3267 break; 3268 } 3269 } 3270 break; 3271 3272 } 3273 default: 3274 sbuf_printf(sb, "Sense Error Code 0x%x", sense->error_code); 3275 if (sense->error_code & SSD_ERRCODE_VALID) { 3276 sbuf_printf(sb, " at block no. %d (decimal)", 3277 info = scsi_4btoul(sense->info)); 3278 } 3279 } 3280 3281 sbuf_printf(sb, "\n"); 3282 3283 return(0); 3284 } 3285 3286 #ifdef _KERNEL 3287 char * 3288 scsi_sense_string(struct ccb_scsiio *csio, char *str, int str_len) 3289 #else /* !_KERNEL */ 3290 char * 3291 scsi_sense_string(struct cam_device *device, struct ccb_scsiio *csio, 3292 char *str, int str_len) 3293 #endif /* _KERNEL/!_KERNEL */ 3294 { 3295 struct sbuf sb; 3296 3297 sbuf_new(&sb, str, str_len, 0); 3298 3299 #ifdef _KERNEL 3300 scsi_sense_sbuf(csio, &sb, SSS_FLAG_PRINT_COMMAND); 3301 #else /* !_KERNEL */ 3302 scsi_sense_sbuf(device, csio, &sb, SSS_FLAG_PRINT_COMMAND); 3303 #endif /* _KERNEL/!_KERNEL */ 3304 3305 sbuf_finish(&sb); 3306 3307 return(sbuf_data(&sb)); 3308 } 3309 3310 #ifdef _KERNEL 3311 void 3312 scsi_sense_print(struct ccb_scsiio *csio) 3313 { 3314 struct sbuf sb; 3315 char str[512]; 3316 3317 sbuf_new(&sb, str, sizeof(str), 0); 3318 3319 scsi_sense_sbuf(csio, &sb, SSS_FLAG_PRINT_COMMAND); 3320 3321 sbuf_finish(&sb); 3322 3323 kprintf("%s", sbuf_data(&sb)); 3324 } 3325 3326 #else /* !_KERNEL */ 3327 void 3328 scsi_sense_print(struct cam_device *device, struct ccb_scsiio *csio, 3329 FILE *ofile) 3330 { 3331 struct sbuf sb; 3332 char str[512]; 3333 3334 if ((device == NULL) || (csio == NULL) || (ofile == NULL)) 3335 return; 3336 3337 sbuf_new(&sb, str, sizeof(str), 0); 3338 3339 scsi_sense_sbuf(device, csio, &sb, SSS_FLAG_PRINT_COMMAND); 3340 3341 sbuf_finish(&sb); 3342 3343 fprintf(ofile, "%s", sbuf_data(&sb)); 3344 } 3345 3346 #endif /* _KERNEL/!_KERNEL */ 3347 3348 /* 3349 * This function currently requires at least 36 bytes, or 3350 * SHORT_INQUIRY_LENGTH, worth of data to function properly. If this 3351 * function needs more or less data in the future, another length should be 3352 * defined in scsi_all.h to indicate the minimum amount of data necessary 3353 * for this routine to function properly. 3354 */ 3355 void 3356 scsi_print_inquiry(struct scsi_inquiry_data *inq_data) 3357 { 3358 u_int8_t type; 3359 char *dtype, *qtype; 3360 char vendor[16], product[48], revision[16], rstr[4]; 3361 3362 type = SID_TYPE(inq_data); 3363 3364 /* 3365 * Figure out basic device type and qualifier. 3366 */ 3367 if (SID_QUAL_IS_VENDOR_UNIQUE(inq_data)) { 3368 qtype = "(vendor-unique qualifier)"; 3369 } else { 3370 switch (SID_QUAL(inq_data)) { 3371 case SID_QUAL_LU_CONNECTED: 3372 qtype = ""; 3373 break; 3374 3375 case SID_QUAL_LU_OFFLINE: 3376 qtype = "(offline)"; 3377 break; 3378 3379 case SID_QUAL_RSVD: 3380 qtype = "(reserved qualifier)"; 3381 break; 3382 default: 3383 case SID_QUAL_BAD_LU: 3384 qtype = "(LUN not supported)"; 3385 break; 3386 } 3387 } 3388 3389 switch (type) { 3390 case T_DIRECT: 3391 dtype = "Direct Access"; 3392 break; 3393 case T_SEQUENTIAL: 3394 dtype = "Sequential Access"; 3395 break; 3396 case T_PRINTER: 3397 dtype = "Printer"; 3398 break; 3399 case T_PROCESSOR: 3400 dtype = "Processor"; 3401 break; 3402 case T_WORM: 3403 dtype = "WORM"; 3404 break; 3405 case T_CDROM: 3406 dtype = "CD-ROM"; 3407 break; 3408 case T_SCANNER: 3409 dtype = "Scanner"; 3410 break; 3411 case T_OPTICAL: 3412 dtype = "Optical"; 3413 break; 3414 case T_CHANGER: 3415 dtype = "Changer"; 3416 break; 3417 case T_COMM: 3418 dtype = "Communication"; 3419 break; 3420 case T_STORARRAY: 3421 dtype = "Storage Array"; 3422 break; 3423 case T_ENCLOSURE: 3424 dtype = "Enclosure Services"; 3425 break; 3426 case T_RBC: 3427 dtype = "Simplified Direct Access"; 3428 break; 3429 case T_OCRW: 3430 dtype = "Optical Card Read/Write"; 3431 break; 3432 case T_OSD: 3433 dtype = "Object-Based Storage"; 3434 break; 3435 case T_ADC: 3436 dtype = "Automation/Drive Interface"; 3437 break; 3438 case T_NODEVICE: 3439 dtype = "Uninstalled"; 3440 default: 3441 dtype = "unknown"; 3442 break; 3443 } 3444 3445 cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), 3446 sizeof(vendor)); 3447 cam_strvis(product, inq_data->product, sizeof(inq_data->product), 3448 sizeof(product)); 3449 cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision), 3450 sizeof(revision)); 3451 3452 if (SID_ANSI_REV(inq_data) == SCSI_REV_CCS) 3453 bcopy("CCS", rstr, 4); 3454 else 3455 ksnprintf(rstr, sizeof (rstr), "%d", SID_ANSI_REV(inq_data)); 3456 kprintf("<%s %s %s> %s %s SCSI-%s device %s\n", 3457 vendor, product, revision, 3458 SID_IS_REMOVABLE(inq_data) ? "Removable" : "Fixed", 3459 dtype, rstr, qtype); 3460 } 3461 3462 /* 3463 * Table of syncrates that don't follow the "divisible by 4" 3464 * rule. This table will be expanded in future SCSI specs. 3465 */ 3466 static struct { 3467 u_int period_factor; 3468 u_int period; /* in 100ths of ns */ 3469 } scsi_syncrates[] = { 3470 { 0x08, 625 }, /* FAST-160 */ 3471 { 0x09, 1250 }, /* FAST-80 */ 3472 { 0x0a, 2500 }, /* FAST-40 40MHz */ 3473 { 0x0b, 3030 }, /* FAST-40 33MHz */ 3474 { 0x0c, 5000 } /* FAST-20 */ 3475 }; 3476 3477 /* 3478 * Return the frequency in kHz corresponding to the given 3479 * sync period factor. 3480 */ 3481 u_int 3482 scsi_calc_syncsrate(u_int period_factor) 3483 { 3484 int i; 3485 int num_syncrates; 3486 3487 /* 3488 * It's a bug if period is zero, but if it is anyway, don't 3489 * die with a divide fault- instead return something which 3490 * 'approximates' async 3491 */ 3492 if (period_factor == 0) { 3493 return (3300); 3494 } 3495 3496 num_syncrates = sizeof(scsi_syncrates) / sizeof(scsi_syncrates[0]); 3497 /* See if the period is in the "exception" table */ 3498 for (i = 0; i < num_syncrates; i++) { 3499 3500 if (period_factor == scsi_syncrates[i].period_factor) { 3501 /* Period in kHz */ 3502 return (100000000 / scsi_syncrates[i].period); 3503 } 3504 } 3505 3506 /* 3507 * Wasn't in the table, so use the standard 3508 * 4 times conversion. 3509 */ 3510 return (10000000 / (period_factor * 4 * 10)); 3511 } 3512 3513 /* 3514 * Return the SCSI sync parameter that corresponsd to 3515 * the passed in period in 10ths of ns. 3516 */ 3517 u_int 3518 scsi_calc_syncparam(u_int period) 3519 { 3520 int i; 3521 int num_syncrates; 3522 3523 if (period == 0) 3524 return (~0); /* Async */ 3525 3526 /* Adjust for exception table being in 100ths. */ 3527 period *= 10; 3528 num_syncrates = sizeof(scsi_syncrates) / sizeof(scsi_syncrates[0]); 3529 /* See if the period is in the "exception" table */ 3530 for (i = 0; i < num_syncrates; i++) { 3531 3532 if (period <= scsi_syncrates[i].period) { 3533 /* Period in 100ths of ns */ 3534 return (scsi_syncrates[i].period_factor); 3535 } 3536 } 3537 3538 /* 3539 * Wasn't in the table, so use the standard 3540 * 1/4 period in ns conversion. 3541 */ 3542 return (period/400); 3543 } 3544 3545 void 3546 scsi_test_unit_ready(struct ccb_scsiio *csio, u_int32_t retries, 3547 void (*cbfcnp)(struct cam_periph *, union ccb *), 3548 u_int8_t tag_action, u_int8_t sense_len, u_int32_t timeout) 3549 { 3550 struct scsi_test_unit_ready *scsi_cmd; 3551 3552 cam_fill_csio(csio, 3553 retries, 3554 cbfcnp, 3555 CAM_DIR_NONE, 3556 tag_action, 3557 /*data_ptr*/NULL, 3558 /*dxfer_len*/0, 3559 sense_len, 3560 sizeof(*scsi_cmd), 3561 timeout); 3562 3563 scsi_cmd = (struct scsi_test_unit_ready *)&csio->cdb_io.cdb_bytes; 3564 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3565 scsi_cmd->opcode = TEST_UNIT_READY; 3566 } 3567 3568 void 3569 scsi_request_sense(struct ccb_scsiio *csio, u_int32_t retries, 3570 void (*cbfcnp)(struct cam_periph *, union ccb *), 3571 void *data_ptr, u_int8_t dxfer_len, u_int8_t tag_action, 3572 u_int8_t sense_len, u_int32_t timeout) 3573 { 3574 struct scsi_request_sense *scsi_cmd; 3575 3576 cam_fill_csio(csio, 3577 retries, 3578 cbfcnp, 3579 CAM_DIR_IN, 3580 tag_action, 3581 data_ptr, 3582 dxfer_len, 3583 sense_len, 3584 sizeof(*scsi_cmd), 3585 timeout); 3586 3587 scsi_cmd = (struct scsi_request_sense *)&csio->cdb_io.cdb_bytes; 3588 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3589 scsi_cmd->opcode = REQUEST_SENSE; 3590 scsi_cmd->length = dxfer_len; 3591 } 3592 3593 void 3594 scsi_inquiry(struct ccb_scsiio *csio, u_int32_t retries, 3595 void (*cbfcnp)(struct cam_periph *, union ccb *), 3596 u_int8_t tag_action, u_int8_t *inq_buf, u_int32_t inq_len, 3597 int evpd, u_int8_t page_code, u_int8_t sense_len, 3598 u_int32_t timeout) 3599 { 3600 struct scsi_inquiry *scsi_cmd; 3601 3602 cam_fill_csio(csio, 3603 retries, 3604 cbfcnp, 3605 /*flags*/CAM_DIR_IN, 3606 tag_action, 3607 /*data_ptr*/inq_buf, 3608 /*dxfer_len*/inq_len, 3609 sense_len, 3610 sizeof(*scsi_cmd), 3611 timeout); 3612 3613 scsi_cmd = (struct scsi_inquiry *)&csio->cdb_io.cdb_bytes; 3614 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3615 scsi_cmd->opcode = INQUIRY; 3616 if (evpd) { 3617 scsi_cmd->byte2 |= SI_EVPD; 3618 scsi_cmd->page_code = page_code; 3619 } 3620 /* 3621 * A 'transfer units' count of 256 is coded as 3622 * zero for all commands with a single byte count 3623 * field. 3624 */ 3625 if (inq_len == 256) 3626 inq_len = 0; 3627 scsi_cmd->length = inq_len; 3628 } 3629 3630 void 3631 scsi_mode_sense(struct ccb_scsiio *csio, u_int32_t retries, 3632 void (*cbfcnp)(struct cam_periph *, union ccb *), 3633 u_int8_t tag_action, int dbd, u_int8_t page_code, 3634 u_int8_t page, u_int8_t *param_buf, u_int32_t param_len, 3635 u_int8_t sense_len, u_int32_t timeout) 3636 { 3637 scsi_mode_sense_len(csio, retries, cbfcnp, tag_action, dbd, 3638 page_code, page, param_buf, param_len, 0, 3639 sense_len, timeout); 3640 } 3641 3642 void 3643 scsi_mode_sense_len(struct ccb_scsiio *csio, u_int32_t retries, 3644 void (*cbfcnp)(struct cam_periph *, union ccb *), 3645 u_int8_t tag_action, int dbd, u_int8_t page_code, 3646 u_int8_t page, u_int8_t *param_buf, u_int32_t param_len, 3647 int minimum_cmd_size, u_int8_t sense_len, u_int32_t timeout) 3648 { 3649 u_int8_t cdb_len; 3650 3651 /* 3652 * Use the smallest possible command to perform the operation. 3653 */ 3654 if ((param_len < 256) && (minimum_cmd_size < 10)) { 3655 /* 3656 * We can fit in a 6 byte cdb. 3657 */ 3658 struct scsi_mode_sense_6 *scsi_cmd; 3659 3660 scsi_cmd = (struct scsi_mode_sense_6 *)&csio->cdb_io.cdb_bytes; 3661 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3662 scsi_cmd->opcode = MODE_SENSE_6; 3663 if (dbd != 0) 3664 scsi_cmd->byte2 |= SMS_DBD; 3665 scsi_cmd->page = page_code | page; 3666 scsi_cmd->length = param_len; 3667 cdb_len = sizeof(*scsi_cmd); 3668 } else { 3669 /* 3670 * Need a 10 byte cdb. 3671 */ 3672 struct scsi_mode_sense_10 *scsi_cmd; 3673 3674 scsi_cmd = (struct scsi_mode_sense_10 *)&csio->cdb_io.cdb_bytes; 3675 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3676 scsi_cmd->opcode = MODE_SENSE_10; 3677 if (dbd != 0) 3678 scsi_cmd->byte2 |= SMS_DBD; 3679 scsi_cmd->page = page_code | page; 3680 scsi_ulto2b(param_len, scsi_cmd->length); 3681 cdb_len = sizeof(*scsi_cmd); 3682 } 3683 cam_fill_csio(csio, 3684 retries, 3685 cbfcnp, 3686 CAM_DIR_IN, 3687 tag_action, 3688 param_buf, 3689 param_len, 3690 sense_len, 3691 cdb_len, 3692 timeout); 3693 } 3694 3695 void 3696 scsi_mode_select(struct ccb_scsiio *csio, u_int32_t retries, 3697 void (*cbfcnp)(struct cam_periph *, union ccb *), 3698 u_int8_t tag_action, int scsi_page_fmt, int save_pages, 3699 u_int8_t *param_buf, u_int32_t param_len, u_int8_t sense_len, 3700 u_int32_t timeout) 3701 { 3702 scsi_mode_select_len(csio, retries, cbfcnp, tag_action, 3703 scsi_page_fmt, save_pages, param_buf, 3704 param_len, 0, sense_len, timeout); 3705 } 3706 3707 void 3708 scsi_mode_select_len(struct ccb_scsiio *csio, u_int32_t retries, 3709 void (*cbfcnp)(struct cam_periph *, union ccb *), 3710 u_int8_t tag_action, int scsi_page_fmt, int save_pages, 3711 u_int8_t *param_buf, u_int32_t param_len, 3712 int minimum_cmd_size, u_int8_t sense_len, 3713 u_int32_t timeout) 3714 { 3715 u_int8_t cdb_len; 3716 3717 /* 3718 * Use the smallest possible command to perform the operation. 3719 */ 3720 if ((param_len < 256) && (minimum_cmd_size < 10)) { 3721 /* 3722 * We can fit in a 6 byte cdb. 3723 */ 3724 struct scsi_mode_select_6 *scsi_cmd; 3725 3726 scsi_cmd = (struct scsi_mode_select_6 *)&csio->cdb_io.cdb_bytes; 3727 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3728 scsi_cmd->opcode = MODE_SELECT_6; 3729 if (scsi_page_fmt != 0) 3730 scsi_cmd->byte2 |= SMS_PF; 3731 if (save_pages != 0) 3732 scsi_cmd->byte2 |= SMS_SP; 3733 scsi_cmd->length = param_len; 3734 cdb_len = sizeof(*scsi_cmd); 3735 } else { 3736 /* 3737 * Need a 10 byte cdb. 3738 */ 3739 struct scsi_mode_select_10 *scsi_cmd; 3740 3741 scsi_cmd = 3742 (struct scsi_mode_select_10 *)&csio->cdb_io.cdb_bytes; 3743 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3744 scsi_cmd->opcode = MODE_SELECT_10; 3745 if (scsi_page_fmt != 0) 3746 scsi_cmd->byte2 |= SMS_PF; 3747 if (save_pages != 0) 3748 scsi_cmd->byte2 |= SMS_SP; 3749 scsi_ulto2b(param_len, scsi_cmd->length); 3750 cdb_len = sizeof(*scsi_cmd); 3751 } 3752 cam_fill_csio(csio, 3753 retries, 3754 cbfcnp, 3755 CAM_DIR_OUT, 3756 tag_action, 3757 param_buf, 3758 param_len, 3759 sense_len, 3760 cdb_len, 3761 timeout); 3762 } 3763 3764 void 3765 scsi_read_capacity_16(struct ccb_scsiio *csio, uint32_t retries, 3766 void (*cbfcnp)(struct cam_periph *, union ccb *), 3767 uint8_t tag_action, uint64_t lba, int reladr, int pmi, 3768 struct scsi_read_capacity_data_16 *rcap_buf, 3769 uint8_t sense_len, uint32_t timeout) 3770 { 3771 struct scsi_read_capacity_16 *scsi_cmd; 3772 3773 cam_fill_csio(csio, 3774 retries, 3775 cbfcnp, 3776 /*flags*/CAM_DIR_IN, 3777 tag_action, 3778 /*data_ptr*/(u_int8_t *)rcap_buf, 3779 /*dxfer_len*/sizeof(*rcap_buf), 3780 sense_len, 3781 sizeof(*scsi_cmd), 3782 timeout); 3783 scsi_cmd = (struct scsi_read_capacity_16 *)&csio->cdb_io.cdb_bytes; 3784 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3785 scsi_cmd->opcode = READ_CAPACITY_16; 3786 scsi_cmd->service_action = SRC16_SERVICE_ACTION; 3787 scsi_u64to8b(lba, scsi_cmd->addr); 3788 scsi_ulto4b(sizeof(*rcap_buf), scsi_cmd->alloc_len); 3789 if (pmi) 3790 reladr |= SRC16_PMI; 3791 if (reladr) 3792 reladr |= SRC16_RELADR; 3793 } 3794 3795 /* 3796 * Prevent or allow the user to remove the media 3797 */ 3798 void 3799 scsi_prevent(struct ccb_scsiio *csio, u_int32_t retries, 3800 void (*cbfcnp)(struct cam_periph *, union ccb *), 3801 u_int8_t tag_action, u_int8_t action, 3802 u_int8_t sense_len, u_int32_t timeout) 3803 { 3804 struct scsi_prevent *scsi_cmd; 3805 3806 cam_fill_csio(csio, 3807 retries, 3808 cbfcnp, 3809 /*flags*/CAM_DIR_NONE, 3810 tag_action, 3811 /*data_ptr*/NULL, 3812 /*dxfer_len*/0, 3813 sense_len, 3814 sizeof(*scsi_cmd), 3815 timeout); 3816 3817 scsi_cmd = (struct scsi_prevent *)&csio->cdb_io.cdb_bytes; 3818 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3819 scsi_cmd->opcode = PREVENT_ALLOW; 3820 scsi_cmd->how = action; 3821 } 3822 3823 /* XXX allow specification of address and PMI bit and LBA */ 3824 void 3825 scsi_read_capacity(struct ccb_scsiio *csio, u_int32_t retries, 3826 void (*cbfcnp)(struct cam_periph *, union ccb *), 3827 u_int8_t tag_action, 3828 struct scsi_read_capacity_data *rcap_buf, 3829 u_int8_t sense_len, u_int32_t timeout) 3830 { 3831 struct scsi_read_capacity *scsi_cmd; 3832 3833 cam_fill_csio(csio, 3834 retries, 3835 cbfcnp, 3836 /*flags*/CAM_DIR_IN, 3837 tag_action, 3838 /*data_ptr*/(u_int8_t *)rcap_buf, 3839 /*dxfer_len*/sizeof(*rcap_buf), 3840 sense_len, 3841 sizeof(*scsi_cmd), 3842 timeout); 3843 3844 scsi_cmd = (struct scsi_read_capacity *)&csio->cdb_io.cdb_bytes; 3845 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3846 scsi_cmd->opcode = READ_CAPACITY; 3847 } 3848 3849 void 3850 scsi_report_luns(struct ccb_scsiio *csio, u_int32_t retries, 3851 void (*cbfcnp)(struct cam_periph *, union ccb *), 3852 u_int8_t tag_action, u_int8_t select_report, 3853 struct scsi_report_luns_data *rpl_buf, u_int32_t alloc_len, 3854 u_int8_t sense_len, u_int32_t timeout) 3855 { 3856 struct scsi_report_luns *scsi_cmd; 3857 3858 cam_fill_csio(csio, 3859 retries, 3860 cbfcnp, 3861 /*flags*/CAM_DIR_IN, 3862 tag_action, 3863 /*data_ptr*/(u_int8_t *)rpl_buf, 3864 /*dxfer_len*/alloc_len, 3865 sense_len, 3866 sizeof(*scsi_cmd), 3867 timeout); 3868 scsi_cmd = (struct scsi_report_luns *)&csio->cdb_io.cdb_bytes; 3869 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3870 scsi_cmd->opcode = REPORT_LUNS; 3871 scsi_cmd->select_report = select_report; 3872 scsi_ulto4b(alloc_len, scsi_cmd->length); 3873 } 3874 3875 /* 3876 * Syncronize the media to the contents of the cache for 3877 * the given lba/count pair. Specifying 0/0 means sync 3878 * the whole cache. 3879 */ 3880 void 3881 scsi_synchronize_cache(struct ccb_scsiio *csio, u_int32_t retries, 3882 void (*cbfcnp)(struct cam_periph *, union ccb *), 3883 u_int8_t tag_action, u_int32_t begin_lba, 3884 u_int16_t lb_count, u_int8_t sense_len, 3885 u_int32_t timeout) 3886 { 3887 struct scsi_sync_cache *scsi_cmd; 3888 3889 cam_fill_csio(csio, 3890 retries, 3891 cbfcnp, 3892 /*flags*/CAM_DIR_NONE, 3893 tag_action, 3894 /*data_ptr*/NULL, 3895 /*dxfer_len*/0, 3896 sense_len, 3897 sizeof(*scsi_cmd), 3898 timeout); 3899 3900 scsi_cmd = (struct scsi_sync_cache *)&csio->cdb_io.cdb_bytes; 3901 bzero(scsi_cmd, sizeof(*scsi_cmd)); 3902 scsi_cmd->opcode = SYNCHRONIZE_CACHE; 3903 scsi_ulto4b(begin_lba, scsi_cmd->begin_lba); 3904 scsi_ulto2b(lb_count, scsi_cmd->lb_count); 3905 } 3906 3907 void 3908 scsi_read_write(struct ccb_scsiio *csio, u_int32_t retries, 3909 void (*cbfcnp)(struct cam_periph *, union ccb *), 3910 u_int8_t tag_action, int readop, u_int8_t byte2, 3911 int minimum_cmd_size, u_int64_t lba, u_int32_t block_count, 3912 u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, 3913 u_int32_t timeout) 3914 { 3915 u_int8_t cdb_len; 3916 3917 /* 3918 * Use the smallest possible command to perform the operation 3919 * as some legacy hardware does not support the 10 byte commands. 3920 * If any of the bits in byte2 is set, we have to go with a larger 3921 * command. 3922 */ 3923 if ((minimum_cmd_size < 10) 3924 && ((lba & 0x1fffff) == lba) 3925 && ((block_count & 0xff) == block_count) 3926 && (byte2 == 0)) { 3927 /* 3928 * We can fit in a 6 byte cdb. 3929 */ 3930 struct scsi_rw_6 *scsi_cmd; 3931 3932 scsi_cmd = (struct scsi_rw_6 *)&csio->cdb_io.cdb_bytes; 3933 scsi_cmd->opcode = readop ? READ_6 : WRITE_6; 3934 scsi_ulto3b(lba, scsi_cmd->addr); 3935 scsi_cmd->length = block_count & 0xff; 3936 scsi_cmd->control = 0; 3937 cdb_len = sizeof(*scsi_cmd); 3938 3939 CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, 3940 ("6byte: %x%x%x:%d:%d\n", scsi_cmd->addr[0], 3941 scsi_cmd->addr[1], scsi_cmd->addr[2], 3942 scsi_cmd->length, dxfer_len)); 3943 } else if ((minimum_cmd_size < 12) 3944 && ((block_count & 0xffff) == block_count) 3945 && ((lba & 0xffffffffU) == lba)) { 3946 /* 3947 * Need a 10 byte cdb. 3948 */ 3949 struct scsi_rw_10 *scsi_cmd; 3950 3951 scsi_cmd = (struct scsi_rw_10 *)&csio->cdb_io.cdb_bytes; 3952 scsi_cmd->opcode = readop ? READ_10 : WRITE_10; 3953 scsi_cmd->byte2 = byte2; 3954 scsi_ulto4b(lba, scsi_cmd->addr); 3955 scsi_cmd->reserved = 0; 3956 scsi_ulto2b(block_count, scsi_cmd->length); 3957 scsi_cmd->control = 0; 3958 cdb_len = sizeof(*scsi_cmd); 3959 3960 CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, 3961 ("10byte: %x%x%x%x:%x%x: %d\n", scsi_cmd->addr[0], 3962 scsi_cmd->addr[1], scsi_cmd->addr[2], 3963 scsi_cmd->addr[3], scsi_cmd->length[0], 3964 scsi_cmd->length[1], dxfer_len)); 3965 } else if ((minimum_cmd_size < 16) 3966 && ((block_count & 0xffffffffU) == block_count) 3967 && ((lba & 0xffffffffU) == lba)) { 3968 /* 3969 * The block count is too big for a 10 byte CDB, use a 12 3970 * byte CDB. 3971 */ 3972 struct scsi_rw_12 *scsi_cmd; 3973 3974 scsi_cmd = (struct scsi_rw_12 *)&csio->cdb_io.cdb_bytes; 3975 scsi_cmd->opcode = readop ? READ_12 : WRITE_12; 3976 scsi_cmd->byte2 = byte2; 3977 scsi_ulto4b(lba, scsi_cmd->addr); 3978 scsi_cmd->reserved = 0; 3979 scsi_ulto4b(block_count, scsi_cmd->length); 3980 scsi_cmd->control = 0; 3981 cdb_len = sizeof(*scsi_cmd); 3982 3983 CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, 3984 ("12byte: %x%x%x%x:%x%x%x%x: %d\n", scsi_cmd->addr[0], 3985 scsi_cmd->addr[1], scsi_cmd->addr[2], 3986 scsi_cmd->addr[3], scsi_cmd->length[0], 3987 scsi_cmd->length[1], scsi_cmd->length[2], 3988 scsi_cmd->length[3], dxfer_len)); 3989 } else { 3990 /* 3991 * 16 byte CDB. We'll only get here if the LBA is larger 3992 * than 2^32, or if the user asks for a 16 byte command. 3993 */ 3994 struct scsi_rw_16 *scsi_cmd; 3995 3996 scsi_cmd = (struct scsi_rw_16 *)&csio->cdb_io.cdb_bytes; 3997 scsi_cmd->opcode = readop ? READ_16 : WRITE_16; 3998 scsi_cmd->byte2 = byte2; 3999 scsi_u64to8b(lba, scsi_cmd->addr); 4000 scsi_cmd->reserved = 0; 4001 scsi_ulto4b(block_count, scsi_cmd->length); 4002 scsi_cmd->control = 0; 4003 cdb_len = sizeof(*scsi_cmd); 4004 } 4005 cam_fill_csio(csio, 4006 retries, 4007 cbfcnp, 4008 /*flags*/readop ? CAM_DIR_IN : CAM_DIR_OUT, 4009 tag_action, 4010 data_ptr, 4011 dxfer_len, 4012 sense_len, 4013 cdb_len, 4014 timeout); 4015 } 4016 4017 void 4018 scsi_start_stop(struct ccb_scsiio *csio, u_int32_t retries, 4019 void (*cbfcnp)(struct cam_periph *, union ccb *), 4020 u_int8_t tag_action, int start, int load_eject, 4021 int immediate, u_int8_t sense_len, u_int32_t timeout) 4022 { 4023 struct scsi_start_stop_unit *scsi_cmd; 4024 int extra_flags = 0; 4025 4026 scsi_cmd = (struct scsi_start_stop_unit *)&csio->cdb_io.cdb_bytes; 4027 bzero(scsi_cmd, sizeof(*scsi_cmd)); 4028 scsi_cmd->opcode = START_STOP_UNIT; 4029 if (start != 0) { 4030 scsi_cmd->how |= SSS_START; 4031 /* it takes a lot of power to start a drive */ 4032 extra_flags |= CAM_HIGH_POWER; 4033 } 4034 if (load_eject != 0) 4035 scsi_cmd->how |= SSS_LOEJ; 4036 if (immediate != 0) 4037 scsi_cmd->byte2 |= SSS_IMMED; 4038 4039 cam_fill_csio(csio, 4040 retries, 4041 cbfcnp, 4042 /*flags*/CAM_DIR_NONE | extra_flags, 4043 tag_action, 4044 /*data_ptr*/NULL, 4045 /*dxfer_len*/0, 4046 sense_len, 4047 sizeof(*scsi_cmd), 4048 timeout); 4049 4050 } 4051 4052 void 4053 scsi_log_sense(struct ccb_scsiio *csio, u_int32_t retries, 4054 void (*cbfcnp)(struct cam_periph *, union ccb *), 4055 u_int8_t tag_action, u_int8_t page_code, u_int8_t page, 4056 int save_pages, int ppc, u_int32_t paramptr, 4057 u_int8_t *param_buf, u_int32_t param_len, u_int8_t sense_len, 4058 u_int32_t timeout) 4059 { 4060 struct scsi_log_sense *scsi_cmd; 4061 u_int8_t cdb_len; 4062 4063 scsi_cmd = (struct scsi_log_sense *)&csio->cdb_io.cdb_bytes; 4064 bzero(scsi_cmd, sizeof(*scsi_cmd)); 4065 scsi_cmd->opcode = LOG_SENSE; 4066 scsi_cmd->page = page_code | page; 4067 if (save_pages != 0) 4068 scsi_cmd->byte2 |= SLS_SP; 4069 if (ppc != 0) 4070 scsi_cmd->byte2 |= SLS_PPC; 4071 scsi_ulto2b(paramptr, scsi_cmd->paramptr); 4072 scsi_ulto2b(param_len, scsi_cmd->length); 4073 cdb_len = sizeof(*scsi_cmd); 4074 4075 cam_fill_csio(csio, 4076 retries, 4077 cbfcnp, 4078 /*flags*/CAM_DIR_IN, 4079 tag_action, 4080 /*data_ptr*/param_buf, 4081 /*dxfer_len*/param_len, 4082 sense_len, 4083 cdb_len, 4084 timeout); 4085 } 4086 4087 void 4088 scsi_log_select(struct ccb_scsiio *csio, u_int32_t retries, 4089 void (*cbfcnp)(struct cam_periph *, union ccb *), 4090 u_int8_t tag_action, u_int8_t page_code, int save_pages, 4091 int pc_reset, u_int8_t *param_buf, u_int32_t param_len, 4092 u_int8_t sense_len, u_int32_t timeout) 4093 { 4094 struct scsi_log_select *scsi_cmd; 4095 u_int8_t cdb_len; 4096 4097 scsi_cmd = (struct scsi_log_select *)&csio->cdb_io.cdb_bytes; 4098 bzero(scsi_cmd, sizeof(*scsi_cmd)); 4099 scsi_cmd->opcode = LOG_SELECT; 4100 scsi_cmd->page = page_code & SLS_PAGE_CODE; 4101 if (save_pages != 0) 4102 scsi_cmd->byte2 |= SLS_SP; 4103 if (pc_reset != 0) 4104 scsi_cmd->byte2 |= SLS_PCR; 4105 scsi_ulto2b(param_len, scsi_cmd->length); 4106 cdb_len = sizeof(*scsi_cmd); 4107 4108 cam_fill_csio(csio, 4109 retries, 4110 cbfcnp, 4111 /*flags*/CAM_DIR_OUT, 4112 tag_action, 4113 /*data_ptr*/param_buf, 4114 /*dxfer_len*/param_len, 4115 sense_len, 4116 cdb_len, 4117 timeout); 4118 } 4119 4120 /* 4121 * Try make as good a match as possible with 4122 * available sub drivers 4123 */ 4124 int 4125 scsi_inquiry_match(caddr_t inqbuffer, caddr_t table_entry) 4126 { 4127 struct scsi_inquiry_pattern *entry; 4128 struct scsi_inquiry_data *inq; 4129 4130 entry = (struct scsi_inquiry_pattern *)table_entry; 4131 inq = (struct scsi_inquiry_data *)inqbuffer; 4132 4133 if (((SID_TYPE(inq) == entry->type) 4134 || (entry->type == T_ANY)) 4135 && (SID_IS_REMOVABLE(inq) ? entry->media_type & SIP_MEDIA_REMOVABLE 4136 : entry->media_type & SIP_MEDIA_FIXED) 4137 && (cam_strmatch(inq->vendor, entry->vendor, sizeof(inq->vendor)) == 0) 4138 && (cam_strmatch(inq->product, entry->product, 4139 sizeof(inq->product)) == 0) 4140 && (cam_strmatch(inq->revision, entry->revision, 4141 sizeof(inq->revision)) == 0)) { 4142 return (0); 4143 } 4144 return (-1); 4145 } 4146 4147 #ifdef _KERNEL 4148 static void 4149 init_scsi_delay(void) 4150 { 4151 int delay; 4152 4153 delay = SCSI_DELAY; 4154 TUNABLE_INT_FETCH("kern.cam.scsi_delay", &delay); 4155 4156 if (set_scsi_delay(delay) != 0) { 4157 kprintf("cam: invalid value for tunable kern.cam.scsi_delay\n"); 4158 set_scsi_delay(SCSI_DELAY); 4159 } 4160 } 4161 SYSINIT(scsi_delay, SI_BOOT1_TUNABLES, SI_ORDER_ANY, init_scsi_delay, NULL); 4162 4163 static int 4164 sysctl_scsi_delay(SYSCTL_HANDLER_ARGS) 4165 { 4166 int error, delay; 4167 4168 delay = scsi_delay; 4169 error = sysctl_handle_int(oidp, &delay, 0, req); 4170 if (error != 0 || req->newptr == NULL) 4171 return (error); 4172 return (set_scsi_delay(delay)); 4173 } 4174 SYSCTL_PROC(_kern_cam, OID_AUTO, scsi_delay, CTLTYPE_INT|CTLFLAG_RW, 4175 0, 0, sysctl_scsi_delay, "I", 4176 "Delay to allow devices to settle after a SCSI bus reset (ms)"); 4177 4178 static int 4179 set_scsi_delay(int delay) 4180 { 4181 /* 4182 * If someone sets this to 0, we assume that they want the 4183 * minimum allowable bus settle delay. 4184 */ 4185 if (delay == 0) { 4186 kprintf("cam: using minimum scsi_delay (%dms)\n", 4187 SCSI_MIN_DELAY); 4188 delay = SCSI_MIN_DELAY; 4189 } 4190 if (delay < SCSI_MIN_DELAY) 4191 return (EINVAL); 4192 scsi_delay = delay; 4193 return (0); 4194 } 4195 #endif /* _KERNEL */ 4196 4197 /* 4198 * Try make as good a match as possible with 4199 * available sub drivers 4200 */ 4201 int 4202 scsi_static_inquiry_match(caddr_t inqbuffer, caddr_t table_entry) 4203 { 4204 struct scsi_static_inquiry_pattern *entry; 4205 struct scsi_inquiry_data *inq; 4206 4207 entry = (struct scsi_static_inquiry_pattern *)table_entry; 4208 inq = (struct scsi_inquiry_data *)inqbuffer; 4209 4210 if (((SID_TYPE(inq) == entry->type) 4211 || (entry->type == T_ANY)) 4212 && (SID_IS_REMOVABLE(inq) ? entry->media_type & SIP_MEDIA_REMOVABLE 4213 : entry->media_type & SIP_MEDIA_FIXED) 4214 && (cam_strmatch(inq->vendor, entry->vendor, sizeof(inq->vendor)) == 0) 4215 && (cam_strmatch(inq->product, entry->product, 4216 sizeof(inq->product)) == 0) 4217 && (cam_strmatch(inq->revision, entry->revision, 4218 sizeof(inq->revision)) == 0)) { 4219 return (0); 4220 } 4221 return (-1); 4222 } 4223