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