Lines Matching refs:SCpnt
355 static void nsp32_build_identify(struct scsi_cmnd *SCpnt)
357 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
366 data->msgoutbuf[pos] = IDENTIFY(mode, SCpnt->device->lun); pos++;
374 static void nsp32_build_sdtr(struct scsi_cmnd *SCpnt,
378 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
393 static void nsp32_build_nop(struct scsi_cmnd *SCpnt)
395 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
411 static void nsp32_build_reject(struct scsi_cmnd *SCpnt)
413 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
424 static void nsp32_start_timer(struct scsi_cmnd *SCpnt, int time)
426 unsigned int base = SCpnt->host->io_port;
442 static int nsp32_selection_autopara(struct scsi_cmnd *SCpnt)
444 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
445 unsigned int base = SCpnt->device->host->io_port;
446 unsigned int host_id = SCpnt->device->host->this_id;
447 unsigned char target = scmd_id(SCpnt);
463 SCpnt->result = DID_BUS_BUSY << 16;
475 SCpnt->result = DID_ERROR << 16;
505 for (i = 0; i < SCpnt->cmd_len; i++) {
506 param->cdb[4 * i] = SCpnt->cmnd[i];
564 ret = nsp32_arbitration(SCpnt, base);
573 static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
575 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
576 unsigned int base = SCpnt->device->host->io_port;
577 unsigned int host_id = SCpnt->device->host->this_id;
578 unsigned char target = scmd_id(SCpnt);
599 SCpnt->result = DID_BUS_BUSY << 16;
617 for (i = 0; i < SCpnt->cmd_len; i++) {
618 nsp32_write1(base, COMMAND_DATA, SCpnt->cmnd[i]);
620 nsp32_dbg(NSP32_DEBUG_CDB_CONTENTS, "CDB[0]=[0x%x]", SCpnt->cmnd[0]);
635 SCpnt->result = DID_ERROR << 16;
705 if (scsi_bufflen(SCpnt) > 0) {
728 status = nsp32_arbitration(SCpnt, base);
748 static int nsp32_arbitration(struct scsi_cmnd *SCpnt, unsigned int base)
765 SCpnt->result = DID_OK << 16;
769 SCpnt->result = DID_BUS_BUSY << 16;
777 SCpnt->result = DID_NO_CONNECT << 16;
797 static int nsp32_reselection(struct scsi_cmnd *SCpnt, unsigned char newlun)
799 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
800 unsigned int host_id = SCpnt->device->host->this_id;
801 unsigned int base = SCpnt->device->host->io_port;
828 } else if(data->lunt[newid][newlun].SCpnt == NULL) {
851 static int nsp32_setup_sg_table(struct scsi_cmnd *SCpnt)
853 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
864 num = scsi_dma_map(SCpnt);
870 scsi_for_each_sg(SCpnt, sg, num, i) {
897 static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
899 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
907 SCpnt->device->id, SCpnt->device->lun, SCpnt->cmnd[0], SCpnt->cmd_len,
908 scsi_sg_count(SCpnt), scsi_sglist(SCpnt), scsi_bufflen(SCpnt));
913 SCpnt->result = DID_NO_CONNECT << 16;
914 done(SCpnt);
919 if (scmd_id(SCpnt) == SCpnt->device->host->this_id) {
921 SCpnt->result = DID_BAD_TARGET << 16;
922 done(SCpnt);
927 if (SCpnt->device->lun >= MAX_LUN) {
929 SCpnt->result = DID_BAD_TARGET << 16;
930 done(SCpnt);
934 show_command(SCpnt);
936 SCpnt->scsi_done = done;
937 data->CurrentSC = SCpnt;
938 SCpnt->SCp.Status = CHECK_CONDITION;
939 SCpnt->SCp.Message = 0;
940 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
942 SCpnt->SCp.ptr = (char *)scsi_sglist(SCpnt);
943 SCpnt->SCp.this_residual = scsi_bufflen(SCpnt);
944 SCpnt->SCp.buffer = NULL;
945 SCpnt->SCp.buffers_residual = 0;
950 cur_lunt = &(data->lunt[SCpnt->device->id][SCpnt->device->lun]);
951 cur_lunt->SCpnt = SCpnt;
955 data->cur_id = SCpnt->device->id;
956 data->cur_lun = SCpnt->device->lun;
958 ret = nsp32_setup_sg_table(SCpnt);
961 SCpnt->result = DID_ERROR << 16;
962 nsp32_scsi_done(SCpnt);
967 nsp32_build_identify(SCpnt);
974 target = &data->target[scmd_id(SCpnt)];
982 nsp32_build_sdtr(SCpnt, period, offset);
1020 SCpnt->device->id, target->sync_flag, target->syncreg,
1025 ret = nsp32_selection_autopara(SCpnt);
1027 ret = nsp32_selection_autoscsi(SCpnt);
1032 nsp32_scsi_done(SCpnt);
1152 struct scsi_cmnd *SCpnt = data->CurrentSC;
1184 SCpnt->result = DID_BAD_TARGET << 16;
1185 nsp32_scsi_done(SCpnt);
1201 if (SCpnt != NULL) {
1202 SCpnt->result = DID_RESET << 16;
1203 nsp32_scsi_done(SCpnt);
1208 if (SCpnt == NULL) {
1209 nsp32_msg(KERN_WARNING, "SCpnt==NULL this can't be happened");
1230 SCpnt->result = DID_TIME_OUT << 16;
1231 nsp32_scsi_done(SCpnt);
1256 (scsi_get_resid(SCpnt) > 0) &&
1259 //nsp32_pio_read(SCpnt);
1277 scsi_set_resid(SCpnt, 0); /* all data transferred! */
1284 nsp32_msgin_occur(SCpnt, irq_stat, auto_stat);
1291 nsp32_msgout_occur(SCpnt);
1298 ret = nsp32_busfree_occur(SCpnt, auto_stat);
1306 * Read CSB and substitute CSB for SCpnt->result
1312 SCpnt->result = (int)nsp32_read1(base, SCSI_CSB_IN);
1351 //nsp32_pio_write(SCpnt);
1358 //nsp32_pio_read(SCpnt);
1365 SCpnt->SCp.Status = nsp32_read1(base, SCSI_CSB_IN);
1385 nsp32_msgin_occur(SCpnt, irq_stat, 0);
1508 * Be careful setting SCpnt->result = DID_* before calling this function.
1510 static void nsp32_scsi_done(struct scsi_cmnd *SCpnt)
1512 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1513 unsigned int base = SCpnt->device->host->io_port;
1515 scsi_dma_unmap(SCpnt);
1526 (*SCpnt->scsi_done)(SCpnt);
1531 data->cur_lunt->SCpnt = NULL;
1548 static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)
1550 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1551 unsigned int base = SCpnt->device->host->io_port;
1609 nsp32_adjust_busfree(SCpnt, s_sacklen);
1668 SCpnt->SCp.Status = nsp32_read1(base, SCSI_CSB_IN);
1669 SCpnt->SCp.Message = 0;
1672 SCpnt->SCp.Status, scsi_get_resid(SCpnt));
1673 SCpnt->result = (DID_OK << 16) |
1674 (SCpnt->SCp.Message << 8) |
1675 (SCpnt->SCp.Status << 0);
1676 nsp32_scsi_done(SCpnt);
1681 SCpnt->SCp.Status = nsp32_read1(base, SCSI_CSB_IN);
1682 SCpnt->SCp.Message = 4;
1691 //SCpnt->result = (DID_OK << 16) | (SCpnt->SCp.Message << 8) | (SCpnt->SCp.Status << 0);
1692 SCpnt->result = DID_ERROR << 16;
1693 nsp32_scsi_done(SCpnt);
1706 static void nsp32_adjust_busfree(struct scsi_cmnd *SCpnt, unsigned int s_sacklen)
1708 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1716 nsp32_dbg(NSP32_DEBUG_SGLIST, "old resid=0x%x", scsi_get_resid(SCpnt));
1760 if (scsi_get_resid(SCpnt) < sentlen) {
1764 scsi_set_resid(SCpnt, scsi_get_resid(SCpnt) - sentlen);
1765 nsp32_dbg(NSP32_DEBUG_SGLIST, "new resid=0x%x", scsi_get_resid(SCpnt));
1779 static void nsp32_msgout_occur(struct scsi_cmnd *SCpnt)
1781 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1782 unsigned int base = SCpnt->device->host->io_port;
1795 nsp32_build_nop(SCpnt);
1825 //nsp32_restart_autoscsi(SCpnt, command);
1855 static void nsp32_restart_autoscsi(struct scsi_cmnd *SCpnt, unsigned short command)
1857 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1894 if (scsi_bufflen(SCpnt) > 0) {
1921 static void nsp32_msgin_occur(struct scsi_cmnd *SCpnt,
1925 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1926 unsigned int base = SCpnt->device->host->io_port;
1966 ret = nsp32_reselection(SCpnt, newlun);
2003 nsp32_adjust_busfree(SCpnt, s_sacklen);
2128 nsp32_analyze_sdtr(SCpnt);
2188 nsp32_restart_autoscsi(SCpnt, command);
2209 nsp32_build_reject(SCpnt);
2218 static void nsp32_analyze_sdtr(struct scsi_cmnd *SCpnt)
2220 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);