Lines Matching refs:SCpnt
112 static int sd_init_command(struct scsi_cmnd *SCpnt);
113 static void sd_uninit_command(struct scsi_cmnd *SCpnt);
883 static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt) in sd_setup_read_write_cmnd() argument
885 struct request *rq = SCpnt->request; in sd_setup_read_write_cmnd()
886 struct scsi_device *sdp = SCpnt->device; in sd_setup_read_write_cmnd()
896 ret = scsi_init_io(SCpnt); in sd_setup_read_write_cmnd()
899 SCpnt = rq->special; in sd_setup_read_write_cmnd()
907 scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
913 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
916 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
917 "Retry with 0x%p\n", SCpnt)); in sd_setup_read_write_cmnd()
947 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "block=%llu\n", in sd_setup_read_write_cmnd()
963 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
973 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
983 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
992 SCpnt->cmnd[0] = WRITE_6; in sd_setup_read_write_cmnd()
995 sd_dif_prepare(SCpnt); in sd_setup_read_write_cmnd()
998 SCpnt->cmnd[0] = READ_6; in sd_setup_read_write_cmnd()
1000 scmd_printk(KERN_ERR, SCpnt, "Unknown command %llx\n", (unsigned long long) rq->cmd_flags); in sd_setup_read_write_cmnd()
1004 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
1010 dix = scsi_prot_sg_count(SCpnt); in sd_setup_read_write_cmnd()
1011 dif = scsi_host_dif_capable(SCpnt->device->host, sdkp->protection_type); in sd_setup_read_write_cmnd()
1014 protect = sd_setup_protect_cmnd(SCpnt, dix, dif); in sd_setup_read_write_cmnd()
1019 SCpnt->cmnd = mempool_alloc(sd_cdb_pool, GFP_ATOMIC); in sd_setup_read_write_cmnd()
1021 if (unlikely(SCpnt->cmnd == NULL)) { in sd_setup_read_write_cmnd()
1026 SCpnt->cmd_len = SD_EXT_CDB_SIZE; in sd_setup_read_write_cmnd()
1027 memset(SCpnt->cmnd, 0, SCpnt->cmd_len); in sd_setup_read_write_cmnd()
1028 SCpnt->cmnd[0] = VARIABLE_LENGTH_CMD; in sd_setup_read_write_cmnd()
1029 SCpnt->cmnd[7] = 0x18; in sd_setup_read_write_cmnd()
1030 SCpnt->cmnd[9] = (rq_data_dir(rq) == READ) ? READ_32 : WRITE_32; in sd_setup_read_write_cmnd()
1031 SCpnt->cmnd[10] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0); in sd_setup_read_write_cmnd()
1034 SCpnt->cmnd[12] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; in sd_setup_read_write_cmnd()
1035 SCpnt->cmnd[13] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; in sd_setup_read_write_cmnd()
1036 SCpnt->cmnd[14] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; in sd_setup_read_write_cmnd()
1037 SCpnt->cmnd[15] = sizeof(block) > 4 ? (unsigned char) (block >> 32) & 0xff : 0; in sd_setup_read_write_cmnd()
1038 SCpnt->cmnd[16] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1039 SCpnt->cmnd[17] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1040 SCpnt->cmnd[18] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1041 SCpnt->cmnd[19] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1044 SCpnt->cmnd[20] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1045 SCpnt->cmnd[21] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1046 SCpnt->cmnd[22] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1047 SCpnt->cmnd[23] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1050 SCpnt->cmnd[28] = (unsigned char) (this_count >> 24) & 0xff; in sd_setup_read_write_cmnd()
1051 SCpnt->cmnd[29] = (unsigned char) (this_count >> 16) & 0xff; in sd_setup_read_write_cmnd()
1052 SCpnt->cmnd[30] = (unsigned char) (this_count >> 8) & 0xff; in sd_setup_read_write_cmnd()
1053 SCpnt->cmnd[31] = (unsigned char) this_count & 0xff; in sd_setup_read_write_cmnd()
1055 SCpnt->cmnd[0] += READ_16 - READ_6; in sd_setup_read_write_cmnd()
1056 SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0); in sd_setup_read_write_cmnd()
1057 SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; in sd_setup_read_write_cmnd()
1058 SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; in sd_setup_read_write_cmnd()
1059 SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; in sd_setup_read_write_cmnd()
1060 SCpnt->cmnd[5] = sizeof(block) > 4 ? (unsigned char) (block >> 32) & 0xff : 0; in sd_setup_read_write_cmnd()
1061 SCpnt->cmnd[6] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1062 SCpnt->cmnd[7] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1063 SCpnt->cmnd[8] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1064 SCpnt->cmnd[9] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1065 SCpnt->cmnd[10] = (unsigned char) (this_count >> 24) & 0xff; in sd_setup_read_write_cmnd()
1066 SCpnt->cmnd[11] = (unsigned char) (this_count >> 16) & 0xff; in sd_setup_read_write_cmnd()
1067 SCpnt->cmnd[12] = (unsigned char) (this_count >> 8) & 0xff; in sd_setup_read_write_cmnd()
1068 SCpnt->cmnd[13] = (unsigned char) this_count & 0xff; in sd_setup_read_write_cmnd()
1069 SCpnt->cmnd[14] = SCpnt->cmnd[15] = 0; in sd_setup_read_write_cmnd()
1071 scsi_device_protection(SCpnt->device) || in sd_setup_read_write_cmnd()
1072 SCpnt->device->use_10_for_rw) { in sd_setup_read_write_cmnd()
1073 SCpnt->cmnd[0] += READ_10 - READ_6; in sd_setup_read_write_cmnd()
1074 SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0); in sd_setup_read_write_cmnd()
1075 SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1076 SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1077 SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1078 SCpnt->cmnd[5] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1079 SCpnt->cmnd[6] = SCpnt->cmnd[9] = 0; in sd_setup_read_write_cmnd()
1080 SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff; in sd_setup_read_write_cmnd()
1081 SCpnt->cmnd[8] = (unsigned char) this_count & 0xff; in sd_setup_read_write_cmnd()
1090 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
1095 SCpnt->cmnd[1] |= (unsigned char) ((block >> 16) & 0x1f); in sd_setup_read_write_cmnd()
1096 SCpnt->cmnd[2] = (unsigned char) ((block >> 8) & 0xff); in sd_setup_read_write_cmnd()
1097 SCpnt->cmnd[3] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1098 SCpnt->cmnd[4] = (unsigned char) this_count; in sd_setup_read_write_cmnd()
1099 SCpnt->cmnd[5] = 0; in sd_setup_read_write_cmnd()
1101 SCpnt->sdb.length = this_count * sdp->sector_size; in sd_setup_read_write_cmnd()
1108 SCpnt->transfersize = sdp->sector_size; in sd_setup_read_write_cmnd()
1109 SCpnt->underflow = this_count << 9; in sd_setup_read_write_cmnd()
1110 SCpnt->allowed = SD_MAX_RETRIES; in sd_setup_read_write_cmnd()
1135 static void sd_uninit_command(struct scsi_cmnd *SCpnt) in sd_uninit_command() argument
1137 struct request *rq = SCpnt->request; in sd_uninit_command()
1142 if (SCpnt->cmnd != rq->cmd) { in sd_uninit_command()
1143 mempool_free(SCpnt->cmnd, sd_cdb_pool); in sd_uninit_command()
1144 SCpnt->cmnd = NULL; in sd_uninit_command()
1145 SCpnt->cmd_len = 0; in sd_uninit_command()
1650 static int sd_done(struct scsi_cmnd *SCpnt) in sd_done() argument
1652 int result = SCpnt->result; in sd_done()
1653 unsigned int good_bytes = result ? 0 : scsi_bufflen(SCpnt); in sd_done()
1655 struct scsi_disk *sdkp = scsi_disk(SCpnt->request->rq_disk); in sd_done()
1656 struct request *req = SCpnt->request; in sd_done()
1659 unsigned char op = SCpnt->cmnd[0]; in sd_done()
1660 unsigned char unmap = SCpnt->cmnd[1] & 8; in sd_done()
1665 scsi_set_resid(SCpnt, 0); in sd_done()
1668 scsi_set_resid(SCpnt, blk_rq_bytes(req)); in sd_done()
1673 sense_valid = scsi_command_normalize_sense(SCpnt, &sshdr); in sd_done()
1686 good_bytes = sd_completed_bytes(SCpnt); in sd_done()
1689 good_bytes = scsi_bufflen(SCpnt); in sd_done()
1696 SCpnt->result = 0; in sd_done()
1697 memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in sd_done()
1701 good_bytes = sd_completed_bytes(SCpnt); in sd_done()
1705 good_bytes = sd_completed_bytes(SCpnt); in sd_done()
1731 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt, in sd_done()
1733 good_bytes, scsi_bufflen(SCpnt))); in sd_done()
1735 if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt)) in sd_done()
1736 sd_dif_complete(SCpnt, good_bytes); in sd_done()