Lines Matching refs:SCpnt
134 static inline void nsp_inc_resid(struct scsi_cmnd *SCpnt, int residInc) in nsp_inc_resid() argument
136 scsi_set_resid(SCpnt, scsi_get_resid(SCpnt) + residInc); in nsp_inc_resid()
177 static void nsp_scsi_done(struct scsi_cmnd *SCpnt) in nsp_scsi_done() argument
179 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_scsi_done()
183 SCpnt->scsi_done(SCpnt); in nsp_scsi_done()
186 static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt, in nsp_queuecommand_lck() argument
192 unsigned char target = scmd_id(SCpnt); in nsp_queuecommand_lck()
194 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_queuecommand_lck()
198 SCpnt, target, SCpnt->device->lun, scsi_sglist(SCpnt), in nsp_queuecommand_lck()
199 scsi_bufflen(SCpnt), scsi_sg_count(SCpnt)); in nsp_queuecommand_lck()
202 SCpnt->scsi_done = done; in nsp_queuecommand_lck()
206 SCpnt->result = DID_BAD_TARGET << 16; in nsp_queuecommand_lck()
207 nsp_scsi_done(SCpnt); in nsp_queuecommand_lck()
216 SCpnt->result = DID_BAD_TARGET << 16; in nsp_queuecommand_lck()
217 nsp_scsi_done(SCpnt); in nsp_queuecommand_lck()
222 show_command(SCpnt); in nsp_queuecommand_lck()
224 data->CurrentSC = SCpnt; in nsp_queuecommand_lck()
226 SCpnt->SCp.Status = CHECK_CONDITION; in nsp_queuecommand_lck()
227 SCpnt->SCp.Message = 0; in nsp_queuecommand_lck()
228 SCpnt->SCp.have_data_in = IO_UNKNOWN; in nsp_queuecommand_lck()
229 SCpnt->SCp.sent_command = 0; in nsp_queuecommand_lck()
230 SCpnt->SCp.phase = PH_UNDETERMINED; in nsp_queuecommand_lck()
231 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt)); in nsp_queuecommand_lck()
239 if (scsi_bufflen(SCpnt)) { in nsp_queuecommand_lck()
240 SCpnt->SCp.buffer = scsi_sglist(SCpnt); in nsp_queuecommand_lck()
241 SCpnt->SCp.ptr = BUFFER_ADDR; in nsp_queuecommand_lck()
242 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; in nsp_queuecommand_lck()
243 SCpnt->SCp.buffers_residual = scsi_sg_count(SCpnt) - 1; in nsp_queuecommand_lck()
245 SCpnt->SCp.ptr = NULL; in nsp_queuecommand_lck()
246 SCpnt->SCp.this_residual = 0; in nsp_queuecommand_lck()
247 SCpnt->SCp.buffer = NULL; in nsp_queuecommand_lck()
248 SCpnt->SCp.buffers_residual = 0; in nsp_queuecommand_lck()
251 if (nsphw_start_selection(SCpnt) == FALSE) { in nsp_queuecommand_lck()
253 SCpnt->result = DID_BUS_BUSY << 16; in nsp_queuecommand_lck()
254 nsp_scsi_done(SCpnt); in nsp_queuecommand_lck()
364 static int nsphw_start_selection(struct scsi_cmnd *SCpnt) in nsphw_start_selection() argument
366 unsigned int host_id = SCpnt->device->host->this_id; in nsphw_start_selection()
367 unsigned int base = SCpnt->device->host->io_port; in nsphw_start_selection()
368 unsigned char target = scmd_id(SCpnt); in nsphw_start_selection()
369 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsphw_start_selection()
383 SCpnt->SCp.phase = PH_ARBSTART; in nsphw_start_selection()
403 SCpnt->SCp.phase = PH_SELSTART; in nsphw_start_selection()
414 nsp_start_timer(SCpnt, 1000/51); in nsphw_start_selection()
445 static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt) in nsp_analyze_sdtr() argument
447 unsigned char target = scmd_id(SCpnt); in nsp_analyze_sdtr()
449 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_analyze_sdtr()
503 static void nsp_start_timer(struct scsi_cmnd *SCpnt, int time) in nsp_start_timer() argument
505 unsigned int base = SCpnt->device->host->io_port; in nsp_start_timer()
506 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_start_timer()
516 static int nsp_negate_signal(struct scsi_cmnd *SCpnt, unsigned char mask, in nsp_negate_signal() argument
519 unsigned int base = SCpnt->device->host->io_port; in nsp_negate_signal()
544 static int nsp_expect_signal(struct scsi_cmnd *SCpnt, in nsp_expect_signal() argument
548 unsigned int base = SCpnt->device->host->io_port; in nsp_expect_signal()
579 static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase) in nsp_xfer() argument
581 unsigned int base = SCpnt->device->host->io_port; in nsp_xfer()
582 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_xfer()
591 ret = nsp_expect_signal(SCpnt, phase, BUSMON_REQ); in nsp_xfer()
598 if (len == 1 && SCpnt->SCp.phase == PH_MSG_OUT) { in nsp_xfer()
610 nsp_negate_signal(SCpnt, BUSMON_ACK, "xfer<ack>"); in nsp_xfer()
619 static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt) in nsp_dataphase_bypass() argument
621 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_dataphase_bypass()
626 if (SCpnt->SCp.have_data_in != IO_IN) { in nsp_dataphase_bypass()
630 count = nsp_fifo_count(SCpnt); in nsp_dataphase_bypass()
641 SCpnt->SCp.phase = PH_DATA; in nsp_dataphase_bypass()
642 nsp_pio_read(SCpnt); in nsp_dataphase_bypass()
651 static int nsp_reselected(struct scsi_cmnd *SCpnt) in nsp_reselected() argument
653 unsigned int base = SCpnt->device->host->io_port; in nsp_reselected()
654 unsigned int host_id = SCpnt->device->host->this_id; in nsp_reselected()
673 if (scmd_id(SCpnt) != target) { in nsp_reselected()
677 nsp_negate_signal(SCpnt, BUSMON_SEL, "reselect<SEL>"); in nsp_reselected()
679 nsp_nexus(SCpnt); in nsp_reselected()
690 static int nsp_fifo_count(struct scsi_cmnd *SCpnt) in nsp_fifo_count() argument
692 unsigned int base = SCpnt->device->host->io_port; in nsp_fifo_count()
717 static void nsp_pio_read(struct scsi_cmnd *SCpnt) in nsp_pio_read() argument
719 unsigned int base = SCpnt->device->host->io_port; in nsp_pio_read()
720 unsigned long mmio_base = SCpnt->device->host->base; in nsp_pio_read()
721 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_pio_read()
729 SCpnt, scsi_get_resid(SCpnt), ocount, SCpnt->SCp.ptr, in nsp_pio_read()
730 SCpnt->SCp.this_residual, SCpnt->SCp.buffer, in nsp_pio_read()
731 SCpnt->SCp.buffers_residual); in nsp_pio_read()
736 (SCpnt->SCp.this_residual > 0 || SCpnt->SCp.buffers_residual > 0 ) ) { in nsp_pio_read()
742 res = nsp_fifo_count(SCpnt) - ocount; in nsp_pio_read()
760 res = min(res, SCpnt->SCp.this_residual); in nsp_pio_read()
765 nsp_fifo32_read(base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_read()
768 nsp_fifo8_read (base, SCpnt->SCp.ptr, res ); in nsp_pio_read()
773 nsp_mmio_fifo32_read(mmio_base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_read()
781 nsp_inc_resid(SCpnt, -res); in nsp_pio_read()
782 SCpnt->SCp.ptr += res; in nsp_pio_read()
783 SCpnt->SCp.this_residual -= res; in nsp_pio_read()
788 if (SCpnt->SCp.this_residual == 0 && in nsp_pio_read()
789 SCpnt->SCp.buffers_residual != 0 ) { in nsp_pio_read()
791 SCpnt->SCp.buffers_residual--; in nsp_pio_read()
792 SCpnt->SCp.buffer++; in nsp_pio_read()
793 SCpnt->SCp.ptr = BUFFER_ADDR; in nsp_pio_read()
794 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; in nsp_pio_read()
805 scsi_get_resid(SCpnt), SCpnt->SCp.this_residual, in nsp_pio_read()
806 SCpnt->SCp.buffers_residual); in nsp_pio_read()
810 scsi_get_resid(SCpnt)); in nsp_pio_read()
816 static void nsp_pio_write(struct scsi_cmnd *SCpnt) in nsp_pio_write() argument
818 unsigned int base = SCpnt->device->host->io_port; in nsp_pio_write()
819 unsigned long mmio_base = SCpnt->device->host->base; in nsp_pio_write()
820 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_pio_write()
828 data->FifoCount, SCpnt->SCp.ptr, SCpnt->SCp.this_residual, in nsp_pio_write()
829 SCpnt->SCp.buffer, SCpnt->SCp.buffers_residual, in nsp_pio_write()
830 scsi_get_resid(SCpnt)); in nsp_pio_write()
835 (SCpnt->SCp.this_residual > 0 || SCpnt->SCp.buffers_residual > 0)) { in nsp_pio_write()
840 res = ocount - nsp_fifo_count(SCpnt); in nsp_pio_write()
844 nsp_inc_resid(SCpnt, res); in nsp_pio_write()
845 SCpnt->SCp.ptr -= res; in nsp_pio_write()
846 SCpnt->SCp.this_residual += res; in nsp_pio_write()
852 res = ocount - nsp_fifo_count(SCpnt); in nsp_pio_write()
858 res = min(SCpnt->SCp.this_residual, WFIFO_CRIT); in nsp_pio_write()
864 nsp_fifo32_write(base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_write()
867 nsp_fifo8_write (base, SCpnt->SCp.ptr, res ); in nsp_pio_write()
872 nsp_mmio_fifo32_write(mmio_base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_write()
880 nsp_inc_resid(SCpnt, -res); in nsp_pio_write()
881 SCpnt->SCp.ptr += res; in nsp_pio_write()
882 SCpnt->SCp.this_residual -= res; in nsp_pio_write()
886 if (SCpnt->SCp.this_residual == 0 && in nsp_pio_write()
887 SCpnt->SCp.buffers_residual != 0 ) { in nsp_pio_write()
889 SCpnt->SCp.buffers_residual--; in nsp_pio_write()
890 SCpnt->SCp.buffer++; in nsp_pio_write()
891 SCpnt->SCp.ptr = BUFFER_ADDR; in nsp_pio_write()
892 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; in nsp_pio_write()
901 scsi_get_resid(SCpnt)); in nsp_pio_write()
905 scsi_get_resid(SCpnt)); in nsp_pio_write()
913 static int nsp_nexus(struct scsi_cmnd *SCpnt) in nsp_nexus() argument
915 unsigned int base = SCpnt->device->host->io_port; in nsp_nexus()
916 unsigned char target = scmd_id(SCpnt); in nsp_nexus()
918 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_nexus()
927 if (scsi_get_resid(SCpnt) % 4 != 0 || in nsp_nexus()
928 scsi_get_resid(SCpnt) <= PAGE_SIZE ) { in nsp_nexus()
1479 static int nsp_eh_bus_reset(struct scsi_cmnd *SCpnt) in nsp_eh_bus_reset() argument
1481 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_eh_bus_reset()
1483 nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt); in nsp_eh_bus_reset()
1488 static int nsp_eh_host_reset(struct scsi_cmnd *SCpnt) in nsp_eh_host_reset() argument
1490 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_eh_host_reset()