Lines Matching refs:cmd

85 #define DEBUG_TARGET(cmd)	((cmd) && ALLOW_DEBUG((cmd)->device->id))  argument
189 static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd);
396 static void mesh_start_cmd(struct mesh_state *ms, struct scsi_cmnd *cmd) in mesh_start_cmd() argument
401 id = cmd->device->id; in mesh_start_cmd()
402 ms->current_req = cmd; in mesh_start_cmd()
403 ms->tgts[id].data_goes_out = cmd->sc_data_direction == DMA_TO_DEVICE; in mesh_start_cmd()
404 ms->tgts[id].current_req = cmd; in mesh_start_cmd()
407 if (DEBUG_TARGET(cmd)) { in mesh_start_cmd()
409 printk(KERN_DEBUG "mesh_start: %p tgt=%d cmd=", cmd, id); in mesh_start_cmd()
410 for (i = 0; i < cmd->cmd_len; ++i) in mesh_start_cmd()
411 printk(" %x", cmd->cmnd[i]); in mesh_start_cmd()
413 scsi_sg_count(cmd), scsi_sglist(cmd), scsi_bufflen(cmd)); in mesh_start_cmd()
432 dlog(ms, "start cmd=%x", (int) cmd); in mesh_start_cmd()
551 struct scsi_cmnd *cmd, *prev, *next; in mesh_start() local
561 for (cmd = ms->request_q; ; cmd = (struct scsi_cmnd *) cmd->host_scribble) { in mesh_start()
562 if (cmd == NULL) in mesh_start()
564 if (ms->tgts[cmd->device->id].current_req == NULL) in mesh_start()
566 prev = cmd; in mesh_start()
568 next = (struct scsi_cmnd *) cmd->host_scribble; in mesh_start()
576 mesh_start_cmd(ms, cmd); in mesh_start()
582 struct scsi_cmnd *cmd; in mesh_done() local
585 cmd = ms->current_req; in mesh_done()
588 if (cmd) { in mesh_done()
589 struct mesh_cmd_priv *mcmd = mesh_priv(cmd); in mesh_done()
591 set_host_byte(cmd, ms->stat); in mesh_done()
592 set_status_byte(cmd, mcmd->status); in mesh_done()
594 scsi_msg_to_host_byte(cmd, mcmd->message); in mesh_done()
595 if (DEBUG_TARGET(cmd)) { in mesh_done()
597 cmd->result, ms->data_ptr, scsi_bufflen(cmd)); in mesh_done()
600 if ((cmd->cmnd[0] == 0 || cmd->cmnd[0] == 0x12 || cmd->cmnd[0] == 3) in mesh_done()
601 && cmd->request_buffer != 0) { in mesh_done()
602 unsigned char *b = cmd->request_buffer; in mesh_done()
609 scsi_done(cmd); in mesh_done()
678 struct scsi_cmnd *cmd = ms->current_req; in start_phase() local
765 if (cmd) { in start_phase()
766 out_8(&mr->count_lo, cmd->cmd_len); in start_phase()
768 for (i = 0; i < cmd->cmd_len; ++i) in start_phase()
769 out_8(&mr->fifo, cmd->cmnd[i]); in start_phase()
780 set_dma_cmds(ms, cmd); in start_phase()
853 struct scsi_cmnd *cmd; in reselected() local
861 if ((cmd = ms->current_req) != NULL) { in reselected()
863 cmd->host_scribble = (void *) ms->request_q; in reselected()
865 ms->request_qtail = cmd; in reselected()
866 ms->request_q = cmd; in reselected()
867 tp = &ms->tgts[cmd->device->id]; in reselected()
984 struct scsi_cmnd *cmd; in handle_reset() local
989 if ((cmd = tp->current_req) != NULL) { in handle_reset()
990 set_host_byte(cmd, DID_RESET); in handle_reset()
992 scsi_done(cmd); in handle_reset()
998 while ((cmd = ms->request_q) != NULL) { in handle_reset()
999 ms->request_q = (struct scsi_cmnd *) cmd->host_scribble; in handle_reset()
1000 set_host_byte(cmd, DID_RESET); in handle_reset()
1001 scsi_done(cmd); in handle_reset()
1156 struct scsi_cmnd *cmd = ms->current_req; in handle_msgin() local
1175 if (cmd) in handle_msgin()
1176 mesh_priv(cmd)->message = code; in handle_msgin()
1225 if (cmd == NULL) { in handle_msgin()
1228 } else if (code != cmd->device->lun + IDENTIFY_BASE) { in handle_msgin()
1232 cmd->device->lun, ms->conn_tgt); in handle_msgin()
1254 static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd) in set_dma_cmds() argument
1264 if (cmd) { in set_dma_cmds()
1267 mesh_priv(cmd)->this_residual = scsi_bufflen(cmd); in set_dma_cmds()
1269 nseg = scsi_dma_map(cmd); in set_dma_cmds()
1276 scsi_for_each_sg(cmd, scl, nseg, i) { in set_dma_cmds()
1319 struct scsi_cmnd *cmd = ms->current_req; in halt_dma() local
1349 } else if (cmd && scsi_bufflen(cmd) && in halt_dma()
1350 ms->data_ptr > scsi_bufflen(cmd)) { in halt_dma()
1353 ms->conn_tgt, ms->data_ptr, scsi_bufflen(cmd), in halt_dma()
1356 if (cmd) in halt_dma()
1357 scsi_dma_unmap(cmd); in halt_dma()
1443 struct scsi_cmnd *cmd = ms->current_req; in cmd_complete() local
1545 (cmd? cmd->device->lun: 0)); in cmd_complete()
1596 if (cmd) { in cmd_complete()
1597 struct mesh_cmd_priv *mcmd = mesh_priv(cmd); in cmd_complete()
1600 if (DEBUG_TARGET(cmd)) in cmd_complete()
1628 static int mesh_queue_lck(struct scsi_cmnd *cmd) in mesh_queue_lck() argument
1632 cmd->host_scribble = NULL; in mesh_queue_lck()
1634 ms = (struct mesh_state *) cmd->device->host->hostdata; in mesh_queue_lck()
1637 ms->request_q = cmd; in mesh_queue_lck()
1639 ms->request_qtail->host_scribble = (void *) cmd; in mesh_queue_lck()
1640 ms->request_qtail = cmd; in mesh_queue_lck()
1685 static int mesh_abort(struct scsi_cmnd *cmd) in mesh_abort() argument
1687 struct mesh_state *ms = (struct mesh_state *) cmd->device->host->hostdata; in mesh_abort()
1689 printk(KERN_DEBUG "mesh_abort(%p)\n", cmd); in mesh_abort()
1691 dumplog(ms, cmd->device->id); in mesh_abort()
1702 static int mesh_host_reset(struct scsi_cmnd *cmd) in mesh_host_reset() argument
1704 struct mesh_state *ms = (struct mesh_state *) cmd->device->host->hostdata; in mesh_host_reset()