Lines Matching refs:cmd
199 static inline void write_wd33c93_cmd(const wd33c93_regs regs, uchar cmd) in write_wd33c93_cmd() argument
203 *regs.SCMD = cmd; in write_wd33c93_cmd()
254 static int is_dir_out(Scsi_Cmnd *cmd) in is_dir_out() argument
256 switch (cmd->cmnd[0]) { in is_dir_out()
314 int wd33c93_queuecommand (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) in wd33c93_queuecommand() argument
320 hostdata = (struct WD33C93_hostdata *)cmd->host->hostdata; in wd33c93_queuecommand()
322 DB(DB_QUEUE_COMMAND,printk("Q-%d-%02x-%ld( ",cmd->target,cmd->cmnd[0],cmd->pid)) in wd33c93_queuecommand()
330 cmd->host_scribble = NULL; in wd33c93_queuecommand()
331 cmd->scsi_done = done; in wd33c93_queuecommand()
332 cmd->result = 0; in wd33c93_queuecommand()
349 if (cmd->use_sg) { in wd33c93_queuecommand()
350 cmd->SCp.buffer = (struct scatterlist *)cmd->buffer; in wd33c93_queuecommand()
351 cmd->SCp.buffers_residual = cmd->use_sg - 1; in wd33c93_queuecommand()
352 cmd->SCp.ptr = (char *)cmd->SCp.buffer->address; in wd33c93_queuecommand()
353 cmd->SCp.this_residual = cmd->SCp.buffer->length; in wd33c93_queuecommand()
356 cmd->SCp.buffer = NULL; in wd33c93_queuecommand()
357 cmd->SCp.buffers_residual = 0; in wd33c93_queuecommand()
358 cmd->SCp.ptr = (char *)cmd->request_buffer; in wd33c93_queuecommand()
359 cmd->SCp.this_residual = cmd->request_bufflen; in wd33c93_queuecommand()
379 cmd->SCp.Status = ILLEGAL_STATUS_BYTE; in wd33c93_queuecommand()
390 if (!(hostdata->input_Q) || (cmd->cmnd[0] == REQUEST_SENSE)) { in wd33c93_queuecommand()
391 cmd->host_scribble = (uchar *)hostdata->input_Q; in wd33c93_queuecommand()
392 hostdata->input_Q = cmd; in wd33c93_queuecommand()
398 tmp->host_scribble = (uchar *)cmd; in wd33c93_queuecommand()
405 wd33c93_execute(cmd->host); in wd33c93_queuecommand()
407 DB(DB_QUEUE_COMMAND,printk(")Q-%ld ",cmd->pid)) in wd33c93_queuecommand()
429 Scsi_Cmnd *cmd, *prev; in wd33c93_execute() local
446 cmd = (Scsi_Cmnd *)hostdata->input_Q; in wd33c93_execute()
448 while (cmd) { in wd33c93_execute()
449 if (!(hostdata->busy[cmd->target] & (1 << cmd->lun))) in wd33c93_execute()
451 prev = cmd; in wd33c93_execute()
452 cmd = (Scsi_Cmnd *)cmd->host_scribble; in wd33c93_execute()
457 if (!cmd) { in wd33c93_execute()
467 prev->host_scribble = cmd->host_scribble; in wd33c93_execute()
469 hostdata->input_Q = (Scsi_Cmnd *)cmd->host_scribble; in wd33c93_execute()
472 hostdata->cmd_cnt[cmd->target]++; in wd33c93_execute()
479 if (is_dir_out(cmd)) in wd33c93_execute()
480 write_wd33c93(regs, WD_DESTINATION_ID, cmd->target); in wd33c93_execute()
482 write_wd33c93(regs, WD_DESTINATION_ID, cmd->target | DSTID_DPD); in wd33c93_execute()
507 cmd->SCp.phase = 0; /* assume no disconnect */ in wd33c93_execute()
512 if (cmd->device->type == 1) /* tape drive? */ in wd33c93_execute()
520 if ((prev->target != cmd->target) || (prev->lun != cmd->lun)) { in wd33c93_execute()
530 cmd->SCp.phase = 1; in wd33c93_execute()
533 hostdata->disc_allowed_cnt[cmd->target]++; in wd33c93_execute()
538 write_wd33c93(regs, WD_SOURCE_ID, ((cmd->SCp.phase)?SRCID_ER:0)); in wd33c93_execute()
540 write_wd33c93(regs, WD_TARGET_LUN, cmd->lun); in wd33c93_execute()
541 write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,hostdata->sync_xfer[cmd->target]); in wd33c93_execute()
542 hostdata->busy[cmd->target] |= (1 << cmd->lun); in wd33c93_execute()
545 (hostdata->sync_stat[cmd->target] == SS_UNSET)) { in wd33c93_execute()
555 hostdata->selecting = cmd; in wd33c93_execute()
569 if (hostdata->sync_stat[cmd->target] == SS_UNSET) in wd33c93_execute()
570 hostdata->sync_stat[cmd->target] = SS_FIRST; in wd33c93_execute()
586 hostdata->connected = cmd; in wd33c93_execute()
594 for (i=0; i<cmd->cmd_len; i++) in wd33c93_execute()
595 *regs.SCMD = cmd->cmnd[i]; in wd33c93_execute()
603 write_wd33c93(regs, WD_OWN_ID, cmd->cmd_len); in wd33c93_execute()
610 if ((cmd->SCp.phase == 0) && (hostdata->no_dma == 0)) { in wd33c93_execute()
611 if (hostdata->dma_setup(cmd, in wd33c93_execute()
612 (is_dir_out(cmd))?DATA_OUT_DIR:DATA_IN_DIR)) in wd33c93_execute()
615 write_wd33c93_count(regs, cmd->SCp.this_residual); in wd33c93_execute()
634 DB(DB_EXECUTE,printk("%s%ld)EX-2 ",(cmd->SCp.phase)?"d:":"",cmd->pid)) in wd33c93_execute()
675 static void transfer_bytes(const wd33c93_regs regs, Scsi_Cmnd *cmd, in transfer_bytes() argument
681 hostdata = (struct WD33C93_hostdata *)cmd->host->hostdata; in transfer_bytes()
691 if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) { in transfer_bytes()
692 ++cmd->SCp.buffer; in transfer_bytes()
693 --cmd->SCp.buffers_residual; in transfer_bytes()
694 cmd->SCp.this_residual = cmd->SCp.buffer->length; in transfer_bytes()
695 cmd->SCp.ptr = cmd->SCp.buffer->address; in transfer_bytes()
698 write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,hostdata->sync_xfer[cmd->target]); in transfer_bytes()
711 else if (hostdata->dma_setup(cmd, data_in_dir)) { in transfer_bytes()
716 transfer_pio(regs, (uchar *)cmd->SCp.ptr, cmd->SCp.this_residual, in transfer_bytes()
718 length = cmd->SCp.this_residual; in transfer_bytes()
719 cmd->SCp.this_residual = read_wd33c93_count(regs); in transfer_bytes()
720 cmd->SCp.ptr += (length - cmd->SCp.this_residual); in transfer_bytes()
737 write_wd33c93_count(regs, cmd->SCp.this_residual); in transfer_bytes()
740 (hostdata->level2 == L2_BASIC && cmd->SCp.phase == 0)) { in transfer_bytes()
758 Scsi_Cmnd *patch, *cmd; in wd33c93_intr() local
772 cmd = (Scsi_Cmnd *)hostdata->connected; /* assume we're connected */ in wd33c93_intr()
794 DB(DB_TRANSFER,printk("[%p/%d:",cmd->SCp.ptr,cmd->SCp.this_residual)) in wd33c93_intr()
795 hostdata->dma_stop(cmd->host, cmd, 1); in wd33c93_intr()
797 length = cmd->SCp.this_residual; in wd33c93_intr()
798 cmd->SCp.this_residual = read_wd33c93_count(regs); in wd33c93_intr()
799 cmd->SCp.ptr += (length - cmd->SCp.this_residual); in wd33c93_intr()
800 DB(DB_TRANSFER,printk("%p/%d]",cmd->SCp.ptr,cmd->SCp.this_residual)) in wd33c93_intr()
813 cmd = (Scsi_Cmnd *)hostdata->selecting; /* get a valid cmd */ in wd33c93_intr()
817 cmd->result = DID_NO_CONNECT << 16; in wd33c93_intr()
818 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in wd33c93_intr()
820 cmd->scsi_done(cmd); in wd33c93_intr()
847 hostdata->connected = cmd = (Scsi_Cmnd *)hostdata->selecting; in wd33c93_intr()
852 hostdata->outgoing_msg[0] = (0x80 | 0x00 | cmd->lun); in wd33c93_intr()
853 if (cmd->SCp.phase) in wd33c93_intr()
856 if (hostdata->sync_stat[cmd->target] == SS_FIRST) { in wd33c93_intr()
861 hostdata->sync_stat[cmd->target] = SS_WAITING; in wd33c93_intr()
872 if (hostdata->no_sync & (1 << cmd->target)) { in wd33c93_intr()
892 DB(DB_INTR,printk("IN-%d.%d",cmd->SCp.this_residual,cmd->SCp.buffers_residual)) in wd33c93_intr()
893 transfer_bytes(regs, cmd, DATA_IN_DIR); in wd33c93_intr()
902 DB(DB_INTR,printk("OUT-%d.%d",cmd->SCp.this_residual,cmd->SCp.buffers_residual)) in wd33c93_intr()
903 transfer_bytes(regs, cmd, DATA_OUT_DIR); in wd33c93_intr()
914 DB(DB_INTR,printk("CMND-%02x,%ld",cmd->cmnd[0],cmd->pid)) in wd33c93_intr()
915 transfer_pio(regs, cmd->cmnd, cmd->cmd_len, DATA_OUT_DIR, hostdata); in wd33c93_intr()
925 cmd->SCp.Status = read_1_byte(regs); in wd33c93_intr()
926 DB(DB_INTR,printk("%02x",cmd->SCp.Status)) in wd33c93_intr()
953 cmd->SCp.Message = msg; in wd33c93_intr()
957 DB(DB_INTR,printk("CCMP-%ld",cmd->pid)) in wd33c93_intr()
983 cmd->device->disconnect = 1; in wd33c93_intr()
993 if (hostdata->sync_stat[cmd->target] == SS_WAITING) in wd33c93_intr()
994 hostdata->sync_stat[cmd->target] = SS_SET; in wd33c93_intr()
1015 if (hostdata->sync_stat[cmd->target] != SS_WAITING) { in wd33c93_intr()
1033 hostdata->sync_xfer[cmd->target] = in wd33c93_intr()
1037 hostdata->sync_xfer[cmd->target] = id; in wd33c93_intr()
1040 printk("sync_xfer=%02x",hostdata->sync_xfer[cmd->target]); in wd33c93_intr()
1042 hostdata->sync_stat[cmd->target] = SS_SET; in wd33c93_intr()
1100 DB(DB_INTR,printk("SX-DONE-%ld",cmd->pid)) in wd33c93_intr()
1101 cmd->SCp.Message = COMMAND_COMPLETE; in wd33c93_intr()
1103 DB(DB_INTR,printk(":%d.%d",cmd->SCp.Status,lun)) in wd33c93_intr()
1105 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in wd33c93_intr()
1107 if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE) in wd33c93_intr()
1108 cmd->SCp.Status = lun; in wd33c93_intr()
1109 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) in wd33c93_intr()
1110 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); in wd33c93_intr()
1112 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in wd33c93_intr()
1113 cmd->scsi_done(cmd); in wd33c93_intr()
1122 printk("%02x:%02x:%02x-%ld: Unknown SEL_XFER_DONE phase!!---",asr,sr,phs,cmd->pid); in wd33c93_intr()
1182 if (cmd == NULL) { in wd33c93_intr()
1187 DB(DB_INTR,printk("UNEXP_DISC-%ld",cmd->pid)) in wd33c93_intr()
1189 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in wd33c93_intr()
1191 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) in wd33c93_intr()
1192 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); in wd33c93_intr()
1194 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in wd33c93_intr()
1195 cmd->scsi_done(cmd); in wd33c93_intr()
1213 DB(DB_INTR,printk("DISC-%ld",cmd->pid)) in wd33c93_intr()
1214 if (cmd == NULL) { in wd33c93_intr()
1221 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in wd33c93_intr()
1223 DB(DB_INTR,printk(":%d",cmd->SCp.Status)) in wd33c93_intr()
1224 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) in wd33c93_intr()
1225 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); in wd33c93_intr()
1227 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in wd33c93_intr()
1228 cmd->scsi_done(cmd); in wd33c93_intr()
1233 cmd->host_scribble = (uchar *)hostdata->disconnected_Q; in wd33c93_intr()
1234 hostdata->disconnected_Q = cmd; in wd33c93_intr()
1239 hostdata->disc_done_cnt[cmd->target]++; in wd33c93_intr()
1270 cmd = (Scsi_Cmnd *)hostdata->selecting; in wd33c93_intr()
1272 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in wd33c93_intr()
1273 cmd->host_scribble = (uchar *)hostdata->input_Q; in wd33c93_intr()
1274 hostdata->input_Q = cmd; in wd33c93_intr()
1280 if (cmd) { in wd33c93_intr()
1282 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in wd33c93_intr()
1283 cmd->host_scribble = (uchar *)hostdata->input_Q; in wd33c93_intr()
1284 hostdata->input_Q = cmd; in wd33c93_intr()
1355 cmd = (Scsi_Cmnd *)hostdata->disconnected_Q; in wd33c93_intr()
1357 while (cmd) { in wd33c93_intr()
1358 if (id == cmd->target && lun == cmd->lun) in wd33c93_intr()
1360 patch = cmd; in wd33c93_intr()
1361 cmd = (Scsi_Cmnd *)cmd->host_scribble; in wd33c93_intr()
1366 if (!cmd) { in wd33c93_intr()
1374 patch->host_scribble = cmd->host_scribble; in wd33c93_intr()
1376 hostdata->disconnected_Q = (Scsi_Cmnd *)cmd->host_scribble; in wd33c93_intr()
1377 hostdata->connected = cmd; in wd33c93_intr()
1384 if (is_dir_out(cmd)) in wd33c93_intr()
1385 write_wd33c93(regs, WD_DESTINATION_ID, cmd->target); in wd33c93_intr()
1387 write_wd33c93(regs, WD_DESTINATION_ID, cmd->target | DSTID_DPD); in wd33c93_intr()
1397 DB(DB_INTR,printk("-%ld",cmd->pid)) in wd33c93_intr()
1507 int wd33c93_abort (Scsi_Cmnd *cmd) in wd33c93_abort() argument
1514 disable_irq(cmd->host->irq); in wd33c93_abort()
1516 instance = cmd->host; in wd33c93_abort()
1528 if (tmp == cmd) { in wd33c93_abort()
1530 prev->host_scribble = cmd->host_scribble; in wd33c93_abort()
1532 hostdata->input_Q = (Scsi_Cmnd *)cmd->host_scribble; in wd33c93_abort()
1533 cmd->host_scribble = NULL; in wd33c93_abort()
1534 cmd->result = DID_ABORT << 16; in wd33c93_abort()
1536 instance->host_no, cmd->pid); in wd33c93_abort()
1537 enable_irq(cmd->host->irq); in wd33c93_abort()
1538 cmd->scsi_done(cmd); in wd33c93_abort()
1556 if (hostdata->connected == cmd) { in wd33c93_abort()
1561 instance->host_no, cmd->pid); in wd33c93_abort()
1565 hostdata->dma_stop(instance, cmd, 0); in wd33c93_abort()
1602 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in wd33c93_abort()
1605 cmd->result = DID_ABORT << 16; in wd33c93_abort()
1610 enable_irq(cmd->host->irq); in wd33c93_abort()
1611 cmd->scsi_done(cmd); in wd33c93_abort()
1623 if (tmp == cmd) { in wd33c93_abort()
1625 instance->host_no, cmd->pid); in wd33c93_abort()
1627 enable_irq(cmd->host->irq); in wd33c93_abort()
1646 enable_irq(cmd->host->irq); in wd33c93_abort()
1888 Scsi_Cmnd *cmd; in wd33c93_proc_info() local
2002 cmd = (Scsi_Cmnd *)hd->connected; in wd33c93_proc_info()
2004 cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]); in wd33c93_proc_info()
2010 cmd = (Scsi_Cmnd *)hd->input_Q; in wd33c93_proc_info()
2011 while (cmd) { in wd33c93_proc_info()
2013 cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]); in wd33c93_proc_info()
2015 cmd = (Scsi_Cmnd *)cmd->host_scribble; in wd33c93_proc_info()
2020 cmd = (Scsi_Cmnd *)hd->disconnected_Q; in wd33c93_proc_info()
2021 while (cmd) { in wd33c93_proc_info()
2023 cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]); in wd33c93_proc_info()
2025 cmd = (Scsi_Cmnd *)cmd->host_scribble; in wd33c93_proc_info()