Lines Matching refs:SCpnt
362 static void nsp32_build_identify(struct scsi_cmnd *SCpnt)
364 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
373 data->msgoutbuf[pos] = IDENTIFY(mode, SCpnt->device->lun); pos++;
381 static void nsp32_build_sdtr(struct scsi_cmnd *SCpnt,
385 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
400 static void nsp32_build_nop(struct scsi_cmnd *SCpnt)
402 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
418 static void nsp32_build_reject(struct scsi_cmnd *SCpnt)
420 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
431 static void nsp32_start_timer(struct scsi_cmnd *SCpnt, int time)
433 unsigned int base = SCpnt->host->io_port;
449 static int nsp32_selection_autopara(struct scsi_cmnd *SCpnt)
451 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
452 unsigned int base = SCpnt->device->host->io_port;
453 unsigned int host_id = SCpnt->device->host->this_id;
454 unsigned char target = scmd_id(SCpnt);
470 SCpnt->result = DID_BUS_BUSY << 16;
482 SCpnt->result = DID_ERROR << 16;
513 for (i = 0; i < SCpnt->cmd_len; i++) {
514 param->cdb[4 * i] = SCpnt->cmnd[i];
572 ret = nsp32_arbitration(SCpnt, base);
581 static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
583 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
584 unsigned int base = SCpnt->device->host->io_port;
585 unsigned int host_id = SCpnt->device->host->this_id;
586 unsigned char target = scmd_id(SCpnt);
606 SCpnt->result = DID_BUS_BUSY << 16;
624 for (i = 0; i < SCpnt->cmd_len; i++) {
625 nsp32_write1(base, COMMAND_DATA, SCpnt->cmnd[i]);
627 nsp32_dbg(NSP32_DEBUG_CDB_CONTENTS, "CDB[0]=[0x%x]", SCpnt->cmnd[0]);
643 SCpnt->result = DID_ERROR << 16;
714 if (scsi_bufflen(SCpnt) > 0) {
737 status = nsp32_arbitration(SCpnt, base);
757 static int nsp32_arbitration(struct scsi_cmnd *SCpnt, unsigned int base)
774 SCpnt->result = DID_OK << 16;
778 SCpnt->result = DID_BUS_BUSY << 16;
786 SCpnt->result = DID_NO_CONNECT << 16;
806 static int nsp32_reselection(struct scsi_cmnd *SCpnt, unsigned char newlun)
808 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
809 unsigned int host_id = SCpnt->device->host->this_id;
810 unsigned int base = SCpnt->device->host->io_port;
838 } else if(data->lunt[newid][newlun].SCpnt == NULL) {
861 static int nsp32_setup_sg_table(struct scsi_cmnd *SCpnt)
863 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
874 num = scsi_dma_map(SCpnt);
880 scsi_for_each_sg(SCpnt, sg, num, i) {
908 static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt)
911 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
919 SCpnt->device->id, SCpnt->device->lun, SCpnt->cmnd[0],
920 SCpnt->cmd_len, scsi_sg_count(SCpnt), scsi_sglist(SCpnt),
921 scsi_bufflen(SCpnt));
926 SCpnt->result = DID_NO_CONNECT << 16;
927 done(SCpnt);
932 if (scmd_id(SCpnt) == SCpnt->device->host->this_id) {
934 SCpnt->result = DID_BAD_TARGET << 16;
935 done(SCpnt);
940 if (SCpnt->device->lun >= MAX_LUN) {
942 SCpnt->result = DID_BAD_TARGET << 16;
943 done(SCpnt);
947 show_command(SCpnt);
949 data->CurrentSC = SCpnt;
950 nsp32_priv(SCpnt)->status = SAM_STAT_CHECK_CONDITION;
951 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
956 cur_lunt = &(data->lunt[SCpnt->device->id][SCpnt->device->lun]);
957 cur_lunt->SCpnt = SCpnt;
961 data->cur_id = SCpnt->device->id;
962 data->cur_lun = SCpnt->device->lun;
964 ret = nsp32_setup_sg_table(SCpnt);
967 SCpnt->result = DID_ERROR << 16;
968 nsp32_scsi_done(SCpnt);
973 nsp32_build_identify(SCpnt);
980 target = &data->target[scmd_id(SCpnt)];
988 nsp32_build_sdtr(SCpnt, period, offset);
1026 SCpnt->device->id, target->sync_flag, target->syncreg,
1031 ret = nsp32_selection_autopara(SCpnt);
1033 ret = nsp32_selection_autoscsi(SCpnt);
1038 nsp32_scsi_done(SCpnt);
1160 struct scsi_cmnd *SCpnt = data->CurrentSC;
1193 SCpnt->result = DID_BAD_TARGET << 16;
1194 nsp32_scsi_done(SCpnt);
1210 if (SCpnt != NULL) {
1211 SCpnt->result = DID_RESET << 16;
1212 nsp32_scsi_done(SCpnt);
1217 if (SCpnt == NULL) {
1218 nsp32_msg(KERN_WARNING, "SCpnt==NULL this can't be happened");
1240 SCpnt->result = DID_TIME_OUT << 16;
1241 nsp32_scsi_done(SCpnt);
1266 (scsi_get_resid(SCpnt) > 0) &&
1269 //nsp32_pio_read(SCpnt);
1287 scsi_set_resid(SCpnt, 0); /* all data transferred! */
1294 nsp32_msgin_occur(SCpnt, irq_stat, auto_stat);
1301 nsp32_msgout_occur(SCpnt);
1308 ret = nsp32_busfree_occur(SCpnt, auto_stat);
1316 * Read CSB and substitute CSB for SCpnt->result
1322 SCpnt->result = (int)nsp32_read1(base, SCSI_CSB_IN);
1361 //nsp32_pio_write(SCpnt);
1368 //nsp32_pio_read(SCpnt);
1375 nsp32_priv(SCpnt)->status = nsp32_read1(base, SCSI_CSB_IN);
1396 nsp32_msgin_occur(SCpnt, irq_stat, 0);
1526 * Be careful setting SCpnt->result = DID_* before calling this function.
1528 static void nsp32_scsi_done(struct scsi_cmnd *SCpnt)
1530 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1531 unsigned int base = SCpnt->device->host->io_port;
1533 scsi_dma_unmap(SCpnt);
1544 scsi_done(SCpnt);
1549 data->cur_lunt->SCpnt = NULL;
1566 static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)
1568 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1569 unsigned int base = SCpnt->device->host->io_port;
1627 nsp32_adjust_busfree(SCpnt, s_sacklen);
1686 nsp32_priv(SCpnt)->status = nsp32_read1(base, SCSI_CSB_IN);
1689 nsp32_priv(SCpnt)->status, scsi_get_resid(SCpnt));
1690 SCpnt->result = (DID_OK << 16) |
1691 (nsp32_priv(SCpnt)->status << 0);
1692 nsp32_scsi_done(SCpnt);
1697 nsp32_priv(SCpnt)->status = nsp32_read1(base, SCSI_CSB_IN);
1705 SCpnt->result = DID_ERROR << 16;
1706 nsp32_scsi_done(SCpnt);
1719 static void nsp32_adjust_busfree(struct scsi_cmnd *SCpnt, unsigned int s_sacklen)
1721 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1729 nsp32_dbg(NSP32_DEBUG_SGLIST, "old resid=0x%x", scsi_get_resid(SCpnt));
1775 if (scsi_get_resid(SCpnt) < sentlen) {
1779 scsi_set_resid(SCpnt, scsi_get_resid(SCpnt) - sentlen);
1780 nsp32_dbg(NSP32_DEBUG_SGLIST, "new resid=0x%x", scsi_get_resid(SCpnt));
1794 static void nsp32_msgout_occur(struct scsi_cmnd *SCpnt)
1796 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1797 unsigned int base = SCpnt->device->host->io_port;
1808 nsp32_build_nop(SCpnt);
1830 //nsp32_restart_autoscsi(SCpnt, command);
1860 static void nsp32_restart_autoscsi(struct scsi_cmnd *SCpnt, unsigned short command)
1862 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1899 if (scsi_bufflen(SCpnt) > 0) {
1926 static void nsp32_msgin_occur(struct scsi_cmnd *SCpnt,
1930 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1931 unsigned int base = SCpnt->device->host->io_port;
1971 ret = nsp32_reselection(SCpnt, newlun);
2008 nsp32_adjust_busfree(SCpnt, s_sacklen);
2133 nsp32_analyze_sdtr(SCpnt);
2193 nsp32_restart_autoscsi(SCpnt, command);
2214 nsp32_build_reject(SCpnt);
2223 static void nsp32_analyze_sdtr(struct scsi_cmnd *SCpnt)
2225 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
2322 nsp32_build_sdtr(SCpnt, 0, ASYNC_OFFSET);
2325 nsp32_build_sdtr(SCpnt, get_period, get_offset);
2338 nsp32_build_reject(SCpnt);
2660 .SCpnt = NULL,
2809 static int nsp32_eh_abort(struct scsi_cmnd *SCpnt)
2811 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
2812 unsigned int base = SCpnt->device->host->io_port;
2816 if (data->cur_lunt->SCpnt == NULL) {
2830 SCpnt->result = DID_ABORT << 16;
2831 nsp32_scsi_done(SCpnt);
2879 static int nsp32_eh_host_reset(struct scsi_cmnd *SCpnt)
2881 struct Scsi_Host *host = SCpnt->device->host;
2882 unsigned int base = SCpnt->device->host->io_port;
2886 nsp32_dbg(NSP32_DEBUG_BUSRESET, "SCpnt=0x%x", SCpnt);
2888 spin_lock_irq(SCpnt->device->host->host_lock);
2895 spin_unlock_irq(SCpnt->device->host->host_lock);