diff options
Diffstat (limited to 'drivers/scsi/53c700.c')
-rw-r--r-- | drivers/scsi/53c700.c | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index a7620fc368e7..523d2a97fd27 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -128,6 +128,7 @@ | |||
128 | #include <linux/blkdev.h> | 128 | #include <linux/blkdev.h> |
129 | #include <linux/module.h> | 129 | #include <linux/module.h> |
130 | #include <linux/interrupt.h> | 130 | #include <linux/interrupt.h> |
131 | #include <linux/device.h> | ||
131 | #include <asm/dma.h> | 132 | #include <asm/dma.h> |
132 | #include <asm/system.h> | 133 | #include <asm/system.h> |
133 | #include <asm/io.h> | 134 | #include <asm/io.h> |
@@ -831,8 +832,8 @@ process_extended_message(struct Scsi_Host *host, | |||
831 | 832 | ||
832 | } else { | 833 | } else { |
833 | /* SDTR message out of the blue, reject it */ | 834 | /* SDTR message out of the blue, reject it */ |
834 | printk(KERN_WARNING "scsi%d Unexpected SDTR msg\n", | 835 | shost_printk(KERN_WARNING, host, |
835 | host->host_no); | 836 | "Unexpected SDTR msg\n"); |
836 | hostdata->msgout[0] = A_REJECT_MSG; | 837 | hostdata->msgout[0] = A_REJECT_MSG; |
837 | dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE); | 838 | dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE); |
838 | script_patch_16(hostdata->script, MessageCount, 1); | 839 | script_patch_16(hostdata->script, MessageCount, 1); |
@@ -906,15 +907,17 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata | |||
906 | NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); | 907 | NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); |
907 | } else if(SCp != NULL && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_DURING_TAG_NEGOTIATION) { | 908 | } else if(SCp != NULL && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_DURING_TAG_NEGOTIATION) { |
908 | /* rejected our first simple tag message */ | 909 | /* rejected our first simple tag message */ |
909 | printk(KERN_WARNING "scsi%d (%d:%d) Rejected first tag queue attempt, turning off tag queueing\n", host->host_no, pun, lun); | 910 | scmd_printk(KERN_WARNING, SCp, |
911 | "Rejected first tag queue attempt, turning off tag queueing\n"); | ||
910 | /* we're done negotiating */ | 912 | /* we're done negotiating */ |
911 | NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION); | 913 | NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION); |
912 | hostdata->tag_negotiated &= ~(1<<SCp->device->id); | 914 | hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); |
913 | SCp->device->tagged_supported = 0; | 915 | SCp->device->tagged_supported = 0; |
914 | scsi_deactivate_tcq(SCp->device, host->cmd_per_lun); | 916 | scsi_deactivate_tcq(SCp->device, host->cmd_per_lun); |
915 | } else { | 917 | } else { |
916 | printk(KERN_WARNING "scsi%d (%d:%d) Unexpected REJECT Message %s\n", | 918 | shost_printk(KERN_WARNING, host, |
917 | host->host_no, pun, lun, | 919 | "(%d:%d) Unexpected REJECT Message %s\n", |
920 | pun, lun, | ||
918 | NCR_700_phase[(dsps & 0xf00) >> 8]); | 921 | NCR_700_phase[(dsps & 0xf00) >> 8]); |
919 | /* however, just ignore it */ | 922 | /* however, just ignore it */ |
920 | } | 923 | } |
@@ -983,7 +986,8 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, | |||
983 | if(SCp->cmnd[0] == REQUEST_SENSE) { | 986 | if(SCp->cmnd[0] == REQUEST_SENSE) { |
984 | /* OOPS: bad device, returning another | 987 | /* OOPS: bad device, returning another |
985 | * contingent allegiance condition */ | 988 | * contingent allegiance condition */ |
986 | printk(KERN_ERR "scsi%d (%d:%d) broken device is looping in contingent allegiance: ignoring\n", host->host_no, pun, lun); | 989 | scmd_printk(KERN_ERR, SCp, |
990 | "broken device is looping in contingent allegiance: ignoring\n"); | ||
987 | NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); | 991 | NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); |
988 | } else { | 992 | } else { |
989 | #ifdef NCR_DEBUG | 993 | #ifdef NCR_DEBUG |
@@ -1047,12 +1051,13 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, | |||
1047 | // SCp->request_bufflen, | 1051 | // SCp->request_bufflen, |
1048 | // DMA_FROM_DEVICE); | 1052 | // DMA_FROM_DEVICE); |
1049 | // if(((char *)SCp->request_buffer)[7] & 0x02) { | 1053 | // if(((char *)SCp->request_buffer)[7] & 0x02) { |
1050 | // printk(KERN_INFO "scsi%d: (%d:%d) Enabling Tag Command Queuing\n", host->host_no, pun, lun); | 1054 | // scmd_printk(KERN_INFO, SCp, |
1051 | // hostdata->tag_negotiated |= (1<<SCp->device->id); | 1055 | // "Enabling Tag Command Queuing\n"); |
1056 | // hostdata->tag_negotiated |= (1<<scmd_id(SCp)); | ||
1052 | // NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING); | 1057 | // NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING); |
1053 | // } else { | 1058 | // } else { |
1054 | // NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING); | 1059 | // NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING); |
1055 | // hostdata->tag_negotiated &= ~(1<<SCp->device->id); | 1060 | // hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); |
1056 | // } | 1061 | // } |
1057 | //} | 1062 | //} |
1058 | NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); | 1063 | NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); |
@@ -1060,11 +1065,11 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, | |||
1060 | } else if((dsps & 0xfffff0f0) == A_UNEXPECTED_PHASE) { | 1065 | } else if((dsps & 0xfffff0f0) == A_UNEXPECTED_PHASE) { |
1061 | __u8 i = (dsps & 0xf00) >> 8; | 1066 | __u8 i = (dsps & 0xf00) >> 8; |
1062 | 1067 | ||
1063 | printk(KERN_ERR "scsi%d: (%d:%d), UNEXPECTED PHASE %s (%s)\n", | 1068 | scmd_printk(KERN_ERR, SCp, "UNEXPECTED PHASE %s (%s)\n", |
1064 | host->host_no, pun, lun, | ||
1065 | NCR_700_phase[i], | 1069 | NCR_700_phase[i], |
1066 | sbcl_to_string(NCR_700_readb(host, SBCL_REG))); | 1070 | sbcl_to_string(NCR_700_readb(host, SBCL_REG))); |
1067 | printk(KERN_ERR " len = %d, cmd =", SCp->cmd_len); | 1071 | scmd_printk(KERN_ERR, SCp, " len = %d, cmd =", |
1072 | SCp->cmd_len); | ||
1068 | scsi_print_command(SCp); | 1073 | scsi_print_command(SCp); |
1069 | 1074 | ||
1070 | NCR_700_internal_bus_reset(host); | 1075 | NCR_700_internal_bus_reset(host); |
@@ -1115,14 +1120,14 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, | |||
1115 | } | 1120 | } |
1116 | 1121 | ||
1117 | slot = (struct NCR_700_command_slot *)SCp->host_scribble; | 1122 | slot = (struct NCR_700_command_slot *)SCp->host_scribble; |
1118 | DEBUG(("53c700: %d:%d:%d, reselection is tag %d, slot %p(%d)\n", | 1123 | DDEBUG(KERN_DEBUG, SDp, |
1119 | host->host_no, SDp->id, SDp->lun, | 1124 | "reselection is tag %d, slot %p(%d)\n", |
1120 | hostdata->msgin[2], slot, slot->tag)); | 1125 | hostdata->msgin[2], slot, slot->tag); |
1121 | } else { | 1126 | } else { |
1122 | struct scsi_cmnd *SCp = scsi_find_tag(SDp, SCSI_NO_TAG); | 1127 | struct scsi_cmnd *SCp = scsi_find_tag(SDp, SCSI_NO_TAG); |
1123 | if(unlikely(SCp == NULL)) { | 1128 | if(unlikely(SCp == NULL)) { |
1124 | printk(KERN_ERR "scsi%d: (%d:%d) no saved request for untagged cmd\n", | 1129 | sdev_printk(KERN_ERR, SDp, |
1125 | host->host_no, reselection_id, lun); | 1130 | "no saved request for untagged cmd\n"); |
1126 | BUG(); | 1131 | BUG(); |
1127 | } | 1132 | } |
1128 | slot = (struct NCR_700_command_slot *)SCp->host_scribble; | 1133 | slot = (struct NCR_700_command_slot *)SCp->host_scribble; |
@@ -1764,17 +1769,15 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) | |||
1764 | * - The blk layer sent and untagged command | 1769 | * - The blk layer sent and untagged command |
1765 | */ | 1770 | */ |
1766 | if(NCR_700_get_depth(SCp->device) != 0 | 1771 | if(NCR_700_get_depth(SCp->device) != 0 |
1767 | && (!(hostdata->tag_negotiated & (1<<SCp->device->id)) | 1772 | && (!(hostdata->tag_negotiated & (1<<scmd_id(SCp))) |
1768 | || !blk_rq_tagged(SCp->request))) { | 1773 | || !blk_rq_tagged(SCp->request))) { |
1769 | DEBUG((KERN_ERR "scsi%d (%d:%d) has non zero depth %d\n", | 1774 | CDEBUG(KERN_ERR, SCp, "has non zero depth %d\n", |
1770 | SCp->device->host->host_no, SCp->device->id, SCp->device->lun, | 1775 | NCR_700_get_depth(SCp->device)); |
1771 | NCR_700_get_depth(SCp->device))); | ||
1772 | return SCSI_MLQUEUE_DEVICE_BUSY; | 1776 | return SCSI_MLQUEUE_DEVICE_BUSY; |
1773 | } | 1777 | } |
1774 | if(NCR_700_get_depth(SCp->device) >= SCp->device->queue_depth) { | 1778 | if(NCR_700_get_depth(SCp->device) >= SCp->device->queue_depth) { |
1775 | DEBUG((KERN_ERR "scsi%d (%d:%d) has max tag depth %d\n", | 1779 | CDEBUG(KERN_ERR, SCp, "has max tag depth %d\n", |
1776 | SCp->device->host->host_no, SCp->device->id, SCp->device->lun, | 1780 | NCR_700_get_depth(SCp->device)); |
1777 | NCR_700_get_depth(SCp->device))); | ||
1778 | return SCSI_MLQUEUE_DEVICE_BUSY; | 1781 | return SCSI_MLQUEUE_DEVICE_BUSY; |
1779 | } | 1782 | } |
1780 | NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) + 1); | 1783 | NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) + 1); |
@@ -1796,10 +1799,10 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) | |||
1796 | scsi_print_command(SCp); | 1799 | scsi_print_command(SCp); |
1797 | #endif | 1800 | #endif |
1798 | if(blk_rq_tagged(SCp->request) | 1801 | if(blk_rq_tagged(SCp->request) |
1799 | && (hostdata->tag_negotiated &(1<<SCp->device->id)) == 0 | 1802 | && (hostdata->tag_negotiated &(1<<scmd_id(SCp))) == 0 |
1800 | && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_START_TAG_NEGOTIATION) { | 1803 | && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_START_TAG_NEGOTIATION) { |
1801 | printk(KERN_ERR "scsi%d: (%d:%d) Enabling Tag Command Queuing\n", SCp->device->host->host_no, SCp->device->id, SCp->device->lun); | 1804 | scmd_printk(KERN_ERR, SCp, "Enabling Tag Command Queuing\n"); |
1802 | hostdata->tag_negotiated |= (1<<SCp->device->id); | 1805 | hostdata->tag_negotiated |= (1<<scmd_id(SCp)); |
1803 | NCR_700_set_tag_neg_state(SCp->device, NCR_700_DURING_TAG_NEGOTIATION); | 1806 | NCR_700_set_tag_neg_state(SCp->device, NCR_700_DURING_TAG_NEGOTIATION); |
1804 | } | 1807 | } |
1805 | 1808 | ||
@@ -1810,17 +1813,16 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) | |||
1810 | * FIXME: This will royally screw up on multiple LUN devices | 1813 | * FIXME: This will royally screw up on multiple LUN devices |
1811 | * */ | 1814 | * */ |
1812 | if(!blk_rq_tagged(SCp->request) | 1815 | if(!blk_rq_tagged(SCp->request) |
1813 | && (hostdata->tag_negotiated &(1<<SCp->device->id))) { | 1816 | && (hostdata->tag_negotiated &(1<<scmd_id(SCp)))) { |
1814 | printk(KERN_INFO "scsi%d: (%d:%d) Disabling Tag Command Queuing\n", SCp->device->host->host_no, SCp->device->id, SCp->device->lun); | 1817 | scmd_printk(KERN_INFO, SCp, "Disabling Tag Command Queuing\n"); |
1815 | hostdata->tag_negotiated &= ~(1<<SCp->device->id); | 1818 | hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); |
1816 | } | 1819 | } |
1817 | 1820 | ||
1818 | if((hostdata->tag_negotiated &(1<<SCp->device->id)) | 1821 | if((hostdata->tag_negotiated &(1<<scmd_id(SCp))) |
1819 | && scsi_get_tag_type(SCp->device)) { | 1822 | && scsi_get_tag_type(SCp->device)) { |
1820 | slot->tag = SCp->request->tag; | 1823 | slot->tag = SCp->request->tag; |
1821 | DEBUG(("53c700 %d:%d:%d, sending out tag %d, slot %p\n", | 1824 | CDEBUG(KERN_DEBUG, SCp, "sending out tag %d, slot %p\n", |
1822 | SCp->device->host->host_no, SCp->device->id, SCp->device->lun, slot->tag, | 1825 | slot->tag, slot); |
1823 | slot)); | ||
1824 | } else { | 1826 | } else { |
1825 | slot->tag = SCSI_NO_TAG; | 1827 | slot->tag = SCSI_NO_TAG; |
1826 | /* must populate current_cmnd for scsi_find_tag to work */ | 1828 | /* must populate current_cmnd for scsi_find_tag to work */ |
@@ -1920,8 +1922,8 @@ NCR_700_abort(struct scsi_cmnd * SCp) | |||
1920 | { | 1922 | { |
1921 | struct NCR_700_command_slot *slot; | 1923 | struct NCR_700_command_slot *slot; |
1922 | 1924 | ||
1923 | printk(KERN_INFO "scsi%d (%d:%d) New error handler wants to abort command\n\t", | 1925 | scmd_printk(KERN_INFO, SCp, |
1924 | SCp->device->host->host_no, SCp->device->id, SCp->device->lun); | 1926 | "New error handler wants to abort command\n\t"); |
1925 | scsi_print_command(SCp); | 1927 | scsi_print_command(SCp); |
1926 | 1928 | ||
1927 | slot = (struct NCR_700_command_slot *)SCp->host_scribble; | 1929 | slot = (struct NCR_700_command_slot *)SCp->host_scribble; |
@@ -1954,8 +1956,8 @@ NCR_700_bus_reset(struct scsi_cmnd * SCp) | |||
1954 | struct NCR_700_Host_Parameters *hostdata = | 1956 | struct NCR_700_Host_Parameters *hostdata = |
1955 | (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; | 1957 | (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; |
1956 | 1958 | ||
1957 | printk(KERN_INFO "scsi%d (%d:%d) New error handler wants BUS reset, cmd %p\n\t", | 1959 | scmd_printk(KERN_INFO, SCp, |
1958 | SCp->device->host->host_no, SCp->device->id, SCp->device->lun, SCp); | 1960 | "New error handler wants BUS reset, cmd %p\n\t", SCp); |
1959 | scsi_print_command(SCp); | 1961 | scsi_print_command(SCp); |
1960 | 1962 | ||
1961 | /* In theory, eh_complete should always be null because the | 1963 | /* In theory, eh_complete should always be null because the |
@@ -1987,8 +1989,7 @@ NCR_700_bus_reset(struct scsi_cmnd * SCp) | |||
1987 | STATIC int | 1989 | STATIC int |
1988 | NCR_700_host_reset(struct scsi_cmnd * SCp) | 1990 | NCR_700_host_reset(struct scsi_cmnd * SCp) |
1989 | { | 1991 | { |
1990 | printk(KERN_INFO "scsi%d (%d:%d) New error handler wants HOST reset\n\t", | 1992 | scmd_printk(KERN_INFO, SCp, "New error handler wants HOST reset\n\t"); |
1991 | SCp->device->host->host_no, SCp->device->id, SCp->device->lun); | ||
1992 | scsi_print_command(SCp); | 1993 | scsi_print_command(SCp); |
1993 | 1994 | ||
1994 | spin_lock_irq(SCp->device->host->host_lock); | 1995 | spin_lock_irq(SCp->device->host->host_lock); |