Lines Matching refs:SCpnt
132 static inline void nsp_inc_resid(struct scsi_cmnd *SCpnt, int residInc)
134 scsi_set_resid(SCpnt, scsi_get_resid(SCpnt) + residInc);
174 * You must be set SCpnt->result before call this function.
176 static void nsp_scsi_done(struct scsi_cmnd *SCpnt)
178 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
182 SCpnt->scsi_done(SCpnt);
185 static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt,
189 /*unsigned int host_id = SCpnt->device->host->this_id;*/
190 /*unsigned int base = SCpnt->device->host->io_port;*/
191 unsigned char target = scmd_id(SCpnt);
193 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
196 "SCpnt=0x%p target=%d lun=%llu sglist=0x%p bufflen=%d sg_count=%d",
197 SCpnt, target, SCpnt->device->lun, scsi_sglist(SCpnt),
198 scsi_bufflen(SCpnt), scsi_sg_count(SCpnt));
201 SCpnt->scsi_done = done;
205 SCpnt->result = DID_BAD_TARGET << 16;
206 nsp_scsi_done(SCpnt);
215 SCpnt->result = DID_BAD_TARGET << 16;
216 nsp_scsi_done(SCpnt);
221 show_command(SCpnt);
223 data->CurrentSC = SCpnt;
225 SCpnt->SCp.Status = CHECK_CONDITION;
226 SCpnt->SCp.Message = 0;
227 SCpnt->SCp.have_data_in = IO_UNKNOWN;
228 SCpnt->SCp.sent_command = 0;
229 SCpnt->SCp.phase = PH_UNDETERMINED;
230 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
238 if (scsi_bufflen(SCpnt)) {
239 SCpnt->SCp.buffer = scsi_sglist(SCpnt);
240 SCpnt->SCp.ptr = BUFFER_ADDR;
241 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
242 SCpnt->SCp.buffers_residual = scsi_sg_count(SCpnt) - 1;
244 SCpnt->SCp.ptr = NULL;
245 SCpnt->SCp.this_residual = 0;
246 SCpnt->SCp.buffer = NULL;
247 SCpnt->SCp.buffers_residual = 0;
250 if (nsphw_start_selection(SCpnt) == FALSE) {
252 SCpnt->result = DID_BUS_BUSY << 16;
253 nsp_scsi_done(SCpnt);
363 static int nsphw_start_selection(struct scsi_cmnd *SCpnt)
365 unsigned int host_id = SCpnt->device->host->this_id;
366 unsigned int base = SCpnt->device->host->io_port;
367 unsigned char target = scmd_id(SCpnt);
368 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
382 SCpnt->SCp.phase = PH_ARBSTART;
402 SCpnt->SCp.phase = PH_SELSTART;
413 nsp_start_timer(SCpnt, 1000/51);
444 static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt)
446 unsigned char target = scmd_id(SCpnt);
447 // unsigned char lun = SCpnt->device->lun;
448 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
502 static void nsp_start_timer(struct scsi_cmnd *SCpnt, int time)
504 unsigned int base = SCpnt->device->host->io_port;
505 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
507 //nsp_dbg(NSP_DEBUG_INTR, "in SCpnt=0x%p, time=%d", SCpnt, time);
515 static int nsp_negate_signal(struct scsi_cmnd *SCpnt, unsigned char mask,
518 unsigned int base = SCpnt->device->host->io_port;
543 static int nsp_expect_signal(struct scsi_cmnd *SCpnt,
547 unsigned int base = SCpnt->device->host->io_port;
578 static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase)
580 unsigned int base = SCpnt->device->host->io_port;
581 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
590 ret = nsp_expect_signal(SCpnt, phase, BUSMON_REQ);
597 if (len == 1 && SCpnt->SCp.phase == PH_MSG_OUT) {
609 nsp_negate_signal(SCpnt, BUSMON_ACK, "xfer<ack>");
618 static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt)
620 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
625 if (SCpnt->SCp.have_data_in != IO_IN) {
629 count = nsp_fifo_count(SCpnt);
640 SCpnt->SCp.phase = PH_DATA;
641 nsp_pio_read(SCpnt);
650 static int nsp_reselected(struct scsi_cmnd *SCpnt)
652 unsigned int base = SCpnt->device->host->io_port;
653 unsigned int host_id = SCpnt->device->host->this_id;
654 //nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
672 if (scmd_id(SCpnt) != target) {
676 nsp_negate_signal(SCpnt, BUSMON_SEL, "reselect<SEL>");
678 nsp_nexus(SCpnt);
689 static int nsp_fifo_count(struct scsi_cmnd *SCpnt)
691 unsigned int base = SCpnt->device->host->io_port;
716 static void nsp_pio_read(struct scsi_cmnd *SCpnt)
718 unsigned int base = SCpnt->device->host->io_port;
719 unsigned long mmio_base = SCpnt->device->host->base;
720 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
727 nsp_dbg(NSP_DEBUG_DATA_IO, "in SCpnt=0x%p resid=%d ocount=%d ptr=0x%p this_residual=%d buffers=0x%p nbuf=%d",
728 SCpnt, scsi_get_resid(SCpnt), ocount, SCpnt->SCp.ptr,
729 SCpnt->SCp.this_residual, SCpnt->SCp.buffer,
730 SCpnt->SCp.buffers_residual);
735 (SCpnt->SCp.this_residual > 0 || SCpnt->SCp.buffers_residual > 0 ) ) {
741 res = nsp_fifo_count(SCpnt) - ocount;
742 //nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x ocount=0x%x res=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, ocount, res);
745 //nsp_dbg(NSP_DEBUG_DATA_IO, " wait for data this=%d", SCpnt->SCp.this_residual);
759 res = min(res, SCpnt->SCp.this_residual);
764 nsp_fifo32_read(base, SCpnt->SCp.ptr, res >> 2);
767 nsp_fifo8_read (base, SCpnt->SCp.ptr, res );
772 nsp_mmio_fifo32_read(mmio_base, SCpnt->SCp.ptr, res >> 2);
780 nsp_inc_resid(SCpnt, -res);
781 SCpnt->SCp.ptr += res;
782 SCpnt->SCp.this_residual -= res;
784 //nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this_residual=0x%x ocount=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, ocount);
787 if (SCpnt->SCp.this_residual == 0 &&
788 SCpnt->SCp.buffers_residual != 0 ) {
790 SCpnt->SCp.buffers_residual--;
791 SCpnt->SCp.buffer = sg_next(SCpnt->SCp.buffer);
792 SCpnt->SCp.ptr = BUFFER_ADDR;
793 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
796 //nsp_dbg(NSP_DEBUG_DATA_IO, "page: 0x%p, off: 0x%x", SCpnt->SCp.buffer->page, SCpnt->SCp.buffer->offset);
804 scsi_get_resid(SCpnt), SCpnt->SCp.this_residual,
805 SCpnt->SCp.buffers_residual);
809 scsi_get_resid(SCpnt));
815 static void nsp_pio_write(struct scsi_cmnd *SCpnt)
817 unsigned int base = SCpnt->device->host->io_port;
818 unsigned long mmio_base = SCpnt->device->host->base;
819 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
827 data->FifoCount, SCpnt->SCp.ptr, SCpnt->SCp.this_residual,
828 SCpnt->SCp.buffer, SCpnt->SCp.buffers_residual,
829 scsi_get_resid(SCpnt));
834 (SCpnt->SCp.this_residual > 0 || SCpnt->SCp.buffers_residual > 0)) {
839 res = ocount - nsp_fifo_count(SCpnt);
843 nsp_inc_resid(SCpnt, res);
844 SCpnt->SCp.ptr -= res;
845 SCpnt->SCp.this_residual += res;
851 res = ocount - nsp_fifo_count(SCpnt);
857 res = min(SCpnt->SCp.this_residual, WFIFO_CRIT);
859 //nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x res=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, res);
863 nsp_fifo32_write(base, SCpnt->SCp.ptr, res >> 2);
866 nsp_fifo8_write (base, SCpnt->SCp.ptr, res );
871 nsp_mmio_fifo32_write(mmio_base, SCpnt->SCp.ptr, res >> 2);
879 nsp_inc_resid(SCpnt, -res);
880 SCpnt->SCp.ptr += res;
881 SCpnt->SCp.this_residual -= res;
885 if (SCpnt->SCp.this_residual == 0 &&
886 SCpnt->SCp.buffers_residual != 0 ) {
888 SCpnt->SCp.buffers_residual--;
889 SCpnt->SCp.buffer = sg_next(SCpnt->SCp.buffer);
890 SCpnt->SCp.ptr = BUFFER_ADDR;
891 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
900 scsi_get_resid(SCpnt));
904 scsi_get_resid(SCpnt));
912 static int nsp_nexus(struct scsi_cmnd *SCpnt)
914 unsigned int base = SCpnt->device->host->io_port;
915 unsigned char target = scmd_id(SCpnt);
916 // unsigned char lun = SCpnt->device->lun;
917 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
920 //nsp_dbg(NSP_DEBUG_DATA_IO, "in SCpnt=0x%p", SCpnt);
926 if (scsi_get_resid(SCpnt) % 4 != 0 ||
927 scsi_get_resid(SCpnt) <= PAGE_SIZE ) {
1451 static int nsp_eh_abort(struct scsi_cmnd *SCpnt)
1453 nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt);
1455 return nsp_eh_bus_reset(SCpnt);
1479 static int nsp_eh_bus_reset(struct scsi_cmnd *SCpnt)
1481 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
1483 nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt);
1488 static int nsp_eh_host_reset(struct scsi_cmnd *SCpnt)
1490 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;