Lines Matching refs:SCpnt

368 static void nsp32_build_identify(struct scsi_cmnd *SCpnt)
370 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
379 data->msgoutbuf[pos] = IDENTIFY(mode, SCpnt->device->lun); pos++;
387 static void nsp32_build_sdtr(struct scsi_cmnd *SCpnt,
391 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
406 static void nsp32_build_nop(struct scsi_cmnd *SCpnt)
408 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
424 static void nsp32_build_reject(struct scsi_cmnd *SCpnt)
426 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
437 static void nsp32_start_timer(struct scsi_cmnd *SCpnt, int time)
439 unsigned int base = SCpnt->host->io_port;
455 static int nsp32_selection_autopara(struct scsi_cmnd *SCpnt)
457 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
458 unsigned int base = SCpnt->device->host->io_port;
459 unsigned int host_id = SCpnt->device->host->this_id;
460 unsigned char target = scmd_id(SCpnt);
476 SCpnt->result = DID_BUS_BUSY << 16;
488 SCpnt->result = DID_ERROR << 16;
518 for (i = 0; i < SCpnt->cmd_len; i++) {
519 param->cdb[4 * i] = SCpnt->cmnd[i];
577 ret = nsp32_arbitration(SCpnt, base);
586 static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
588 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
589 unsigned int base = SCpnt->device->host->io_port;
590 unsigned int host_id = SCpnt->device->host->this_id;
591 unsigned char target = scmd_id(SCpnt);
612 SCpnt->result = DID_BUS_BUSY << 16;
630 for (i = 0; i < SCpnt->cmd_len; i++) {
631 nsp32_write1(base, COMMAND_DATA, SCpnt->cmnd[i]);
633 nsp32_dbg(NSP32_DEBUG_CDB_CONTENTS, "CDB[0]=[0x%x]", SCpnt->cmnd[0]);
648 SCpnt->result = DID_ERROR << 16;
718 if (scsi_bufflen(SCpnt) > 0) {
741 status = nsp32_arbitration(SCpnt, base);
761 static int nsp32_arbitration(struct scsi_cmnd *SCpnt, unsigned int base)
778 SCpnt->result = DID_OK << 16;
782 SCpnt->result = DID_BUS_BUSY << 16;
790 SCpnt->result = DID_NO_CONNECT << 16;
810 static int nsp32_reselection(struct scsi_cmnd *SCpnt, unsigned char newlun)
812 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
813 unsigned int host_id = SCpnt->device->host->this_id;
814 unsigned int base = SCpnt->device->host->io_port;
841 } else if(data->lunt[newid][newlun].SCpnt == NULL) {
864 static int nsp32_setup_sg_table(struct scsi_cmnd *SCpnt)
866 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
877 num = scsi_dma_map(SCpnt);
883 scsi_for_each_sg(SCpnt, sg, num, i) {
910 static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
912 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
920 SCpnt->device->id, SCpnt->device->lun, SCpnt->cmnd[0], SCpnt->cmd_len,
921 scsi_sg_count(SCpnt), scsi_sglist(SCpnt), 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 SCpnt->scsi_done = done;
950 data->CurrentSC = SCpnt;
951 SCpnt->SCp.Status = CHECK_CONDITION;
952 SCpnt->SCp.Message = 0;
953 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
955 SCpnt->SCp.ptr = (char *)scsi_sglist(SCpnt);
956 SCpnt->SCp.this_residual = scsi_bufflen(SCpnt);
957 SCpnt->SCp.buffer = NULL;
958 SCpnt->SCp.buffers_residual = 0;
963 cur_lunt = &(data->lunt[SCpnt->device->id][SCpnt->device->lun]);
964 cur_lunt->SCpnt = SCpnt;
968 data->cur_id = SCpnt->device->id;
969 data->cur_lun = SCpnt->device->lun;
971 ret = nsp32_setup_sg_table(SCpnt);
974 SCpnt->result = DID_ERROR << 16;
975 nsp32_scsi_done(SCpnt);
980 nsp32_build_identify(SCpnt);
987 target = &data->target[scmd_id(SCpnt)];
995 nsp32_build_sdtr(SCpnt, period, offset);
1033 SCpnt->device->id, target->sync_flag, target->syncreg,
1038 ret = nsp32_selection_autopara(SCpnt);
1040 ret = nsp32_selection_autoscsi(SCpnt);
1045 nsp32_scsi_done(SCpnt);
1165 struct scsi_cmnd *SCpnt = data->CurrentSC;
1197 SCpnt->result = DID_BAD_TARGET << 16;
1198 nsp32_scsi_done(SCpnt);
1214 if (SCpnt != NULL) {
1215 SCpnt->result = DID_RESET << 16;
1216 nsp32_scsi_done(SCpnt);
1221 if (SCpnt == NULL) {
1222 nsp32_msg(KERN_WARNING, "SCpnt==NULL this can't be happened");
1243 SCpnt->result = DID_TIME_OUT << 16;
1244 nsp32_scsi_done(SCpnt);
1269 (scsi_get_resid(SCpnt) > 0) &&
1272 //nsp32_pio_read(SCpnt);
1290 scsi_set_resid(SCpnt, 0); /* all data transferred! */
1297 nsp32_msgin_occur(SCpnt, irq_stat, auto_stat);
1304 nsp32_msgout_occur(SCpnt);
1311 ret = nsp32_busfree_occur(SCpnt, auto_stat);
1319 * Read CSB and substitute CSB for SCpnt->result
1325 SCpnt->result = (int)nsp32_read1(base, SCSI_CSB_IN);
1364 //nsp32_pio_write(SCpnt);
1371 //nsp32_pio_read(SCpnt);
1378 SCpnt->SCp.Status = nsp32_read1(base, SCSI_CSB_IN);
1398 nsp32_msgin_occur(SCpnt, irq_stat, 0);
1524 * Be careful setting SCpnt->result = DID_* before calling this function.
1526 static void nsp32_scsi_done(struct scsi_cmnd *SCpnt)
1528 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1529 unsigned int base = SCpnt->device->host->io_port;
1531 scsi_dma_unmap(SCpnt);
1542 (*SCpnt->scsi_done)(SCpnt);
1547 data->cur_lunt->SCpnt = NULL;
1564 static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)
1566 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1567 unsigned int base = SCpnt->device->host->io_port;
1625 nsp32_adjust_busfree(SCpnt, s_sacklen);
1684 SCpnt->SCp.Status = nsp32_read1(base, SCSI_CSB_IN);
1685 SCpnt->SCp.Message = 0;
1688 SCpnt->SCp.Status, scsi_get_resid(SCpnt));
1689 SCpnt->result = (DID_OK << 16) |
1690 (SCpnt->SCp.Message << 8) |
1691 (SCpnt->SCp.Status << 0);
1692 nsp32_scsi_done(SCpnt);
1697 SCpnt->SCp.Status = nsp32_read1(base, SCSI_CSB_IN);
1698 SCpnt->SCp.Message = 4;
1707 //SCpnt->result = (DID_OK << 16) | (SCpnt->SCp.Message << 8) | (SCpnt->SCp.Status << 0);
1708 SCpnt->result = DID_ERROR << 16;
1709 nsp32_scsi_done(SCpnt);
1722 static void nsp32_adjust_busfree(struct scsi_cmnd *SCpnt, unsigned int s_sacklen)
1724 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1732 nsp32_dbg(NSP32_DEBUG_SGLIST, "old resid=0x%x", scsi_get_resid(SCpnt));
1776 if (scsi_get_resid(SCpnt) < sentlen) {
1780 scsi_set_resid(SCpnt, scsi_get_resid(SCpnt) - sentlen);
1781 nsp32_dbg(NSP32_DEBUG_SGLIST, "new resid=0x%x", scsi_get_resid(SCpnt));
1795 static void nsp32_msgout_occur(struct scsi_cmnd *SCpnt)
1797 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1798 unsigned int base = SCpnt->device->host->io_port;
1811 nsp32_build_nop(SCpnt);
1841 //nsp32_restart_autoscsi(SCpnt, command);
1871 static void nsp32_restart_autoscsi(struct scsi_cmnd *SCpnt, unsigned short command)
1873 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1910 if (scsi_bufflen(SCpnt) > 0) {
1937 static void nsp32_msgin_occur(struct scsi_cmnd *SCpnt,
1941 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
1942 unsigned int base = SCpnt->device->host->io_port;
1982 ret = nsp32_reselection(SCpnt, newlun);
2019 nsp32_adjust_busfree(SCpnt, s_sacklen);
2144 nsp32_analyze_sdtr(SCpnt);
2204 nsp32_restart_autoscsi(SCpnt, command);
2225 nsp32_build_reject(SCpnt);
2234 static void nsp32_analyze_sdtr(struct scsi_cmnd *SCpnt)
2236 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
2338 nsp32_build_sdtr(SCpnt, 0, ASYNC_OFFSET);
2341 nsp32_build_sdtr(SCpnt, get_period, get_offset);
2354 nsp32_build_reject(SCpnt);
2675 .SCpnt = NULL,
2824 static int nsp32_eh_abort(struct scsi_cmnd *SCpnt)
2826 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
2827 unsigned int base = SCpnt->device->host->io_port;
2831 if (data->cur_lunt->SCpnt == NULL) {
2845 SCpnt->result = DID_ABORT << 16;
2846 nsp32_scsi_done(SCpnt);
2852 static int nsp32_eh_bus_reset(struct scsi_cmnd *SCpnt)
2854 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
2855 unsigned int base = SCpnt->device->host->io_port;
2857 spin_lock_irq(SCpnt->device->host->host_lock);
2860 nsp32_dbg(NSP32_DEBUG_BUSRESET, "SCpnt=0x%x", SCpnt);
2866 spin_unlock_irq(SCpnt->device->host->host_lock);
2912 static int nsp32_eh_host_reset(struct scsi_cmnd *SCpnt)
2914 struct Scsi_Host *host = SCpnt->device->host;
2915 unsigned int base = SCpnt->device->host->io_port;
2919 nsp32_dbg(NSP32_DEBUG_BUSRESET, "SCpnt=0x%x", SCpnt);
2921 spin_lock_irq(SCpnt->device->host->host_lock);
2928 spin_unlock_irq(SCpnt->device->host->host_lock);