Lines Matching refs:SCpnt

113 static int sd_init_command(struct scsi_cmnd *SCpnt);
114 static void sd_uninit_command(struct scsi_cmnd *SCpnt);
898 static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt) in sd_setup_read_write_cmnd() argument
900 struct request *rq = SCpnt->request; in sd_setup_read_write_cmnd()
901 struct scsi_device *sdp = SCpnt->device; in sd_setup_read_write_cmnd()
911 ret = scsi_init_io(SCpnt); in sd_setup_read_write_cmnd()
914 SCpnt = rq->special; in sd_setup_read_write_cmnd()
922 scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
928 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
931 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
932 "Retry with 0x%p\n", SCpnt)); in sd_setup_read_write_cmnd()
962 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "block=%llu\n", in sd_setup_read_write_cmnd()
978 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
988 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
998 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
1007 SCpnt->cmnd[0] = WRITE_6; in sd_setup_read_write_cmnd()
1010 sd_dif_prepare(SCpnt); in sd_setup_read_write_cmnd()
1013 SCpnt->cmnd[0] = READ_6; in sd_setup_read_write_cmnd()
1015 scmd_printk(KERN_ERR, SCpnt, "Unknown command %llx\n", (unsigned long long) rq->cmd_flags); in sd_setup_read_write_cmnd()
1019 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, in sd_setup_read_write_cmnd()
1025 dix = scsi_prot_sg_count(SCpnt); in sd_setup_read_write_cmnd()
1026 dif = scsi_host_dif_capable(SCpnt->device->host, sdkp->protection_type); in sd_setup_read_write_cmnd()
1029 protect = sd_setup_protect_cmnd(SCpnt, dix, dif); in sd_setup_read_write_cmnd()
1034 SCpnt->cmnd = mempool_alloc(sd_cdb_pool, GFP_ATOMIC); in sd_setup_read_write_cmnd()
1036 if (unlikely(SCpnt->cmnd == NULL)) { in sd_setup_read_write_cmnd()
1041 SCpnt->cmd_len = SD_EXT_CDB_SIZE; in sd_setup_read_write_cmnd()
1042 memset(SCpnt->cmnd, 0, SCpnt->cmd_len); in sd_setup_read_write_cmnd()
1043 SCpnt->cmnd[0] = VARIABLE_LENGTH_CMD; in sd_setup_read_write_cmnd()
1044 SCpnt->cmnd[7] = 0x18; in sd_setup_read_write_cmnd()
1045 SCpnt->cmnd[9] = (rq_data_dir(rq) == READ) ? READ_32 : WRITE_32; in sd_setup_read_write_cmnd()
1046 SCpnt->cmnd[10] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0); in sd_setup_read_write_cmnd()
1049 SCpnt->cmnd[12] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; in sd_setup_read_write_cmnd()
1050 SCpnt->cmnd[13] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; in sd_setup_read_write_cmnd()
1051 SCpnt->cmnd[14] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; in sd_setup_read_write_cmnd()
1052 SCpnt->cmnd[15] = sizeof(block) > 4 ? (unsigned char) (block >> 32) & 0xff : 0; in sd_setup_read_write_cmnd()
1053 SCpnt->cmnd[16] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1054 SCpnt->cmnd[17] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1055 SCpnt->cmnd[18] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1056 SCpnt->cmnd[19] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1059 SCpnt->cmnd[20] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1060 SCpnt->cmnd[21] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1061 SCpnt->cmnd[22] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1062 SCpnt->cmnd[23] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1065 SCpnt->cmnd[28] = (unsigned char) (this_count >> 24) & 0xff; in sd_setup_read_write_cmnd()
1066 SCpnt->cmnd[29] = (unsigned char) (this_count >> 16) & 0xff; in sd_setup_read_write_cmnd()
1067 SCpnt->cmnd[30] = (unsigned char) (this_count >> 8) & 0xff; in sd_setup_read_write_cmnd()
1068 SCpnt->cmnd[31] = (unsigned char) this_count & 0xff; in sd_setup_read_write_cmnd()
1070 SCpnt->cmnd[0] += READ_16 - READ_6; in sd_setup_read_write_cmnd()
1071 SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0); in sd_setup_read_write_cmnd()
1072 SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; in sd_setup_read_write_cmnd()
1073 SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; in sd_setup_read_write_cmnd()
1074 SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; in sd_setup_read_write_cmnd()
1075 SCpnt->cmnd[5] = sizeof(block) > 4 ? (unsigned char) (block >> 32) & 0xff : 0; in sd_setup_read_write_cmnd()
1076 SCpnt->cmnd[6] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1077 SCpnt->cmnd[7] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1078 SCpnt->cmnd[8] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1079 SCpnt->cmnd[9] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1080 SCpnt->cmnd[10] = (unsigned char) (this_count >> 24) & 0xff; in sd_setup_read_write_cmnd()
1081 SCpnt->cmnd[11] = (unsigned char) (this_count >> 16) & 0xff; in sd_setup_read_write_cmnd()
1082 SCpnt->cmnd[12] = (unsigned char) (this_count >> 8) & 0xff; in sd_setup_read_write_cmnd()
1083 SCpnt->cmnd[13] = (unsigned char) this_count & 0xff; in sd_setup_read_write_cmnd()
1084 SCpnt->cmnd[14] = SCpnt->cmnd[15] = 0; in sd_setup_read_write_cmnd()
1086 scsi_device_protection(SCpnt->device) || in sd_setup_read_write_cmnd()
1087 SCpnt->device->use_10_for_rw) { in sd_setup_read_write_cmnd()
1088 SCpnt->cmnd[0] += READ_10 - READ_6; in sd_setup_read_write_cmnd()
1089 SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0); in sd_setup_read_write_cmnd()
1090 SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; in sd_setup_read_write_cmnd()
1091 SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff; in sd_setup_read_write_cmnd()
1092 SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff; in sd_setup_read_write_cmnd()
1093 SCpnt->cmnd[5] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1094 SCpnt->cmnd[6] = SCpnt->cmnd[9] = 0; in sd_setup_read_write_cmnd()
1095 SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff; in sd_setup_read_write_cmnd()
1096 SCpnt->cmnd[8] = (unsigned char) this_count & 0xff; in sd_setup_read_write_cmnd()
1105 scmd_printk(KERN_ERR, SCpnt, in sd_setup_read_write_cmnd()
1110 SCpnt->cmnd[1] |= (unsigned char) ((block >> 16) & 0x1f); in sd_setup_read_write_cmnd()
1111 SCpnt->cmnd[2] = (unsigned char) ((block >> 8) & 0xff); in sd_setup_read_write_cmnd()
1112 SCpnt->cmnd[3] = (unsigned char) block & 0xff; in sd_setup_read_write_cmnd()
1113 SCpnt->cmnd[4] = (unsigned char) this_count; in sd_setup_read_write_cmnd()
1114 SCpnt->cmnd[5] = 0; in sd_setup_read_write_cmnd()
1116 SCpnt->sdb.length = this_count * sdp->sector_size; in sd_setup_read_write_cmnd()
1123 SCpnt->transfersize = sdp->sector_size; in sd_setup_read_write_cmnd()
1124 SCpnt->underflow = this_count << 9; in sd_setup_read_write_cmnd()
1125 SCpnt->allowed = SD_MAX_RETRIES; in sd_setup_read_write_cmnd()
1150 static void sd_uninit_command(struct scsi_cmnd *SCpnt) in sd_uninit_command() argument
1152 struct request *rq = SCpnt->request; in sd_uninit_command()
1157 if (SCpnt->cmnd != rq->cmd) { in sd_uninit_command()
1158 mempool_free(SCpnt->cmnd, sd_cdb_pool); in sd_uninit_command()
1159 SCpnt->cmnd = NULL; in sd_uninit_command()
1160 SCpnt->cmd_len = 0; in sd_uninit_command()
1760 static int sd_done(struct scsi_cmnd *SCpnt) in sd_done() argument
1762 int result = SCpnt->result; in sd_done()
1763 unsigned int good_bytes = result ? 0 : scsi_bufflen(SCpnt); in sd_done()
1765 struct scsi_disk *sdkp = scsi_disk(SCpnt->request->rq_disk); in sd_done()
1766 struct request *req = SCpnt->request; in sd_done()
1769 unsigned char op = SCpnt->cmnd[0]; in sd_done()
1770 unsigned char unmap = SCpnt->cmnd[1] & 8; in sd_done()
1775 scsi_set_resid(SCpnt, 0); in sd_done()
1778 scsi_set_resid(SCpnt, blk_rq_bytes(req)); in sd_done()
1783 sense_valid = scsi_command_normalize_sense(SCpnt, &sshdr); in sd_done()
1796 good_bytes = sd_completed_bytes(SCpnt); in sd_done()
1799 good_bytes = scsi_bufflen(SCpnt); in sd_done()
1806 SCpnt->result = 0; in sd_done()
1807 memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in sd_done()
1811 good_bytes = sd_completed_bytes(SCpnt); in sd_done()
1815 good_bytes = sd_completed_bytes(SCpnt); in sd_done()
1841 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt, in sd_done()
1843 good_bytes, scsi_bufflen(SCpnt))); in sd_done()
1845 if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt)) in sd_done()
1846 sd_dif_complete(SCpnt, good_bytes); in sd_done()