Lines Matching defs:cmd
191 void ata_scsi_set_sense(struct ata_device *dev, struct scsi_cmnd *cmd,
196 if (!cmd)
199 cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
201 scsi_build_sense_buffer(d_sense, cmd->sense_buffer, sk, asc, ascq);
205 struct scsi_cmnd *cmd,
210 if (!cmd)
217 scsi_set_sense_information(cmd->sense_buffer,
222 struct scsi_cmnd *cmd, u16 field, u8 bit)
224 ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x24, 0x0);
226 scsi_set_sense_field_pointer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
231 struct scsi_cmnd *cmd, u16 field)
234 ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x26, 0x0);
235 scsi_set_sense_field_pointer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
543 unsigned int cmd, void __user *arg)
549 switch (cmd) {
598 int ata_scsi_ioctl(struct scsi_device *scsidev, unsigned int cmd,
602 scsidev, cmd, arg);
609 * @cmd: SCSI command that originated this ATA command
626 struct scsi_cmnd *cmd)
630 qc = ata_qc_new_init(dev, cmd->request->tag);
632 qc->scsicmd = cmd;
633 qc->scsidone = cmd->scsi_done;
635 qc->sg = scsi_sglist(cmd);
636 qc->n_elem = scsi_sg_count(cmd);
638 if (cmd->request->rq_flags & RQF_QUIET)
641 cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1);
642 cmd->scsi_done(cmd);
852 struct scsi_cmnd *cmd = qc->scsicmd;
854 unsigned char *sb = cmd->sense_buffer;
861 cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
871 ata_scsi_set_sense(qc->dev, cmd, sense_key, asc, ascq);
877 scsi_build_sense_buffer(1, cmd->sense_buffer,
881 if ((cmd->sense_buffer[0] & 0x7f) >= 0x72) {
951 struct scsi_cmnd *cmd = qc->scsicmd;
953 unsigned char *sb = cmd->sense_buffer;
960 cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
965 ata_scsi_set_sense(dev, cmd, NOT_READY, 0x04, 0x21);
975 ata_scsi_set_sense(dev, cmd, sense_key, asc, ascq);
980 ata_scsi_set_sense(dev, cmd, ABORTED_COMMAND, 0, 0);
1022 return atapi_cmd_type(scsi_req(rq)->cmd[0]) == ATAPI_MISC;
1634 struct scsi_cmnd *cmd = qc->scsicmd;
1638 done(cmd);
1644 struct scsi_cmnd *cmd = qc->scsicmd;
1645 u8 *cdb = cmd->cmnd;
1661 cmd->result = SAM_STAT_CHECK_CONDITION;
1665 cmd->result = SAM_STAT_GOOD;
1676 * @cmd: SCSI command to execute
1677 * @xlat_func: Actor which translates @cmd to an ATA taskfile
1688 * then cmd->result (and possibly cmd->sense_buffer) are assumed
1699 static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
1708 qc = ata_scsi_qc_new(dev, cmd);
1713 if (cmd->sc_data_direction == DMA_FROM_DEVICE ||
1714 cmd->sc_data_direction == DMA_TO_DEVICE) {
1715 if (unlikely(scsi_bufflen(cmd) < 1)) {
1720 ata_sg_init(qc, scsi_sglist(cmd), scsi_sg_count(cmd));
1722 qc->dma_dir = cmd->sc_data_direction;
1743 cmd->scsi_done(cmd);
1749 cmd->result = (DID_ERROR << 16);
1750 cmd->scsi_done(cmd);
1767 struct scsi_cmnd *cmd;
1772 * @cmd: SCSI command containing buffer to be mapped.
1784 static void *ata_scsi_rbuf_get(struct scsi_cmnd *cmd, bool copy_in,
1791 sg_copy_to_buffer(scsi_sglist(cmd), scsi_sg_count(cmd),
1798 * @cmd: SCSI command containing buffer to be unmapped.
1802 * Returns rbuf buffer. The result is copied to @cmd's buffer if
1808 static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, bool copy_out,
1812 sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd),
1826 * completed successfully (0), or not (in which case cmd->result
1837 struct scsi_cmnd *cmd = args->cmd;
1840 rbuf = ata_scsi_rbuf_get(cmd, false, &flags);
1842 ata_scsi_rbuf_put(cmd, rc == 0, &flags);
1845 cmd->result = SAM_STAT_GOOD;
1851 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
1933 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
1965 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
1990 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
2049 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
2285 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
2297 u8 *scsicmd = args->cmd->cmnd, *p = rbuf;
2396 ata_scsi_set_invalid_field(dev, args->cmd, fp, bp);
2400 ata_scsi_set_sense(dev, args->cmd, ILLEGAL_REQUEST, 0x39, 0x0);
2408 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
2429 if (args->cmd->cmnd[0] == READ_CAPACITY) {
2486 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
2524 struct scsi_cmnd *cmd = qc->scsicmd;
2528 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
2536 cmd->sense_buffer[0] = 0x70;
2537 cmd->sense_buffer[2] = qc->tf.feature >> 4;
2542 sg_init_one(&qc->sgent, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE);
2578 static void atapi_fixup_inquiry(struct scsi_cmnd *cmd)
2582 sg_copy_to_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), buf, 4);
2587 sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), buf, 4);
2592 struct scsi_cmnd *cmd = qc->scsicmd;
2633 cmd->result = SAM_STAT_CHECK_CONDITION;
2644 if (cmd->cmnd[0] == INQUIRY && (cmd->cmnd[1] & 0x03) == 0)
2645 atapi_fixup_inquiry(cmd);
2646 cmd->result = SAM_STAT_GOOD;
2881 /* 7Fh variable length cmd means a ata pass-thru(32) */
3127 * @cmd: SCSI command being translated
3146 static size_t ata_format_dsm_trim_descr(struct scsi_cmnd *cmd, u32 trmax,
3149 struct scsi_device *sdp = cmd->device;
3173 r = sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), buf, len);
3231 /* If the request is too large the cmd is invalid */
3296 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
3306 u8 *cdb = args->cmd->cmnd;
3966 * @cmd: SCSI command opcode to consider
3975 static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
3977 switch (cmd) {
4034 * @cmd: SCSI command to dump
4039 void ata_scsi_dump_cdb(struct ata_port *ap, struct scsi_cmnd *cmd)
4042 struct scsi_device *scsidev = cmd->device;
4047 cmd->cmnd);
4110 * @cmd: SCSI command to be sent
4123 * Return value from __ata_scsi_queuecmd() if @cmd can be queued,
4126 int ata_scsi_queuecmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
4130 struct scsi_device *scsidev = cmd->device;
4138 ata_scsi_dump_cdb(ap, cmd);
4142 rc = __ata_scsi_queuecmd(cmd, dev);
4144 cmd->result = (DID_BAD_TARGET << 16);
4145 cmd->scsi_done(cmd);
4157 * @cmd: SCSI command being sent to device.
4166 void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
4169 const u8 *scsicmd = cmd->cmnd;
4174 args.cmd = cmd;
4179 ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
4211 ata_scsi_set_invalid_field(dev, cmd, 2, 0xff);
4229 ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
4237 ata_scsi_set_sense(dev, cmd, 0, 0, 0);
4238 cmd->result = (DRIVER_SENSE << 24);
4258 ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
4265 ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
4270 ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0);
4275 cmd->scsi_done(cmd);