Lines Matching refs:SCpnt
135 static inline void nsp_inc_resid(struct scsi_cmnd *SCpnt, int residInc) in nsp_inc_resid() argument
137 scsi_set_resid(SCpnt, scsi_get_resid(SCpnt) + residInc); in nsp_inc_resid()
178 static void nsp_scsi_done(struct scsi_cmnd *SCpnt) in nsp_scsi_done() argument
180 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_scsi_done()
184 SCpnt->scsi_done(SCpnt); in nsp_scsi_done()
187 static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt, in nsp_queuecommand_lck() argument
193 unsigned char target = scmd_id(SCpnt); in nsp_queuecommand_lck()
195 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_queuecommand_lck()
199 SCpnt, target, SCpnt->device->lun, scsi_sglist(SCpnt), in nsp_queuecommand_lck()
200 scsi_bufflen(SCpnt), scsi_sg_count(SCpnt)); in nsp_queuecommand_lck()
203 SCpnt->scsi_done = done; in nsp_queuecommand_lck()
207 SCpnt->result = DID_BAD_TARGET << 16; in nsp_queuecommand_lck()
208 nsp_scsi_done(SCpnt); in nsp_queuecommand_lck()
217 SCpnt->result = DID_BAD_TARGET << 16; in nsp_queuecommand_lck()
218 nsp_scsi_done(SCpnt); in nsp_queuecommand_lck()
223 show_command(SCpnt); in nsp_queuecommand_lck()
225 data->CurrentSC = SCpnt; in nsp_queuecommand_lck()
227 SCpnt->SCp.Status = CHECK_CONDITION; in nsp_queuecommand_lck()
228 SCpnt->SCp.Message = 0; in nsp_queuecommand_lck()
229 SCpnt->SCp.have_data_in = IO_UNKNOWN; in nsp_queuecommand_lck()
230 SCpnt->SCp.sent_command = 0; in nsp_queuecommand_lck()
231 SCpnt->SCp.phase = PH_UNDETERMINED; in nsp_queuecommand_lck()
232 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt)); in nsp_queuecommand_lck()
240 if (scsi_bufflen(SCpnt)) { in nsp_queuecommand_lck()
241 SCpnt->SCp.buffer = scsi_sglist(SCpnt); in nsp_queuecommand_lck()
242 SCpnt->SCp.ptr = BUFFER_ADDR; in nsp_queuecommand_lck()
243 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; in nsp_queuecommand_lck()
244 SCpnt->SCp.buffers_residual = scsi_sg_count(SCpnt) - 1; in nsp_queuecommand_lck()
246 SCpnt->SCp.ptr = NULL; in nsp_queuecommand_lck()
247 SCpnt->SCp.this_residual = 0; in nsp_queuecommand_lck()
248 SCpnt->SCp.buffer = NULL; in nsp_queuecommand_lck()
249 SCpnt->SCp.buffers_residual = 0; in nsp_queuecommand_lck()
252 if (nsphw_start_selection(SCpnt) == FALSE) { in nsp_queuecommand_lck()
254 SCpnt->result = DID_BUS_BUSY << 16; in nsp_queuecommand_lck()
255 nsp_scsi_done(SCpnt); in nsp_queuecommand_lck()
365 static int nsphw_start_selection(struct scsi_cmnd *SCpnt) in nsphw_start_selection() argument
367 unsigned int host_id = SCpnt->device->host->this_id; in nsphw_start_selection()
368 unsigned int base = SCpnt->device->host->io_port; in nsphw_start_selection()
369 unsigned char target = scmd_id(SCpnt); in nsphw_start_selection()
370 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsphw_start_selection()
384 SCpnt->SCp.phase = PH_ARBSTART; in nsphw_start_selection()
404 SCpnt->SCp.phase = PH_SELSTART; in nsphw_start_selection()
415 nsp_start_timer(SCpnt, 1000/51); in nsphw_start_selection()
446 static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt) in nsp_analyze_sdtr() argument
448 unsigned char target = scmd_id(SCpnt); in nsp_analyze_sdtr()
450 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_analyze_sdtr()
504 static void nsp_start_timer(struct scsi_cmnd *SCpnt, int time) in nsp_start_timer() argument
506 unsigned int base = SCpnt->device->host->io_port; in nsp_start_timer()
507 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_start_timer()
517 static int nsp_negate_signal(struct scsi_cmnd *SCpnt, unsigned char mask, in nsp_negate_signal() argument
520 unsigned int base = SCpnt->device->host->io_port; in nsp_negate_signal()
545 static int nsp_expect_signal(struct scsi_cmnd *SCpnt, in nsp_expect_signal() argument
549 unsigned int base = SCpnt->device->host->io_port; in nsp_expect_signal()
580 static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase) in nsp_xfer() argument
582 unsigned int base = SCpnt->device->host->io_port; in nsp_xfer()
583 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_xfer()
592 ret = nsp_expect_signal(SCpnt, phase, BUSMON_REQ); in nsp_xfer()
599 if (len == 1 && SCpnt->SCp.phase == PH_MSG_OUT) { in nsp_xfer()
611 nsp_negate_signal(SCpnt, BUSMON_ACK, "xfer<ack>"); in nsp_xfer()
620 static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt) in nsp_dataphase_bypass() argument
622 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_dataphase_bypass()
627 if (SCpnt->SCp.have_data_in != IO_IN) { in nsp_dataphase_bypass()
631 count = nsp_fifo_count(SCpnt); in nsp_dataphase_bypass()
642 SCpnt->SCp.phase = PH_DATA; in nsp_dataphase_bypass()
643 nsp_pio_read(SCpnt); in nsp_dataphase_bypass()
652 static int nsp_reselected(struct scsi_cmnd *SCpnt) in nsp_reselected() argument
654 unsigned int base = SCpnt->device->host->io_port; in nsp_reselected()
655 unsigned int host_id = SCpnt->device->host->this_id; in nsp_reselected()
674 if (scmd_id(SCpnt) != target) { in nsp_reselected()
678 nsp_negate_signal(SCpnt, BUSMON_SEL, "reselect<SEL>"); in nsp_reselected()
680 nsp_nexus(SCpnt); in nsp_reselected()
691 static int nsp_fifo_count(struct scsi_cmnd *SCpnt) in nsp_fifo_count() argument
693 unsigned int base = SCpnt->device->host->io_port; in nsp_fifo_count()
718 static void nsp_pio_read(struct scsi_cmnd *SCpnt) in nsp_pio_read() argument
720 unsigned int base = SCpnt->device->host->io_port; in nsp_pio_read()
721 unsigned long mmio_base = SCpnt->device->host->base; in nsp_pio_read()
722 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_pio_read()
730 SCpnt, scsi_get_resid(SCpnt), ocount, SCpnt->SCp.ptr, in nsp_pio_read()
731 SCpnt->SCp.this_residual, SCpnt->SCp.buffer, in nsp_pio_read()
732 SCpnt->SCp.buffers_residual); in nsp_pio_read()
737 (SCpnt->SCp.this_residual > 0 || SCpnt->SCp.buffers_residual > 0 ) ) { in nsp_pio_read()
743 res = nsp_fifo_count(SCpnt) - ocount; in nsp_pio_read()
761 res = min(res, SCpnt->SCp.this_residual); in nsp_pio_read()
766 nsp_fifo32_read(base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_read()
769 nsp_fifo8_read (base, SCpnt->SCp.ptr, res ); in nsp_pio_read()
774 nsp_mmio_fifo32_read(mmio_base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_read()
782 nsp_inc_resid(SCpnt, -res); in nsp_pio_read()
783 SCpnt->SCp.ptr += res; in nsp_pio_read()
784 SCpnt->SCp.this_residual -= res; in nsp_pio_read()
789 if (SCpnt->SCp.this_residual == 0 && in nsp_pio_read()
790 SCpnt->SCp.buffers_residual != 0 ) { in nsp_pio_read()
792 SCpnt->SCp.buffers_residual--; in nsp_pio_read()
793 SCpnt->SCp.buffer++; in nsp_pio_read()
794 SCpnt->SCp.ptr = BUFFER_ADDR; in nsp_pio_read()
795 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; in nsp_pio_read()
806 scsi_get_resid(SCpnt), SCpnt->SCp.this_residual, in nsp_pio_read()
807 SCpnt->SCp.buffers_residual); in nsp_pio_read()
811 scsi_get_resid(SCpnt)); in nsp_pio_read()
817 static void nsp_pio_write(struct scsi_cmnd *SCpnt) in nsp_pio_write() argument
819 unsigned int base = SCpnt->device->host->io_port; in nsp_pio_write()
820 unsigned long mmio_base = SCpnt->device->host->base; in nsp_pio_write()
821 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_pio_write()
829 data->FifoCount, SCpnt->SCp.ptr, SCpnt->SCp.this_residual, in nsp_pio_write()
830 SCpnt->SCp.buffer, SCpnt->SCp.buffers_residual, in nsp_pio_write()
831 scsi_get_resid(SCpnt)); in nsp_pio_write()
836 (SCpnt->SCp.this_residual > 0 || SCpnt->SCp.buffers_residual > 0)) { in nsp_pio_write()
841 res = ocount - nsp_fifo_count(SCpnt); in nsp_pio_write()
845 nsp_inc_resid(SCpnt, res); in nsp_pio_write()
846 SCpnt->SCp.ptr -= res; in nsp_pio_write()
847 SCpnt->SCp.this_residual += res; in nsp_pio_write()
853 res = ocount - nsp_fifo_count(SCpnt); in nsp_pio_write()
859 res = min(SCpnt->SCp.this_residual, WFIFO_CRIT); in nsp_pio_write()
865 nsp_fifo32_write(base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_write()
868 nsp_fifo8_write (base, SCpnt->SCp.ptr, res ); in nsp_pio_write()
873 nsp_mmio_fifo32_write(mmio_base, SCpnt->SCp.ptr, res >> 2); in nsp_pio_write()
881 nsp_inc_resid(SCpnt, -res); in nsp_pio_write()
882 SCpnt->SCp.ptr += res; in nsp_pio_write()
883 SCpnt->SCp.this_residual -= res; in nsp_pio_write()
887 if (SCpnt->SCp.this_residual == 0 && in nsp_pio_write()
888 SCpnt->SCp.buffers_residual != 0 ) { in nsp_pio_write()
890 SCpnt->SCp.buffers_residual--; in nsp_pio_write()
891 SCpnt->SCp.buffer++; in nsp_pio_write()
892 SCpnt->SCp.ptr = BUFFER_ADDR; in nsp_pio_write()
893 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; in nsp_pio_write()
902 scsi_get_resid(SCpnt)); in nsp_pio_write()
906 scsi_get_resid(SCpnt)); in nsp_pio_write()
914 static int nsp_nexus(struct scsi_cmnd *SCpnt) in nsp_nexus() argument
916 unsigned int base = SCpnt->device->host->io_port; in nsp_nexus()
917 unsigned char target = scmd_id(SCpnt); in nsp_nexus()
919 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_nexus()
928 if (scsi_get_resid(SCpnt) % 4 != 0 || in nsp_nexus()
929 scsi_get_resid(SCpnt) <= PAGE_SIZE ) { in nsp_nexus()
1480 static int nsp_eh_bus_reset(struct scsi_cmnd *SCpnt) in nsp_eh_bus_reset() argument
1482 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_eh_bus_reset()
1484 nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt); in nsp_eh_bus_reset()
1489 static int nsp_eh_host_reset(struct scsi_cmnd *SCpnt) in nsp_eh_host_reset() argument
1491 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; in nsp_eh_host_reset()