Lines Matching refs:SCp

558 		     Scsi_Cmnd *SCp, __u32 dsp)  in save_for_reselection()  argument
561 if(SCp != NULL) { in save_for_reselection()
563 (struct NCR_700_command_slot *)SCp->host_scribble; in save_for_reselection()
648 NCR_700_unmap(struct NCR_700_Host_Parameters *hostdata, Scsi_Cmnd *SCp, in NCR_700_unmap() argument
651 if(SCp->sc_data_direction != SCSI_DATA_NONE && in NCR_700_unmap()
652 SCp->sc_data_direction != SCSI_DATA_UNKNOWN) { in NCR_700_unmap()
653 int pci_direction = scsi_to_pci_dma_dir(SCp->sc_data_direction); in NCR_700_unmap()
654 if(SCp->use_sg) { in NCR_700_unmap()
655 pci_unmap_sg(hostdata->pci_dev, SCp->buffer, in NCR_700_unmap()
656 SCp->use_sg, pci_direction); in NCR_700_unmap()
660 SCp->request_bufflen, in NCR_700_unmap()
668 Scsi_Cmnd *SCp, int result) in NCR_700_scsi_done() argument
673 if(SCp != NULL) { in NCR_700_scsi_done()
675 (struct NCR_700_command_slot *)SCp->host_scribble; in NCR_700_scsi_done()
677 NCR_700_unmap(hostdata, SCp, slot); in NCR_700_scsi_done()
679 sizeof(SCp->cmnd), PCI_DMA_TODEVICE); in NCR_700_scsi_done()
680 if(SCp->cmnd[0] == REQUEST_SENSE && SCp->cmnd[6] == NCR_700_INTERNAL_SENSE_MAGIC) { in NCR_700_scsi_done()
683 SCp, SCp->cmnd[7], result); in NCR_700_scsi_done()
684 print_sense("53c700", SCp); in NCR_700_scsi_done()
690 result = SCp->cmnd[7]; in NCR_700_scsi_done()
692 memcpy((void *) SCp->cmnd, (void *) SCp->data_cmnd, in NCR_700_scsi_done()
693 sizeof(SCp->data_cmnd)); in NCR_700_scsi_done()
694 SCp->request_buffer = SCp->buffer; in NCR_700_scsi_done()
695 SCp->request_bufflen = SCp->bufflen; in NCR_700_scsi_done()
696 SCp->use_sg = SCp->old_use_sg; in NCR_700_scsi_done()
697 SCp->cmd_len = SCp->old_cmd_len; in NCR_700_scsi_done()
698 SCp->sc_data_direction = SCp->sc_old_data_direction; in NCR_700_scsi_done()
699 SCp->underflow = SCp->old_underflow; in NCR_700_scsi_done()
705 if(NCR_700_get_depth(SCp->device) == 0 || in NCR_700_scsi_done()
706 NCR_700_get_depth(SCp->device) > NCR_700_MAX_TAGS) in NCR_700_scsi_done()
708 NCR_700_get_depth(SCp->device)); in NCR_700_scsi_done()
710 NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) - 1); in NCR_700_scsi_done()
712 SCp->host_scribble = NULL; in NCR_700_scsi_done()
713 SCp->result = result; in NCR_700_scsi_done()
714 SCp->scsi_done(SCp); in NCR_700_scsi_done()
856 Scsi_Cmnd *SCp, __u32 dsp, __u32 dsps) in process_extended_message() argument
861 if(SCp != NULL) { in process_extended_message()
862 pun = SCp->target; in process_extended_message()
863 lun = SCp->lun; in process_extended_message()
868 if(SCp != NULL && NCR_700_is_flag_set(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION)) { in process_extended_message()
878 if(sxfer != NCR_700_get_SXFER(SCp->device)) { in process_extended_message()
883 NCR_700_set_SXFER(SCp->device, sxfer); in process_extended_message()
887 NCR_700_set_flag(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC); in process_extended_message()
888 NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); in process_extended_message()
890 NCR_700_writeb(NCR_700_get_SXFER(SCp->device), in process_extended_message()
936 Scsi_Cmnd *SCp, __u32 dsp, __u32 dsps) in process_message() argument
942 if(SCp != NULL) { in process_message()
943 pun = SCp->target; in process_message()
944 lun = SCp->lun; in process_message()
957 resume_offset = process_extended_message(host, hostdata, SCp, in process_message()
962 if(SCp != NULL && NCR_700_is_flag_set(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION)) { in process_message()
964 NCR_700_set_SXFER(SCp->device, 0); in process_message()
965 NCR_700_set_flag(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC); in process_message()
966 NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); in process_message()
967 } else if(SCp != NULL && NCR_700_is_flag_set(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING)) { in process_message()
970 NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING); in process_message()
971 hostdata->tag_negotiated &= ~(1<<SCp->target); in process_message()
972 SCp->device->tagged_queue = 0; in process_message()
973 SCp->device->tagged_supported = 0; in process_message()
1017 process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp, in process_script_interrupt() argument
1024 if(SCp != NULL) { in process_script_interrupt()
1025 pun = SCp->target; in process_script_interrupt()
1026 lun = SCp->lun; in process_script_interrupt()
1033 NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING); in process_script_interrupt()
1038 (struct NCR_700_command_slot *)SCp->host_scribble; in process_script_interrupt()
1039 if(SCp->cmnd[0] == REQUEST_SENSE) { in process_script_interrupt()
1043 NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); in process_script_interrupt()
1046 print_command(SCp->cmnd); in process_script_interrupt()
1048 SCp, hostdata->status[0]); in process_script_interrupt()
1057 NCR_700_unmap(hostdata, SCp, slot); in process_script_interrupt()
1059 SCp->cmnd[0] = REQUEST_SENSE; in process_script_interrupt()
1060 SCp->cmnd[1] = (SCp->lun & 0x7) << 5; in process_script_interrupt()
1061 SCp->cmnd[2] = 0; in process_script_interrupt()
1062 SCp->cmnd[3] = 0; in process_script_interrupt()
1063 SCp->cmnd[4] = sizeof(SCp->sense_buffer); in process_script_interrupt()
1064 SCp->cmnd[5] = 0; in process_script_interrupt()
1065 SCp->cmd_len = 6; in process_script_interrupt()
1072 SCp->cmnd[6] = NCR_700_INTERNAL_SENSE_MAGIC; in process_script_interrupt()
1073 SCp->cmnd[7] = hostdata->status[0]; in process_script_interrupt()
1074 SCp->use_sg = 0; in process_script_interrupt()
1075 SCp->sc_data_direction = SCSI_DATA_READ; in process_script_interrupt()
1078 SCp->cmd_len, in process_script_interrupt()
1080 SCp->request_bufflen = sizeof(SCp->sense_buffer); in process_script_interrupt()
1081 …slot->dma_handle = pci_map_single(hostdata->pci_dev, SCp->sense_buffer, sizeof(SCp->sense_buffer),… in process_script_interrupt()
1082 slot->SG[0].ins = bS_to_host(SCRIPT_MOVE_DATA_IN | sizeof(SCp->sense_buffer)); in process_script_interrupt()
1088 NCR_700_dma_cache_inv((unsigned long)SCp->sense_buffer, sizeof(SCp->sense_buffer)); in process_script_interrupt()
1116 NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); in process_script_interrupt()
1125 printk(KERN_ERR " len = %d, cmd =", SCp->cmd_len); in process_script_interrupt()
1126 print_command(SCp->cmnd); in process_script_interrupt()
1147 save_for_reselection(hostdata, SCp, dsp); in process_script_interrupt()
1253 SCp = hostdata->slots[i].cmnd; in process_script_interrupt()
1256 if(SCp != NULL) { in process_script_interrupt()
1257 slot = (struct NCR_700_command_slot *)SCp->host_scribble; in process_script_interrupt()
1293 resume_offset = process_message(host, hostdata, SCp, in process_script_interrupt()
1300 if(SCp != NULL) { in process_script_interrupt()
1301 print_command(SCp->cmnd); in process_script_interrupt()
1303 if(SCp->use_sg) { in process_script_interrupt()
1304 for(i = 0; i < SCp->use_sg + 1; i++) { in process_script_interrupt()
1305 … scatterlist *)SCp->buffer)[i].length, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].… in process_script_interrupt()
1337 Scsi_Cmnd *SCp = hostdata->cmd; in process_selection() local
1360 if(hostdata->state == NCR_700_HOST_BUSY && SCp != NULL) { in process_selection()
1362 (struct NCR_700_command_slot *)SCp->host_scribble; in process_selection()
1368 save_for_reselection(hostdata, SCp, Ent_Disconnect2 + hostdata->pScript); in process_selection()
1372 save_for_reselection(hostdata, SCp, Ent_Disconnect4 + hostdata->pScript); in process_selection()
1376 save_for_reselection(hostdata, SCp, Ent_Disconnect6 + hostdata->pScript); in process_selection()
1380 save_for_reselection(hostdata, SCp, Ent_Disconnect8 + hostdata->pScript); in process_selection()
1384 process_script_interrupt(A_GOOD_STATUS_AFTER_STATUS, dsp, SCp, host, hostdata); in process_selection()
1437 NCR_700_start_command(Scsi_Cmnd *SCp) in NCR_700_start_command() argument
1440 (struct NCR_700_command_slot *)SCp->host_scribble; in NCR_700_start_command()
1442 (struct NCR_700_Host_Parameters *)SCp->host->hostdata[0]; in NCR_700_start_command()
1456 SCp->host->host_no, slot->cmnd, slot)); in NCR_700_start_command()
1460 hostdata->cmd = SCp; in NCR_700_start_command()
1465 hostdata->msgout[0] = NCR_700_identify(SCp->cmnd[0] != REQUEST_SENSE, in NCR_700_start_command()
1466 SCp->lun); in NCR_700_start_command()
1470 if(SCp->cmnd[0] == INQUIRY || SCp->cmnd[0] == REQUEST_SENSE) { in NCR_700_start_command()
1471 NCR_700_clear_flag(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC); in NCR_700_start_command()
1478 if((hostdata->tag_negotiated & (1<<SCp->target)) in NCR_700_start_command()
1479 && (slot->tag != NCR_700_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE)) { in NCR_700_start_command()
1485 NCR_700_is_flag_clear(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC)) { in NCR_700_start_command()
1489 NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); in NCR_700_start_command()
1496 Device_ID, 1<<SCp->target); in NCR_700_start_command()
1500 script_patch_16(hostdata->script, CommandCount, SCp->cmd_len); in NCR_700_start_command()
1505 NCR_700_clear_fifo(SCp->host); in NCR_700_start_command()
1512 NCR_700_dma_cache_wback((unsigned long)SCp->cmnd, SCp->cmd_len); in NCR_700_start_command()
1516 NCR_700_writeb(NCR_700_get_SXFER(SCp->device), in NCR_700_start_command()
1517 SCp->host, SXFER_REG); in NCR_700_start_command()
1518 NCR_700_writel(slot->temp, SCp->host, TEMP_REG); in NCR_700_start_command()
1519 NCR_700_writel(slot->resume_offset, SCp->host, DSP_REG); in NCR_700_start_command()
1558 Scsi_Cmnd *SCp = hostdata->cmd; in NCR_700_intr() local
1562 SCp = hostdata->cmd; in NCR_700_intr()
1584 if(SCp != NULL) { in NCR_700_intr()
1585 pun = SCp->target; in NCR_700_intr()
1586 lun = SCp->lun; in NCR_700_intr()
1596 … host->host_no, SCp, SCp == NULL ? NULL : SCp->host_scribble, dsp, dsp - hostdata->pScript); in NCR_700_intr()
1604 Scsi_Cmnd *SCp; in NCR_700_intr() local
1611 SCp = slot->cmnd; in NCR_700_intr()
1613 slot, SCp); in NCR_700_intr()
1615 SCp->host_scribble = NULL; in NCR_700_intr()
1616 NCR_700_set_depth(SCp->device, 0); in NCR_700_intr()
1623 SCp->result = DID_RESET << 16; in NCR_700_intr()
1624 SCp->scsi_done(SCp); in NCR_700_intr()
1635 NCR_700_scsi_done(hostdata, SCp, DID_NO_CONNECT<<16); in NCR_700_intr()
1637 struct NCR_700_command_slot *slot = (SCp == NULL) ? NULL : in NCR_700_intr()
1638 (struct NCR_700_command_slot *)SCp->host_scribble; in NCR_700_intr()
1661 print_command(SCp->cmnd); in NCR_700_intr()
1710 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1714 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1718 resume_offset = process_script_interrupt(dsps, dsp, SCp, host, hostdata); in NCR_700_intr()
1724 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1728 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1840 NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *)) in NCR_700_queuecommand() argument
1843 (struct NCR_700_Host_Parameters *)SCp->host->hostdata[0]; in NCR_700_queuecommand()
1852 printk(KERN_WARNING "scsi%d: Command depth has gone over queue depth\n", SCp->host->host_no); in NCR_700_queuecommand()
1855 if(NCR_700_get_depth(SCp->device) != 0 && !(hostdata->tag_negotiated & (1<<SCp->target))) { in NCR_700_queuecommand()
1857 SCp->host->host_no, SCp->target, SCp->lun, in NCR_700_queuecommand()
1858 NCR_700_get_depth(SCp->device))); in NCR_700_queuecommand()
1861 if(NCR_700_get_depth(SCp->device) >= NCR_700_MAX_TAGS) { in NCR_700_queuecommand()
1863 SCp->host->host_no, SCp->target, SCp->lun, in NCR_700_queuecommand()
1864 NCR_700_get_depth(SCp->device))); in NCR_700_queuecommand()
1867 NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) + 1); in NCR_700_queuecommand()
1874 slot->cmnd = SCp; in NCR_700_queuecommand()
1876 SCp->scsi_done = done; in NCR_700_queuecommand()
1877 SCp->host_scribble = (unsigned char *)slot; in NCR_700_queuecommand()
1878 SCp->SCp.ptr = NULL; in NCR_700_queuecommand()
1879 SCp->SCp.buffer = NULL; in NCR_700_queuecommand()
1882 printk("53c700: scsi%d, command ", SCp->host->host_no); in NCR_700_queuecommand()
1883 print_command(SCp->cmnd); in NCR_700_queuecommand()
1885 if(SCp->device->tagged_supported && !SCp->device->tagged_queue in NCR_700_queuecommand()
1886 && (hostdata->tag_negotiated &(1<<SCp->target)) == 0 in NCR_700_queuecommand()
1887 && NCR_700_is_flag_clear(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING)) { in NCR_700_queuecommand()
1894 …NFO "scsi%d: (%d:%d) Enabling Tag Command Queuing\n", SCp->device->host->host_no, SCp->target, SCp in NCR_700_queuecommand()
1895 hostdata->tag_negotiated |= (1<<SCp->target); in NCR_700_queuecommand()
1896 NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING); in NCR_700_queuecommand()
1897 SCp->device->tagged_queue = 1; in NCR_700_queuecommand()
1900 if(hostdata->tag_negotiated &(1<<SCp->target)) { in NCR_700_queuecommand()
1903 find_ITL_Nexus(hostdata, SCp->target, SCp->lun); in NCR_700_queuecommand()
1908 if(old != NULL && old->tag == SCp->device->current_tag) { in NCR_700_queuecommand()
1912 if(NCR_700_is_flag_clear(SCp->device, NCR_700_DEV_TAG_STARVATION_WARNED)) { in NCR_700_queuecommand()
1913 …si%d (%d:%d) Target is suffering from tag starvation.\n", SCp->host->host_no, SCp->target, SCp->lu… in NCR_700_queuecommand()
1914 NCR_700_set_flag(SCp->device, NCR_700_DEV_TAG_STARVATION_WARNED); in NCR_700_queuecommand()
1919 NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) - 1); in NCR_700_queuecommand()
1922 slot->tag = SCp->device->current_tag++; in NCR_700_queuecommand()
1924 while((found = find_ITLQ_Nexus(hostdata, SCp->target, SCp->lun, slot->tag)) != NULL) { in NCR_700_queuecommand()
1928 slot->tag = SCp->device->current_tag++; in NCR_700_queuecommand()
1931 if(old->cmnd->target == SCp->target && in NCR_700_queuecommand()
1932 old->cmnd->lun == SCp->lun) in NCR_700_queuecommand()
1939 hash = hash_ITLQ(SCp->target, SCp->lun, slot->tag); in NCR_700_queuecommand()
1945 …tk(KERN_ERR "scsi%d (%d:%d) ITLQ_back is not NULL!!!!\n", SCp->host->host_no, SCp->target, SCp->lu… in NCR_700_queuecommand()
1957 hash = hash_ITL(SCp->target, SCp->lun); in NCR_700_queuecommand()
1963 SCp->host->host_no, SCp->target, SCp->lun); in NCR_700_queuecommand()
1974 if(!SCp->use_sg && !SCp->request_bufflen in NCR_700_queuecommand()
1975 && SCp->sc_data_direction != SCSI_DATA_NONE) { in NCR_700_queuecommand()
1978 print_command(SCp->cmnd); in NCR_700_queuecommand()
1979 printk("Has wrong data direction %d\n", SCp->sc_data_direction); in NCR_700_queuecommand()
1981 SCp->sc_data_direction = SCSI_DATA_NONE; in NCR_700_queuecommand()
1984 switch (SCp->cmnd[0]) { in NCR_700_queuecommand()
1987 SCp->cmnd[6] = 0; in NCR_700_queuecommand()
1991 switch(SCp->sc_data_direction) { in NCR_700_queuecommand()
1995 print_command(SCp->cmnd); in NCR_700_queuecommand()
2012 pci_direction = scsi_to_pci_dma_dir(SCp->sc_data_direction); in NCR_700_queuecommand()
2019 if(SCp->use_sg) { in NCR_700_queuecommand()
2020 sg_count = pci_map_sg(hostdata->pci_dev, SCp->buffer, in NCR_700_queuecommand()
2021 SCp->use_sg, pci_direction); in NCR_700_queuecommand()
2024 SCp->request_buffer, in NCR_700_queuecommand()
2025 SCp->request_bufflen, in NCR_700_queuecommand()
2027 count = SCp->request_bufflen; in NCR_700_queuecommand()
2035 if(SCp->use_sg) { in NCR_700_queuecommand()
2036 struct scatterlist *sg = SCp->buffer; in NCR_700_queuecommand()
2055 slot->pCmd = pci_map_single(hostdata->pci_dev, SCp->cmnd, in NCR_700_queuecommand()
2056 sizeof(SCp->cmnd), PCI_DMA_TODEVICE); in NCR_700_queuecommand()
2057 NCR_700_start_command(SCp); in NCR_700_queuecommand()
2062 NCR_700_abort(Scsi_Cmnd * SCp) in NCR_700_abort() argument
2066 (struct NCR_700_Host_Parameters *)SCp->host->hostdata[0]; in NCR_700_abort()
2069 SCp->host->host_no, SCp->target, SCp->lun); in NCR_700_abort()
2070 print_command(SCp->cmnd); in NCR_700_abort()
2072 slot = find_ITL_Nexus(hostdata, SCp->target, SCp->lun); in NCR_700_abort()
2073 while(slot != NULL && slot->cmnd != SCp) in NCR_700_abort()
2079 if(SCp->cmnd[0] == TEST_UNIT_READY) { in NCR_700_abort()
2090 NCR_700_internal_bus_reset(SCp->host); in NCR_700_abort()
2098 NCR_700_bus_reset(Scsi_Cmnd * SCp) in NCR_700_bus_reset() argument
2101 SCp->host->host_no, SCp->target, SCp->lun, SCp); in NCR_700_bus_reset()
2102 print_command(SCp->cmnd); in NCR_700_bus_reset()
2103 NCR_700_internal_bus_reset(SCp->host); in NCR_700_bus_reset()
2108 NCR_700_dev_reset(Scsi_Cmnd * SCp) in NCR_700_dev_reset() argument
2111 SCp->host->host_no, SCp->target, SCp->lun); in NCR_700_dev_reset()
2112 print_command(SCp->cmnd); in NCR_700_dev_reset()
2118 NCR_700_host_reset(Scsi_Cmnd * SCp) in NCR_700_host_reset() argument
2121 SCp->host->host_no, SCp->target, SCp->lun); in NCR_700_host_reset()
2122 print_command(SCp->cmnd); in NCR_700_host_reset()
2124 NCR_700_internal_bus_reset(SCp->host); in NCR_700_host_reset()
2125 NCR_700_chip_reset(SCp->host); in NCR_700_host_reset()