Lines Matching refs:cmd
330 static __inline__ void initialize_SCp(Scsi_Cmnd * cmd) in initialize_SCp() argument
337 if (cmd->use_sg) { in initialize_SCp()
338 cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; in initialize_SCp()
339 cmd->SCp.buffers_residual = cmd->use_sg - 1; in initialize_SCp()
340 cmd->SCp.ptr = (char *) cmd->SCp.buffer->address; in initialize_SCp()
341 cmd->SCp.this_residual = cmd->SCp.buffer->length; in initialize_SCp()
343 cmd->SCp.buffer = NULL; in initialize_SCp()
344 cmd->SCp.buffers_residual = 0; in initialize_SCp()
345 cmd->SCp.ptr = (char *) cmd->request_buffer; in initialize_SCp()
346 cmd->SCp.this_residual = cmd->request_bufflen; in initialize_SCp()
558 static int should_disconnect(unsigned char cmd) in should_disconnect() argument
560 switch (cmd) { in should_disconnect()
815 char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length);
817 char *lprint_command(unsigned char *cmd, char *pos, char *buffer, int len);
899 char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length) in lprint_Scsi_Cmnd() argument
901 SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->host->host_no, cmd->target, cmd->lun); in lprint_Scsi_Cmnd()
903 pos = lprint_command(cmd->cmnd, pos, buffer, length); in lprint_Scsi_Cmnd()
1070 int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) { in NCR5380_queue_command() argument
1071 struct Scsi_Host *instance = cmd->host; in NCR5380_queue_command()
1076 switch (cmd->cmnd[0]) { in NCR5380_queue_command()
1080 cmd->result = (DID_ERROR << 16); in NCR5380_queue_command()
1081 done(cmd); in NCR5380_queue_command()
1087 switch (cmd->cmnd[0]) { in NCR5380_queue_command()
1091 hostdata->time_write[cmd->target] -= (jiffies - hostdata->timebase); in NCR5380_queue_command()
1092 hostdata->bytes_write[cmd->target] += cmd->request_bufflen; in NCR5380_queue_command()
1098 hostdata->time_read[cmd->target] -= (jiffies - hostdata->timebase); in NCR5380_queue_command()
1099 hostdata->bytes_read[cmd->target] += cmd->request_bufflen; in NCR5380_queue_command()
1110 cmd->host_scribble = NULL; in NCR5380_queue_command()
1111 cmd->scsi_done = done; in NCR5380_queue_command()
1112 cmd->result = 0; in NCR5380_queue_command()
1121 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) { in NCR5380_queue_command()
1122 LIST(cmd, hostdata->issue_queue); in NCR5380_queue_command()
1123 cmd->host_scribble = (unsigned char *) hostdata->issue_queue; in NCR5380_queue_command()
1124 hostdata->issue_queue = cmd; in NCR5380_queue_command()
1127 LIST(cmd, tmp); in NCR5380_queue_command()
1128 tmp->host_scribble = (unsigned char *) cmd; in NCR5380_queue_command()
1130 …dprintk(NDEBUG_QUEUES, ("scsi%d : command added to %s of queue\n", instance->host_no, (cmd->cmnd[0… in NCR5380_queue_command()
1401 static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd) in collect_stats() argument
1404 switch (cmd->cmnd[0]) { in collect_stats()
1408 hostdata->time_write[cmd->target] += (jiffies - hostdata->timebase); in collect_stats()
1414 hostdata->time_read[cmd->target] += (jiffies - hostdata->timebase); in collect_stats()
1455 static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag) in NCR5380_select() argument
1557 NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->target))); in NCR5380_select()
1602 dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, cmd->target)); in NCR5380_select()
1618 hostdata->selecting = cmd; in NCR5380_select()
1656 if (hostdata->targets_present & (1 << cmd->target)) { in NCR5380_select()
1664 cmd->result = DID_BAD_TARGET << 16; in NCR5380_select()
1665 collect_stats(hostdata, cmd); in NCR5380_select()
1666 cmd->scsi_done(cmd); in NCR5380_select()
1672 hostdata->targets_present |= (1 << cmd->target); in NCR5380_select()
1708 … ("scsi%d : target %d selected, going into MESSAGE OUT phase.\n", instance->host_no, cmd->target)); in NCR5380_select()
1709 tmp[0] = IDENTIFY(((instance->irq == SCSI_IRQ_NONE) ? 0 : 1), cmd->lun); in NCR5380_select()
1712 cmd->tag = 0; in NCR5380_select()
1720 hostdata->connected = cmd; in NCR5380_select()
1721 hostdata->busy[cmd->target] |= (1 << cmd->lun); in NCR5380_select()
1723 initialize_SCp(cmd); in NCR5380_select()
2267 Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected; local
2298 cmd->result = DID_ERROR << 16;
2299 cmd->done(cmd);
2307 if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) {
2308 ++cmd->SCp.buffer;
2309 --cmd->SCp.buffers_residual;
2310 cmd->SCp.this_residual = cmd->SCp.buffer->length;
2311 cmd->SCp.ptr = cmd->SCp.buffer->address;
2312 …("scsi%d : %d bytes and %d buffers left\n", instance->host_no, cmd->SCp.this_residual, cmd->SCp.bu…
2333 …if (!cmd->device->borken && !(hostdata->flags & FLAG_NO_PSEUDO_DMA) && (transfersize = NCR5380_dma…
2335 transfersize = cmd->transfersize;
2342 …if (!cmd->device->borken && transfersize && !(hostdata->flags & FLAG_NO_PSEUDO_DMA) && cmd->SCp.th…
2349 if (NCR5380_transfer_dma(instance, &phase, &len, (unsigned char **) &cmd->SCp.ptr)) {
2354 …csi%d : switching target %d lun %d to slow handshake\n", instance->host_no, cmd->target, cmd->lun);
2355 cmd->device->borken = 1;
2359 cmd->result = DID_ERROR << 16;
2360 cmd->done(cmd);
2363 cmd->SCp.this_residual -= transfersize - len;
2366 NCR5380_transfer_pio(instance, &phase, (int *) &cmd->SCp.this_residual, (unsigned char **)
2367 &cmd->SCp.ptr);
2373 cmd->SCp.Message = tmp;
2391 …"scsi%d : target %d lun %d linked command complete.\n", instance->host_no, cmd->target, cmd->lun));
2397 if (!cmd->next_link) {
2398 …arget %d lun %d linked command complete, no next_link\n" instance->host_no, cmd->target, cmd->lun);
2403 initialize_SCp(cmd->next_link);
2405 cmd->next_link->tag = cmd->tag;
2406 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
2407 …%d lun %d linked request done, calling scsi_done().\n", instance->host_no, cmd->target, cmd->lun));
2408 collect_stats(hostdata, cmd);
2409 cmd->scsi_done(cmd);
2410 cmd = hostdata->connected;
2419 … ("scsi%d : command for target %d, lun %d completed\n", instance->host_no, cmd->target, cmd->lun));
2420 hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
2438 if (cmd->cmnd[0] != REQUEST_SENSE)
2439 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
2440 else if (cmd->SCp.Status != GOOD)
2441 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
2444 if ((cmd->cmnd[0] != REQUEST_SENSE) && (cmd->SCp.Status == CHECK_CONDITION)) {
2446 cmd->cmnd[0] = REQUEST_SENSE;
2447 cmd->cmnd[1] &= 0xe0;
2448 cmd->cmnd[2] = 0;
2449 cmd->cmnd[3] = 0;
2450 cmd->cmnd[4] = sizeof(cmd->sense_buffer);
2451 cmd->cmnd[5] = 0;
2453 cmd->SCp.buffer = NULL;
2454 cmd->SCp.buffers_residual = 0;
2455 cmd->SCp.ptr = (char *) cmd->sense_buffer;
2456 cmd->SCp.this_residual = sizeof(cmd->sense_buffer);
2458 LIST(cmd, hostdata->issue_queue);
2459 cmd->host_scribble = (unsigned char *)
2461 hostdata->issue_queue = (Scsi_Cmnd *) cmd;
2466 collect_stats(hostdata, cmd);
2467 cmd->scsi_done(cmd);
2487 cmd->device->tagged_queue = 0;
2488 hostdata->busy[cmd->target] |= (1 << cmd->lun);
2496 cmd->device->disconnect = 1;
2497 LIST(cmd, hostdata->disconnected_queue);
2498 cmd->host_scribble = (unsigned char *)
2501 hostdata->disconnected_queue = cmd;
2502 … moved from connected to" " the disconnected_queue\n", instance->host_no, cmd->target, cmd->lun));
2592 …ing unknown message %02x from target %d, lun %d\n", instance->host_no, tmp, cmd->target, cmd->lun);
2594 … target %d, lun %d\n", instance->host_no, extended_msg[1], extended_msg[0], cmd->target, cmd->lun);
2607 hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
2609 cmd->result = DID_ERROR << 16;
2610 collect_stats(hostdata, cmd);
2611 cmd->scsi_done(cmd);
2618 len = cmd->cmd_len;
2619 data = cmd->cmnd;
2626 if (!cmd->device->disconnect && should_disconnect(cmd->cmnd[0])) {
2637 cmd->SCp.Status = tmp;
2647 if (!cmd->device->disconnect && time_after_eq(jiffies, poll_time)) {
2839 int NCR5380_abort(Scsi_Cmnd * cmd) { argument
2841 struct Scsi_Host *instance = cmd->host;
2846 print_Scsi_Cmnd(cmd);
2851 print_Scsi_Cmnd(cmd);
2867 if (hostdata->connected == cmd) {
2898 if (cmd == tmp) {
2954 if (cmd == tmp) {
2957 if (NCR5380_select(instance, cmd, (int) cmd->tag))
2964 if (cmd == tmp) {
3000 int NCR5380_reset(Scsi_Cmnd * cmd, unsigned int dummy) { argument
3002 NCR5380_setup(cmd->host);
3004 NCR5380_print_status(cmd->host);
3005 do_reset(cmd->host);