Lines Matching refs:SCpnt
131 static inline void nsp_inc_resid(struct scsi_cmnd *SCpnt, int residInc) in nsp_inc_resid() argument
133 scsi_set_resid(SCpnt, scsi_get_resid(SCpnt) + residInc); in nsp_inc_resid()
175 static void nsp_scsi_done(struct scsi_cmnd *SCpnt) in nsp_scsi_done() argument
177 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_scsi_done()
181 SCpnt->scsi_done(SCpnt); in nsp_scsi_done()
184 static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt, in nsp_queuecommand_lck() argument
190 unsigned char target = scmd_id(SCpnt); in nsp_queuecommand_lck()
192 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_queuecommand_lck()
196 SCpnt, target, SCpnt->device->lun, scsi_sglist(SCpnt), in nsp_queuecommand_lck()
197 scsi_bufflen(SCpnt), scsi_sg_count(SCpnt)); in nsp_queuecommand_lck()
200 SCpnt->scsi_done = done; in nsp_queuecommand_lck()
204 SCpnt->result = DID_BAD_TARGET << 16; in nsp_queuecommand_lck()
205 nsp_scsi_done(SCpnt); in nsp_queuecommand_lck()
214 SCpnt->result = DID_BAD_TARGET << 16; in nsp_queuecommand_lck()
215 nsp_scsi_done(SCpnt); in nsp_queuecommand_lck()
220 show_command(SCpnt); in nsp_queuecommand_lck()
222 data->CurrentSC = SCpnt; in nsp_queuecommand_lck()
224 SCpnt->SCp.Status = SAM_STAT_CHECK_CONDITION; in nsp_queuecommand_lck()
225 SCpnt->SCp.Message = 0; in nsp_queuecommand_lck()
226 SCpnt->SCp.have_data_in = IO_UNKNOWN; in nsp_queuecommand_lck()
227 SCpnt->SCp.sent_command = 0; in nsp_queuecommand_lck()
228 SCpnt->SCp.phase = PH_UNDETERMINED; in nsp_queuecommand_lck()
229 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt)); in nsp_queuecommand_lck()
237 if (scsi_bufflen(SCpnt)) { in nsp_queuecommand_lck()
238 SCpnt->SCp.buffer = scsi_sglist(SCpnt); in nsp_queuecommand_lck()
239 SCpnt->SCp.ptr = BUFFER_ADDR; in nsp_queuecommand_lck()
240 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; in nsp_queuecommand_lck()
241 SCpnt->SCp.buffers_residual = scsi_sg_count(SCpnt) - 1; in nsp_queuecommand_lck()
243 SCpnt->SCp.ptr = NULL; in nsp_queuecommand_lck()
244 SCpnt->SCp.this_residual = 0; in nsp_queuecommand_lck()
245 SCpnt->SCp.buffer = NULL; in nsp_queuecommand_lck()
246 SCpnt->SCp.buffers_residual = 0; in nsp_queuecommand_lck()
249 if (nsphw_start_selection(SCpnt) == FALSE) { in nsp_queuecommand_lck()
251 SCpnt->result = DID_BUS_BUSY << 16; in nsp_queuecommand_lck()
252 nsp_scsi_done(SCpnt); in nsp_queuecommand_lck()
362 static int nsphw_start_selection(struct scsi_cmnd *SCpnt) in nsphw_start_selection() argument
364 unsigned int host_id = SCpnt->device->host->this_id; in nsphw_start_selection()
365 unsigned int base = SCpnt->device->host->io_port; in nsphw_start_selection()
366 unsigned char target = scmd_id(SCpnt); in nsphw_start_selection()
367 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsphw_start_selection()
381 SCpnt->SCp.phase = PH_ARBSTART; in nsphw_start_selection()
401 SCpnt->SCp.phase = PH_SELSTART; in nsphw_start_selection()
412 nsp_start_timer(SCpnt, 1000/51); in nsphw_start_selection()
443 static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt) in nsp_analyze_sdtr() argument
445 unsigned char target = scmd_id(SCpnt); in nsp_analyze_sdtr()
447 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_analyze_sdtr()
501 static void nsp_start_timer(struct scsi_cmnd *SCpnt, int time) in nsp_start_timer() argument
503 unsigned int base = SCpnt->device->host->io_port; in nsp_start_timer()
504 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_start_timer()
514 static int nsp_negate_signal(struct scsi_cmnd *SCpnt, unsigned char mask, in nsp_negate_signal() argument
517 unsigned int base = SCpnt->device->host->io_port; in nsp_negate_signal()
542 static int nsp_expect_signal(struct scsi_cmnd *SCpnt, in nsp_expect_signal() argument
546 unsigned int base = SCpnt->device->host->io_port; in nsp_expect_signal()
577 static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase) in nsp_xfer() argument
579 unsigned int base = SCpnt->device->host->io_port; in nsp_xfer()
580 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_xfer()
589 ret = nsp_expect_signal(SCpnt, phase, BUSMON_REQ); in nsp_xfer()
596 if (len == 1 && SCpnt->SCp.phase == PH_MSG_OUT) { in nsp_xfer()
608 nsp_negate_signal(SCpnt, BUSMON_ACK, "xfer<ack>"); in nsp_xfer()
617 static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt) in nsp_dataphase_bypass() argument
619 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_dataphase_bypass()
624 if (SCpnt->SCp.have_data_in != IO_IN) { in nsp_dataphase_bypass()
628 count = nsp_fifo_count(SCpnt); in nsp_dataphase_bypass()
639 SCpnt->SCp.phase = PH_DATA; in nsp_dataphase_bypass()
640 nsp_pio_read(SCpnt); in nsp_dataphase_bypass()
649 static int nsp_reselected(struct scsi_cmnd *SCpnt) in nsp_reselected() argument
651 unsigned int base = SCpnt->device->host->io_port; in nsp_reselected()
652 unsigned int host_id = SCpnt->device->host->this_id; in nsp_reselected()
671 if (scmd_id(SCpnt) != target) { in nsp_reselected()
675 nsp_negate_signal(SCpnt, BUSMON_SEL, "reselect<SEL>"); in nsp_reselected()
677 nsp_nexus(SCpnt); in nsp_reselected()
688 static int nsp_fifo_count(struct scsi_cmnd *SCpnt) in nsp_fifo_count() argument
690 unsigned int base = SCpnt->device->host->io_port; in nsp_fifo_count()
715 static void nsp_pio_read(struct scsi_cmnd *SCpnt) in nsp_pio_read() argument
717 unsigned int base = SCpnt->device->host->io_port; in nsp_pio_read()
718 unsigned long mmio_base = SCpnt->device->host->base; in nsp_pio_read()
719 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_pio_read()
727 SCpnt, scsi_get_resid(SCpnt), ocount, SCpnt->SCp.ptr, in nsp_pio_read()
728 SCpnt->SCp.this_residual, SCpnt->SCp.buffer, in nsp_pio_read()
729 SCpnt->SCp.buffers_residual); in nsp_pio_read()
734 (SCpnt->SCp.this_residual > 0 || SCpnt->SCp.buffers_residual > 0 ) ) { in nsp_pio_read()
740 res = nsp_fifo_count(SCpnt) - ocount; in nsp_pio_read()
758 res = min(res, SCpnt->SCp.this_residual); in nsp_pio_read()
763 nsp_fifo32_read(base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_read()
766 nsp_fifo8_read (base, SCpnt->SCp.ptr, res ); in nsp_pio_read()
771 nsp_mmio_fifo32_read(mmio_base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_read()
779 nsp_inc_resid(SCpnt, -res); in nsp_pio_read()
780 SCpnt->SCp.ptr += res; in nsp_pio_read()
781 SCpnt->SCp.this_residual -= res; in nsp_pio_read()
786 if (SCpnt->SCp.this_residual == 0 && in nsp_pio_read()
787 SCpnt->SCp.buffers_residual != 0 ) { in nsp_pio_read()
789 SCpnt->SCp.buffers_residual--; in nsp_pio_read()
790 SCpnt->SCp.buffer = sg_next(SCpnt->SCp.buffer); in nsp_pio_read()
791 SCpnt->SCp.ptr = BUFFER_ADDR; in nsp_pio_read()
792 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; in nsp_pio_read()
803 scsi_get_resid(SCpnt), SCpnt->SCp.this_residual, in nsp_pio_read()
804 SCpnt->SCp.buffers_residual); in nsp_pio_read()
808 scsi_get_resid(SCpnt)); in nsp_pio_read()
814 static void nsp_pio_write(struct scsi_cmnd *SCpnt) in nsp_pio_write() argument
816 unsigned int base = SCpnt->device->host->io_port; in nsp_pio_write()
817 unsigned long mmio_base = SCpnt->device->host->base; in nsp_pio_write()
818 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_pio_write()
826 data->FifoCount, SCpnt->SCp.ptr, SCpnt->SCp.this_residual, in nsp_pio_write()
827 SCpnt->SCp.buffer, SCpnt->SCp.buffers_residual, in nsp_pio_write()
828 scsi_get_resid(SCpnt)); in nsp_pio_write()
833 (SCpnt->SCp.this_residual > 0 || SCpnt->SCp.buffers_residual > 0)) { in nsp_pio_write()
838 res = ocount - nsp_fifo_count(SCpnt); in nsp_pio_write()
842 nsp_inc_resid(SCpnt, res); in nsp_pio_write()
843 SCpnt->SCp.ptr -= res; in nsp_pio_write()
844 SCpnt->SCp.this_residual += res; in nsp_pio_write()
850 res = ocount - nsp_fifo_count(SCpnt); in nsp_pio_write()
856 res = min(SCpnt->SCp.this_residual, WFIFO_CRIT); in nsp_pio_write()
862 nsp_fifo32_write(base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_write()
865 nsp_fifo8_write (base, SCpnt->SCp.ptr, res ); in nsp_pio_write()
870 nsp_mmio_fifo32_write(mmio_base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_write()
878 nsp_inc_resid(SCpnt, -res); in nsp_pio_write()
879 SCpnt->SCp.ptr += res; in nsp_pio_write()
880 SCpnt->SCp.this_residual -= res; in nsp_pio_write()
884 if (SCpnt->SCp.this_residual == 0 && in nsp_pio_write()
885 SCpnt->SCp.buffers_residual != 0 ) { in nsp_pio_write()
887 SCpnt->SCp.buffers_residual--; in nsp_pio_write()
888 SCpnt->SCp.buffer = sg_next(SCpnt->SCp.buffer); in nsp_pio_write()
889 SCpnt->SCp.ptr = BUFFER_ADDR; in nsp_pio_write()
890 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; in nsp_pio_write()
899 scsi_get_resid(SCpnt)); in nsp_pio_write()
903 scsi_get_resid(SCpnt)); in nsp_pio_write()
911 static int nsp_nexus(struct scsi_cmnd *SCpnt) in nsp_nexus() argument
913 unsigned int base = SCpnt->device->host->io_port; in nsp_nexus()
914 unsigned char target = scmd_id(SCpnt); in nsp_nexus()
916 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_nexus()
925 if (scsi_get_resid(SCpnt) % 4 != 0 || in nsp_nexus()
926 scsi_get_resid(SCpnt) <= PAGE_SIZE ) { in nsp_nexus()
1476 static int nsp_eh_bus_reset(struct scsi_cmnd *SCpnt) in nsp_eh_bus_reset() argument
1478 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_eh_bus_reset()
1480 nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt); in nsp_eh_bus_reset()
1485 static int nsp_eh_host_reset(struct scsi_cmnd *SCpnt) in nsp_eh_host_reset() argument
1487 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_eh_host_reset()