Lines Matching refs:SCpnt

112 static int sd_init_command(struct scsi_cmnd *SCpnt);
113 static void sd_uninit_command(struct scsi_cmnd *SCpnt);
902 static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt)
904 struct request *rq = SCpnt->request;
905 struct scsi_device *sdp = SCpnt->device;
915 ret = scsi_init_io(SCpnt, GFP_ATOMIC);
918 SCpnt = rq->special;
926 scmd_printk(KERN_INFO, SCpnt,
932 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
935 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
936 "Retry with 0x%p\n", SCpnt));
966 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "block=%llu\n",
982 scmd_printk(KERN_ERR, SCpnt,
992 scmd_printk(KERN_ERR, SCpnt,
1002 scmd_printk(KERN_ERR, SCpnt,
1011 SCpnt->cmnd[0] = WRITE_6;
1014 sd_dif_prepare(SCpnt);
1017 SCpnt->cmnd[0] = READ_6;
1019 scmd_printk(KERN_ERR, SCpnt, "Unknown command %llx\n", (unsigned long long) rq->cmd_flags);
1023 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
1029 dix = scsi_prot_sg_count(SCpnt);
1030 dif = scsi_host_dif_capable(SCpnt->device->host, sdkp->protection_type);
1033 protect = sd_setup_protect_cmnd(SCpnt, dix, dif);
1038 SCpnt->cmnd = mempool_alloc(sd_cdb_pool, GFP_ATOMIC);
1040 if (unlikely(SCpnt->cmnd == NULL)) {
1045 SCpnt->cmd_len = SD_EXT_CDB_SIZE;
1046 memset(SCpnt->cmnd, 0, SCpnt->cmd_len);
1047 SCpnt->cmnd[0] = VARIABLE_LENGTH_CMD;
1048 SCpnt->cmnd[7] = 0x18;
1049 SCpnt->cmnd[9] = (rq_data_dir(rq) == READ) ? READ_32 : WRITE_32;
1050 SCpnt->cmnd[10] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0);
1053 SCpnt->cmnd[12] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0;
1054 SCpnt->cmnd[13] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0;
1055 SCpnt->cmnd[14] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0;
1056 SCpnt->cmnd[15] = sizeof(block) > 4 ? (unsigned char) (block >> 32) & 0xff : 0;
1057 SCpnt->cmnd[16] = (unsigned char) (block >> 24) & 0xff;
1058 SCpnt->cmnd[17] = (unsigned char) (block >> 16) & 0xff;
1059 SCpnt->cmnd[18] = (unsigned char) (block >> 8) & 0xff;
1060 SCpnt->cmnd[19] = (unsigned char) block & 0xff;
1063 SCpnt->cmnd[20] = (unsigned char) (block >> 24) & 0xff;
1064 SCpnt->cmnd[21] = (unsigned char) (block >> 16) & 0xff;
1065 SCpnt->cmnd[22] = (unsigned char) (block >> 8) & 0xff;
1066 SCpnt->cmnd[23] = (unsigned char) block & 0xff;
1069 SCpnt->cmnd[28] = (unsigned char) (this_count >> 24) & 0xff;
1070 SCpnt->cmnd[29] = (unsigned char) (this_count >> 16) & 0xff;
1071 SCpnt->cmnd[30] = (unsigned char) (this_count >> 8) & 0xff;
1072 SCpnt->cmnd[31] = (unsigned char) this_count & 0xff;
1074 SCpnt->cmnd[0] += READ_16 - READ_6;
1075 SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0);
1076 SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0;
1077 SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0;
1078 SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0;
1079 SCpnt->cmnd[5] = sizeof(block) > 4 ? (unsigned char) (block >> 32) & 0xff : 0;
1080 SCpnt->cmnd[6] = (unsigned char) (block >> 24) & 0xff;
1081 SCpnt->cmnd[7] = (unsigned char) (block >> 16) & 0xff;
1082 SCpnt->cmnd[8] = (unsigned char) (block >> 8) & 0xff;
1083 SCpnt->cmnd[9] = (unsigned char) block & 0xff;
1084 SCpnt->cmnd[10] = (unsigned char) (this_count >> 24) & 0xff;
1085 SCpnt->cmnd[11] = (unsigned char) (this_count >> 16) & 0xff;
1086 SCpnt->cmnd[12] = (unsigned char) (this_count >> 8) & 0xff;
1087 SCpnt->cmnd[13] = (unsigned char) this_count & 0xff;
1088 SCpnt->cmnd[14] = SCpnt->cmnd[15] = 0;
1090 scsi_device_protection(SCpnt->device) ||
1091 SCpnt->device->use_10_for_rw) {
1092 SCpnt->cmnd[0] += READ_10 - READ_6;
1093 SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0);
1094 SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff;
1095 SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff;
1096 SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff;
1097 SCpnt->cmnd[5] = (unsigned char) block & 0xff;
1098 SCpnt->cmnd[6] = SCpnt->cmnd[9] = 0;
1099 SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff;
1100 SCpnt->cmnd[8] = (unsigned char) this_count & 0xff;
1109 scmd_printk(KERN_ERR, SCpnt,
1114 SCpnt->cmnd[1] |= (unsigned char) ((block >> 16) & 0x1f);
1115 SCpnt->cmnd[2] = (unsigned char) ((block >> 8) & 0xff);
1116 SCpnt->cmnd[3] = (unsigned char) block & 0xff;
1117 SCpnt->cmnd[4] = (unsigned char) this_count;
1118 SCpnt->cmnd[5] = 0;
1120 SCpnt->sdb.length = this_count * sdp->sector_size;
1127 SCpnt->transfersize = sdp->sector_size;
1128 SCpnt->underflow = this_count << 9;
1129 SCpnt->allowed = SD_MAX_RETRIES;
1154 static void sd_uninit_command(struct scsi_cmnd *SCpnt)
1156 struct request *rq = SCpnt->request;
1161 if (SCpnt->cmnd != rq->cmd) {
1162 mempool_free(SCpnt->cmnd, sd_cdb_pool);
1163 SCpnt->cmnd = NULL;
1164 SCpnt->cmd_len = 0;
1685 * @SCpnt: mid-level's per command structure.
1689 static int sd_done(struct scsi_cmnd *SCpnt)
1691 int result = SCpnt->result;
1692 unsigned int good_bytes = result ? 0 : scsi_bufflen(SCpnt);
1694 struct scsi_disk *sdkp = scsi_disk(SCpnt->request->rq_disk);
1695 struct request *req = SCpnt->request;
1698 unsigned char op = SCpnt->cmnd[0];
1699 unsigned char unmap = SCpnt->cmnd[1] & 8;
1704 scsi_set_resid(SCpnt, 0);
1707 scsi_set_resid(SCpnt, blk_rq_bytes(req));
1712 sense_valid = scsi_command_normalize_sense(SCpnt, &sshdr);
1717 SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt));
1719 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
1736 good_bytes = sd_completed_bytes(SCpnt);
1739 good_bytes = scsi_bufflen(SCpnt);
1746 scsi_print_sense("sd", SCpnt);
1747 SCpnt->result = 0;
1748 memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
1752 good_bytes = sd_completed_bytes(SCpnt);
1756 good_bytes = sd_completed_bytes(SCpnt);
1782 if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt))
1783 sd_dif_complete(SCpnt, good_bytes);