Lines Matching refs:SCpnt
113 static int sd_init_command(struct scsi_cmnd *SCpnt);
114 static void sd_uninit_command(struct scsi_cmnd *SCpnt);
912 static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt) in sd_setup_read_write_cmnd() argument
914 struct request *rq = SCpnt->request; in sd_setup_read_write_cmnd()
915 struct scsi_device *sdp = SCpnt->device; in sd_setup_read_write_cmnd()
925 ret = scsi_init_io(SCpnt); in sd_setup_read_write_cmnd()
928 SCpnt = rq->special; in sd_setup_read_write_cmnd()
936 scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
942 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
945 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
946 "Retry with 0x%p\n", SCpnt)); in sd_setup_read_write_cmnd()
976 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "block=%llu\n", in sd_setup_read_write_cmnd()
992 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
1002 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
1012 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
1021 SCpnt->cmnd[0] = WRITE_6; in sd_setup_read_write_cmnd()
1024 sd_dif_prepare(SCpnt); in sd_setup_read_write_cmnd()
1027 SCpnt->cmnd[0] = READ_6; in sd_setup_read_write_cmnd()
1029 scmd_printk(KERN_ERR, SCpnt, "Unknown command %llx\n", (unsigned long long) rq->cmd_flags); in sd_setup_read_write_cmnd()
1033 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
1039 dix = scsi_prot_sg_count(SCpnt); in sd_setup_read_write_cmnd()
1040 dif = scsi_host_dif_capable(SCpnt->device->host, sdkp->protection_type); in sd_setup_read_write_cmnd()
1043 protect = sd_setup_protect_cmnd(SCpnt, dix, dif); in sd_setup_read_write_cmnd()
1048 SCpnt->cmnd = mempool_alloc(sd_cdb_pool, GFP_ATOMIC); in sd_setup_read_write_cmnd()
1050 if (unlikely(SCpnt->cmnd == NULL)) { in sd_setup_read_write_cmnd()
1055 SCpnt->cmd_len = SD_EXT_CDB_SIZE; in sd_setup_read_write_cmnd()
1056 memset(SCpnt->cmnd, 0, SCpnt->cmd_len); in sd_setup_read_write_cmnd()
1057 SCpnt->cmnd[0] = VARIABLE_LENGTH_CMD; in sd_setup_read_write_cmnd()
1058 SCpnt->cmnd[7] = 0x18; in sd_setup_read_write_cmnd()
1059 SCpnt->cmnd[9] = (rq_data_dir(rq) == READ) ? READ_32 : WRITE_32; in sd_setup_read_write_cmnd()
1060 SCpnt->cmnd[10] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0); in sd_setup_read_write_cmnd()
1063 SCpnt->cmnd[12] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; in sd_setup_read_write_cmnd()
1064 SCpnt->cmnd[13] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; in sd_setup_read_write_cmnd()
1065 SCpnt->cmnd[14] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; in sd_setup_read_write_cmnd()
1066 SCpnt->cmnd[15] = sizeof(block) > 4 ? (unsigned char) (block >> 32) & 0xff : 0; in sd_setup_read_write_cmnd()
1067 SCpnt->cmnd[16] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1068 SCpnt->cmnd[17] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1069 SCpnt->cmnd[18] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1070 SCpnt->cmnd[19] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1073 SCpnt->cmnd[20] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1074 SCpnt->cmnd[21] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1075 SCpnt->cmnd[22] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1076 SCpnt->cmnd[23] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1079 SCpnt->cmnd[28] = (unsigned char) (this_count >> 24) & 0xff; in sd_setup_read_write_cmnd()
1080 SCpnt->cmnd[29] = (unsigned char) (this_count >> 16) & 0xff; in sd_setup_read_write_cmnd()
1081 SCpnt->cmnd[30] = (unsigned char) (this_count >> 8) & 0xff; in sd_setup_read_write_cmnd()
1082 SCpnt->cmnd[31] = (unsigned char) this_count & 0xff; in sd_setup_read_write_cmnd()
1084 SCpnt->cmnd[0] += READ_16 - READ_6; in sd_setup_read_write_cmnd()
1085 SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0); in sd_setup_read_write_cmnd()
1086 SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; in sd_setup_read_write_cmnd()
1087 SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; in sd_setup_read_write_cmnd()
1088 SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; in sd_setup_read_write_cmnd()
1089 SCpnt->cmnd[5] = sizeof(block) > 4 ? (unsigned char) (block >> 32) & 0xff : 0; in sd_setup_read_write_cmnd()
1090 SCpnt->cmnd[6] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1091 SCpnt->cmnd[7] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1092 SCpnt->cmnd[8] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1093 SCpnt->cmnd[9] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1094 SCpnt->cmnd[10] = (unsigned char) (this_count >> 24) & 0xff; in sd_setup_read_write_cmnd()
1095 SCpnt->cmnd[11] = (unsigned char) (this_count >> 16) & 0xff; in sd_setup_read_write_cmnd()
1096 SCpnt->cmnd[12] = (unsigned char) (this_count >> 8) & 0xff; in sd_setup_read_write_cmnd()
1097 SCpnt->cmnd[13] = (unsigned char) this_count & 0xff; in sd_setup_read_write_cmnd()
1098 SCpnt->cmnd[14] = SCpnt->cmnd[15] = 0; in sd_setup_read_write_cmnd()
1100 scsi_device_protection(SCpnt->device) || in sd_setup_read_write_cmnd()
1101 SCpnt->device->use_10_for_rw) { in sd_setup_read_write_cmnd()
1102 SCpnt->cmnd[0] += READ_10 - READ_6; in sd_setup_read_write_cmnd()
1103 SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0); in sd_setup_read_write_cmnd()
1104 SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1105 SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1106 SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1107 SCpnt->cmnd[5] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1108 SCpnt->cmnd[6] = SCpnt->cmnd[9] = 0; in sd_setup_read_write_cmnd()
1109 SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff; in sd_setup_read_write_cmnd()
1110 SCpnt->cmnd[8] = (unsigned char) this_count & 0xff; in sd_setup_read_write_cmnd()
1119 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
1124 SCpnt->cmnd[1] |= (unsigned char) ((block >> 16) & 0x1f); in sd_setup_read_write_cmnd()
1125 SCpnt->cmnd[2] = (unsigned char) ((block >> 8) & 0xff); in sd_setup_read_write_cmnd()
1126 SCpnt->cmnd[3] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1127 SCpnt->cmnd[4] = (unsigned char) this_count; in sd_setup_read_write_cmnd()
1128 SCpnt->cmnd[5] = 0; in sd_setup_read_write_cmnd()
1130 SCpnt->sdb.length = this_count * sdp->sector_size; in sd_setup_read_write_cmnd()
1137 SCpnt->transfersize = sdp->sector_size; in sd_setup_read_write_cmnd()
1138 SCpnt->underflow = this_count << 9; in sd_setup_read_write_cmnd()
1139 SCpnt->allowed = SD_MAX_RETRIES; in sd_setup_read_write_cmnd()
1164 static void sd_uninit_command(struct scsi_cmnd *SCpnt) in sd_uninit_command() argument
1166 struct request *rq = SCpnt->request; in sd_uninit_command()
1171 if (SCpnt->cmnd != rq->cmd) { in sd_uninit_command()
1172 mempool_free(SCpnt->cmnd, sd_cdb_pool); in sd_uninit_command()
1173 SCpnt->cmnd = NULL; in sd_uninit_command()
1174 SCpnt->cmd_len = 0; in sd_uninit_command()
1774 static int sd_done(struct scsi_cmnd *SCpnt) in sd_done() argument
1776 int result = SCpnt->result; in sd_done()
1777 unsigned int good_bytes = result ? 0 : scsi_bufflen(SCpnt); in sd_done()
1779 struct scsi_disk *sdkp = scsi_disk(SCpnt->request->rq_disk); in sd_done()
1780 struct request *req = SCpnt->request; in sd_done()
1783 unsigned char op = SCpnt->cmnd[0]; in sd_done()
1784 unsigned char unmap = SCpnt->cmnd[1] & 8; in sd_done()
1789 scsi_set_resid(SCpnt, 0); in sd_done()
1792 scsi_set_resid(SCpnt, blk_rq_bytes(req)); in sd_done()
1797 sense_valid = scsi_command_normalize_sense(SCpnt, &sshdr); in sd_done()
1810 good_bytes = sd_completed_bytes(SCpnt); in sd_done()
1813 good_bytes = scsi_bufflen(SCpnt); in sd_done()
1820 SCpnt->result = 0; in sd_done()
1821 memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in sd_done()
1825 good_bytes = sd_completed_bytes(SCpnt); in sd_done()
1829 good_bytes = sd_completed_bytes(SCpnt); in sd_done()
1855 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt, in sd_done()
1857 good_bytes, scsi_bufflen(SCpnt))); in sd_done()
1859 if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt)) in sd_done()
1860 sd_dif_complete(SCpnt, good_bytes); in sd_done()