Lines Matching +full:spi +full:- +full:crc
1 /*-
4 * SPDX-License-Identifier: BSD-2-Clause
78 #define ERESTART -1 /* restart syscall */
79 #define EJUSTRETURN -2 /* don't modify regs, just return */
91 * a minimum value of 100ms. Note that this is pertinent only for SPI-
142 { 0xD8, R, "CD-DA READ" }
149 * to read CD-DA data. I'm not sure which Plextor CDROM
152 * 12-20X does. I don't know about any earlier models,
156 {T_CDROM, SIP_MEDIA_REMOVABLE, "PLEXTOR", "CD-ROM PX*", "*"},
164 * From: http://www.t10.org/lists/op-num.txt
166 * and Jung-uk Kim (jkim@FreeBSD.org)
174 /* File: OP-NUM.TXT
180 * D - DIRECT ACCESS DEVICE (SBC-2) device column key
181 * .T - SEQUENTIAL ACCESS DEVICE (SSC-2) -----------------
182 * . L - PRINTER DEVICE (SSC) M = Mandatory
183 * . P - PROCESSOR DEVICE (SPC) O = Optional
184 * . .W - WRITE ONCE READ MULTIPLE DEVICE (SBC-2) V = Vendor spec.
185 * . . R - CD/DVE DEVICE (MMC-3) Z = Obsolete
186 * . . O - OPTICAL MEMORY DEVICE (SBC-2)
187 * . . .M - MEDIA CHANGER DEVICE (SMC-2)
188 * . . . A - STORAGE ARRAY DEVICE (SCC-2)
189 * . . . .E - ENCLOSURE SERVICES DEVICE (SES)
190 * . . . .B - SIMPLIFIED DIRECT-ACCESS DEVICE (RBC)
191 * . . . . K - OPTICAL CARD READER/WRITER DEVICE (OCRW)
192 * . . . . V - AUTOMATION/DRIVE INTERFACE (ADC)
193 * . . . . .F - OBJECT-BASED STORAGE (OSD)
195 * -- -------------- ---------------------------------------------- */
345 /* 34 O O O O PRE-FETCH(10) */
346 { 0x34, D | W | O | K, "PRE-FETCH(10)" },
381 /* 42 O READ SUB-CHANNEL */
382 { 0x42, R, "READ SUB-CHANNEL" },
491 /* 90 O O O O PRE-FETCH(16) */
492 { 0x90, D | W | O | B, "PRE-FETCH(16)" },
521 /* XXX KDM ALL for this? op-num.txt defines it for none.. */
654 table[0] = ((struct scsi_op_quirk_entry *)match)->op_table; in scsi_op_desc()
655 num_ops[0] = ((struct scsi_op_quirk_entry *)match)->num_ops; in scsi_op_desc()
756 "Vendor Unique - Logical Unit Not Ready") },
764 "Unrecovered Self-Test Hard-Cache Test Fail") },
766 "Unrecovered Self-Test OTF-Cache Fail") },
778 "Vendor Unique - Internal Target Failure") },
780 "Vendor Unique - Internal Target Failure") },
782 "Vendor Unique - Internal Target Failure") },
784 "Vendor Unique - Internal Target Failure") },
786 "Vendor Unique - Internal Target Failure") },
788 "Extreme Over-Temperature Warning") },
792 "Vendor Unique - Internal Logic Error") },
794 "Vendor Unique - Internal Key Seed Error") },
807 "Pre-SMART Warning") },
813 "Write Error - Too many error recovery revs") },
815 "Unrecovered Read Error - Too many error recovery revs") },
829 "Invalid Field Parameter - CAP File") },
831 "Invalid Field Parameter - RAP File") },
833 "Invalid Field Parameter - TMS Firmware Tag") },
835 "Invalid Field Parameter - Check Sum") },
837 "Invalid Field Parameter - Firmware Tag") },
851 "Defect List - Length exceeds Command Allocated Length") },
937 {T_DIRECT, SIP_MEDIA_REMOVABLE, "SONY", "SMO-*", "*"},
945 * HGST vendor-specific error codes
955 * SEAGATE vendor-specific error codes
969 * From: http://www.t10.org/lists/asc-num.txt
970 * Modifications by Jung-uk Kim (jkim@FreeBSD.org)
973 * File: ASC-NUM.TXT
979 * D - DIRECT ACCESS DEVICE (SBC-2) device column key
980 * .T - SEQUENTIAL ACCESS DEVICE (SSC) -------------------
981 * . L - PRINTER DEVICE (SSC) blank = reserved
982 * . P - PROCESSOR DEVICE (SPC) not blank = allowed
983 * . .W - WRITE ONCE READ MULTIPLE DEVICE (SBC-2)
984 * . . R - CD DEVICE (MMC)
985 * . . O - OPTICAL MEMORY DEVICE (SBC-2)
986 * . . .M - MEDIA CHANGER DEVICE (SMC)
987 * . . . A - STORAGE ARRAY DEVICE (SCC)
988 * . . . E - ENCLOSURE SERVICES DEVICE (SES)
989 * . . . .B - SIMPLIFIED DIRECT-ACCESS DEVICE (RBC)
990 * . . . . K - OPTICAL CARD READER/WRITER DEVICE (OCRW)
991 * . . . . V - AUTOMATION/DRIVE INTERFACE (ADC)
992 * . . . . .F - OBJECT-BASED STORAGE (OSD)
1005 "End-of-partition/medium detected") },
1011 "Beginning-of-partition/medium detected") },
1014 "End-of-data detected") },
1122 "Logical unit not ready, self-test in progress") },
1218 "Logical unit communication time-out") },
1224 "Logical unit communication CRC error (Ultra-DMA/32)") },
1254 "Warning - specified temperature exceeded") },
1257 "Warning - enclosure degraded") },
1260 "Warning - background self-test failed") },
1263 "Warning - background pre-scan detected medium error") },
1266 "Warning - background medium scan detected medium error") },
1269 "Warning - non-volatile cache now volatile") },
1272 "Warning - degraded power to non-volatile cache") },
1275 "Warning - power loss expected") },
1278 "Warning - device statistics notification available") },
1281 "Warning - High critical temperature limit exceeded") },
1284 "Warning - Low critical temperature limit exceeded") },
1287 "Warning - High operating temperature limit exceeded") },
1290 "Warning - Low operating temperature limit exceeded") },
1293 "Warning - High citical humidity limit exceeded") },
1296 "Warning - Low citical humidity limit exceeded") },
1299 "Warning - High operating humidity limit exceeded") },
1302 "Warning - Low operating humidity limit exceeded") },
1305 "Warning - Microcode security at risk") },
1308 "Warning - Microcode digital signature validation failure") },
1311 "Warning - Physical element status change") },
1317 "Write error - recovered with auto reallocation") },
1320 "Write error - auto reallocation failed") },
1323 "Write error - recommend reassignment") },
1335 "Write error - recovery needed") },
1338 "Write error - recovery failed") },
1341 "Write error - loss of streaming") },
1344 "Write error - padding blocks added") },
1350 "Write error - unexpected unsolicited data") },
1353 "Write error - not enough unsolicited data") },
1365 "Write error - recovery scan needed") },
1368 "Write error - insufficient zone resources") },
1401 "ID CRC or ECC error") },
1431 "Unrecovered read error - auto reallocate failed") },
1434 "L-EC uncorrectable error") },
1440 "Data re-synchronization error") },
1452 "Unrecovered read error - recommend reassignment") },
1455 "Unrecovered read error - recommend rewrite the data") },
1458 "De-compression CRC error") },
1470 "Read error - loss of streaming") },
1476 "Read error - failed retransmission request") },
1479 "Read error - LBA marked bad by application client") },
1500 "End-of-data not found") },
1506 "Record not found - recommend reassignment") },
1509 "Record not found - data auto-reallocated") },
1527 "Data sync error - data rewritten") },
1530 "Data sync error - recommend rewrite") },
1533 "Data sync error - data auto-reallocated") },
1536 "Data sync error - recommend reassignment") },
1557 "Recovered data without ECC - data auto-reallocated") },
1560 "Recovered data without ECC - recommend reassignment") },
1563 "Recovered data without ECC - recommend rewrite") },
1566 "Recovered data without ECC - data rewritten") },
1575 "Recovered data - data auto-reallocated") },
1581 "Recovered data with L-EC") },
1584 "Recovered data - recommend reassignment") },
1587 "Recovered data - recommend rewrite") },
1590 "Recovered data with ECC - data rewritten") },
1638 "Access denied - initiator pending-enrolled") },
1641 "Access denied - no access rights") },
1644 "Access denied - invalid mgmt ID key") },
1659 "Access denied - enrollment conflict") },
1662 "Access denied - invalid LU identifier") },
1665 "Access denied - invalid proxy token") },
1668 "Access denied - ACL LUN conflict") },
1671 "Illegal command when not in append-only mode") },
1827 "Invalid data-out buffer integrity check value") },
1833 "Incomplete key-associated data set") },
1884 "Format-layer may have changed") },
1889 * XXX JGibbs - All of these should use the same errno, but I don't
1910 "Transceiver mode changed to single-ended") },
2075 "Cannot read medium - unknown format") },
2078 "Cannot read medium - incompatible format") },
2084 "Cannot write medium - unknown format") },
2087 "Cannot write medium - incompatible format") },
2090 "Cannot format medium - incompatible medium") },
2096 "Cannot write - application code mismatch") },
2105 "WORM medium - overwrite attempted") },
2108 "WORM medium - integrity check") },
2180 "ESN - power management class event") },
2183 "ESN - media class event") },
2186 "ESN - device busy class event") },
2201 "Medium not present - tray closed") },
2204 "Medium not present - tray open") },
2207 "Medium not present - loadable") },
2210 "Medium not present - medium auxiliary memory accessible") },
2216 "Tape position error at beginning-of-medium") },
2219 "Tape position error at end-of-medium") },
2231 "Failed to sense top-of-form") },
2234 "Failed to sense bottom-of-form") },
2303 "Logical unit has not self-configured yet") },
2312 "Logical unit failed self-test") },
2315 "Logical unit unable to update self-test log") },
2398 "RAM failure") }, /* deprecated - use 40 NN instead */
2404 NULL) }, /* Range 0x80->0xFF */
2407 "Data path failure") }, /* deprecated - use 40 NN instead */
2410 "Power-on or self-test failure") },
2411 /* deprecated - use 40 NN instead */
2435 "Data phase CRC error detected") },
2447 "Protocol service CRC error") },
2489 "Data-in buffer overflow - data buffer size") },
2492 "Data-in buffer overflow - data buffer descriptor area") },
2495 "Data-in buffer error") },
2498 "Data-out buffer overflow - data buffer size") },
2501 "Data-out buffer overflow - data buffer descriptor area") },
2504 "Data-out buffer error") },
2531 "Logical unit failed self-configuration") },
2537 NULL) }, /* Range 0x00->0xFF */
2555 "Erase failure - incomplete erase operation detected") },
2588 "Data transfer device error - load failed") },
2591 "Data transfer device error - unload failed") },
2594 "Data transfer device error - unload missing") },
2597 "Data transfer device error - eject failed") },
2600 "Data transfer device error - library communication failed") },
2660 "Unable to recover table-of-contents") },
2747 "Hardware impending failure spin-up retry count") },
2789 "Controller impending failure spin-up retry count") },
2828 "Data channel impending failure spin-up retry count") },
2867 "Servo impending failure spin-up retry count") },
2906 "Spindle impending failure spin-up retry count") },
2945 "Firmware impending failure spin-up retry count") },
2972 "Idle-B condition activated by timer") },
2975 "Idle-B condition activated by command") },
2978 "Idle-C condition activated by timer") },
2981 "Idle-C condition activated by command") },
2984 "Standby-Y condition activated by timer") },
2987 "Standby-Y condition activated by command") },
3125 "Copy protection key exchange failure - authentication failure") },
3128 "Copy protection key exchange failure - key not present") },
3131 "Copy protection key exchange failure - key not established") },
3152 "Invalid drive-host pairing server") },
3155 "Drive-host pairing suspended") },
3161 NULL) }, /* Range 0x00 -> 0xFF */
3167 NULL) }, /* Range 0x00 -> 0xFF */
3173 "Session fixation error writing lead-in") },
3176 "Session fixation error writing lead-out") },
3179 "Session fixation error - incomplete track in session") },
3323 asc = ((const struct asc_key *)key)->asc; in ascentrycomp()
3324 ascq = ((const struct asc_key *)key)->ascq; in ascentrycomp()
3327 if (asc >= table_entry->asc) { in ascentrycomp()
3328 if (asc > table_entry->asc) in ascentrycomp()
3331 if (ascq <= table_entry->ascq) { in ascentrycomp()
3333 if (ascq == table_entry->ascq in ascentrycomp()
3334 || ((table_entry->action & SSQ_RANGE) != 0 in ascentrycomp()
3335 && ascq >= (table_entry - 1)->ascq)) in ascentrycomp()
3337 return (-1); in ascentrycomp()
3341 return (-1); in ascentrycomp()
3353 if (sense_key >= table_entry->sense_key) { in senseentrycomp()
3354 if (sense_key == table_entry->sense_key) in senseentrycomp()
3358 return (-1); in senseentrycomp()
3392 asc_tables[0] = quirk->asc_info; in fetchtableentries()
3393 asc_tables_size[0] = quirk->num_ascs; in fetchtableentries()
3397 sense_tables[0] = quirk->sense_key_info; in fetchtableentries()
3398 sense_tables_size[0] = quirk->num_sense_keys; in fetchtableentries()
3457 *sense_key_desc = sense_entry->desc; in scsi_sense_desc()
3462 *asc_desc = asc_entry->desc; in scsi_sense_desc()
3526 action = asc_entry->action; in scsi_error_action()
3528 action = sense_entry->action; in scsi_error_action()
3606 * This is taken from the SCSI-3 draft spec. in scsi_cdb_sbuf()
3650 switch(csio->scsi_status) { in scsi_status_string()
3660 return("Intermediate-Condition Met"); in scsi_status_string()
3674 csio->scsi_status); in scsi_status_string()
3681 * scsi_command_string() returns 0 for success and -1 for failure.
3699 return(-1); in scsi_command_string()
3703 xpt_setup_ccb(&cgd->ccb_h, in scsi_command_string()
3704 csio->ccb_h.path, in scsi_command_string()
3706 cgd->ccb_h.func_code = XPT_GDEV_TYPE; in scsi_command_string()
3713 if (cgd->ccb_h.status == CAM_DEV_NOT_THERE) in scsi_command_string()
3714 cgd->inq_data.device = T_DIRECT; in scsi_command_string()
3716 inq_data = &cgd->inq_data; in scsi_command_string()
3720 inq_data = &device->inq_data; in scsi_command_string()
3738 * returns non-zero, list traversal is stopped.
3759 desc_len = sense_len -offsetof(struct scsi_sense_data_desc, sense_desc); in scsi_desc_iterate()
3765 desc_len = MIN(desc_len, MIN(sense->extra_len, SSD_EXTRA_MAX)); in scsi_desc_iterate()
3773 desc_len -= sizeof(struct scsi_sense_desc_header); in scsi_desc_iterate()
3779 &sense->sense_desc[cur_pos]; in scsi_desc_iterate()
3789 * desc_len - cur_pos is correct. in scsi_desc_iterate()
3791 if (header->length > (desc_len - cur_pos)) in scsi_desc_iterate()
3797 cur_pos += sizeof(*header) + header->length; in scsi_desc_iterate()
3814 if (header->desc_type == desc_info->desc_type) { in scsi_find_desc_func()
3815 desc_info->header = header; in scsi_find_desc_func()
3858 sense->error_code = SSD_DESC_CURRENT_ERROR; in scsi_set_sense_data_desc_va()
3860 sense->error_code = SSD_DESC_DEFERRED_ERROR; in scsi_set_sense_data_desc_va()
3861 sense->sense_key = sense_key; in scsi_set_sense_data_desc_va()
3862 sense->add_sense_code = asc; in scsi_set_sense_data_desc_va()
3863 sense->add_sense_code_qual = ascq; in scsi_set_sense_data_desc_va()
3864 sense->flags = 0; in scsi_set_sense_data_desc_va()
3866 desc = &sense->sense_desc[0]; in scsi_set_sense_data_desc_va()
3867 space = *sense_len - offsetof(struct scsi_sense_data_desc, sense_desc); in scsi_set_sense_data_desc_va()
3883 sense->flags |= SSDD_SDAT_OVFL; in scsi_set_sense_data_desc_va()
3888 space -= len; in scsi_set_sense_data_desc_va()
3893 if (len > sizeof(sks->sense_key_spec)) in scsi_set_sense_data_desc_va()
3896 sense->flags |= SSDD_SDAT_OVFL; in scsi_set_sense_data_desc_va()
3899 sks->desc_type = SSD_DESC_SKS; in scsi_set_sense_data_desc_va()
3900 sks->length = sizeof(*sks) - in scsi_set_sense_data_desc_va()
3902 bcopy(data, &sks->sense_key_spec, len); in scsi_set_sense_data_desc_va()
3904 space -= sizeof(*sks); in scsi_set_sense_data_desc_va()
3910 if (len > sizeof(cmd->command_info)) in scsi_set_sense_data_desc_va()
3913 sense->flags |= SSDD_SDAT_OVFL; in scsi_set_sense_data_desc_va()
3916 cmd->desc_type = SSD_DESC_COMMAND; in scsi_set_sense_data_desc_va()
3917 cmd->length = sizeof(*cmd) - in scsi_set_sense_data_desc_va()
3919 bcopy(data, &cmd->command_info[ in scsi_set_sense_data_desc_va()
3920 sizeof(cmd->command_info) - len], len); in scsi_set_sense_data_desc_va()
3922 space -= sizeof(*cmd); in scsi_set_sense_data_desc_va()
3928 if (len > sizeof(info->info)) in scsi_set_sense_data_desc_va()
3931 sense->flags |= SSDD_SDAT_OVFL; in scsi_set_sense_data_desc_va()
3934 info->desc_type = SSD_DESC_INFO; in scsi_set_sense_data_desc_va()
3935 info->length = sizeof(*info) - in scsi_set_sense_data_desc_va()
3937 info->byte2 = SSD_INFO_VALID; in scsi_set_sense_data_desc_va()
3938 bcopy(data, &info->info[sizeof(info->info) - len], len); in scsi_set_sense_data_desc_va()
3940 space -= sizeof(*info); in scsi_set_sense_data_desc_va()
3946 if (len > sizeof(fru->fru)) in scsi_set_sense_data_desc_va()
3949 sense->flags |= SSDD_SDAT_OVFL; in scsi_set_sense_data_desc_va()
3952 fru->desc_type = SSD_DESC_FRU; in scsi_set_sense_data_desc_va()
3953 fru->length = sizeof(*fru) - in scsi_set_sense_data_desc_va()
3955 fru->fru = *data; in scsi_set_sense_data_desc_va()
3957 space -= sizeof(*fru); in scsi_set_sense_data_desc_va()
3963 if (len > sizeof(stream->byte3)) in scsi_set_sense_data_desc_va()
3966 sense->flags |= SSDD_SDAT_OVFL; in scsi_set_sense_data_desc_va()
3969 stream->desc_type = SSD_DESC_STREAM; in scsi_set_sense_data_desc_va()
3970 stream->length = sizeof(*stream) - in scsi_set_sense_data_desc_va()
3972 stream->byte3 = *data; in scsi_set_sense_data_desc_va()
3974 space -= sizeof(*stream); in scsi_set_sense_data_desc_va()
3985 sense->extra_len = desc - &sense->sense_desc[0]; in scsi_set_sense_data_desc_va()
3987 sense->extra_len; in scsi_set_sense_data_desc_va()
4006 sense->error_code = SSD_CURRENT_ERROR; in scsi_set_sense_data_fixed_va()
4008 sense->error_code = SSD_DEFERRED_ERROR; in scsi_set_sense_data_fixed_va()
4009 sense->flags = sense_key & SSD_KEY; in scsi_set_sense_data_fixed_va()
4010 sense->extra_len = 0; in scsi_set_sense_data_fixed_va()
4012 sense->add_sense_code = asc; in scsi_set_sense_data_fixed_va()
4013 sense->extra_len = MAX(sense->extra_len, 5); in scsi_set_sense_data_fixed_va()
4015 sense->flags |= SSD_SDAT_OVFL; in scsi_set_sense_data_fixed_va()
4017 sense->add_sense_code_qual = ascq; in scsi_set_sense_data_fixed_va()
4018 sense->extra_len = MAX(sense->extra_len, 6); in scsi_set_sense_data_fixed_va()
4020 sense->flags |= SSD_SDAT_OVFL; in scsi_set_sense_data_fixed_va()
4036 if (len > sizeof(sense->sense_key_spec)) in scsi_set_sense_data_fixed_va()
4039 sense->flags |= SSD_SDAT_OVFL; in scsi_set_sense_data_fixed_va()
4042 bcopy(data, &sense->sense_key_spec[0], len); in scsi_set_sense_data_fixed_va()
4043 sense->extra_len = MAX(sense->extra_len, 10); in scsi_set_sense_data_fixed_va()
4047 sense->flags |= SSD_SDAT_OVFL; in scsi_set_sense_data_fixed_va()
4050 if (len > sizeof(sense->cmd_spec_info)) { in scsi_set_sense_data_fixed_va()
4051 data += len - sizeof(sense->cmd_spec_info); in scsi_set_sense_data_fixed_va()
4052 len = sizeof(sense->cmd_spec_info); in scsi_set_sense_data_fixed_va()
4054 bcopy(data, &sense->cmd_spec_info[ in scsi_set_sense_data_fixed_va()
4055 sizeof(sense->cmd_spec_info) - len], len); in scsi_set_sense_data_fixed_va()
4056 sense->extra_len = MAX(sense->extra_len, 4); in scsi_set_sense_data_fixed_va()
4060 sense->error_code |= SSD_ERRCODE_VALID; in scsi_set_sense_data_fixed_va()
4061 while (len > sizeof(sense->info)) { in scsi_set_sense_data_fixed_va()
4063 sense->error_code &= ~SSD_ERRCODE_VALID; in scsi_set_sense_data_fixed_va()
4065 len --; in scsi_set_sense_data_fixed_va()
4067 bcopy(data, &sense->info[sizeof(sense->info) - len], len); in scsi_set_sense_data_fixed_va()
4071 sense->flags |= SSD_SDAT_OVFL; in scsi_set_sense_data_fixed_va()
4074 sense->fru = *data; in scsi_set_sense_data_fixed_va()
4075 sense->extra_len = MAX(sense->extra_len, 7); in scsi_set_sense_data_fixed_va()
4078 sense->flags |= *data & in scsi_set_sense_data_fixed_va()
4090 sense->extra_len; in scsi_set_sense_data_fixed_va()
4171 if ((info_desc->byte2 & SSD_INFO_VALID) == 0) in scsi_get_sense_info()
4174 *info = scsi_8btou64(info_desc->info); in scsi_get_sense_info()
4184 *info = scsi_8btou64(cmd_desc->command_info); in scsi_get_sense_info()
4194 if (fru_desc->fru == 0) in scsi_get_sense_info()
4197 *info = fru_desc->fru; in scsi_get_sense_info()
4199 *signed_info = (int8_t)fru_desc->fru; in scsi_get_sense_info()
4217 if ((sense->error_code & SSD_ERRCODE_VALID) == 0) in scsi_get_sense_info()
4223 info_val = scsi_4btoul(sense->info); in scsi_get_sense_info()
4238 cmd_val = scsi_4btoul(sense->cmd_spec_info); in scsi_get_sense_info()
4252 if (sense->fru == 0) in scsi_get_sense_info()
4255 *info = sense->fru; in scsi_get_sense_info()
4257 *signed_info = (int8_t)sense->fru; in scsi_get_sense_info()
4297 if ((desc->sense_key_spec[0] & SSD_SKS_VALID) == 0) in scsi_get_sks()
4300 bcopy(desc->sense_key_spec, sks, sizeof(desc->sense_key_spec)); in scsi_get_sks()
4312 if ((sense->sense_key_spec[0] & SSD_SCS_VALID) == 0) in scsi_get_sks()
4315 bcopy(sense->sense_key_spec, sks,sizeof(sense->sense_key_spec)); in scsi_get_sks()
4329 * whether we have block-specific sense information. It is clear by the
4365 *block_bits = block->byte3; in scsi_get_block_info()
4376 *block_bits = sense->flags & SSD_ILI; in scsi_get_block_info()
4418 *stream_bits = stream->byte3; in scsi_get_stream_info()
4429 *stream_bits = sense->flags & (SSD_ILI|SSD_EOM|SSD_FILEMARK); in scsi_get_stream_info()
4479 if (field->byte0 & SSD_SKS_FIELD_CMD) in scsi_sks_sbuf()
4487 if (field->byte0 & SSD_SKS_BPV) in scsi_sks_sbuf()
4489 field->byte0 & SSD_SKS_BIT_VALUE); in scsi_sks_sbuf()
4493 scsi_2btoul(field->field), tmpstr); in scsi_sks_sbuf()
4503 (overflow->byte0 & SSD_SKS_OVERFLOW_SET) ? in scsi_sks_sbuf()
4516 scsi_2btoul(retry->actual_retry_count)); in scsi_sks_sbuf()
4526 progress_val = scsi_2btoul(progress->progress); in scsi_sks_sbuf()
4540 if (segment->byte0 & SSD_SKS_SEGMENT_BPV) in scsi_sks_sbuf()
4542 segment->byte0 & SSD_SKS_SEGMENT_BITPTR); in scsi_sks_sbuf()
4544 sbuf_printf(sb, "%s byte %d %sis invalid", (segment->byte0 & in scsi_sks_sbuf()
4546 scsi_2btoul(segment->field), tmpstr); in scsi_sks_sbuf()
4607 if ((info->byte2 & SSD_INFO_VALID) == 0) in scsi_sense_info_sbuf()
4610 scsi_info_sbuf(sb, cdb, cdb_len, inq_data, scsi_8btou64(info->info)); in scsi_sense_info_sbuf()
4624 scsi_8btou64(command->command_info)); in scsi_sense_command_sbuf()
4638 if ((sks->sense_key_spec[0] & SSD_SKS_VALID) == 0) in scsi_sense_sks_sbuf()
4644 scsi_sks_sbuf(sb, sense_key, sks->sense_key_spec); in scsi_sense_sks_sbuf()
4657 if (fru->fru == 0) in scsi_sense_fru_sbuf()
4660 scsi_fru_sbuf(sb, (uint64_t)fru->fru); in scsi_sense_fru_sbuf()
4672 scsi_stream_sbuf(sb, stream->byte3); in scsi_sense_stream_sbuf()
4684 scsi_block_sbuf(sb, block->byte3); in scsi_sense_block_sbuf()
4705 scsi_sense_desc(progress->sense_key, progress->add_sense_code, in scsi_sense_progress_sbuf()
4706 progress->add_sense_code_qual, inq_data, in scsi_sense_progress_sbuf()
4709 progress_val = scsi_2btoul(progress->progress); in scsi_sense_progress_sbuf()
4716 sbuf_printf(sb, " asc:%x,%x (%s): ", progress->add_sense_code, in scsi_sense_progress_sbuf()
4717 progress->add_sense_code_qual, asc_desc); in scsi_sense_progress_sbuf()
4732 res->status, in scsi_sense_ata_sbuf()
4733 (res->status & 0x80) ? "BSY " : "", in scsi_sense_ata_sbuf()
4734 (res->status & 0x40) ? "DRDY " : "", in scsi_sense_ata_sbuf()
4735 (res->status & 0x20) ? "DF " : "", in scsi_sense_ata_sbuf()
4736 (res->status & 0x10) ? "SERV " : "", in scsi_sense_ata_sbuf()
4737 (res->status & 0x08) ? "DRQ " : "", in scsi_sense_ata_sbuf()
4738 (res->status & 0x04) ? "CORR " : "", in scsi_sense_ata_sbuf()
4739 (res->status & 0x02) ? "IDX " : "", in scsi_sense_ata_sbuf()
4740 (res->status & 0x01) ? "ERR" : ""); in scsi_sense_ata_sbuf()
4741 if (res->status & 1) { in scsi_sense_ata_sbuf()
4743 res->error, in scsi_sense_ata_sbuf()
4744 (res->error & 0x80) ? "ICRC " : "", in scsi_sense_ata_sbuf()
4745 (res->error & 0x40) ? "UNC " : "", in scsi_sense_ata_sbuf()
4746 (res->error & 0x20) ? "MC " : "", in scsi_sense_ata_sbuf()
4747 (res->error & 0x10) ? "IDNF " : "", in scsi_sense_ata_sbuf()
4748 (res->error & 0x08) ? "MCR " : "", in scsi_sense_ata_sbuf()
4749 (res->error & 0x04) ? "ABRT " : "", in scsi_sense_ata_sbuf()
4750 (res->error & 0x02) ? "NM " : "", in scsi_sense_ata_sbuf()
4751 (res->error & 0x01) ? "ILI" : ""); in scsi_sense_ata_sbuf()
4754 if (res->flags & SSD_DESC_ATA_FLAG_EXTEND) { in scsi_sense_ata_sbuf()
4756 res->count_15_8, res->count_7_0); in scsi_sense_ata_sbuf()
4758 res->lba_47_40, res->lba_39_32, res->lba_31_24, in scsi_sense_ata_sbuf()
4759 res->lba_23_16, res->lba_15_8, res->lba_7_0); in scsi_sense_ata_sbuf()
4761 sbuf_printf(sb, "count: %02x, ", res->count_7_0); in scsi_sense_ata_sbuf()
4763 res->lba_23_16, res->lba_15_8, res->lba_7_0); in scsi_sense_ata_sbuf()
4765 sbuf_printf(sb, "device: %02x, ", res->device); in scsi_sense_ata_sbuf()
4780 scsi_extract_sense_len((struct scsi_sense_data *)forwarded->sense_data, in scsi_sense_forwarded_sbuf()
4781 forwarded->length - 2, &error_code, &sense_key, &asc, &ascq, 1); in scsi_sense_forwarded_sbuf()
4801 sbuf_printf(sb, "Descriptor %#x:", header->desc_type); in scsi_sense_generic_sbuf()
4805 for (i = 0; i < header->length; i++, buf_ptr++) in scsi_sense_generic_sbuf()
4856 if (printer->desc_type > header->desc_type) in scsi_sense_desc_sbuf()
4859 if (printer->desc_type != header->desc_type) in scsi_sense_desc_sbuf()
4862 printer->print_func(sb, sense, sense_len, cdb, cdb_len, in scsi_sense_desc_sbuf()
4878 switch (sense_data->error_code & SSD_ERRCODE) { in scsi_sense_type()
4910 switch (header->desc_type) { in scsi_print_desc_func()
4923 sbuf_printf(print_info->sb, "%s", print_info->path_str); in scsi_print_desc_func()
4924 scsi_sense_desc_sbuf(print_info->sb, in scsi_print_desc_func()
4926 print_info->cdb, print_info->cdb_len, in scsi_print_desc_func()
4927 print_info->inq_data, header); in scsi_print_desc_func()
4928 sbuf_putc(print_info->sb, '\n'); in scsi_print_desc_func()
4974 * data isn't long enough), the -1 values that in scsi_sense_only_sbuf()
4988 * Print any block or stream device-specific information. in scsi_sense_only_sbuf()
5023 * Print any command-specific information. in scsi_sense_only_sbuf()
5033 * Print out any sense-key-specific information. in scsi_sense_only_sbuf()
5064 case -1: in scsi_sense_only_sbuf()
5066 * scsi_extract_sense_len() sets values to -1 if the in scsi_sense_only_sbuf()
5074 if (sense->error_code & SSD_ERRCODE_VALID) { in scsi_sense_only_sbuf()
5082 info = scsi_4btoul(fixed_sense->info); in scsi_sense_only_sbuf()
5095 * scsi_sense_sbuf() returns 0 for success and -1 for failure.
5116 return(-1); in scsi_sense_sbuf()
5119 return(-1); in scsi_sense_sbuf()
5124 if ((csio->ccb_h.flags & CAM_CDB_PHYS) != 0) in scsi_sense_sbuf()
5128 xpt_path_string(csio->ccb_h.path, path_str, sizeof(path_str)); in scsi_sense_sbuf()
5135 return(-1); in scsi_sense_sbuf()
5139 xpt_setup_ccb(&cgd->ccb_h, in scsi_sense_sbuf()
5140 csio->ccb_h.path, in scsi_sense_sbuf()
5142 cgd->ccb_h.func_code = XPT_GDEV_TYPE; in scsi_sense_sbuf()
5149 if (cgd->ccb_h.status == CAM_DEV_NOT_THERE) in scsi_sense_sbuf()
5150 cgd->inq_data.device = T_DIRECT; in scsi_sense_sbuf()
5152 inq_data = &cgd->inq_data; in scsi_sense_sbuf()
5156 inq_data = &device->inq_data; in scsi_sense_sbuf()
5176 if (csio->ccb_h.flags & CAM_SENSE_PTR) { in scsi_sense_sbuf()
5177 if (csio->ccb_h.flags & CAM_SENSE_PHYS) { in scsi_sense_sbuf()
5181 return(-1); in scsi_sense_sbuf()
5188 bcopy((struct scsi_sense_data **)&csio->sense_data, in scsi_sense_sbuf()
5200 if (csio->ccb_h.flags & CAM_SENSE_PHYS) { in scsi_sense_sbuf()
5204 return(-1); in scsi_sense_sbuf()
5206 sense = &csio->sense_data; in scsi_sense_sbuf()
5209 scsi_sense_only_sbuf(sense, csio->sense_len - csio->sense_resid, sb, in scsi_sense_sbuf()
5210 path_str, inq_data, scsiio_cdb_ptr(csio), csio->cdb_len); in scsi_sense_sbuf()
5281 * Extract basic sense information. This is backward-compatible with the
5303 if (ccb->ccb_h.func_code != XPT_SCSI_IO || in scsi_extract_sense_ccb()
5304 (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR || in scsi_extract_sense_ccb()
5305 (ccb->csio.scsi_status != SCSI_STATUS_CHECK_COND) || in scsi_extract_sense_ccb()
5306 (ccb->ccb_h.status & CAM_AUTOSNS_VALID) == 0 || in scsi_extract_sense_ccb()
5307 (ccb->ccb_h.flags & CAM_SENSE_PHYS)) in scsi_extract_sense_ccb()
5310 if (ccb->ccb_h.flags & CAM_SENSE_PTR) in scsi_extract_sense_ccb()
5311 bcopy((struct scsi_sense_data **)&ccb->csio.sense_data, in scsi_extract_sense_ccb()
5314 sense_data = &ccb->csio.sense_data; in scsi_extract_sense_ccb()
5316 ccb->csio.sense_len - ccb->csio.sense_resid, in scsi_extract_sense_ccb()
5318 if (*error_code == -1) in scsi_extract_sense_ccb()
5325 * will be set to -1 if they are not present.
5342 *error_code = -1; in scsi_extract_sense_len()
5343 *sense_key = -1; in scsi_extract_sense_len()
5344 *asc = -1; in scsi_extract_sense_len()
5345 *ascq = -1; in scsi_extract_sense_len()
5350 *error_code = sense_data->error_code & SSD_ERRCODE; in scsi_extract_sense_len()
5360 *sense_key = sense->sense_key & SSD_KEY; in scsi_extract_sense_len()
5362 *sense_key = (show_errors) ? -1 : 0; in scsi_extract_sense_len()
5365 *asc = sense->add_sense_code; in scsi_extract_sense_len()
5367 *asc = (show_errors) ? -1 : 0; in scsi_extract_sense_len()
5370 *ascq = sense->add_sense_code_qual; in scsi_extract_sense_len()
5372 *ascq = (show_errors) ? -1 : 0; in scsi_extract_sense_len()
5383 *sense_key = sense->flags & SSD_KEY; in scsi_extract_sense_len()
5385 *sense_key = (show_errors) ? -1 : 0; in scsi_extract_sense_len()
5389 *asc = sense->add_sense_code; in scsi_extract_sense_len()
5391 *asc = (show_errors) ? -1 : 0; in scsi_extract_sense_len()
5395 *ascq = sense->add_sense_code_qual; in scsi_extract_sense_len()
5397 *ascq = (show_errors) ? -1 : 0; in scsi_extract_sense_len()
5458 qtype = " (vendor-unique qualifier)"; in scsi_print_inquiry_sbuf()
5496 dtype = "CD-ROM"; in scsi_print_inquiry_sbuf()
5523 dtype = "Object-Based Storage"; in scsi_print_inquiry_sbuf()
5546 sbuf_printf(sb, "SCSI-%d ", SID_ANSI_REV(inq_data)); in scsi_print_inquiry_sbuf()
5548 sbuf_printf(sb, "SPC-%d SCSI ", SID_ANSI_REV(inq_data) - 2); in scsi_print_inquiry_sbuf()
5570 cam_strvis_sbuf(sb, inq_data->vendor, sizeof(inq_data->vendor), 0); in scsi_print_inquiry_short_sbuf()
5572 cam_strvis_sbuf(sb, inq_data->product, sizeof(inq_data->product), 0); in scsi_print_inquiry_short_sbuf()
5574 cam_strvis_sbuf(sb, inq_data->revision, sizeof(inq_data->revision), 0); in scsi_print_inquiry_short_sbuf()
5598 { 0x08, 625 }, /* FAST-160 */
5599 { 0x09, 1250 }, /* FAST-80 */
5600 { 0x0a, 2500 }, /* FAST-40 40MHz */
5601 { 0x0b, 3030 }, /* FAST-40 33MHz */
5602 { 0x0c, 5000 } /* FAST-20 */
5617 * die with a divide fault- instead return something which in scsi_calc_syncsrate()
5679 naa = (struct scsi_vpd_id_naa_basic *)descr->identifier; in scsi_devid_is_naa_ieee_reg()
5680 if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_NAA) in scsi_devid_is_naa_ieee_reg()
5682 if (descr->length < sizeof(struct scsi_vpd_id_naa_ieee_reg)) in scsi_devid_is_naa_ieee_reg()
5684 n = naa->naa >> SVPD_ID_NAA_NAA_SHIFT; in scsi_devid_is_naa_ieee_reg()
5698 if ((descr->id_type & SVPD_ID_PIV) == 0) /* proto field reserved */ in scsi_devid_is_sas_target()
5700 if ((descr->proto_codeset >> SVPD_ID_PROTO_SHIFT) != SCSI_PROTO_SAS) in scsi_devid_is_sas_target()
5711 if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) in scsi_devid_is_lun_eui64()
5713 if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_EUI64) in scsi_devid_is_lun_eui64()
5724 if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) in scsi_devid_is_lun_naa()
5726 if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_NAA) in scsi_devid_is_lun_naa()
5737 if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) in scsi_devid_is_lun_t10()
5739 if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_T10) in scsi_devid_is_lun_t10()
5750 if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) in scsi_devid_is_lun_name()
5752 if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_SCSI_NAME) in scsi_devid_is_lun_name()
5763 if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) in scsi_devid_is_lun_md5()
5765 if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_MD5_LUN_ID) in scsi_devid_is_lun_md5()
5776 if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) in scsi_devid_is_lun_uuid()
5778 if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_UUID) in scsi_devid_is_lun_uuid()
5789 if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_PORT) in scsi_devid_is_port_naa()
5791 if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_NAA) in scsi_devid_is_port_naa()
5804 for (; desc->identifier <= desc_buf_end && in scsi_get_devid_desc()
5805 desc->identifier + desc->length <= desc_buf_end; in scsi_get_devid_desc()
5806 desc = (struct scsi_vpd_id_descriptor *)(desc->identifier in scsi_get_devid_desc()
5807 + desc->length)) { in scsi_get_devid_desc()
5822 len = MIN(scsi_2btoul(id->length), page_len - sizeof(*id)); in scsi_get_devid()
5824 id->desc_list, len, ck_fn)); in scsi_get_devid()
5831 switch (hdr->format_protocol & SCSI_TRN_PROTO_MASK) { in scsi_transportid_sbuf()
5838 n_port_name = scsi_8btou64(fcp->n_port_name); in scsi_transportid_sbuf()
5844 struct scsi_transportid_spi *spi; in scsi_transportid_sbuf() local
5846 spi = (struct scsi_transportid_spi *)hdr; in scsi_transportid_sbuf()
5848 sbuf_printf(sb, "SPI address: %u,%u", in scsi_transportid_sbuf()
5849 scsi_2btoul(spi->scsi_addr), in scsi_transportid_sbuf()
5850 scsi_2btoul(spi->rel_trgt_port_id)); in scsi_transportid_sbuf()
5855 * XXX KDM there is no transport ID defined in SPC-4 for in scsi_transportid_sbuf()
5865 eui64 = scsi_8btou64(sbp->eui64); in scsi_transportid_sbuf()
5876 for (i = 0; i < sizeof(rdma->initiator_port_id); i++) in scsi_transportid_sbuf()
5877 sbuf_printf(sb, "%02x", rdma->initiator_port_id[i]); in scsi_transportid_sbuf()
5886 if ((hdr->format_protocol & SCSI_TRN_FORMAT_MASK) == in scsi_transportid_sbuf()
5895 add_len = scsi_2btoul(dev->additional_length); in scsi_transportid_sbuf()
5896 add_len = MIN(add_len, valid_len - in scsi_transportid_sbuf()
5899 iscsi_name = &dev->iscsi_name[0]; in scsi_transportid_sbuf()
5901 } else if ((hdr->format_protocol & SCSI_TRN_FORMAT_MASK) == in scsi_transportid_sbuf()
5907 add_len = scsi_2btoul(port->additional_length); in scsi_transportid_sbuf()
5908 add_len = MIN(add_len, valid_len - in scsi_transportid_sbuf()
5911 iscsi_name = &port->iscsi_name[0]; in scsi_transportid_sbuf()
5914 (hdr->format_protocol & in scsi_transportid_sbuf()
5924 * This is supposed to be a NUL-terminated ASCII in scsi_transportid_sbuf()
5951 sas_addr = scsi_8btou64(sas->sas_address); in scsi_transportid_sbuf()
5960 * SPC-4. in scsi_transportid_sbuf()
5963 "%#x", hdr->format_protocol & SCSI_TRN_PROTO_MASK); in scsi_transportid_sbuf()
5970 rid = (struct scsi_sop_routing_id_norm *)sop->routing_id; in scsi_transportid_sbuf()
5973 * Note that there is no alternate format specified in SPC-4 in scsi_transportid_sbuf()
5980 rid->bus, rid->devfunc >> SCSI_TRN_SOP_DEV_SHIFT, in scsi_transportid_sbuf()
5981 rid->devfunc & SCSI_TRN_SOP_FUNC_NORM_MAX); in scsi_transportid_sbuf()
5987 hdr->format_protocol & SCSI_TRN_PROTO_MASK); in scsi_transportid_sbuf()
5996 { "spi", SCSI_PROTO_SPI },
6028 * SCSI_NV_FOUND - match found
6029 * SCSI_NV_AMBIGUOUS - more than one match, none of them exact
6030 * SCSI_NV_NOT_FOUND - no match found
6077 * all 64-bit numbers, the code is similar.
6099 "parsing ID %s, 64-bit number required", in scsi_parse_transportid_64bit()
6148 fcp->format_protocol = SCSI_PROTO_FC | in scsi_parse_transportid_64bit()
6150 scsi_u64to8b(value, fcp->n_port_name); in scsi_parse_transportid_64bit()
6157 sbp->format_protocol = SCSI_PROTO_1394 | in scsi_parse_transportid_64bit()
6159 scsi_u64to8b(value, sbp->eui64); in scsi_parse_transportid_64bit()
6166 sas->format_protocol = SCSI_PROTO_SAS | in scsi_parse_transportid_64bit()
6168 scsi_u64to8b(value, sas->sas_address); in scsi_parse_transportid_64bit()
6179 * Parse a SPI (Parallel SCSI) address of the form: id,rel_tgt_port
6190 struct scsi_transportid_spi *spi; in scsi_parse_transportid_spi() local
6236 spi = malloc(sizeof(*spi), type, flags); in scsi_parse_transportid_spi()
6238 spi = malloc(sizeof(*spi)); in scsi_parse_transportid_spi()
6240 if (spi == NULL) { in scsi_parse_transportid_spi()
6244 sizeof(*spi)); in scsi_parse_transportid_spi()
6249 *alloc_len = sizeof(*spi); in scsi_parse_transportid_spi()
6250 bzero(spi, sizeof(*spi)); in scsi_parse_transportid_spi()
6252 spi->format_protocol = SCSI_PROTO_SPI | SCSI_TRN_SPI_FORMAT_DEFAULT; in scsi_parse_transportid_spi()
6253 scsi_ulto2b(scsi_addr, spi->scsi_addr); in scsi_parse_transportid_spi()
6254 scsi_ulto2b(target_port, spi->rel_trgt_port_id); in scsi_parse_transportid_spi()
6256 *hdr = (struct scsi_transportid_header *)spi; in scsi_parse_transportid_spi()
6321 * 128-bit integer type, and so no strtou128t() routine to convert in scsi_parse_transportid_rdma()
6346 c -= '0'; in scsi_parse_transportid_rdma()
6348 c -= isupper(c) ? 'A' - 10 : 'a' - 10; in scsi_parse_transportid_rdma()
6397 rdma->format_protocol = SCSI_PROTO_RDMA | SCSI_TRN_RDMA_FORMAT_DEFAULT; in scsi_parse_transportid_rdma()
6398 bcopy(rdma_id, rdma->initiator_port_id, SCSI_TRN_RDMA_PORT_LEN); in scsi_parse_transportid_rdma()
6409 * iqn.2012-06.com.example:target0
6412 * iqn.2012-06.com.example:target0,i,0x123
6508 iscsi->format_protocol = SCSI_PROTO_ISCSI; in scsi_parse_transportid_iscsi()
6510 iscsi->format_protocol |= SCSI_TRN_ISCSI_FORMAT_DEVICE; in scsi_parse_transportid_iscsi()
6512 iscsi->format_protocol |= SCSI_TRN_ISCSI_FORMAT_PORT; in scsi_parse_transportid_iscsi()
6513 name_len = id_size - sizeof(*iscsi); in scsi_parse_transportid_iscsi()
6514 scsi_ulto2b(name_len, iscsi->additional_length); in scsi_parse_transportid_iscsi()
6515 snprintf(iscsi->iscsi_name, name_len, "%s%s", iqn_prefix, id_str); in scsi_parse_transportid_iscsi()
6661 sop->format_protocol = SCSI_PROTO_SOP | SCSI_TRN_SOP_FORMAT_DEFAULT; in scsi_parse_transportid_sop()
6667 bcopy(&rid, sop->routing_id, MIN(sizeof(rid), in scsi_parse_transportid_sop()
6668 sizeof(sop->routing_id))); in scsi_parse_transportid_sop()
6674 bcopy(&rid, sop->routing_id, MIN(sizeof(rid), in scsi_parse_transportid_sop()
6675 sizeof(sop->routing_id))); in scsi_parse_transportid_sop()
6684 * transportid_str: NUL-terminated string with format: protcol,id
6690 * error_str: If non-NULL, it will contain error information (without
6694 * Returns 0 for success, non-zero for failure.
6849 "Device Vendor/Serial at Last Load - 1",
6853 "Device Vendor/Serial at Last Load - 2",
6857 "Device Vendor/Serial at Last Load - 3",
7063 field_size = scsi_2btoul(hdr->length); in scsi_attrib_volcoh_sbuf()
7064 avail_len = valid_len - sizeof(*hdr); in scsi_attrib_volcoh_sbuf()
7069 "length %u", scsi_2btoul(hdr->id), avail_len, in scsi_attrib_volcoh_sbuf()
7082 cur_ptr = hdr->attribute; in scsi_attrib_volcoh_sbuf()
7169 field_size = scsi_2btoul(hdr->length); in scsi_attrib_vendser_sbuf()
7170 avail_len = valid_len - sizeof(*hdr); in scsi_attrib_vendser_sbuf()
7175 "length %u", scsi_2btoul(hdr->id), avail_len, in scsi_attrib_vendser_sbuf()
7189 scsi_2btoul(hdr->id)); in scsi_attrib_vendser_sbuf()
7194 vendser = (struct scsi_attrib_vendser *)hdr->attribute; in scsi_attrib_vendser_sbuf()
7208 cam_strvis_sbuf(sb, vendser->vendor, sizeof(vendser->vendor), in scsi_attrib_vendser_sbuf()
7211 cam_strvis_sbuf(sb, vendser->serial_num, sizeof(vendser->serial_num), in scsi_attrib_vendser_sbuf()
7229 field_size = scsi_2btoul(hdr->length); in scsi_attrib_hexdump_sbuf()
7230 avail_len = valid_len - sizeof(*hdr); in scsi_attrib_hexdump_sbuf()
7232 num_ptr = hdr->attribute; in scsi_attrib_hexdump_sbuf()
7253 number_size = scsi_2btoul(hdr->length); in scsi_attrib_int_sbuf()
7255 avail_len = valid_len - sizeof(*hdr); in scsi_attrib_int_sbuf()
7260 "length %u", scsi_2btoul(hdr->id), avail_len, in scsi_attrib_int_sbuf()
7277 print_number = hdr->attribute[0]; in scsi_attrib_int_sbuf()
7280 print_number = scsi_2btoul(hdr->attribute); in scsi_attrib_int_sbuf()
7283 print_number = scsi_3btoul(hdr->attribute); in scsi_attrib_int_sbuf()
7286 print_number = scsi_4btoul(hdr->attribute); in scsi_attrib_int_sbuf()
7289 print_number = scsi_8btou64(hdr->attribute); in scsi_attrib_int_sbuf()
7337 avail_len = valid_len - sizeof(*hdr); in scsi_attrib_ascii_sbuf()
7338 field_size = scsi_2btoul(hdr->length); in scsi_attrib_ascii_sbuf()
7356 cam_strvis_sbuf(sb, hdr->attribute, print_size, strvis_flags); in scsi_attrib_ascii_sbuf()
7362 * e.g. in SPC-4r37, section 7.4.2.2.5, VOLUME IDENTIFIER in scsi_attrib_ascii_sbuf()
7364 * (see SMC-3) of the medium. If the device server supports in scsi_attrib_ascii_sbuf()
7372 "length %u", scsi_2btoul(hdr->id), avail_len, in scsi_attrib_ascii_sbuf()
7392 avail_len = valid_len - sizeof(*hdr); in scsi_attrib_text_sbuf()
7393 field_size = scsi_2btoul(hdr->length); in scsi_attrib_text_sbuf()
7404 if (hdr->attribute[i] == '\0') in scsi_attrib_text_sbuf()
7406 else if (((unsigned char)hdr->attribute[i] < 0x80) in scsi_attrib_text_sbuf()
7408 sbuf_putc(sb, hdr->attribute[i]); in scsi_attrib_text_sbuf()
7411 (unsigned char)hdr->attribute[i]); in scsi_attrib_text_sbuf()
7421 "length %u", scsi_2btoul(hdr->id), avail_len, in scsi_attrib_text_sbuf()
7458 switch (hdr->byte2 & SMA_FORMAT_MASK) { in scsi_attrib_value_sbuf()
7464 if (scsi_2btoul(hdr->length) <= 8) in scsi_attrib_value_sbuf()
7481 "format 0x%x", hdr->byte2 & SMA_FORMAT_MASK); in scsi_attrib_value_sbuf()
7511 id = scsi_2btoul(hdr->id); in scsi_attrib_prefix_sbuf()
7520 len = scsi_2btoul(hdr->length); in scsi_attrib_prefix_sbuf()
7543 (hdr->byte2 & SMA_READ_ONLY) ? "RO" : "RW"); in scsi_attrib_prefix_sbuf()
7567 id = scsi_2btoul(hdr->id); in scsi_attrib_sbuf()
7589 entry->desc); in scsi_attrib_sbuf()
7590 if (entry->to_str == NULL) in scsi_attrib_sbuf()
7592 retval = entry->to_str(sb, hdr, valid_len, entry->flags, in scsi_attrib_sbuf()
7599 if (entry->to_str == NULL) in scsi_attrib_sbuf()
7603 valid_len, entry->desc); in scsi_attrib_sbuf()
7604 retval = entry->to_str(sb, hdr, valid_len, entry->flags, in scsi_attrib_sbuf()
7619 && (entry->suffix != NULL)) in scsi_attrib_sbuf()
7620 sbuf_printf(sb, " %s", entry->suffix); in scsi_attrib_sbuf()
7647 scsi_cmd = (struct scsi_test_unit_ready *)&csio->cdb_io.cdb_bytes; in scsi_test_unit_ready()
7649 scsi_cmd->opcode = TEST_UNIT_READY; in scsi_test_unit_ready()
7671 scsi_cmd = (struct scsi_request_sense *)&csio->cdb_io.cdb_bytes; in scsi_request_sense()
7673 scsi_cmd->opcode = REQUEST_SENSE; in scsi_request_sense()
7674 scsi_cmd->length = dxfer_len; in scsi_request_sense()
7697 scsi_cmd = (struct scsi_inquiry *)&csio->cdb_io.cdb_bytes; in scsi_inquiry()
7699 scsi_cmd->opcode = INQUIRY; in scsi_inquiry()
7701 scsi_cmd->byte2 |= SI_EVPD; in scsi_inquiry()
7702 scsi_cmd->page_code = page_code; in scsi_inquiry()
7704 scsi_ulto2b(inq_len, scsi_cmd->length); in scsi_inquiry()
7749 scsi_cmd = (struct scsi_mode_sense_6 *)&csio->cdb_io.cdb_bytes; in scsi_mode_sense_subpage()
7751 scsi_cmd->opcode = MODE_SENSE_6; in scsi_mode_sense_subpage()
7753 scsi_cmd->byte2 |= SMS_DBD; in scsi_mode_sense_subpage()
7754 scsi_cmd->page = pc | page; in scsi_mode_sense_subpage()
7755 scsi_cmd->subpage = subpage; in scsi_mode_sense_subpage()
7756 scsi_cmd->length = param_len; in scsi_mode_sense_subpage()
7764 scsi_cmd = (struct scsi_mode_sense_10 *)&csio->cdb_io.cdb_bytes; in scsi_mode_sense_subpage()
7766 scsi_cmd->opcode = MODE_SENSE_10; in scsi_mode_sense_subpage()
7768 scsi_cmd->byte2 |= SMS_DBD; in scsi_mode_sense_subpage()
7769 scsi_cmd->page = pc | page; in scsi_mode_sense_subpage()
7770 scsi_cmd->subpage = subpage; in scsi_mode_sense_subpage()
7771 scsi_ulto2b(param_len, scsi_cmd->length); in scsi_mode_sense_subpage()
7818 scsi_cmd = (struct scsi_mode_select_6 *)&csio->cdb_io.cdb_bytes; in scsi_mode_select_len()
7820 scsi_cmd->opcode = MODE_SELECT_6; in scsi_mode_select_len()
7822 scsi_cmd->byte2 |= SMS_PF; in scsi_mode_select_len()
7824 scsi_cmd->byte2 |= SMS_SP; in scsi_mode_select_len()
7825 scsi_cmd->length = param_len; in scsi_mode_select_len()
7834 (struct scsi_mode_select_10 *)&csio->cdb_io.cdb_bytes; in scsi_mode_select_len()
7836 scsi_cmd->opcode = MODE_SELECT_10; in scsi_mode_select_len()
7838 scsi_cmd->byte2 |= SMS_PF; in scsi_mode_select_len()
7840 scsi_cmd->byte2 |= SMS_SP; in scsi_mode_select_len()
7841 scsi_ulto2b(param_len, scsi_cmd->length); in scsi_mode_select_len()
7867 scsi_cmd = (struct scsi_log_sense *)&csio->cdb_io.cdb_bytes; in scsi_log_sense()
7869 scsi_cmd->opcode = LOG_SENSE; in scsi_log_sense()
7870 scsi_cmd->page = page_code | page; in scsi_log_sense()
7872 scsi_cmd->byte2 |= SLS_SP; in scsi_log_sense()
7874 scsi_cmd->byte2 |= SLS_PPC; in scsi_log_sense()
7875 scsi_ulto2b(paramptr, scsi_cmd->paramptr); in scsi_log_sense()
7876 scsi_ulto2b(param_len, scsi_cmd->length); in scsi_log_sense()
7901 scsi_cmd = (struct scsi_log_select *)&csio->cdb_io.cdb_bytes; in scsi_log_select()
7903 scsi_cmd->opcode = LOG_SELECT; in scsi_log_select()
7904 scsi_cmd->page = page_code & SLS_PAGE_CODE; in scsi_log_select()
7906 scsi_cmd->byte2 |= SLS_SP; in scsi_log_select()
7908 scsi_cmd->byte2 |= SLS_PCR; in scsi_log_select()
7909 scsi_ulto2b(param_len, scsi_cmd->length); in scsi_log_select()
7946 scsi_cmd = (struct scsi_prevent *)&csio->cdb_io.cdb_bytes; in scsi_prevent()
7948 scsi_cmd->opcode = PREVENT_ALLOW; in scsi_prevent()
7949 scsi_cmd->how = action; in scsi_prevent()
7973 scsi_cmd = (struct scsi_read_capacity *)&csio->cdb_io.cdb_bytes; in scsi_read_capacity()
7975 scsi_cmd->opcode = READ_CAPACITY; in scsi_read_capacity()
7997 scsi_cmd = (struct scsi_read_capacity_16 *)&csio->cdb_io.cdb_bytes; in scsi_read_capacity_16()
7999 scsi_cmd->opcode = SERVICE_ACTION_IN; in scsi_read_capacity_16()
8000 scsi_cmd->service_action = SRC16_SERVICE_ACTION; in scsi_read_capacity_16()
8001 scsi_u64to8b(lba, scsi_cmd->addr); in scsi_read_capacity_16()
8002 scsi_ulto4b(rcap_buf_len, scsi_cmd->alloc_len); in scsi_read_capacity_16()
8028 scsi_cmd = (struct scsi_report_luns *)&csio->cdb_io.cdb_bytes; in scsi_report_luns()
8030 scsi_cmd->opcode = REPORT_LUNS; in scsi_report_luns()
8031 scsi_cmd->select_report = select_report; in scsi_report_luns()
8032 scsi_ulto4b(alloc_len, scsi_cmd->length); in scsi_report_luns()
8054 scsi_cmd = (struct scsi_target_group *)&csio->cdb_io.cdb_bytes; in scsi_report_target_group()
8056 scsi_cmd->opcode = MAINTENANCE_IN; in scsi_report_target_group()
8057 scsi_cmd->service_action = REPORT_TARGET_PORT_GROUPS | pdf; in scsi_report_target_group()
8058 scsi_ulto4b(alloc_len, scsi_cmd->length); in scsi_report_target_group()
8080 scsi_cmd = (struct scsi_timestamp *)&csio->cdb_io.cdb_bytes; in scsi_report_timestamp()
8082 scsi_cmd->opcode = MAINTENANCE_IN; in scsi_report_timestamp()
8083 scsi_cmd->service_action = REPORT_TIMESTAMP | pdf; in scsi_report_timestamp()
8084 scsi_ulto4b(alloc_len, scsi_cmd->length); in scsi_report_timestamp()
8105 scsi_cmd = (struct scsi_target_group *)&csio->cdb_io.cdb_bytes; in scsi_set_target_group()
8107 scsi_cmd->opcode = MAINTENANCE_OUT; in scsi_set_target_group()
8108 scsi_cmd->service_action = SET_TARGET_PORT_GROUPS; in scsi_set_target_group()
8109 scsi_ulto4b(alloc_len, scsi_cmd->length); in scsi_set_target_group()
8144 scsi_cmd = (struct scsi_timestamp *)&csio->cdb_io.cdb_bytes; in scsi_set_timestamp()
8146 scsi_cmd->opcode = MAINTENANCE_OUT; in scsi_set_timestamp()
8147 scsi_cmd->service_action = SET_TIMESTAMP; in scsi_set_timestamp()
8148 scsi_ulto4b(alloc_len, scsi_cmd->length); in scsi_set_timestamp()
8176 scsi_cmd = (struct scsi_sync_cache *)&csio->cdb_io.cdb_bytes; in scsi_synchronize_cache()
8178 scsi_cmd->opcode = SYNCHRONIZE_CACHE; in scsi_synchronize_cache()
8179 scsi_ulto4b(begin_lba, scsi_cmd->begin_lba); in scsi_synchronize_cache()
8180 scsi_ulto2b(lb_count, scsi_cmd->lb_count); in scsi_synchronize_cache()
8211 scsi_cmd = (struct scsi_rw_6 *)&csio->cdb_io.cdb_bytes; in scsi_read_write()
8212 scsi_cmd->opcode = read ? READ_6 : WRITE_6; in scsi_read_write()
8213 scsi_ulto3b(lba, scsi_cmd->addr); in scsi_read_write()
8214 scsi_cmd->length = block_count & 0xff; in scsi_read_write()
8215 scsi_cmd->control = 0; in scsi_read_write()
8218 CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, in scsi_read_write()
8219 ("6byte: %x%x%x:%d:%d\n", scsi_cmd->addr[0], in scsi_read_write()
8220 scsi_cmd->addr[1], scsi_cmd->addr[2], in scsi_read_write()
8221 scsi_cmd->length, dxfer_len)); in scsi_read_write()
8230 scsi_cmd = (struct scsi_rw_10 *)&csio->cdb_io.cdb_bytes; in scsi_read_write()
8231 scsi_cmd->opcode = read ? READ_10 : WRITE_10; in scsi_read_write()
8232 scsi_cmd->byte2 = byte2; in scsi_read_write()
8233 scsi_ulto4b(lba, scsi_cmd->addr); in scsi_read_write()
8234 scsi_cmd->reserved = 0; in scsi_read_write()
8235 scsi_ulto2b(block_count, scsi_cmd->length); in scsi_read_write()
8236 scsi_cmd->control = 0; in scsi_read_write()
8239 CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, in scsi_read_write()
8240 ("10byte: %x%x%x%x:%x%x: %d\n", scsi_cmd->addr[0], in scsi_read_write()
8241 scsi_cmd->addr[1], scsi_cmd->addr[2], in scsi_read_write()
8242 scsi_cmd->addr[3], scsi_cmd->length[0], in scsi_read_write()
8243 scsi_cmd->length[1], dxfer_len)); in scsi_read_write()
8253 scsi_cmd = (struct scsi_rw_12 *)&csio->cdb_io.cdb_bytes; in scsi_read_write()
8254 scsi_cmd->opcode = read ? READ_12 : WRITE_12; in scsi_read_write()
8255 scsi_cmd->byte2 = byte2; in scsi_read_write()
8256 scsi_ulto4b(lba, scsi_cmd->addr); in scsi_read_write()
8257 scsi_cmd->reserved = 0; in scsi_read_write()
8258 scsi_ulto4b(block_count, scsi_cmd->length); in scsi_read_write()
8259 scsi_cmd->control = 0; in scsi_read_write()
8262 CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, in scsi_read_write()
8263 ("12byte: %x%x%x%x:%x%x%x%x: %d\n", scsi_cmd->addr[0], in scsi_read_write()
8264 scsi_cmd->addr[1], scsi_cmd->addr[2], in scsi_read_write()
8265 scsi_cmd->addr[3], scsi_cmd->length[0], in scsi_read_write()
8266 scsi_cmd->length[1], scsi_cmd->length[2], in scsi_read_write()
8267 scsi_cmd->length[3], dxfer_len)); in scsi_read_write()
8275 scsi_cmd = (struct scsi_rw_16 *)&csio->cdb_io.cdb_bytes; in scsi_read_write()
8276 scsi_cmd->opcode = read ? READ_16 : WRITE_16; in scsi_read_write()
8277 scsi_cmd->byte2 = byte2; in scsi_read_write()
8278 scsi_u64to8b(lba, scsi_cmd->addr); in scsi_read_write()
8279 scsi_cmd->reserved = 0; in scsi_read_write()
8280 scsi_ulto4b(block_count, scsi_cmd->length); in scsi_read_write()
8281 scsi_cmd->control = 0; in scsi_read_write()
8314 scsi_cmd = (struct scsi_write_same_10 *)&csio->cdb_io.cdb_bytes; in scsi_write_same()
8315 scsi_cmd->opcode = WRITE_SAME_10; in scsi_write_same()
8316 scsi_cmd->byte2 = byte2; in scsi_write_same()
8317 scsi_ulto4b(lba, scsi_cmd->addr); in scsi_write_same()
8318 scsi_cmd->group = 0; in scsi_write_same()
8319 scsi_ulto2b(block_count, scsi_cmd->length); in scsi_write_same()
8320 scsi_cmd->control = 0; in scsi_write_same()
8323 CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, in scsi_write_same()
8324 ("10byte: %x%x%x%x:%x%x: %d\n", scsi_cmd->addr[0], in scsi_write_same()
8325 scsi_cmd->addr[1], scsi_cmd->addr[2], in scsi_write_same()
8326 scsi_cmd->addr[3], scsi_cmd->length[0], in scsi_write_same()
8327 scsi_cmd->length[1], dxfer_len)); in scsi_write_same()
8335 scsi_cmd = (struct scsi_write_same_16 *)&csio->cdb_io.cdb_bytes; in scsi_write_same()
8336 scsi_cmd->opcode = WRITE_SAME_16; in scsi_write_same()
8337 scsi_cmd->byte2 = byte2; in scsi_write_same()
8338 scsi_u64to8b(lba, scsi_cmd->addr); in scsi_write_same()
8339 scsi_ulto4b(block_count, scsi_cmd->length); in scsi_write_same()
8340 scsi_cmd->group = 0; in scsi_write_same()
8341 scsi_cmd->control = 0; in scsi_write_same()
8344 CAM_DEBUG(csio->ccb_h.path, CAM_DEBUG_SUBTRACE, in scsi_write_same()
8346 scsi_cmd->addr[0], scsi_cmd->addr[1], in scsi_write_same()
8347 scsi_cmd->addr[2], scsi_cmd->addr[3], in scsi_write_same()
8348 scsi_cmd->addr[4], scsi_cmd->addr[5], in scsi_write_same()
8349 scsi_cmd->addr[6], scsi_cmd->addr[7], in scsi_write_same()
8350 scsi_cmd->length[0], scsi_cmd->length[1], in scsi_write_same()
8351 scsi_cmd->length[2], scsi_cmd->length[3], in scsi_write_same()
8558 * If we have parameters that require a 48-bit ATA command, we have to in scsi_ata_pass()
8559 * use the 16 byte ATA PASS-THROUGH command at least. in scsi_ata_pass()
8574 * 32-byte version of the ATA PASS-THROUGH command. in scsi_ata_pass()
8582 if ((cmd_size > sizeof(csio->cdb_io.cdb_bytes)) in scsi_ata_pass()
8591 * in one place or another. We prefer the built-in array, but used in scsi_ata_pass()
8594 if (cmd_size <= sizeof(csio->cdb_io.cdb_bytes)) in scsi_ata_pass()
8595 cdb_ptr = csio->cdb_io.cdb_bytes; in scsi_ata_pass()
8608 cdb->opcode = ATA_PASS_12; in scsi_ata_pass()
8609 cdb->protocol = protocol; in scsi_ata_pass()
8610 cdb->flags = ata_flags; in scsi_ata_pass()
8611 cdb->features = features; in scsi_ata_pass()
8612 cdb->sector_count = sector_count; in scsi_ata_pass()
8613 cdb->lba_low = lba & 0xff; in scsi_ata_pass()
8614 cdb->lba_mid = (lba >> 8) & 0xff; in scsi_ata_pass()
8615 cdb->lba_high = (lba >> 16) & 0xff; in scsi_ata_pass()
8616 cdb->device = ((lba >> 24) & 0xf) | ATA_DEV_LBA; in scsi_ata_pass()
8617 cdb->command = command; in scsi_ata_pass()
8618 cdb->control = control; in scsi_ata_pass()
8626 cdb->opcode = ATA_PASS_16; in scsi_ata_pass()
8627 cdb->protocol = protocol; in scsi_ata_pass()
8628 cdb->flags = ata_flags; in scsi_ata_pass()
8629 cdb->features = features & 0xff; in scsi_ata_pass()
8630 cdb->sector_count = sector_count & 0xff; in scsi_ata_pass()
8631 cdb->lba_low = lba & 0xff; in scsi_ata_pass()
8632 cdb->lba_mid = (lba >> 8) & 0xff; in scsi_ata_pass()
8633 cdb->lba_high = (lba >> 16) & 0xff; in scsi_ata_pass()
8635 * If AP_EXTEND is set, we're sending a 48-bit command. in scsi_ata_pass()
8636 * Otherwise it's a 28-bit command. in scsi_ata_pass()
8639 cdb->lba_low_ext = (lba >> 24) & 0xff; in scsi_ata_pass()
8640 cdb->lba_mid_ext = (lba >> 32) & 0xff; in scsi_ata_pass()
8641 cdb->lba_high_ext = (lba >> 40) & 0xff; in scsi_ata_pass()
8642 cdb->features_ext = (features >> 8) & 0xff; in scsi_ata_pass()
8643 cdb->sector_count_ext = (sector_count >> 8) & 0xff; in scsi_ata_pass()
8644 cdb->device = device | ATA_DEV_LBA; in scsi_ata_pass()
8646 cdb->lba_low_ext = (lba >> 24) & 0xf; in scsi_ata_pass()
8647 cdb->device = ((lba >> 24) & 0xf) | ATA_DEV_LBA; in scsi_ata_pass()
8649 cdb->command = command; in scsi_ata_pass()
8650 cdb->control = control; in scsi_ata_pass()
8658 cdb->opcode = VARIABLE_LEN_CDB; in scsi_ata_pass()
8659 cdb->control = control; in scsi_ata_pass()
8660 cdb->length = sizeof(*cdb) - __offsetof(struct ata_pass_32, in scsi_ata_pass()
8662 scsi_ulto2b(ATA_PASS_32_SA, cdb->service_action); in scsi_ata_pass()
8663 cdb->protocol = protocol; in scsi_ata_pass()
8664 cdb->flags = ata_flags; in scsi_ata_pass()
8668 cdb->device = ((lba >> 24) & 0xf) | ATA_DEV_LBA; in scsi_ata_pass()
8672 cdb->device = device | ATA_DEV_LBA; in scsi_ata_pass()
8675 bcopy(&tmp_lba[2], cdb->lba, sizeof(cdb->lba)); in scsi_ata_pass()
8676 scsi_ulto2b(features, cdb->features); in scsi_ata_pass()
8677 scsi_ulto2b(sector_count, cdb->count); in scsi_ata_pass()
8678 cdb->command = command; in scsi_ata_pass()
8679 cdb->icc = icc; in scsi_ata_pass()
8680 scsi_ulto4b(auxiliary, cdb->auxiliary); in scsi_ata_pass()
8708 ata_cmd = (struct ata_pass_16 *)&csio->cdb_io.cdb_bytes; in scsi_ata_pass_16()
8709 ata_cmd->opcode = ATA_PASS_16; in scsi_ata_pass_16()
8710 ata_cmd->protocol = protocol; in scsi_ata_pass_16()
8711 ata_cmd->flags = ata_flags; in scsi_ata_pass_16()
8712 ata_cmd->features_ext = features >> 8; in scsi_ata_pass_16()
8713 ata_cmd->features = features; in scsi_ata_pass_16()
8714 ata_cmd->sector_count_ext = sector_count >> 8; in scsi_ata_pass_16()
8715 ata_cmd->sector_count = sector_count; in scsi_ata_pass_16()
8716 ata_cmd->lba_low = lba; in scsi_ata_pass_16()
8717 ata_cmd->lba_mid = lba >> 8; in scsi_ata_pass_16()
8718 ata_cmd->lba_high = lba >> 16; in scsi_ata_pass_16()
8719 ata_cmd->device = ATA_DEV_LBA; in scsi_ata_pass_16()
8721 ata_cmd->lba_low_ext = lba >> 24; in scsi_ata_pass_16()
8722 ata_cmd->lba_mid_ext = lba >> 32; in scsi_ata_pass_16()
8723 ata_cmd->lba_high_ext = lba >> 40; in scsi_ata_pass_16()
8725 ata_cmd->device |= (lba >> 24) & 0x0f; in scsi_ata_pass_16()
8726 ata_cmd->command = command; in scsi_ata_pass_16()
8727 ata_cmd->control = control; in scsi_ata_pass_16()
8750 scsi_cmd = (struct scsi_unmap *)&csio->cdb_io.cdb_bytes; in scsi_unmap()
8751 scsi_cmd->opcode = UNMAP; in scsi_unmap()
8752 scsi_cmd->byte2 = byte2; in scsi_unmap()
8753 scsi_ulto4b(0, scsi_cmd->reserved); in scsi_unmap()
8754 scsi_cmd->group = 0; in scsi_unmap()
8755 scsi_ulto2b(dxfer_len, scsi_cmd->length); in scsi_unmap()
8756 scsi_cmd->control = 0; in scsi_unmap()
8779 scsi_cmd = (struct scsi_receive_diag *)&csio->cdb_io.cdb_bytes; in scsi_receive_diagnostic_results()
8781 scsi_cmd->opcode = RECEIVE_DIAGNOSTIC; in scsi_receive_diagnostic_results()
8783 scsi_cmd->byte2 |= SRD_PCV; in scsi_receive_diagnostic_results()
8784 scsi_cmd->page_code = page_code; in scsi_receive_diagnostic_results()
8786 scsi_ulto2b(allocation_length, scsi_cmd->length); in scsi_receive_diagnostic_results()
8810 scsi_cmd = (struct scsi_send_diag *)&csio->cdb_io.cdb_bytes; in scsi_send_diagnostic()
8812 scsi_cmd->opcode = SEND_DIAGNOSTIC; in scsi_send_diagnostic()
8815 * The default self-test mode control and specific test in scsi_send_diagnostic()
8821 scsi_cmd->byte2 = ((self_test_code << SSD_SELF_TEST_CODE_SHIFT) in scsi_send_diagnostic()
8827 scsi_ulto2b(param_list_length, scsi_cmd->length); in scsi_send_diagnostic()
8851 scsi_cmd = (struct scsi_get_physical_element_status *)&csio->cdb_io.cdb_bytes; in scsi_get_physical_element_status()
8853 scsi_cmd->opcode = SERVICE_ACTION_IN; in scsi_get_physical_element_status()
8854 scsi_cmd->service_action = GET_PHYSICAL_ELEMENT_STATUS; in scsi_get_physical_element_status()
8855 scsi_ulto4b(starting_element, scsi_cmd->starting_element); in scsi_get_physical_element_status()
8856 scsi_ulto4b(allocation_length, scsi_cmd->allocation_length); in scsi_get_physical_element_status()
8879 scsi_cmd = (struct scsi_remove_element_and_truncate *)&csio->cdb_io.cdb_bytes; in scsi_remove_element_and_truncate()
8881 scsi_cmd->opcode = SERVICE_ACTION_IN; in scsi_remove_element_and_truncate()
8882 scsi_cmd->service_action = REMOVE_ELEMENT_AND_TRUNCATE; in scsi_remove_element_and_truncate()
8883 scsi_u64to8b(requested_capacity, scsi_cmd->requested_capacity); in scsi_remove_element_and_truncate()
8884 scsi_ulto4b(element_id, scsi_cmd->element_identifier); in scsi_remove_element_and_truncate()
8906 scsi_cmd = (struct scsi_service_action_in *)&csio->cdb_io.cdb_bytes; in scsi_restore_elements_and_rebuild()
8908 scsi_cmd->opcode = SERVICE_ACTION_IN; in scsi_restore_elements_and_rebuild()
8909 scsi_cmd->service_action = RESTORE_ELEMENTS_AND_REBUILD; in scsi_restore_elements_and_rebuild()
8933 scsi_cmd = (struct scsi_read_buffer *)&csio->cdb_io.cdb_bytes; in scsi_read_buffer()
8935 scsi_cmd->opcode = READ_BUFFER; in scsi_read_buffer()
8936 scsi_cmd->byte2 = mode; in scsi_read_buffer()
8937 scsi_cmd->buffer_id = buffer_id; in scsi_read_buffer()
8938 scsi_ulto3b(offset, scsi_cmd->offset); in scsi_read_buffer()
8939 scsi_ulto3b(allocation_length, scsi_cmd->length); in scsi_read_buffer()
8963 scsi_cmd = (struct scsi_write_buffer *)&csio->cdb_io.cdb_bytes; in scsi_write_buffer()
8965 scsi_cmd->opcode = WRITE_BUFFER; in scsi_write_buffer()
8966 scsi_cmd->byte2 = mode; in scsi_write_buffer()
8967 scsi_cmd->buffer_id = buffer_id; in scsi_write_buffer()
8968 scsi_ulto3b(offset, scsi_cmd->offset); in scsi_write_buffer()
8969 scsi_ulto3b(param_list_length, scsi_cmd->length); in scsi_write_buffer()
8992 scsi_cmd = (struct scsi_start_stop_unit *)&csio->cdb_io.cdb_bytes; in scsi_start_stop()
8994 scsi_cmd->opcode = START_STOP_UNIT; in scsi_start_stop()
8996 scsi_cmd->how |= SSS_START; in scsi_start_stop()
9001 scsi_cmd->how |= SSS_LOEJ; in scsi_start_stop()
9003 scsi_cmd->byte2 |= SSS_IMMED; in scsi_start_stop()
9028 scsi_cmd = (struct scsi_read_attribute *)&csio->cdb_io.cdb_bytes; in scsi_read_attribute()
9031 scsi_cmd->opcode = READ_ATTRIBUTE; in scsi_read_attribute()
9032 scsi_cmd->service_action = service_action; in scsi_read_attribute()
9033 scsi_ulto2b(element, scsi_cmd->element); in scsi_read_attribute()
9034 scsi_cmd->elem_type = elem_type; in scsi_read_attribute()
9035 scsi_cmd->logical_volume = logical_volume; in scsi_read_attribute()
9036 scsi_cmd->partition = partition; in scsi_read_attribute()
9037 scsi_ulto2b(first_attribute, scsi_cmd->first_attribute); in scsi_read_attribute()
9038 scsi_ulto4b(length, scsi_cmd->length); in scsi_read_attribute()
9040 scsi_cmd->cache |= SRA_CACHE; in scsi_read_attribute()
9063 scsi_cmd = (struct scsi_write_attribute *)&csio->cdb_io.cdb_bytes; in scsi_write_attribute()
9066 scsi_cmd->opcode = WRITE_ATTRIBUTE; in scsi_write_attribute()
9068 scsi_cmd->byte2 = SWA_WTC; in scsi_write_attribute()
9069 scsi_ulto3b(element, scsi_cmd->element); in scsi_write_attribute()
9070 scsi_cmd->logical_volume = logical_volume; in scsi_write_attribute()
9071 scsi_cmd->partition = partition; in scsi_write_attribute()
9072 scsi_ulto4b(length, scsi_cmd->length); in scsi_write_attribute()
9095 scsi_cmd = (struct scsi_per_res_in *)&csio->cdb_io.cdb_bytes; in scsi_persistent_reserve_in()
9098 scsi_cmd->opcode = PERSISTENT_RES_IN; in scsi_persistent_reserve_in()
9099 scsi_cmd->action = service_action; in scsi_persistent_reserve_in()
9100 scsi_ulto2b(dxfer_len, scsi_cmd->length); in scsi_persistent_reserve_in()
9123 scsi_cmd = (struct scsi_per_res_out *)&csio->cdb_io.cdb_bytes; in scsi_persistent_reserve_out()
9126 scsi_cmd->opcode = PERSISTENT_RES_OUT; in scsi_persistent_reserve_out()
9127 scsi_cmd->action = service_action; in scsi_persistent_reserve_out()
9128 scsi_cmd->scope_type = scope | res_type; in scsi_persistent_reserve_out()
9129 scsi_ulto4b(dxfer_len, scsi_cmd->length); in scsi_persistent_reserve_out()
9153 scsi_cmd = (struct scsi_security_protocol_in *)&csio->cdb_io.cdb_bytes; in scsi_security_protocol_in()
9156 scsi_cmd->opcode = SECURITY_PROTOCOL_IN; in scsi_security_protocol_in()
9158 scsi_cmd->security_protocol = security_protocol; in scsi_security_protocol_in()
9160 scsi_cmd->security_protocol_specific); in scsi_security_protocol_in()
9161 scsi_cmd->byte4 = byte4; in scsi_security_protocol_in()
9162 scsi_ulto4b(dxfer_len, scsi_cmd->length); in scsi_security_protocol_in()
9186 scsi_cmd = (struct scsi_security_protocol_out *)&csio->cdb_io.cdb_bytes; in scsi_security_protocol_out()
9189 scsi_cmd->opcode = SECURITY_PROTOCOL_OUT; in scsi_security_protocol_out()
9191 scsi_cmd->security_protocol = security_protocol; in scsi_security_protocol_out()
9193 scsi_cmd->security_protocol_specific); in scsi_security_protocol_out()
9194 scsi_cmd->byte4 = byte4; in scsi_security_protocol_out()
9195 scsi_ulto4b(dxfer_len, scsi_cmd->length); in scsi_security_protocol_out()
9219 &csio->cdb_io.cdb_bytes; in scsi_report_supported_opcodes()
9222 scsi_cmd->opcode = MAINTENANCE_IN; in scsi_report_supported_opcodes()
9223 scsi_cmd->service_action = REPORT_SUPPORTED_OPERATION_CODES; in scsi_report_supported_opcodes()
9224 scsi_cmd->options = options; in scsi_report_supported_opcodes()
9225 scsi_cmd->requested_opcode = req_opcode; in scsi_report_supported_opcodes()
9226 scsi_ulto2b(req_service_action, scsi_cmd->requested_service_action); in scsi_report_supported_opcodes()
9227 scsi_ulto4b(dxfer_len, scsi_cmd->length); in scsi_report_supported_opcodes()
9254 if (((SID_TYPE(inq) == entry->type) in scsi_inquiry_match()
9255 || (entry->type == T_ANY)) in scsi_inquiry_match()
9256 && (SID_IS_REMOVABLE(inq) ? entry->media_type & SIP_MEDIA_REMOVABLE in scsi_inquiry_match()
9257 : entry->media_type & SIP_MEDIA_FIXED) in scsi_inquiry_match()
9258 && (cam_strmatch(inq->vendor, entry->vendor, sizeof(inq->vendor)) == 0) in scsi_inquiry_match()
9259 && (cam_strmatch(inq->product, entry->product, in scsi_inquiry_match()
9260 sizeof(inq->product)) == 0) in scsi_inquiry_match()
9261 && (cam_strmatch(inq->revision, entry->revision, in scsi_inquiry_match()
9262 sizeof(inq->revision)) == 0)) { in scsi_inquiry_match()
9265 return (-1); in scsi_inquiry_match()
9281 if (((SID_TYPE(inq) == entry->type) in scsi_static_inquiry_match()
9282 || (entry->type == T_ANY)) in scsi_static_inquiry_match()
9283 && (SID_IS_REMOVABLE(inq) ? entry->media_type & SIP_MEDIA_REMOVABLE in scsi_static_inquiry_match()
9284 : entry->media_type & SIP_MEDIA_FIXED) in scsi_static_inquiry_match()
9285 && (cam_strmatch(inq->vendor, entry->vendor, sizeof(inq->vendor)) == 0) in scsi_static_inquiry_match()
9286 && (cam_strmatch(inq->product, entry->product, in scsi_static_inquiry_match()
9287 sizeof(inq->product)) == 0) in scsi_static_inquiry_match()
9288 && (cam_strmatch(inq->revision, entry->revision, in scsi_static_inquiry_match()
9289 sizeof(inq->revision)) == 0)) { in scsi_static_inquiry_match()
9292 return (-1); in scsi_static_inquiry_match()
9303 * \return 0 on a match, -1 otherwise.
9328 (lhs_end - __offsetof(struct scsi_vpd_id_descriptor, identifier)); in scsi_devid_match()
9330 (rhs_end - __offsetof(struct scsi_vpd_id_descriptor, identifier)); in scsi_devid_match()
9334 && (lhs_id->identifier + lhs_id->length) <= lhs_end) { in scsi_devid_match()
9339 && (rhs_id->identifier + rhs_id->length) <= rhs_end) { in scsi_devid_match()
9340 if ((rhs_id->id_type & in scsi_devid_match()
9342 (lhs_id->id_type & in scsi_devid_match()
9344 && rhs_id->length == lhs_id->length in scsi_devid_match()
9345 && memcmp(rhs_id->identifier, lhs_id->identifier, in scsi_devid_match()
9346 rhs_id->length) == 0) in scsi_devid_match()
9350 (rhs_id->identifier + rhs_id->length); in scsi_devid_match()
9353 (lhs_id->identifier + lhs_id->length); in scsi_devid_match()
9355 return (-1); in scsi_devid_match()
9366 device = periph->path->device; in scsi_vpd_supported_page()
9367 vpds = (struct scsi_vpd_supported_pages *)device->supported_vpds; in scsi_vpd_supported_page()
9370 num_pages = device->supported_vpds_len - in scsi_vpd_supported_page()
9373 if (vpds->page_list[i] == page_id) in scsi_vpd_supported_page()
9403 if (error != 0 || req->newptr == NULL) in sysctl_scsi_delay()