Lines Matching refs:SCp
548 struct scsi_cmnd *SCp, __u32 dsp) in save_for_reselection() argument
551 if(SCp != NULL) { in save_for_reselection()
553 (struct NCR_700_command_slot *)SCp->host_scribble; in save_for_reselection()
562 NCR_700_unmap(struct NCR_700_Host_Parameters *hostdata, struct scsi_cmnd *SCp, in NCR_700_unmap() argument
565 if(SCp->sc_data_direction != DMA_NONE && in NCR_700_unmap()
566 SCp->sc_data_direction != DMA_BIDIRECTIONAL) in NCR_700_unmap()
567 scsi_dma_unmap(SCp); in NCR_700_unmap()
572 struct scsi_cmnd *SCp, int result) in NCR_700_scsi_done() argument
577 if(SCp != NULL) { in NCR_700_scsi_done()
579 (struct NCR_700_command_slot *)SCp->host_scribble; in NCR_700_scsi_done()
584 char *cmnd = NCR_700_get_sense_cmnd(SCp->device); in NCR_700_scsi_done()
593 SCp->cmd_len = cmnd[8]; in NCR_700_scsi_done()
595 NCR_700_unmap(hostdata, SCp, slot); in NCR_700_scsi_done()
599 if(NCR_700_get_depth(SCp->device) == 0 || in NCR_700_scsi_done()
600 NCR_700_get_depth(SCp->device) > SCp->device->queue_depth) in NCR_700_scsi_done()
602 NCR_700_get_depth(SCp->device)); in NCR_700_scsi_done()
604 NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) - 1); in NCR_700_scsi_done()
606 SCp->host_scribble = NULL; in NCR_700_scsi_done()
607 SCp->result = result; in NCR_700_scsi_done()
608 SCp->scsi_done(SCp); in NCR_700_scsi_done()
766 struct scsi_cmnd *SCp, __u32 dsp, __u32 dsps) in process_extended_message() argument
771 if(SCp != NULL) { in process_extended_message()
772 pun = SCp->device->id; in process_extended_message()
773 lun = SCp->device->lun; in process_extended_message()
778 if(SCp != NULL && NCR_700_is_flag_set(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION)) { in process_extended_message()
779 struct scsi_target *starget = SCp->device->sdev_target; in process_extended_message()
791 if(NCR_700_is_flag_set(SCp->device, NCR_700_DEV_PRINT_SYNC_NEGOTIATION)) { in process_extended_message()
793 NCR_700_clear_flag(SCp->device, NCR_700_DEV_PRINT_SYNC_NEGOTIATION); in process_extended_message()
796 NCR_700_set_flag(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC); in process_extended_message()
797 NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); in process_extended_message()
799 NCR_700_writeb(NCR_700_get_SXFER(SCp->device), in process_extended_message()
848 struct scsi_cmnd *SCp, __u32 dsp, __u32 dsps) in process_message() argument
854 if(SCp != NULL) { in process_message()
855 pun = SCp->device->id; in process_message()
856 lun = SCp->device->lun; in process_message()
869 resume_offset = process_extended_message(host, hostdata, SCp, in process_message()
874 if(SCp != NULL && NCR_700_is_flag_set(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION)) { in process_message()
876 spi_period(SCp->device->sdev_target) = in process_message()
877 spi_offset(SCp->device->sdev_target) = 0; in process_message()
878 NCR_700_set_flag(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC); in process_message()
879 NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); in process_message()
880 …} else if(SCp != NULL && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_DURING_TAG_NEGOTIATION)… in process_message()
882 scmd_printk(KERN_WARNING, SCp, in process_message()
885 NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION); in process_message()
886 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); in process_message()
888 SCp->device->tagged_supported = 0; in process_message()
889 SCp->device->simple_tags = 0; in process_message()
890 scsi_change_queue_depth(SCp->device, host->cmd_per_lun); in process_message()
936 process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, in process_script_interrupt() argument
943 if(SCp != NULL) { in process_script_interrupt()
944 pun = SCp->device->id; in process_script_interrupt()
945 lun = SCp->device->lun; in process_script_interrupt()
952 if (NCR_700_get_tag_neg_state(SCp->device) == NCR_700_DURING_TAG_NEGOTIATION) in process_script_interrupt()
953 NCR_700_set_tag_neg_state(SCp->device, in process_script_interrupt()
960 (struct NCR_700_command_slot *)SCp->host_scribble; in process_script_interrupt()
964 scmd_printk(KERN_ERR, SCp, in process_script_interrupt()
966 NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); in process_script_interrupt()
969 NCR_700_get_sense_cmnd(SCp->device); in process_script_interrupt()
971 scsi_print_command(SCp); in process_script_interrupt()
973 SCp, hostdata->status[0]); in process_script_interrupt()
982 NCR_700_unmap(hostdata, SCp, slot); in process_script_interrupt()
1001 cmnd[8] = SCp->cmd_len; in process_script_interrupt()
1002 SCp->cmd_len = 6; /* command length for in process_script_interrupt()
1005 …slot->dma_handle = dma_map_single(hostdata->dev, SCp->sense_buffer, SCSI_SENSE_BUFFERSIZE, DMA_FRO… in process_script_interrupt()
1012 dma_cache_sync(hostdata->dev, SCp->sense_buffer, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); in process_script_interrupt()
1042 NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); in process_script_interrupt()
1047 scmd_printk(KERN_ERR, SCp, "UNEXPECTED PHASE %s (%s)\n", in process_script_interrupt()
1050 scmd_printk(KERN_ERR, SCp, " len = %d, cmd =", in process_script_interrupt()
1051 SCp->cmd_len); in process_script_interrupt()
1052 scsi_print_command(SCp); in process_script_interrupt()
1073 save_for_reselection(hostdata, SCp, dsp); in process_script_interrupt()
1094 struct scsi_cmnd *SCp; in process_script_interrupt() local
1096 SCp = scsi_host_find_tag(SDp->host, hostdata->msgin[2]); in process_script_interrupt()
1097 if(unlikely(SCp == NULL)) { in process_script_interrupt()
1103 slot = (struct NCR_700_command_slot *)SCp->host_scribble; in process_script_interrupt()
1109 struct scsi_cmnd *SCp = p->current_cmnd; in process_script_interrupt() local
1111 if(unlikely(SCp == NULL)) { in process_script_interrupt()
1116 slot = (struct NCR_700_command_slot *)SCp->host_scribble; in process_script_interrupt()
1190 SCp = hostdata->slots[i].cmnd; in process_script_interrupt()
1193 if(SCp != NULL) { in process_script_interrupt()
1194 slot = (struct NCR_700_command_slot *)SCp->host_scribble; in process_script_interrupt()
1230 resume_offset = process_message(host, hostdata, SCp, in process_script_interrupt()
1237 if(SCp != NULL) { in process_script_interrupt()
1240 scsi_print_command(SCp); in process_script_interrupt()
1241 scsi_for_each_sg(SCp, sg, scsi_sg_count(SCp) + 1, i) { in process_script_interrupt()
1242 …g->length, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].ins, ((struct NCR_700_comman… in process_script_interrupt()
1273 struct scsi_cmnd *SCp = hostdata->cmd; in process_selection() local
1296 if(hostdata->state == NCR_700_HOST_BUSY && SCp != NULL) { in process_selection()
1298 (struct NCR_700_command_slot *)SCp->host_scribble; in process_selection()
1304 save_for_reselection(hostdata, SCp, Ent_Disconnect2 + hostdata->pScript); in process_selection()
1308 save_for_reselection(hostdata, SCp, Ent_Disconnect4 + hostdata->pScript); in process_selection()
1312 save_for_reselection(hostdata, SCp, Ent_Disconnect6 + hostdata->pScript); in process_selection()
1316 save_for_reselection(hostdata, SCp, Ent_Disconnect8 + hostdata->pScript); in process_selection()
1320 process_script_interrupt(A_GOOD_STATUS_AFTER_STATUS, dsp, SCp, host, hostdata); in process_selection()
1376 NCR_700_start_command(struct scsi_cmnd *SCp) in NCR_700_start_command() argument
1379 (struct NCR_700_command_slot *)SCp->host_scribble; in NCR_700_start_command()
1381 (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; in NCR_700_start_command()
1383 u8 lun = SCp->device->lun; in NCR_700_start_command()
1392 SCp->device->host->host_no, slot->cmnd, slot)); in NCR_700_start_command()
1396 hostdata->cmd = SCp; in NCR_700_start_command()
1401 hostdata->msgout[0] = NCR_700_identify((SCp->cmnd[0] != REQUEST_SENSE && in NCR_700_start_command()
1407 if(SCp->cmnd[0] == INQUIRY || SCp->cmnd[0] == REQUEST_SENSE || in NCR_700_start_command()
1409 NCR_700_clear_flag(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC); in NCR_700_start_command()
1416 if((hostdata->tag_negotiated & (1<<scmd_id(SCp))) in NCR_700_start_command()
1417 && (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE && in NCR_700_start_command()
1419 count += spi_populate_tag_msg(&hostdata->msgout[count], SCp); in NCR_700_start_command()
1423 NCR_700_is_flag_clear(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC)) { in NCR_700_start_command()
1425 spi_period(SCp->device->sdev_target), in NCR_700_start_command()
1426 spi_offset(SCp->device->sdev_target)); in NCR_700_start_command()
1427 NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); in NCR_700_start_command()
1434 Device_ID, 1<<scmd_id(SCp)); in NCR_700_start_command()
1439 SCp->cmd_len); in NCR_700_start_command()
1444 NCR_700_clear_fifo(SCp->device->host); in NCR_700_start_command()
1452 dma_cache_sync(hostdata->dev, SCp->cmnd, SCp->cmd_len, DMA_TO_DEVICE); in NCR_700_start_command()
1456 NCR_700_writeb(NCR_700_get_SXFER(SCp->device), in NCR_700_start_command()
1457 SCp->device->host, SXFER_REG); in NCR_700_start_command()
1458 NCR_700_writel(slot->temp, SCp->device->host, TEMP_REG); in NCR_700_start_command()
1459 NCR_700_writel(slot->resume_offset, SCp->device->host, DSP_REG); in NCR_700_start_command()
1487 struct scsi_cmnd *SCp = hostdata->cmd; in NCR_700_intr() local
1492 SCp = hostdata->cmd; in NCR_700_intr()
1514 if(SCp != NULL) { in NCR_700_intr()
1515 pun = SCp->device->id; in NCR_700_intr()
1516 lun = SCp->device->lun; in NCR_700_intr()
1526 … host->host_no, SCp, SCp == NULL ? NULL : SCp->host_scribble, dsp, dsp - hostdata->pScript); in NCR_700_intr()
1536 struct scsi_cmnd *SCp; in NCR_700_intr() local
1543 SCp = slot->cmnd; in NCR_700_intr()
1545 slot, SCp); in NCR_700_intr()
1547 SCp->host_scribble = NULL; in NCR_700_intr()
1548 NCR_700_set_depth(SCp->device, 0); in NCR_700_intr()
1555 SCp->result = DID_RESET << 16; in NCR_700_intr()
1556 SCp->scsi_done(SCp); in NCR_700_intr()
1570 NCR_700_scsi_done(hostdata, SCp, DID_NO_CONNECT<<16); in NCR_700_intr()
1572 struct NCR_700_command_slot *slot = (SCp == NULL) ? NULL : in NCR_700_intr()
1573 (struct NCR_700_command_slot *)SCp->host_scribble; in NCR_700_intr()
1596 scsi_print_command(SCp); in NCR_700_intr()
1645 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1649 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1653 resume_offset = process_script_interrupt(dsps, dsp, SCp, host, hostdata); in NCR_700_intr()
1659 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1663 NCR_700_scsi_done(hostdata, SCp, DID_ERROR<<16); in NCR_700_intr()
1737 NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) in NCR_700_queuecommand_lck() argument
1740 (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; in NCR_700_queuecommand_lck()
1748 …printk(KERN_WARNING "scsi%d: Command depth has gone over queue depth\n", SCp->device->host->host_n… in NCR_700_queuecommand_lck()
1757 if(NCR_700_get_depth(SCp->device) != 0 in NCR_700_queuecommand_lck()
1758 && (!(hostdata->tag_negotiated & (1<<scmd_id(SCp))) in NCR_700_queuecommand_lck()
1759 || !(SCp->flags & SCMD_TAGGED))) { in NCR_700_queuecommand_lck()
1760 CDEBUG(KERN_ERR, SCp, "has non zero depth %d\n", in NCR_700_queuecommand_lck()
1761 NCR_700_get_depth(SCp->device)); in NCR_700_queuecommand_lck()
1764 if(NCR_700_get_depth(SCp->device) >= SCp->device->queue_depth) { in NCR_700_queuecommand_lck()
1765 CDEBUG(KERN_ERR, SCp, "has max tag depth %d\n", in NCR_700_queuecommand_lck()
1766 NCR_700_get_depth(SCp->device)); in NCR_700_queuecommand_lck()
1769 NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) + 1); in NCR_700_queuecommand_lck()
1776 slot->cmnd = SCp; in NCR_700_queuecommand_lck()
1778 SCp->scsi_done = done; in NCR_700_queuecommand_lck()
1779 SCp->host_scribble = (unsigned char *)slot; in NCR_700_queuecommand_lck()
1780 SCp->SCp.ptr = NULL; in NCR_700_queuecommand_lck()
1781 SCp->SCp.buffer = NULL; in NCR_700_queuecommand_lck()
1784 printk("53c700: scsi%d, command ", SCp->device->host->host_no); in NCR_700_queuecommand_lck()
1785 scsi_print_command(SCp); in NCR_700_queuecommand_lck()
1787 if ((SCp->flags & SCMD_TAGGED) in NCR_700_queuecommand_lck()
1788 && (hostdata->tag_negotiated &(1<<scmd_id(SCp))) == 0 in NCR_700_queuecommand_lck()
1789 && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_START_TAG_NEGOTIATION) { in NCR_700_queuecommand_lck()
1790 scmd_printk(KERN_ERR, SCp, "Enabling Tag Command Queuing\n"); in NCR_700_queuecommand_lck()
1791 hostdata->tag_negotiated |= (1<<scmd_id(SCp)); in NCR_700_queuecommand_lck()
1792 NCR_700_set_tag_neg_state(SCp->device, NCR_700_DURING_TAG_NEGOTIATION); in NCR_700_queuecommand_lck()
1801 if (!(SCp->flags & SCMD_TAGGED) in NCR_700_queuecommand_lck()
1802 && (hostdata->tag_negotiated &(1<<scmd_id(SCp)))) { in NCR_700_queuecommand_lck()
1803 scmd_printk(KERN_INFO, SCp, "Disabling Tag Command Queuing\n"); in NCR_700_queuecommand_lck()
1804 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); in NCR_700_queuecommand_lck()
1807 if ((hostdata->tag_negotiated & (1<<scmd_id(SCp))) && in NCR_700_queuecommand_lck()
1808 SCp->device->simple_tags) { in NCR_700_queuecommand_lck()
1809 slot->tag = SCp->request->tag; in NCR_700_queuecommand_lck()
1810 CDEBUG(KERN_DEBUG, SCp, "sending out tag %d, slot %p\n", in NCR_700_queuecommand_lck()
1813 struct NCR_700_Device_Parameters *p = SCp->device->hostdata; in NCR_700_queuecommand_lck()
1817 p->current_cmnd = SCp; in NCR_700_queuecommand_lck()
1821 if(!scsi_sg_count(SCp) && !scsi_bufflen(SCp) && in NCR_700_queuecommand_lck()
1822 SCp->sc_data_direction != DMA_NONE) { in NCR_700_queuecommand_lck()
1825 scsi_print_command(SCp); in NCR_700_queuecommand_lck()
1826 printk("Has wrong data direction %d\n", SCp->sc_data_direction); in NCR_700_queuecommand_lck()
1828 SCp->sc_data_direction = DMA_NONE; in NCR_700_queuecommand_lck()
1831 switch (SCp->cmnd[0]) { in NCR_700_queuecommand_lck()
1834 SCp->cmnd[6] = 0; in NCR_700_queuecommand_lck()
1838 switch(SCp->sc_data_direction) { in NCR_700_queuecommand_lck()
1842 scsi_print_command(SCp); in NCR_700_queuecommand_lck()
1859 direction = SCp->sc_data_direction; in NCR_700_queuecommand_lck()
1867 sg_count = scsi_dma_map(SCp); in NCR_700_queuecommand_lck()
1870 scsi_for_each_sg(SCp, sg, sg_count, i) { in NCR_700_queuecommand_lck()
1887 slot->pCmd = dma_map_single(hostdata->dev, SCp->cmnd, in NCR_700_queuecommand_lck()
1889 NCR_700_start_command(SCp); in NCR_700_queuecommand_lck()
1896 NCR_700_abort(struct scsi_cmnd * SCp) in DEF_SCSI_QCMD()
1900 scmd_printk(KERN_INFO, SCp, "abort command\n"); in DEF_SCSI_QCMD()
1902 slot = (struct NCR_700_command_slot *)SCp->host_scribble; in DEF_SCSI_QCMD()
1907 if(SCp->cmnd[0] == TEST_UNIT_READY) { in DEF_SCSI_QCMD()
1918 NCR_700_internal_bus_reset(SCp->device->host); in DEF_SCSI_QCMD()
1926 NCR_700_host_reset(struct scsi_cmnd * SCp) in NCR_700_host_reset() argument
1930 (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; in NCR_700_host_reset()
1932 scmd_printk(KERN_INFO, SCp, in NCR_700_host_reset()
1933 "New error handler wants HOST reset, cmd %p\n\t", SCp); in NCR_700_host_reset()
1934 scsi_print_command(SCp); in NCR_700_host_reset()
1939 spin_lock_irq(SCp->device->host->host_lock); in NCR_700_host_reset()
1941 spin_unlock_irq(SCp->device->host->host_lock); in NCR_700_host_reset()
1943 spin_lock_irq(SCp->device->host->host_lock); in NCR_700_host_reset()
1947 NCR_700_internal_bus_reset(SCp->device->host); in NCR_700_host_reset()
1948 NCR_700_chip_reset(SCp->device->host); in NCR_700_host_reset()
1950 spin_unlock_irq(SCp->device->host->host_lock); in NCR_700_host_reset()
1952 spin_lock_irq(SCp->device->host->host_lock); in NCR_700_host_reset()
1957 spi_schedule_dv_device(SCp->device); in NCR_700_host_reset()
1959 spin_unlock_irq(SCp->device->host->host_lock); in NCR_700_host_reset()