Lines Matching refs:SCp

563 		     struct scsi_cmnd *SCp, __u32 dsp)  in save_for_reselection()  argument
566 if(SCp != NULL) { in save_for_reselection()
568 (struct NCR_700_command_slot *)SCp->host_scribble; in save_for_reselection()
577 NCR_700_unmap(struct NCR_700_Host_Parameters *hostdata, struct scsi_cmnd *SCp, in NCR_700_unmap() argument
580 if(SCp->sc_data_direction != DMA_NONE && in NCR_700_unmap()
581 SCp->sc_data_direction != DMA_BIDIRECTIONAL) in NCR_700_unmap()
582 scsi_dma_unmap(SCp); in NCR_700_unmap()
587 struct scsi_cmnd *SCp, int result) in NCR_700_scsi_done() argument
592 if(SCp != NULL) { in NCR_700_scsi_done()
594 (struct NCR_700_command_slot *)SCp->host_scribble; in NCR_700_scsi_done()
599 char *cmnd = NCR_700_get_sense_cmnd(SCp->device); in NCR_700_scsi_done()
608 SCp->cmd_len = cmnd[8]; in NCR_700_scsi_done()
610 NCR_700_unmap(hostdata, SCp, slot); in NCR_700_scsi_done()
614 if(NCR_700_get_depth(SCp->device) == 0 || in NCR_700_scsi_done()
615 NCR_700_get_depth(SCp->device) > SCp->device->queue_depth) in NCR_700_scsi_done()
617 NCR_700_get_depth(SCp->device)); in NCR_700_scsi_done()
619 NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) - 1); in NCR_700_scsi_done()
621 SCp->host_scribble = NULL; in NCR_700_scsi_done()
622 SCp->result = result; in NCR_700_scsi_done()
623 SCp->scsi_done(SCp); in NCR_700_scsi_done()
781 struct scsi_cmnd *SCp, __u32 dsp, __u32 dsps) in process_extended_message() argument
786 if(SCp != NULL) { in process_extended_message()
787 pun = SCp->device->id; in process_extended_message()
788 lun = SCp->device->lun; in process_extended_message()
793 if(SCp != NULL && NCR_700_is_flag_set(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION)) { in process_extended_message()
794 struct scsi_target *starget = SCp->device->sdev_target; in process_extended_message()
806 if(NCR_700_is_flag_set(SCp->device, NCR_700_DEV_PRINT_SYNC_NEGOTIATION)) { in process_extended_message()
808 NCR_700_clear_flag(SCp->device, NCR_700_DEV_PRINT_SYNC_NEGOTIATION); in process_extended_message()
811 NCR_700_set_flag(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC); in process_extended_message()
812 NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); in process_extended_message()
814 NCR_700_writeb(NCR_700_get_SXFER(SCp->device), in process_extended_message()
863 struct scsi_cmnd *SCp, __u32 dsp, __u32 dsps) in process_message() argument
869 if(SCp != NULL) { in process_message()
870 pun = SCp->device->id; in process_message()
871 lun = SCp->device->lun; in process_message()
884 resume_offset = process_extended_message(host, hostdata, SCp, in process_message()
889 if(SCp != NULL && NCR_700_is_flag_set(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION)) { in process_message()
891 spi_period(SCp->device->sdev_target) = in process_message()
892 spi_offset(SCp->device->sdev_target) = 0; in process_message()
893 NCR_700_set_flag(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC); in process_message()
894 NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); in process_message()
895 …} else if(SCp != NULL && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_DURING_TAG_NEGOTIATION)… in process_message()
897 scmd_printk(KERN_WARNING, SCp, in process_message()
900 NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION); in process_message()
901 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); in process_message()
903 SCp->device->tagged_supported = 0; in process_message()
904 SCp->device->simple_tags = 0; in process_message()
905 scsi_change_queue_depth(SCp->device, host->cmd_per_lun); in process_message()
951 process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, in process_script_interrupt() argument
958 if(SCp != NULL) { in process_script_interrupt()
959 pun = SCp->device->id; in process_script_interrupt()
960 lun = SCp->device->lun; in process_script_interrupt()
967 if (NCR_700_get_tag_neg_state(SCp->device) == NCR_700_DURING_TAG_NEGOTIATION) in process_script_interrupt()
968 NCR_700_set_tag_neg_state(SCp->device, in process_script_interrupt()
975 (struct NCR_700_command_slot *)SCp->host_scribble; in process_script_interrupt()
979 scmd_printk(KERN_ERR, SCp, in process_script_interrupt()
981 NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); in process_script_interrupt()
984 NCR_700_get_sense_cmnd(SCp->device); in process_script_interrupt()
986 scsi_print_command(SCp); in process_script_interrupt()
988 SCp, hostdata->status[0]); in process_script_interrupt()
997 NCR_700_unmap(hostdata, SCp, slot); in process_script_interrupt()
1016 cmnd[8] = SCp->cmd_len; in process_script_interrupt()
1017 SCp->cmd_len = 6; /* command length for in process_script_interrupt()
1020 …slot->dma_handle = dma_map_single(hostdata->dev, SCp->sense_buffer, SCSI_SENSE_BUFFERSIZE, DMA_FRO… in process_script_interrupt()
1027 dma_cache_sync(hostdata->dev, SCp->sense_buffer, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); in process_script_interrupt()
1057 NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); in process_script_interrupt()
1062 scmd_printk(KERN_ERR, SCp, "UNEXPECTED PHASE %s (%s)\n", in process_script_interrupt()
1065 scmd_printk(KERN_ERR, SCp, " len = %d, cmd =", in process_script_interrupt()
1066 SCp->cmd_len); in process_script_interrupt()
1067 scsi_print_command(SCp); in process_script_interrupt()
1088 save_for_reselection(hostdata, SCp, dsp); in process_script_interrupt()
1109 struct scsi_cmnd *SCp; in process_script_interrupt() local
1111 SCp = scsi_host_find_tag(SDp->host, hostdata->msgin[2]); in process_script_interrupt()
1112 if(unlikely(SCp == NULL)) { in process_script_interrupt()
1118 slot = (struct NCR_700_command_slot *)SCp->host_scribble; in process_script_interrupt()
1123 struct scsi_cmnd *SCp; in process_script_interrupt() local
1125 SCp = scsi_host_find_tag(SDp->host, SCSI_NO_TAG); in process_script_interrupt()
1126 if(unlikely(SCp == NULL)) { in process_script_interrupt()
1131 slot = (struct NCR_700_command_slot *)SCp->host_scribble; in process_script_interrupt()
1205 SCp = hostdata->slots[i].cmnd; in process_script_interrupt()
1208 if(SCp != NULL) { in process_script_interrupt()
1209 slot = (struct NCR_700_command_slot *)SCp->host_scribble; in process_script_interrupt()
1245 resume_offset = process_message(host, hostdata, SCp, in process_script_interrupt()
1252 if(SCp != NULL) { in process_script_interrupt()
1255 scsi_print_command(SCp); in process_script_interrupt()
1256 scsi_for_each_sg(SCp, sg, scsi_sg_count(SCp) + 1, i) { in process_script_interrupt()
1257 …g->length, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].ins, ((struct NCR_700_comman… in process_script_interrupt()
1288 struct scsi_cmnd *SCp = hostdata->cmd; in process_selection() local
1311 if(hostdata->state == NCR_700_HOST_BUSY && SCp != NULL) { in process_selection()
1313 (struct NCR_700_command_slot *)SCp->host_scribble; in process_selection()
1319 save_for_reselection(hostdata, SCp, Ent_Disconnect2 + hostdata->pScript); in process_selection()
1323 save_for_reselection(hostdata, SCp, Ent_Disconnect4 + hostdata->pScript); in process_selection()
1327 save_for_reselection(hostdata, SCp, Ent_Disconnect6 + hostdata->pScript); in process_selection()
1331 save_for_reselection(hostdata, SCp, Ent_Disconnect8 + hostdata->pScript); in process_selection()
1335 process_script_interrupt(A_GOOD_STATUS_AFTER_STATUS, dsp, SCp, host, hostdata); in process_selection()
1391 NCR_700_start_command(struct scsi_cmnd *SCp) in NCR_700_start_command() argument
1394 (struct NCR_700_command_slot *)SCp->host_scribble; in NCR_700_start_command()
1396 (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; in NCR_700_start_command()
1398 u8 lun = SCp->device->lun; in NCR_700_start_command()
1407 SCp->device->host->host_no, slot->cmnd, slot)); in NCR_700_start_command()
1411 hostdata->cmd = SCp; in NCR_700_start_command()
1416 hostdata->msgout[0] = NCR_700_identify((SCp->cmnd[0] != REQUEST_SENSE && in NCR_700_start_command()
1422 if(SCp->cmnd[0] == INQUIRY || SCp->cmnd[0] == REQUEST_SENSE || in NCR_700_start_command()
1424 NCR_700_clear_flag(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC); in NCR_700_start_command()
1431 if((hostdata->tag_negotiated & (1<<scmd_id(SCp))) in NCR_700_start_command()
1432 && (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE && in NCR_700_start_command()
1434 count += spi_populate_tag_msg(&hostdata->msgout[count], SCp); in NCR_700_start_command()
1438 NCR_700_is_flag_clear(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC)) { in NCR_700_start_command()
1440 spi_period(SCp->device->sdev_target), in NCR_700_start_command()
1441 spi_offset(SCp->device->sdev_target)); in NCR_700_start_command()
1442 NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); in NCR_700_start_command()
1449 Device_ID, 1<<scmd_id(SCp)); in NCR_700_start_command()
1454 SCp->cmd_len); in NCR_700_start_command()
1459 NCR_700_clear_fifo(SCp->device->host); in NCR_700_start_command()
1467 dma_cache_sync(hostdata->dev, SCp->cmnd, SCp->cmd_len, DMA_TO_DEVICE); in NCR_700_start_command()
1471 NCR_700_writeb(NCR_700_get_SXFER(SCp->device), in NCR_700_start_command()
1472 SCp->device->host, SXFER_REG); in NCR_700_start_command()
1473 NCR_700_writel(slot->temp, SCp->device->host, TEMP_REG); in NCR_700_start_command()
1474 NCR_700_writel(slot->resume_offset, SCp->device->host, DSP_REG); in NCR_700_start_command()
1502 struct scsi_cmnd *SCp = hostdata->cmd; in NCR_700_intr() local
1507 SCp = hostdata->cmd; in NCR_700_intr()
1529 if(SCp != NULL) { in NCR_700_intr()
1530 pun = SCp->device->id; in NCR_700_intr()
1531 lun = SCp->device->lun; in NCR_700_intr()
1541 … host->host_no, SCp, SCp == NULL ? NULL : SCp->host_scribble, dsp, dsp - hostdata->pScript); in NCR_700_intr()
1551 struct scsi_cmnd *SCp; in NCR_700_intr() local
1558 SCp = slot->cmnd; in NCR_700_intr()
1560 slot, SCp); in NCR_700_intr()
1562 SCp->host_scribble = NULL; in NCR_700_intr()
1563 NCR_700_set_depth(SCp->device, 0); in NCR_700_intr()
1570 SCp->result = DID_RESET << 16; in NCR_700_intr()
1571 SCp->scsi_done(SCp); in NCR_700_intr()
1585 NCR_700_scsi_done(hostdata, SCp, DID_NO_CONNECT<<16); in NCR_700_intr()
1587 struct NCR_700_command_slot *slot = (SCp == NULL) ? NULL : in NCR_700_intr()
1588 (struct NCR_700_command_slot *)SCp->host_scribble; in NCR_700_intr()
1611 scsi_print_command(SCp); in NCR_700_intr()
1660 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1664 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1668 resume_offset = process_script_interrupt(dsps, dsp, SCp, host, hostdata); in NCR_700_intr()
1674 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1678 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1752 NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) in NCR_700_queuecommand_lck() argument
1755 (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; in NCR_700_queuecommand_lck()
1763 …printk(KERN_WARNING "scsi%d: Command depth has gone over queue depth\n", SCp->device->host->host_n… in NCR_700_queuecommand_lck()
1772 if(NCR_700_get_depth(SCp->device) != 0 in NCR_700_queuecommand_lck()
1773 && (!(hostdata->tag_negotiated & (1<<scmd_id(SCp))) in NCR_700_queuecommand_lck()
1774 || !(SCp->flags & SCMD_TAGGED))) { in NCR_700_queuecommand_lck()
1775 CDEBUG(KERN_ERR, SCp, "has non zero depth %d\n", in NCR_700_queuecommand_lck()
1776 NCR_700_get_depth(SCp->device)); in NCR_700_queuecommand_lck()
1779 if(NCR_700_get_depth(SCp->device) >= SCp->device->queue_depth) { in NCR_700_queuecommand_lck()
1780 CDEBUG(KERN_ERR, SCp, "has max tag depth %d\n", in NCR_700_queuecommand_lck()
1781 NCR_700_get_depth(SCp->device)); in NCR_700_queuecommand_lck()
1784 NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) + 1); in NCR_700_queuecommand_lck()
1791 slot->cmnd = SCp; in NCR_700_queuecommand_lck()
1793 SCp->scsi_done = done; in NCR_700_queuecommand_lck()
1794 SCp->host_scribble = (unsigned char *)slot; in NCR_700_queuecommand_lck()
1795 SCp->SCp.ptr = NULL; in NCR_700_queuecommand_lck()
1796 SCp->SCp.buffer = NULL; in NCR_700_queuecommand_lck()
1799 printk("53c700: scsi%d, command ", SCp->device->host->host_no); in NCR_700_queuecommand_lck()
1800 scsi_print_command(SCp); in NCR_700_queuecommand_lck()
1802 if ((SCp->flags & SCMD_TAGGED) in NCR_700_queuecommand_lck()
1803 && (hostdata->tag_negotiated &(1<<scmd_id(SCp))) == 0 in NCR_700_queuecommand_lck()
1804 && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_START_TAG_NEGOTIATION) { in NCR_700_queuecommand_lck()
1805 scmd_printk(KERN_ERR, SCp, "Enabling Tag Command Queuing\n"); in NCR_700_queuecommand_lck()
1806 hostdata->tag_negotiated |= (1<<scmd_id(SCp)); in NCR_700_queuecommand_lck()
1807 NCR_700_set_tag_neg_state(SCp->device, NCR_700_DURING_TAG_NEGOTIATION); in NCR_700_queuecommand_lck()
1816 if (!(SCp->flags & SCMD_TAGGED) in NCR_700_queuecommand_lck()
1817 && (hostdata->tag_negotiated &(1<<scmd_id(SCp)))) { in NCR_700_queuecommand_lck()
1818 scmd_printk(KERN_INFO, SCp, "Disabling Tag Command Queuing\n"); in NCR_700_queuecommand_lck()
1819 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); in NCR_700_queuecommand_lck()
1822 if ((hostdata->tag_negotiated & (1<<scmd_id(SCp))) && in NCR_700_queuecommand_lck()
1823 SCp->device->simple_tags) { in NCR_700_queuecommand_lck()
1824 slot->tag = SCp->request->tag; in NCR_700_queuecommand_lck()
1825 CDEBUG(KERN_DEBUG, SCp, "sending out tag %d, slot %p\n", in NCR_700_queuecommand_lck()
1830 SCp->device->current_cmnd = SCp; in NCR_700_queuecommand_lck()
1834 if(!scsi_sg_count(SCp) && !scsi_bufflen(SCp) && in NCR_700_queuecommand_lck()
1835 SCp->sc_data_direction != DMA_NONE) { in NCR_700_queuecommand_lck()
1838 scsi_print_command(SCp); in NCR_700_queuecommand_lck()
1839 printk("Has wrong data direction %d\n", SCp->sc_data_direction); in NCR_700_queuecommand_lck()
1841 SCp->sc_data_direction = DMA_NONE; in NCR_700_queuecommand_lck()
1844 switch (SCp->cmnd[0]) { in NCR_700_queuecommand_lck()
1847 SCp->cmnd[6] = 0; in NCR_700_queuecommand_lck()
1851 switch(SCp->sc_data_direction) { in NCR_700_queuecommand_lck()
1855 scsi_print_command(SCp); in NCR_700_queuecommand_lck()
1872 direction = SCp->sc_data_direction; in NCR_700_queuecommand_lck()
1880 sg_count = scsi_dma_map(SCp); in NCR_700_queuecommand_lck()
1883 scsi_for_each_sg(SCp, sg, sg_count, i) { in NCR_700_queuecommand_lck()
1900 slot->pCmd = dma_map_single(hostdata->dev, SCp->cmnd, in NCR_700_queuecommand_lck()
1902 NCR_700_start_command(SCp); in NCR_700_queuecommand_lck()
1909 NCR_700_abort(struct scsi_cmnd * SCp) in DEF_SCSI_QCMD()
1913 scmd_printk(KERN_INFO, SCp, "abort command\n"); in DEF_SCSI_QCMD()
1915 slot = (struct NCR_700_command_slot *)SCp->host_scribble; in DEF_SCSI_QCMD()
1920 if(SCp->cmnd[0] == TEST_UNIT_READY) { in DEF_SCSI_QCMD()
1931 NCR_700_internal_bus_reset(SCp->device->host); in DEF_SCSI_QCMD()
1939 NCR_700_bus_reset(struct scsi_cmnd * SCp) in NCR_700_bus_reset() argument
1943 (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; in NCR_700_bus_reset()
1945 scmd_printk(KERN_INFO, SCp, in NCR_700_bus_reset()
1946 "New error handler wants BUS reset, cmd %p\n\t", SCp); in NCR_700_bus_reset()
1947 scsi_print_command(SCp); in NCR_700_bus_reset()
1952 spin_lock_irq(SCp->device->host->host_lock); in NCR_700_bus_reset()
1954 spin_unlock_irq(SCp->device->host->host_lock); in NCR_700_bus_reset()
1956 spin_lock_irq(SCp->device->host->host_lock); in NCR_700_bus_reset()
1960 NCR_700_internal_bus_reset(SCp->device->host); in NCR_700_bus_reset()
1962 spin_unlock_irq(SCp->device->host->host_lock); in NCR_700_bus_reset()
1964 spin_lock_irq(SCp->device->host->host_lock); in NCR_700_bus_reset()
1969 spi_schedule_dv_device(SCp->device); in NCR_700_bus_reset()
1971 spin_unlock_irq(SCp->device->host->host_lock); in NCR_700_bus_reset()
1976 NCR_700_host_reset(struct scsi_cmnd * SCp) in NCR_700_host_reset() argument
1978 scmd_printk(KERN_INFO, SCp, "New error handler wants HOST reset\n\t"); in NCR_700_host_reset()
1979 scsi_print_command(SCp); in NCR_700_host_reset()
1981 spin_lock_irq(SCp->device->host->host_lock); in NCR_700_host_reset()
1983 NCR_700_internal_bus_reset(SCp->device->host); in NCR_700_host_reset()
1984 NCR_700_chip_reset(SCp->device->host); in NCR_700_host_reset()
1986 spin_unlock_irq(SCp->device->host->host_lock); in NCR_700_host_reset()