Lines Matching refs:cmd

277  *	@cmd: command block to set up
282 static __inline__ void initialize_SCp(Scsi_Cmnd * cmd)
289 if (scsi_bufflen(cmd)) {
290 cmd->SCp.buffer = scsi_sglist(cmd);
291 cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1;
292 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);
293 cmd->SCp.this_residual = cmd->SCp.buffer->length;
295 cmd->SCp.buffer = NULL;
296 cmd->SCp.buffers_residual = 0;
297 cmd->SCp.ptr = NULL;
298 cmd->SCp.this_residual = 0;
491 * Function : int should_disconnect (unsigned char cmd)
496 * Input : cmd - opcode of SCSI command
512 static int should_disconnect(unsigned char cmd)
514 switch (cmd) {
704 void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m);
706 void lprint_command(unsigned char *cmd, struct seq_file *m);
763 static void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m)
765 SPRINTF("scsi%d : destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
767 lprint_command(cmd->cmnd, m);
928 * @cmd: SCSI command
931 * cmd is added to the per instance issue_queue, with minor
932 * twiddling done to the host specific fields of cmd. If the
938 static int NCR5380_queue_command_lck(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
940 struct Scsi_Host *instance = cmd->device->host;
945 switch (cmd->cmnd[0]) {
949 cmd->result = (DID_ERROR << 16);
950 done(cmd);
956 switch (cmd->cmnd[0]) {
960 hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
961 hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd);
967 hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
968 hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd);
979 cmd->host_scribble = NULL;
980 cmd->scsi_done = done;
981 cmd->result = 0;
984 * Insert the cmd into the issue queue. Note that REQUEST SENSE
990 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
991 LIST(cmd, hostdata->issue_queue);
992 cmd->host_scribble = (unsigned char *) hostdata->issue_queue;
993 hostdata->issue_queue = cmd;
996 LIST(cmd, tmp);
997 tmp->host_scribble = (unsigned char *) cmd;
999 dprintk(NDEBUG_QUEUES, "scsi%d : command added to %s of queue\n", instance->host_no, (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
1189 panic("scsi%d : received end of DMA interrupt with no connected cmd\n", instance->hostno);
1222 * @cmd: command being issued
1227 static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
1230 switch (cmd->cmnd[0]) {
1234 hostdata->time_write[scmd_id(cmd)] += (jiffies - hostdata->timebase);
1240 hostdata->time_read[scmd_id(cmd)] += (jiffies - hostdata->timebase);
1249 * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
1257 * target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for
1272 * instance->connected will be set to cmd.
1275 * If failed (no target) : cmd->scsi_done() will be called, and the
1276 * cmd->result host byte set to DID_BAD_TARGET.
1281 static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
1372 NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << scmd_id(cmd))));
1417 dprintk(NDEBUG_SELECTION, "scsi%d : selecting target %d\n", instance->host_no, scmd_id(cmd));
1433 hostdata->selecting = cmd;
1470 if (hostdata->targets_present & (1 << scmd_id(cmd))) {
1478 cmd->result = DID_BAD_TARGET << 16;
1479 collect_stats(hostdata, cmd);
1480 cmd->scsi_done(cmd);
1486 hostdata->targets_present |= (1 << scmd_id(cmd));
1515 dprintk(NDEBUG_SELECTION, "scsi%d : target %d selected, going into MESSAGE OUT phase.\n", instance->host_no, cmd->device->id);
1516 tmp[0] = IDENTIFY(((instance->irq == SCSI_IRQ_NONE) ? 0 : 1), cmd->device->lun);
1519 cmd->tag = 0;
1527 hostdata->connected = cmd;
1528 hostdata->busy[cmd->device->id] |= (1 << (cmd->device->lun & 0xFF));
1530 initialize_SCp(cmd);
2089 Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected;
2120 cmd->result = DID_ERROR << 16;
2121 cmd->scsi_done(cmd);
2129 if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) {
2130 ++cmd->SCp.buffer;
2131 --cmd->SCp.buffers_residual;
2132 cmd->SCp.this_residual = cmd->SCp.buffer->length;
2133 cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);
2134 dprintk(NDEBUG_INFORMATION, "scsi%d : %d bytes and %d buffers left\n", instance->host_no, cmd->SCp.this_residual, cmd->SCp.buffers_residual);
2155 if (!cmd->device->borken && !(hostdata->flags & FLAG_NO_PSEUDO_DMA) && (transfersize = NCR5380_dma_xfer_len(instance, cmd)) != 0) {
2157 transfersize = cmd->transfersize;
2164 if (!cmd->device->borken && transfersize && !(hostdata->flags & FLAG_NO_PSEUDO_DMA) && cmd->SCp.this_residual && !(cmd->SCp.this_residual % transfersize)) {
2171 if (NCR5380_transfer_dma(instance, &phase, &len, (unsigned char **) &cmd->SCp.ptr)) {
2176 scmd_printk(KERN_INFO, cmd,
2178 cmd->device->borken = 1;
2182 cmd->result = DID_ERROR << 16;
2183 cmd->scsi_done(cmd);
2186 cmd->SCp.this_residual -= transfersize - len;
2189 NCR5380_transfer_pio(instance, &phase, (int *) &cmd->SCp.this_residual, (unsigned char **)
2190 &cmd->SCp.ptr);
2196 cmd->SCp.Message = tmp;
2214 dprintk(NDEBUG_LINKED, "scsi%d : target %d lun %llu linked command complete.\n", instance->host_no, cmd->device->id, cmd->device->lun);
2220 if (!cmd->next_link) {
2221 printk("scsi%d : target %d lun %llu linked command complete, no next_link\n" instance->host_no, cmd->device->id, cmd->device->lun);
2226 initialize_SCp(cmd->next_link);
2228 cmd->next_link->tag = cmd->tag;
2229 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
2230 dprintk(NDEBUG_LINKED, "scsi%d : target %d lun %llu linked request done, calling scsi_done().\n", instance->host_no, cmd->device->id, cmd->device->lun);
2231 collect_stats(hostdata, cmd);
2232 cmd->scsi_done(cmd);
2233 cmd = hostdata->connected;
2242 dprintk(NDEBUG_QUEUES, "scsi%d : command for target %d, lun %llu completed\n", instance->host_no, cmd->device->id, cmd->device->lun);
2243 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xFF));
2261 if (cmd->cmnd[0] != REQUEST_SENSE)
2262 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
2263 else if (status_byte(cmd->SCp.Status) != GOOD)
2264 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
2267 if ((cmd->cmnd[0] == REQUEST_SENSE) &&
2269 scsi_eh_restore_cmnd(cmd, &hostdata->ses);
2273 if ((cmd->cmnd[0] != REQUEST_SENSE) && (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
2274 scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
2278 LIST(cmd, hostdata->issue_queue);
2279 cmd->host_scribble = (unsigned char *)
2281 hostdata->issue_queue = (Scsi_Cmnd *) cmd;
2286 collect_stats(hostdata, cmd);
2287 cmd->scsi_done(cmd);
2307 cmd->device->simple_tags = 0;
2308 hostdata->busy[cmd->device->id] |= (1 << (cmd->device->lun & 0xFF));
2316 cmd->device->disconnect = 1;
2317 LIST(cmd, hostdata->disconnected_queue);
2318 cmd->host_scribble = (unsigned char *)
2321 hostdata->disconnected_queue = cmd;
2322 dprintk(NDEBUG_QUEUES, "scsi%d : command for target %d lun %llu was moved from connected to" " the disconnected_queue\n", instance->host_no, cmd->device->id, cmd->device->lun);
2413 scmd_printk(KERN_INFO, cmd,
2416 scmd_printk(KERN_INFO, cmd,
2430 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xFF));
2432 cmd->result = DID_ERROR << 16;
2433 collect_stats(hostdata, cmd);
2434 cmd->scsi_done(cmd);
2441 len = cmd->cmd_len;
2442 data = cmd->cmnd;
2449 if (!cmd->device->disconnect && should_disconnect(cmd->cmnd[0])) {
2459 cmd->SCp.Status = tmp;
2469 if (!cmd->device->disconnect && time_after_eq(jiffies, poll_time)) {
2646 * Function : int NCR5380_abort (Scsi_Cmnd *cmd)
2650 * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the
2664 static int NCR5380_abort(Scsi_Cmnd * cmd) {
2666 struct Scsi_Host *instance = cmd->device->host;
2671 scsi_print_command(cmd);
2687 if (hostdata->connected == cmd) {
2718 if (cmd == tmp) {
2774 if (cmd == tmp) {
2777 if (NCR5380_select(instance, cmd, (int) cmd->tag))
2784 if (cmd == tmp) {
2809 * Function : int NCR5380_bus_reset (Scsi_Cmnd *cmd)
2818 static int NCR5380_bus_reset(Scsi_Cmnd * cmd)
2820 struct Scsi_Host *instance = cmd->device->host;