Lines Matching refs:cmd
145 static inline void initialize_SCp(struct scsi_cmnd *cmd) in initialize_SCp() argument
147 struct NCR5380_cmd *ncmd = NCR5380_to_ncmd(cmd); in initialize_SCp()
149 if (scsi_bufflen(cmd)) { in initialize_SCp()
150 ncmd->buffer = scsi_sglist(cmd); in initialize_SCp()
174 static inline void set_resid_from_SCp(struct scsi_cmnd *cmd) in set_resid_from_SCp() argument
176 struct NCR5380_cmd *ncmd = NCR5380_to_ncmd(cmd); in set_resid_from_SCp()
185 scsi_set_resid(cmd, resid); in set_resid_from_SCp()
530 struct scsi_cmnd *cmd) in complete_cmd() argument
534 dsprintk(NDEBUG_QUEUES, instance, "complete_cmd: cmd %p\n", cmd); in complete_cmd()
536 if (hostdata->sensing == cmd) { in complete_cmd()
538 if (get_status_byte(cmd) != SAM_STAT_GOOD) { in complete_cmd()
539 scsi_eh_restore_cmnd(cmd, &hostdata->ses); in complete_cmd()
541 scsi_eh_restore_cmnd(cmd, &hostdata->ses); in complete_cmd()
542 set_status_byte(cmd, SAM_STAT_CHECK_CONDITION); in complete_cmd()
547 scsi_done(cmd); in complete_cmd()
561 struct scsi_cmnd *cmd) in NCR5380_queue_command() argument
564 struct NCR5380_cmd *ncmd = NCR5380_to_ncmd(cmd); in NCR5380_queue_command()
568 switch (cmd->cmnd[0]) { in NCR5380_queue_command()
572 cmd->result = (DID_ERROR << 16); in NCR5380_queue_command()
573 scsi_done(cmd); in NCR5380_queue_command()
578 cmd->result = 0; in NCR5380_queue_command()
595 if (cmd->cmnd[0] == REQUEST_SENSE) in NCR5380_queue_command()
603 cmd, (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail"); in NCR5380_queue_command()
639 struct scsi_cmnd *cmd; in dequeue_next_cmd() local
643 cmd = NCR5380_to_scmd(ncmd); in dequeue_next_cmd()
645 cmd, scmd_id(cmd), hostdata->busy[scmd_id(cmd)], cmd->device->lun); in dequeue_next_cmd()
647 if (!(hostdata->busy[scmd_id(cmd)] & (1 << cmd->device->lun))) { in dequeue_next_cmd()
650 "dequeue: removed %p from issue queue\n", cmd); in dequeue_next_cmd()
651 return cmd; in dequeue_next_cmd()
659 cmd = NCR5380_to_scmd(ncmd); in dequeue_next_cmd()
661 "dequeue: removed %p from autosense queue\n", cmd); in dequeue_next_cmd()
662 scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0); in dequeue_next_cmd()
663 hostdata->sensing = cmd; in dequeue_next_cmd()
664 return cmd; in dequeue_next_cmd()
669 static void requeue_cmd(struct Scsi_Host *instance, struct scsi_cmnd *cmd) in requeue_cmd() argument
672 struct NCR5380_cmd *ncmd = NCR5380_to_ncmd(cmd); in requeue_cmd()
674 if (hostdata->sensing == cmd) { in requeue_cmd()
675 scsi_eh_restore_cmnd(cmd, &hostdata->ses); in requeue_cmd()
703 struct scsi_cmnd *cmd = dequeue_next_cmd(instance); in NCR5380_main() local
705 if (!cmd) in NCR5380_main()
708 dsprintk(NDEBUG_MAIN, instance, "main: dequeued %p\n", cmd); in NCR5380_main()
723 if (!NCR5380_select(instance, cmd)) { in NCR5380_main()
727 "main: select failed, returning %p to queue\n", cmd); in NCR5380_main()
728 requeue_cmd(instance, cmd); in NCR5380_main()
965 static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) in NCR5380_select() argument
975 cmd->cmnd[0] != REQUEST_SENSE && in NCR5380_select()
976 (disconnect_mask & BIT(scmd_id(cmd))); in NCR5380_select()
989 hostdata->selecting = cmd; in NCR5380_select()
1080 NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask | (1 << scmd_id(cmd))); in NCR5380_select()
1129 dsprintk(NDEBUG_SELECTION, instance, "selecting target %d\n", scmd_id(cmd)); in NCR5380_select()
1155 cmd->result = DID_BAD_TARGET << 16; in NCR5380_select()
1156 complete_cmd(instance, cmd); in NCR5380_select()
1195 scmd_id(cmd)); in NCR5380_select()
1196 tmp[0] = IDENTIFY(can_disconnect, cmd->device->lun); in NCR5380_select()
1204 cmd->result = DID_ERROR << 16; in NCR5380_select()
1205 complete_cmd(instance, cmd); in NCR5380_select()
1213 hostdata->connected = cmd; in NCR5380_select()
1214 hostdata->busy[cmd->device->id] |= 1 << cmd->device->lun; in NCR5380_select()
1220 initialize_SCp(cmd); in NCR5380_select()
1684 struct scsi_cmnd *cmd; in NCR5380_information_transfer() local
1690 while ((cmd = hostdata->connected)) { in NCR5380_information_transfer()
1691 struct NCR5380_cmd *ncmd = NCR5380_to_ncmd(cmd); in NCR5380_information_transfer()
1703 sun3_dma_setup_done != cmd) { in NCR5380_information_transfer()
1708 count = sun3scsi_dma_xfer_len(hostdata, cmd); in NCR5380_information_transfer()
1711 if (cmd->sc_data_direction == DMA_TO_DEVICE) in NCR5380_information_transfer()
1717 sun3_dma_setup_done = cmd; in NCR5380_information_transfer()
1744 cmd->result = DID_ERROR << 16; in NCR5380_information_transfer()
1745 complete_cmd(instance, cmd); in NCR5380_information_transfer()
1747 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); in NCR5380_information_transfer()
1773 if (!cmd->device->borken) in NCR5380_information_transfer()
1774 transfersize = NCR5380_dma_xfer_len(hostdata, cmd); in NCR5380_information_transfer()
1785 scmd_printk(KERN_INFO, cmd, in NCR5380_information_transfer()
1787 cmd->device->borken = 1; in NCR5380_information_transfer()
1804 if (sun3_dma_setup_done == cmd) in NCR5380_information_transfer()
1819 set_host_byte(cmd, DID_ABORT); in NCR5380_information_transfer()
1827 cmd, scmd_id(cmd), cmd->device->lun); in NCR5380_information_transfer()
1830 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); in NCR5380_information_transfer()
1832 set_status_byte(cmd, ncmd->status); in NCR5380_information_transfer()
1834 set_resid_from_SCp(cmd); in NCR5380_information_transfer()
1836 if (cmd->cmnd[0] == REQUEST_SENSE) in NCR5380_information_transfer()
1837 complete_cmd(instance, cmd); in NCR5380_information_transfer()
1842 cmd); in NCR5380_information_transfer()
1846 complete_cmd(instance, cmd); in NCR5380_information_transfer()
1863 cmd->device->simple_tags = 0; in NCR5380_information_transfer()
1864 hostdata->busy[cmd->device->id] |= (1 << (cmd->device->lun & 0xFF)); in NCR5380_information_transfer()
1877 cmd, scmd_id(cmd), cmd->device->lun); in NCR5380_information_transfer()
1963 scmd_printk(KERN_INFO, cmd, in NCR5380_information_transfer()
1967 scmd_printk(KERN_INFO, cmd, in NCR5380_information_transfer()
1983 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); in NCR5380_information_transfer()
1984 cmd->result = DID_ERROR << 16; in NCR5380_information_transfer()
1985 complete_cmd(instance, cmd); in NCR5380_information_transfer()
1991 len = cmd->cmd_len; in NCR5380_information_transfer()
1992 data = cmd->cmnd; in NCR5380_information_transfer()
2127 struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd); in NCR5380_reselect() local
2129 if (target_mask == (1 << scmd_id(cmd)) && in NCR5380_reselect()
2130 lun == (u8)cmd->device->lun) { in NCR5380_reselect()
2132 tmp = cmd; in NCR5380_reselect()
2248 static int NCR5380_abort(struct scsi_cmnd *cmd) in NCR5380_abort() argument
2250 struct Scsi_Host *instance = cmd->device->host; in NCR5380_abort()
2258 scmd_printk(KERN_INFO, cmd, __func__); in NCR5380_abort()
2263 if (list_del_cmd(&hostdata->unissued, cmd)) { in NCR5380_abort()
2265 "abort: removed %p from issue queue\n", cmd); in NCR5380_abort()
2266 cmd->result = DID_ABORT << 16; in NCR5380_abort()
2267 scsi_done(cmd); /* No tag or busy flag to worry about */ in NCR5380_abort()
2271 if (hostdata->selecting == cmd) { in NCR5380_abort()
2273 "abort: cmd %p == selecting\n", cmd); in NCR5380_abort()
2275 cmd->result = DID_ABORT << 16; in NCR5380_abort()
2276 complete_cmd(instance, cmd); in NCR5380_abort()
2280 if (list_del_cmd(&hostdata->disconnected, cmd)) { in NCR5380_abort()
2282 "abort: removed %p from disconnected list\n", cmd); in NCR5380_abort()
2286 set_host_byte(cmd, DID_ERROR); in NCR5380_abort()
2287 complete_cmd(instance, cmd); in NCR5380_abort()
2292 if (hostdata->connected == cmd) { in NCR5380_abort()
2293 dsprintk(NDEBUG_ABORT, instance, "abort: cmd %p is connected\n", cmd); in NCR5380_abort()
2297 set_host_byte(cmd, DID_ERROR); in NCR5380_abort()
2298 complete_cmd(instance, cmd); in NCR5380_abort()
2302 set_host_byte(cmd, DID_ABORT); in NCR5380_abort()
2303 complete_cmd(instance, cmd); in NCR5380_abort()
2307 if (list_del_cmd(&hostdata->autosense, cmd)) { in NCR5380_abort()
2309 "abort: removed %p from sense queue\n", cmd); in NCR5380_abort()
2310 complete_cmd(instance, cmd); in NCR5380_abort()
2315 dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd); in NCR5380_abort()
2317 hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); in NCR5380_abort()
2318 dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd); in NCR5380_abort()
2352 struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd); in bus_reset_cleanup() local
2354 set_host_byte(cmd, DID_RESET); in bus_reset_cleanup()
2355 complete_cmd(instance, cmd); in bus_reset_cleanup()
2360 struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd); in bus_reset_cleanup() local
2362 scsi_done(cmd); in bus_reset_cleanup()
2386 static int NCR5380_host_reset(struct scsi_cmnd *cmd) in NCR5380_host_reset() argument
2388 struct Scsi_Host *instance = cmd->device->host; in NCR5380_host_reset()