Lines Matching refs:qc
62 typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc);
756 struct ata_queued_cmd *qc; in ata_scsi_qc_new() local
758 qc = ata_qc_new_init(dev, cmd->request->tag); in ata_scsi_qc_new()
759 if (qc) { in ata_scsi_qc_new()
760 qc->scsicmd = cmd; in ata_scsi_qc_new()
761 qc->scsidone = cmd->scsi_done; in ata_scsi_qc_new()
763 qc->sg = scsi_sglist(cmd); in ata_scsi_qc_new()
764 qc->n_elem = scsi_sg_count(cmd); in ata_scsi_qc_new()
770 return qc; in ata_scsi_qc_new()
773 static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc) in ata_qc_set_pc_nbytes() argument
775 struct scsi_cmnd *scmd = qc->scsicmd; in ata_qc_set_pc_nbytes()
777 qc->extrabytes = scmd->request->extra_len; in ata_qc_set_pc_nbytes()
778 qc->nbytes = scsi_bufflen(scmd) + qc->extrabytes; in ata_qc_set_pc_nbytes()
976 static void ata_gen_passthru_sense(struct ata_queued_cmd *qc) in ata_gen_passthru_sense() argument
978 struct scsi_cmnd *cmd = qc->scsicmd; in ata_gen_passthru_sense()
979 struct ata_taskfile *tf = &qc->result_tf; in ata_gen_passthru_sense()
982 int verbose = qc->ap->ops->error_handler == NULL; in ata_gen_passthru_sense()
992 if (qc->err_mask || in ata_gen_passthru_sense()
994 ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature, in ata_gen_passthru_sense()
1049 static void ata_gen_ata_sense(struct ata_queued_cmd *qc) in ata_gen_ata_sense() argument
1051 struct ata_device *dev = qc->dev; in ata_gen_ata_sense()
1052 struct scsi_cmnd *cmd = qc->scsicmd; in ata_gen_ata_sense()
1053 struct ata_taskfile *tf = &qc->result_tf; in ata_gen_ata_sense()
1056 int verbose = qc->ap->ops->error_handler == NULL; in ata_gen_ata_sense()
1069 if (qc->err_mask || in ata_gen_ata_sense()
1071 ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature, in ata_gen_ata_sense()
1076 block = ata_tf_read_block(&qc->result_tf, dev); in ata_gen_ata_sense()
1341 static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) in ata_scsi_start_stop_xlat() argument
1343 struct scsi_cmnd *scmd = qc->scsicmd; in ata_scsi_start_stop_xlat()
1344 struct ata_taskfile *tf = &qc->tf; in ata_scsi_start_stop_xlat()
1363 if (qc->dev->flags & ATA_DFLAG_LBA) { in ata_scsi_start_stop_xlat()
1382 if ((qc->ap->flags & ATA_FLAG_NO_POWEROFF_SPINDOWN) && in ata_scsi_start_stop_xlat()
1386 if ((qc->ap->flags & ATA_FLAG_NO_HIBERNATE_SPINDOWN) && in ata_scsi_start_stop_xlat()
1426 static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc) in ata_scsi_flush_xlat() argument
1428 struct ata_taskfile *tf = &qc->tf; in ata_scsi_flush_xlat()
1433 if (qc->dev->flags & ATA_DFLAG_FLUSH_EXT) in ata_scsi_flush_xlat()
1439 qc->flags |= ATA_QCFLAG_IO; in ata_scsi_flush_xlat()
1547 static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc) in ata_scsi_verify_xlat() argument
1549 struct scsi_cmnd *scmd = qc->scsicmd; in ata_scsi_verify_xlat()
1550 struct ata_taskfile *tf = &qc->tf; in ata_scsi_verify_xlat()
1551 struct ata_device *dev = qc->dev; in ata_scsi_verify_xlat()
1552 u64 dev_sectors = qc->dev->n_sectors; in ata_scsi_verify_xlat()
1675 static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) in ata_scsi_rw_xlat() argument
1677 struct scsi_cmnd *scmd = qc->scsicmd; in ata_scsi_rw_xlat()
1733 qc->flags |= ATA_QCFLAG_IO; in ata_scsi_rw_xlat()
1734 qc->nbytes = n_block * scmd->device->sector_size; in ata_scsi_rw_xlat()
1736 rc = ata_build_rw_tf(&qc->tf, qc->dev, block, n_block, tf_flags, in ata_scsi_rw_xlat()
1737 qc->tag); in ata_scsi_rw_xlat()
1759 static void ata_qc_done(struct ata_queued_cmd *qc) in ata_qc_done() argument
1761 struct scsi_cmnd *cmd = qc->scsicmd; in ata_qc_done()
1762 void (*done)(struct scsi_cmnd *) = qc->scsidone; in ata_qc_done()
1764 ata_qc_free(qc); in ata_qc_done()
1768 static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) in ata_scsi_qc_complete() argument
1770 struct ata_port *ap = qc->ap; in ata_scsi_qc_complete()
1771 struct scsi_cmnd *cmd = qc->scsicmd; in ata_scsi_qc_complete()
1773 int need_sense = (qc->err_mask != 0); in ata_scsi_qc_complete()
1786 ata_gen_passthru_sense(qc); in ata_scsi_qc_complete()
1788 ata_gen_ata_sense(qc); in ata_scsi_qc_complete()
1793 ata_dump_status(ap->print_id, &qc->result_tf); in ata_scsi_qc_complete()
1795 ata_qc_done(qc); in ata_scsi_qc_complete()
1828 struct ata_queued_cmd *qc; in ata_scsi_translate() local
1833 qc = ata_scsi_qc_new(dev, cmd); in ata_scsi_translate()
1834 if (!qc) in ata_scsi_translate()
1845 ata_sg_init(qc, scsi_sglist(cmd), scsi_sg_count(cmd)); in ata_scsi_translate()
1847 qc->dma_dir = cmd->sc_data_direction; in ata_scsi_translate()
1850 qc->complete_fn = ata_scsi_qc_complete; in ata_scsi_translate()
1852 if (xlat_func(qc)) in ata_scsi_translate()
1856 if ((rc = ap->ops->qc_defer(qc))) in ata_scsi_translate()
1861 ata_qc_issue(qc); in ata_scsi_translate()
1867 ata_qc_free(qc); in ata_scsi_translate()
1873 ata_qc_free(qc); in ata_scsi_translate()
1881 ata_qc_free(qc); in ata_scsi_translate()
2586 static void atapi_sense_complete(struct ata_queued_cmd *qc) in atapi_sense_complete() argument
2588 if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) { in atapi_sense_complete()
2594 ata_gen_passthru_sense(qc); in atapi_sense_complete()
2597 ata_qc_done(qc); in atapi_sense_complete()
2606 static void atapi_request_sense(struct ata_queued_cmd *qc) in atapi_request_sense() argument
2608 struct ata_port *ap = qc->ap; in atapi_request_sense()
2609 struct scsi_cmnd *cmd = qc->scsicmd; in atapi_request_sense()
2617 ap->ops->sff_tf_read(ap, &qc->tf); in atapi_request_sense()
2622 cmd->sense_buffer[2] = qc->tf.feature >> 4; in atapi_request_sense()
2624 ata_qc_reinit(qc); in atapi_request_sense()
2627 sg_init_one(&qc->sgent, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); in atapi_request_sense()
2628 ata_sg_init(qc, &qc->sgent, 1); in atapi_request_sense()
2629 qc->dma_dir = DMA_FROM_DEVICE; in atapi_request_sense()
2631 memset(&qc->cdb, 0, qc->dev->cdb_len); in atapi_request_sense()
2632 qc->cdb[0] = REQUEST_SENSE; in atapi_request_sense()
2633 qc->cdb[4] = SCSI_SENSE_BUFFERSIZE; in atapi_request_sense()
2635 qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; in atapi_request_sense()
2636 qc->tf.command = ATA_CMD_PACKET; in atapi_request_sense()
2639 qc->tf.protocol = ATAPI_PROT_DMA; in atapi_request_sense()
2640 qc->tf.feature |= ATAPI_PKT_DMA; in atapi_request_sense()
2642 qc->tf.protocol = ATAPI_PROT_PIO; in atapi_request_sense()
2643 qc->tf.lbam = SCSI_SENSE_BUFFERSIZE; in atapi_request_sense()
2644 qc->tf.lbah = 0; in atapi_request_sense()
2646 qc->nbytes = SCSI_SENSE_BUFFERSIZE; in atapi_request_sense()
2648 qc->complete_fn = atapi_sense_complete; in atapi_request_sense()
2650 ata_qc_issue(qc); in atapi_request_sense()
2655 static void atapi_qc_complete(struct ata_queued_cmd *qc) in atapi_qc_complete() argument
2657 struct scsi_cmnd *cmd = qc->scsicmd; in atapi_qc_complete()
2658 unsigned int err_mask = qc->err_mask; in atapi_qc_complete()
2663 if (unlikely(qc->ap->ops->error_handler && in atapi_qc_complete()
2664 (err_mask || qc->flags & ATA_QCFLAG_SENSE_VALID))) { in atapi_qc_complete()
2666 if (!(qc->flags & ATA_QCFLAG_SENSE_VALID)) { in atapi_qc_complete()
2672 ata_gen_passthru_sense(qc); in atapi_qc_complete()
2688 if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev) in atapi_qc_complete()
2689 qc->dev->sdev->locked = 0; in atapi_qc_complete()
2691 qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; in atapi_qc_complete()
2692 ata_qc_done(qc); in atapi_qc_complete()
2699 atapi_request_sense(qc); in atapi_qc_complete()
2707 ata_gen_passthru_sense(qc); in atapi_qc_complete()
2736 ata_qc_done(qc); in atapi_qc_complete()
2748 static unsigned int atapi_xlat(struct ata_queued_cmd *qc) in atapi_xlat() argument
2750 struct scsi_cmnd *scmd = qc->scsicmd; in atapi_xlat()
2751 struct ata_device *dev = qc->dev; in atapi_xlat()
2756 memset(qc->cdb, 0, dev->cdb_len); in atapi_xlat()
2757 memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len); in atapi_xlat()
2759 qc->complete_fn = atapi_qc_complete; in atapi_xlat()
2761 qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; in atapi_xlat()
2763 qc->tf.flags |= ATA_TFLAG_WRITE; in atapi_xlat()
2767 qc->tf.command = ATA_CMD_PACKET; in atapi_xlat()
2768 ata_qc_set_pc_nbytes(qc); in atapi_xlat()
2771 if (!nodata && !using_pio && atapi_check_dma(qc)) in atapi_xlat()
2779 nbytes = min(ata_qc_raw_nbytes(qc), (unsigned int)63 * 1024); in atapi_xlat()
2808 qc->tf.lbam = (nbytes & 0xFF); in atapi_xlat()
2809 qc->tf.lbah = (nbytes >> 8); in atapi_xlat()
2812 qc->tf.protocol = ATAPI_PROT_NODATA; in atapi_xlat()
2814 qc->tf.protocol = ATAPI_PROT_PIO; in atapi_xlat()
2817 qc->tf.protocol = ATAPI_PROT_DMA; in atapi_xlat()
2818 qc->tf.feature |= ATAPI_PKT_DMA; in atapi_xlat()
2823 qc->tf.feature |= ATAPI_DMADIR; in atapi_xlat()
2939 static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) in ata_scsi_pass_thru() argument
2941 struct ata_taskfile *tf = &(qc->tf); in ata_scsi_pass_thru()
2942 struct scsi_cmnd *scmd = qc->scsicmd; in ata_scsi_pass_thru()
2943 struct ata_device *dev = qc->dev; in ata_scsi_pass_thru()
2999 tf->nsect = qc->tag << 3; in ata_scsi_pass_thru()
3013 qc->sect_size = scsi_bufflen(scmd); in ata_scsi_pass_thru()
3047 qc->sect_size = scmd->device->sector_size; in ata_scsi_pass_thru()
3052 qc->sect_size = ATA_SECT_SIZE; in ata_scsi_pass_thru()
3064 qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET; in ata_scsi_pass_thru()
3072 ata_qc_set_pc_nbytes(qc); in ata_scsi_pass_thru()
3130 static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc) in ata_scsi_write_same_xlat() argument
3132 struct ata_taskfile *tf = &qc->tf; in ata_scsi_write_same_xlat()
3133 struct scsi_cmnd *scmd = qc->scsicmd; in ata_scsi_write_same_xlat()
3134 struct ata_device *dev = qc->dev; in ata_scsi_write_same_xlat()
3168 tf->nsect = qc->tag << 3; in ata_scsi_write_same_xlat()
3185 ata_qc_set_pc_nbytes(qc); in ata_scsi_write_same_xlat()
3206 static int ata_mselect_caching(struct ata_queued_cmd *qc, in ata_mselect_caching() argument
3209 struct ata_taskfile *tf = &qc->tf; in ata_mselect_caching()
3210 struct ata_device *dev = qc->dev; in ata_mselect_caching()
3252 static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc) in ata_scsi_mode_select_xlat() argument
3254 struct scsi_cmnd *scmd = qc->scsicmd; in ata_scsi_mode_select_xlat()
3340 if (ata_mselect_caching(qc, p, pg_len) < 0) in ata_scsi_mode_select_xlat()