Lines Matching refs:cmd
210 static inline void write_3393_cmd(struct IN2000_hostdata *hostdata, uchar cmd) in write_3393_cmd() argument
215 write1_io(cmd,IO_WD_DATA); in write_3393_cmd()
260 static int is_dir_out(Scsi_Cmnd *cmd) in is_dir_out() argument
262 switch (cmd->cmnd[0]) { in is_dir_out()
320 int in2000_queuecommand (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) in in2000_queuecommand() argument
326 hostdata = (struct IN2000_hostdata *)cmd->host->hostdata; in in2000_queuecommand()
328 DB(DB_QUEUE_COMMAND,printk("Q-%d-%02x-%ld(",cmd->target,cmd->cmnd[0],cmd->pid)) in in2000_queuecommand()
336 cmd->host_scribble = NULL; in in2000_queuecommand()
337 cmd->scsi_done = done; in in2000_queuecommand()
338 cmd->result = 0; in in2000_queuecommand()
355 if (cmd->use_sg) { in in2000_queuecommand()
356 cmd->SCp.buffer = (struct scatterlist *)cmd->buffer; in in2000_queuecommand()
357 cmd->SCp.buffers_residual = cmd->use_sg - 1; in in2000_queuecommand()
358 cmd->SCp.ptr = (char *)cmd->SCp.buffer->address; in in2000_queuecommand()
359 cmd->SCp.this_residual = cmd->SCp.buffer->length; in in2000_queuecommand()
362 cmd->SCp.buffer = NULL; in in2000_queuecommand()
363 cmd->SCp.buffers_residual = 0; in in2000_queuecommand()
364 cmd->SCp.ptr = (char *)cmd->request_buffer; in in2000_queuecommand()
365 cmd->SCp.this_residual = cmd->request_bufflen; in in2000_queuecommand()
367 cmd->SCp.have_data_in = 0; in in2000_queuecommand()
388 cmd->SCp.Status = ILLEGAL_STATUS_BYTE; in in2000_queuecommand()
403 if (!(hostdata->input_Q) || (cmd->cmnd[0] == REQUEST_SENSE)) { in in2000_queuecommand()
404 cmd->host_scribble = (uchar *)hostdata->input_Q; in in2000_queuecommand()
405 hostdata->input_Q = cmd; in in2000_queuecommand()
411 tmp->host_scribble = (uchar *)cmd; in in2000_queuecommand()
418 in2000_execute(cmd->host); in in2000_queuecommand()
420 DB(DB_QUEUE_COMMAND,printk(")Q-%ld ",cmd->pid)) in in2000_queuecommand()
439 Scsi_Cmnd *cmd, *prev; in in2000_execute() local
462 cmd = (Scsi_Cmnd *)hostdata->input_Q; in in2000_execute()
464 while (cmd) { in in2000_execute()
465 if (!(hostdata->busy[cmd->target] & (1 << cmd->lun))) in in2000_execute()
467 prev = cmd; in in2000_execute()
468 cmd = (Scsi_Cmnd *)cmd->host_scribble; in in2000_execute()
473 if (!cmd) { in in2000_execute()
483 prev->host_scribble = cmd->host_scribble; in in2000_execute()
485 hostdata->input_Q = (Scsi_Cmnd *)cmd->host_scribble; in in2000_execute()
488 hostdata->cmd_cnt[cmd->target]++; in in2000_execute()
495 if (is_dir_out(cmd)) in in2000_execute()
496 write_3393(hostdata,WD_DESTINATION_ID, cmd->target); in in2000_execute()
498 write_3393(hostdata,WD_DESTINATION_ID, cmd->target | DSTID_DPD); in in2000_execute()
523 cmd->SCp.phase = 0; /* assume no disconnect */ in in2000_execute()
528 if (cmd->device->type == 1) /* tape drive? */ in in2000_execute()
536 if ((prev->target != cmd->target) || (prev->lun != cmd->lun)) { in in2000_execute()
546 cmd->SCp.phase = 1; in in2000_execute()
549 hostdata->disc_allowed_cnt[cmd->target]++; in in2000_execute()
553 write_3393(hostdata,WD_SOURCE_ID,((cmd->SCp.phase)?SRCID_ER:0)); in in2000_execute()
555 write_3393(hostdata,WD_TARGET_LUN, cmd->lun); in in2000_execute()
556 write_3393(hostdata,WD_SYNCHRONOUS_TRANSFER,hostdata->sync_xfer[cmd->target]); in in2000_execute()
557 hostdata->busy[cmd->target] |= (1 << cmd->lun); in in2000_execute()
560 (hostdata->sync_stat[cmd->target] == SS_UNSET)) { in in2000_execute()
570 hostdata->selecting = cmd; in in2000_execute()
582 if (hostdata->sync_stat[cmd->target] == SS_UNSET) { in in2000_execute()
583 if (hostdata->sync_off & (1 << cmd->target)) in in2000_execute()
584 hostdata->sync_stat[cmd->target] = SS_SET; in in2000_execute()
586 hostdata->sync_stat[cmd->target] = SS_FIRST; in in2000_execute()
603 hostdata->connected = cmd; in in2000_execute()
611 for (i=0; i<cmd->cmd_len; i++) in in2000_execute()
612 write1_io(cmd->cmnd[i], IO_WD_DATA); in in2000_execute()
620 write_3393(hostdata, WD_OWN_ID, cmd->cmd_len); in in2000_execute()
640 if (!(cmd->SCp.phase)) { in in2000_execute()
641 write_3393_count(hostdata, cmd->SCp.this_residual); in in2000_execute()
645 if (is_dir_out(cmd)) { in in2000_execute()
647 if ((i = cmd->SCp.this_residual) > (IN2000_FIFO_SIZE - 16) ) in in2000_execute()
649 cmd->SCp.have_data_in = i; /* this much data in fifo */ in in2000_execute()
651 sp = (unsigned short *)cmd->SCp.ptr; in in2000_execute()
665 if (cmd->SCp.have_data_in <= ((IN2000_FIFO_SIZE - 16) - 32)) { in in2000_execute()
684 cmd->SCp.have_data_in = 0; /* nothing transferred yet */ in in2000_execute()
702 DB(DB_EXECUTE,printk("%s%ld)EX-2 ",(cmd->SCp.phase)?"d:":"",cmd->pid)) in in2000_execute()
744 static void transfer_bytes(Scsi_Cmnd *cmd, int data_in_dir) in transfer_bytes() argument
751 hostdata = (struct IN2000_hostdata *)cmd->host->hostdata; in transfer_bytes()
761 if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) { in transfer_bytes()
762 ++cmd->SCp.buffer; in transfer_bytes()
763 --cmd->SCp.buffers_residual; in transfer_bytes()
764 cmd->SCp.this_residual = cmd->SCp.buffer->length; in transfer_bytes()
765 cmd->SCp.ptr = cmd->SCp.buffer->address; in transfer_bytes()
770 write_3393(hostdata,WD_SYNCHRONOUS_TRANSFER,hostdata->sync_xfer[cmd->target]); in transfer_bytes()
771 write_3393_count(hostdata,cmd->SCp.this_residual); in transfer_bytes()
782 (hostdata->level2 == L2_BASIC && cmd->SCp.phase == 0)) { in transfer_bytes()
790 cmd->SCp.have_data_in = 0; in transfer_bytes()
800 (hostdata->level2 == L2_BASIC && cmd->SCp.phase == 0)) { in transfer_bytes()
808 sp = (unsigned short *)cmd->SCp.ptr; in transfer_bytes()
810 if ((i = cmd->SCp.this_residual) > IN2000_FIFO_SIZE) in transfer_bytes()
812 cmd->SCp.have_data_in = i; in transfer_bytes()
838 Scsi_Cmnd *patch, *cmd; in in2000_intr() local
922 cmd = (Scsi_Cmnd *)hostdata->connected; /* assume we're connected */ in in2000_intr()
923 CHECK_NULL(cmd,"fifo_int") in in2000_intr()
929 sp = (unsigned short *)(cmd->SCp.ptr + cmd->SCp.have_data_in); in in2000_intr()
943 i = sp - (unsigned short *)(cmd->SCp.ptr + cmd->SCp.have_data_in); in in2000_intr()
945 cmd->SCp.have_data_in += i; in in2000_intr()
963 if (cmd->SCp.this_residual == cmd->SCp.have_data_in) { in in2000_intr()
974 sp = (unsigned short *)(cmd->SCp.ptr + cmd->SCp.have_data_in); in in2000_intr()
975 i = cmd->SCp.this_residual - cmd->SCp.have_data_in; /* bytes yet to go */ in in2000_intr()
983 i = sp - (unsigned short *)(cmd->SCp.ptr + cmd->SCp.have_data_in); in in2000_intr()
985 cmd->SCp.have_data_in += i; in in2000_intr()
1005 cmd = (Scsi_Cmnd *)hostdata->connected; /* assume we're connected */ in in2000_intr()
1009 if (!cmd && (sr != CSR_RESEL_AM && sr != CSR_TIMEOUT && sr != CSR_SELECT)) { in in2000_intr()
1037 sp = (unsigned short *)(cmd->SCp.ptr + cmd->SCp.have_data_in); in in2000_intr()
1041 i = (cmd->SCp.this_residual - read_3393_count(hostdata)) - cmd->SCp.have_data_in; in in2000_intr()
1055 length = cmd->SCp.this_residual; in in2000_intr()
1056 cmd->SCp.this_residual = read_3393_count(hostdata); in in2000_intr()
1057 cmd->SCp.ptr += (length - cmd->SCp.this_residual); in in2000_intr()
1059 DB(DB_TRANSFER,printk("(%p,%d)",cmd->SCp.ptr,cmd->SCp.this_residual)) in in2000_intr()
1065 length = cmd->SCp.this_residual; in in2000_intr()
1066 cmd->SCp.this_residual = read_3393_count(hostdata); in in2000_intr()
1067 cmd->SCp.ptr += (length - cmd->SCp.this_residual); in in2000_intr()
1069 DB(DB_TRANSFER,printk("(%p,%d)",cmd->SCp.ptr,cmd->SCp.this_residual)) in in2000_intr()
1083 cmd = (Scsi_Cmnd *)hostdata->selecting; /* get a valid cmd */ in in2000_intr()
1084 CHECK_NULL(cmd,"csr_timeout") in in2000_intr()
1088 cmd->result = DID_NO_CONNECT << 16; in in2000_intr()
1089 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in in2000_intr()
1091 cmd->scsi_done(cmd); in in2000_intr()
1105 hostdata->connected = cmd = (Scsi_Cmnd *)hostdata->selecting; in in2000_intr()
1106 CHECK_NULL(cmd,"csr_select") in in2000_intr()
1111 hostdata->outgoing_msg[0] = (0x80 | 0x00 | cmd->lun); in in2000_intr()
1112 if (cmd->SCp.phase) in in2000_intr()
1115 if (hostdata->sync_stat[cmd->target] == SS_FIRST) { in in2000_intr()
1120 hostdata->sync_stat[cmd->target] = SS_WAITING; in in2000_intr()
1141 DB(DB_INTR,printk("IN-%d.%d",cmd->SCp.this_residual,cmd->SCp.buffers_residual)) in in2000_intr()
1142 transfer_bytes(cmd, DATA_IN_DIR); in in2000_intr()
1151 DB(DB_INTR,printk("OUT-%d.%d",cmd->SCp.this_residual,cmd->SCp.buffers_residual)) in in2000_intr()
1152 transfer_bytes(cmd, DATA_OUT_DIR); in in2000_intr()
1163 DB(DB_INTR,printk("CMND-%02x,%ld",cmd->cmnd[0],cmd->pid)) in in2000_intr()
1164 transfer_pio(cmd->cmnd, cmd->cmd_len, DATA_OUT_DIR, hostdata); in in2000_intr()
1174 cmd->SCp.Status = read_1_byte(hostdata); in in2000_intr()
1175 DB(DB_INTR,printk("%02x",cmd->SCp.Status)) in in2000_intr()
1202 cmd->SCp.Message = msg; in in2000_intr()
1206 DB(DB_INTR,printk("CCMP-%ld",cmd->pid)) in in2000_intr()
1232 cmd->device->disconnect = 1; in in2000_intr()
1242 if (hostdata->sync_stat[cmd->target] == SS_WAITING) in in2000_intr()
1243 hostdata->sync_stat[cmd->target] = SS_SET; in in2000_intr()
1264 if (hostdata->sync_stat[cmd->target] != SS_WAITING) { in in2000_intr()
1282 hostdata->sync_xfer[cmd->target] = in in2000_intr()
1286 hostdata->sync_xfer[cmd->target] = id; in in2000_intr()
1289 printk("sync_xfer=%02x",hostdata->sync_xfer[cmd->target]); in in2000_intr()
1291 hostdata->sync_stat[cmd->target] = SS_SET; in in2000_intr()
1348 DB(DB_INTR,printk("SX-DONE-%ld",cmd->pid)) in in2000_intr()
1349 cmd->SCp.Message = COMMAND_COMPLETE; in in2000_intr()
1351 DB(DB_INTR,printk(":%d.%d",cmd->SCp.Status,lun)) in in2000_intr()
1353 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in in2000_intr()
1355 if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE) in in2000_intr()
1356 cmd->SCp.Status = lun; in in2000_intr()
1357 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) in in2000_intr()
1358 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); in in2000_intr()
1360 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in in2000_intr()
1361 cmd->scsi_done(cmd); in in2000_intr()
1370 printk("%02x:%02x:%02x-%ld: Unknown SEL_XFER_DONE phase!!---",asr,sr,phs,cmd->pid); in in2000_intr()
1431 if (cmd == NULL) { in in2000_intr()
1439 DB(DB_INTR,printk("UNEXP_DISC-%ld",cmd->pid)) in in2000_intr()
1441 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in in2000_intr()
1443 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) in in2000_intr()
1444 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); in in2000_intr()
1446 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in in2000_intr()
1447 cmd->scsi_done(cmd); in in2000_intr()
1464 DB(DB_INTR,printk("DISC-%ld",cmd->pid)) in in2000_intr()
1465 if (cmd == NULL) { in in2000_intr()
1472 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in in2000_intr()
1474 DB(DB_INTR,printk(":%d",cmd->SCp.Status)) in in2000_intr()
1475 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) in in2000_intr()
1476 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); in in2000_intr()
1478 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in in2000_intr()
1479 cmd->scsi_done(cmd); in in2000_intr()
1483 cmd->host_scribble = (uchar *)hostdata->disconnected_Q; in in2000_intr()
1484 hostdata->disconnected_Q = cmd; in in2000_intr()
1489 hostdata->disc_done_cnt[cmd->target]++; in in2000_intr()
1516 cmd = (Scsi_Cmnd *)hostdata->selecting; in in2000_intr()
1518 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in in2000_intr()
1519 cmd->host_scribble = (uchar *)hostdata->input_Q; in in2000_intr()
1520 hostdata->input_Q = cmd; in in2000_intr()
1526 if (cmd) { in in2000_intr()
1528 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in in2000_intr()
1529 cmd->host_scribble = (uchar *)hostdata->input_Q; in in2000_intr()
1530 hostdata->input_Q = cmd; in in2000_intr()
1558 cmd = (Scsi_Cmnd *)hostdata->disconnected_Q; in in2000_intr()
1560 while (cmd) { in in2000_intr()
1561 if (id == cmd->target && lun == cmd->lun) in in2000_intr()
1563 patch = cmd; in in2000_intr()
1564 cmd = (Scsi_Cmnd *)cmd->host_scribble; in in2000_intr()
1569 if (!cmd) { in in2000_intr()
1577 patch->host_scribble = cmd->host_scribble; in in2000_intr()
1579 hostdata->disconnected_Q = (Scsi_Cmnd *)cmd->host_scribble; in in2000_intr()
1580 hostdata->connected = cmd; in in2000_intr()
1587 if (is_dir_out(cmd)) in in2000_intr()
1588 write_3393(hostdata,WD_DESTINATION_ID,cmd->target); in in2000_intr()
1590 write_3393(hostdata,WD_DESTINATION_ID,cmd->target | DSTID_DPD); in in2000_intr()
1600 DB(DB_INTR,printk("-%ld",cmd->pid)) in in2000_intr()
1665 int in2000_reset(Scsi_Cmnd *cmd, unsigned int reset_flags) in in2000_reset() argument
1672 instance = cmd->host; in in2000_reset()
1696 cmd->result = DID_RESET << 16; in in2000_reset()
1703 int in2000_abort (Scsi_Cmnd *cmd) in in2000_abort() argument
1715 instance = cmd->host; in in2000_abort()
1720 … READ_AUX_STAT(),read_3393_count(hostdata),cmd->SCp.this_residual,cmd->SCp.buffers_residual, in in2000_abort()
1721 cmd->SCp.have_data_in,read1_io(IO_FIFO_COUNT)); in in2000_abort()
1731 if (tmp == cmd) { in in2000_abort()
1733 prev->host_scribble = cmd->host_scribble; in in2000_abort()
1734 cmd->host_scribble = NULL; in in2000_abort()
1735 cmd->result = DID_ABORT << 16; in in2000_abort()
1737 instance->host_no, cmd->pid); in in2000_abort()
1738 cmd->scsi_done(cmd); in in2000_abort()
1757 if (hostdata->connected == cmd) { in in2000_abort()
1760 instance->host_no, cmd->pid); in in2000_abort()
1795 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in in2000_abort()
1798 cmd->result = DID_ABORT << 16; in in2000_abort()
1799 cmd->scsi_done(cmd); in in2000_abort()
1815 if (cmd == tmp) { in in2000_abort()
2203 Scsi_Cmnd *cmd; in in2000_proc_info() local
2313 cmd = (Scsi_Cmnd *)hd->connected; in in2000_proc_info()
2315 cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]); in in2000_proc_info()
2321 cmd = (Scsi_Cmnd *)hd->input_Q; in in2000_proc_info()
2322 while (cmd) { in in2000_proc_info()
2324 cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]); in in2000_proc_info()
2326 cmd = (Scsi_Cmnd *)cmd->host_scribble; in in2000_proc_info()
2331 cmd = (Scsi_Cmnd *)hd->disconnected_Q; in in2000_proc_info()
2332 while (cmd) { in in2000_proc_info()
2334 cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]); in in2000_proc_info()
2336 cmd = (Scsi_Cmnd *)cmd->host_scribble; in in2000_proc_info()