aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-14 20:53:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-14 20:53:36 -0400
commit39695224bd84dc4be29abad93a0ec232a16fc519 (patch)
tree2bfa5cb50788a4c8be9f2e9f4412e47a565f4508 /drivers/message
parenta9bbd210a44102cc50b30a5f3d111dbf5f2f9cd4 (diff)
parentea038f63ac52439e7816295fa6064fe95e6c1f51 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (209 commits) [SCSI] fix oops during scsi scanning [SCSI] libsrp: fix memory leak in srp_ring_free() [SCSI] libiscsi, bnx2i: make bound ep check common [SCSI] libiscsi: add completion function for drivers that do not need pdu processing [SCSI] scsi_dh_rdac: changes for rdac debug logging [SCSI] scsi_dh_rdac: changes to collect the rdac debug information during the initialization [SCSI] scsi_dh_rdac: move the init code from rdac_activate to rdac_bus_attach [SCSI] sg: fix oops in the error path in sg_build_indirect() [SCSI] mptsas : Bump version to 3.04.12 [SCSI] mptsas : FW event thread and scsi mid layer deadlock in SYNCHRONIZE CACHE command [SCSI] mptsas : Send DID_NO_CONNECT for pending IOs of removed device [SCSI] mptsas : PAE Kernel more than 4 GB kernel panic [SCSI] mptsas : NULL pointer on big endian systems causing Expander not to tear off [SCSI] mptsas : Sanity check for phyinfo is added [SCSI] scsi_dh_rdac: Add support for Sun StorageTek ST2500, ST2510 and ST2530 [SCSI] pmcraid: PMC-Sierra MaxRAID driver to support 6Gb/s SAS RAID controller [SCSI] qla2xxx: Update version number to 8.03.01-k6. [SCSI] qla2xxx: Properly delete rports attached to a vport. [SCSI] qla2xxx: Correct various NPIV issues. [SCSI] qla2xxx: Correct qla2x00_eh_wait_on_command() to wait correctly. ...
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptbase.c94
-rw-r--r--drivers/message/fusion/mptbase.h21
-rw-r--r--drivers/message/fusion/mptfc.c19
-rw-r--r--drivers/message/fusion/mptsas.c62
-rw-r--r--drivers/message/fusion/mptscsih.c67
-rw-r--r--drivers/message/fusion/mptscsih.h1
-rw-r--r--drivers/message/fusion/mptspi.c21
7 files changed, 77 insertions, 208 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 5d0ba4f5924c..76fa2ee0b574 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1015,9 +1015,9 @@ mpt_add_sge_64bit(void *pAddr, u32 flagslength, dma_addr_t dma_addr)
1015{ 1015{
1016 SGESimple64_t *pSge = (SGESimple64_t *) pAddr; 1016 SGESimple64_t *pSge = (SGESimple64_t *) pAddr;
1017 pSge->Address.Low = cpu_to_le32 1017 pSge->Address.Low = cpu_to_le32
1018 (lower_32_bits((unsigned long)(dma_addr))); 1018 (lower_32_bits(dma_addr));
1019 pSge->Address.High = cpu_to_le32 1019 pSge->Address.High = cpu_to_le32
1020 (upper_32_bits((unsigned long)dma_addr)); 1020 (upper_32_bits(dma_addr));
1021 pSge->FlagsLength = cpu_to_le32 1021 pSge->FlagsLength = cpu_to_le32
1022 ((flagslength | MPT_SGE_FLAGS_64_BIT_ADDRESSING)); 1022 ((flagslength | MPT_SGE_FLAGS_64_BIT_ADDRESSING));
1023} 1023}
@@ -1038,8 +1038,8 @@ mpt_add_sge_64bit_1078(void *pAddr, u32 flagslength, dma_addr_t dma_addr)
1038 u32 tmp; 1038 u32 tmp;
1039 1039
1040 pSge->Address.Low = cpu_to_le32 1040 pSge->Address.Low = cpu_to_le32
1041 (lower_32_bits((unsigned long)(dma_addr))); 1041 (lower_32_bits(dma_addr));
1042 tmp = (u32)(upper_32_bits((unsigned long)dma_addr)); 1042 tmp = (u32)(upper_32_bits(dma_addr));
1043 1043
1044 /* 1044 /*
1045 * 1078 errata workaround for the 36GB limitation 1045 * 1078 errata workaround for the 36GB limitation
@@ -1101,7 +1101,7 @@ mpt_add_chain_64bit(void *pAddr, u8 next, u16 length, dma_addr_t dma_addr)
1101 pChain->NextChainOffset = next; 1101 pChain->NextChainOffset = next;
1102 1102
1103 pChain->Address.Low = cpu_to_le32(tmp); 1103 pChain->Address.Low = cpu_to_le32(tmp);
1104 tmp = (u32)(upper_32_bits((unsigned long)dma_addr)); 1104 tmp = (u32)(upper_32_bits(dma_addr));
1105 pChain->Address.High = cpu_to_le32(tmp); 1105 pChain->Address.High = cpu_to_le32(tmp);
1106} 1106}
1107 1107
@@ -1297,12 +1297,8 @@ mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init)
1297 psge = (char *)&ioc_init->HostPageBufferSGE; 1297 psge = (char *)&ioc_init->HostPageBufferSGE;
1298 flags_length = MPI_SGE_FLAGS_SIMPLE_ELEMENT | 1298 flags_length = MPI_SGE_FLAGS_SIMPLE_ELEMENT |
1299 MPI_SGE_FLAGS_SYSTEM_ADDRESS | 1299 MPI_SGE_FLAGS_SYSTEM_ADDRESS |
1300 MPI_SGE_FLAGS_32_BIT_ADDRESSING |
1301 MPI_SGE_FLAGS_HOST_TO_IOC | 1300 MPI_SGE_FLAGS_HOST_TO_IOC |
1302 MPI_SGE_FLAGS_END_OF_BUFFER; 1301 MPI_SGE_FLAGS_END_OF_BUFFER;
1303 if (sizeof(dma_addr_t) == sizeof(u64)) {
1304 flags_length |= MPI_SGE_FLAGS_64_BIT_ADDRESSING;
1305 }
1306 flags_length = flags_length << MPI_SGE_FLAGS_SHIFT; 1302 flags_length = flags_length << MPI_SGE_FLAGS_SHIFT;
1307 flags_length |= ioc->HostPageBuffer_sz; 1303 flags_length |= ioc->HostPageBuffer_sz;
1308 ioc->add_sge(psge, flags_length, ioc->HostPageBuffer_dma); 1304 ioc->add_sge(psge, flags_length, ioc->HostPageBuffer_dma);
@@ -2224,8 +2220,6 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
2224 int hard; 2220 int hard;
2225 int rc=0; 2221 int rc=0;
2226 int ii; 2222 int ii;
2227 u8 cb_idx;
2228 int handlers;
2229 int ret = 0; 2223 int ret = 0;
2230 int reset_alt_ioc_active = 0; 2224 int reset_alt_ioc_active = 0;
2231 int irq_allocated = 0; 2225 int irq_allocated = 0;
@@ -2548,34 +2542,6 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
2548 mpt_get_manufacturing_pg_0(ioc); 2542 mpt_get_manufacturing_pg_0(ioc);
2549 } 2543 }
2550 2544
2551 /*
2552 * Call each currently registered protocol IOC reset handler
2553 * with post-reset indication.
2554 * NOTE: If we're doing _IOC_BRINGUP, there can be no
2555 * MptResetHandlers[] registered yet.
2556 */
2557 if (hard_reset_done) {
2558 rc = handlers = 0;
2559 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
2560 if ((ret == 0) && MptResetHandlers[cb_idx]) {
2561 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2562 "Calling IOC post_reset handler #%d\n",
2563 ioc->name, cb_idx));
2564 rc += mpt_signal_reset(cb_idx, ioc, MPT_IOC_POST_RESET);
2565 handlers++;
2566 }
2567
2568 if (alt_ioc_ready && MptResetHandlers[cb_idx]) {
2569 drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2570 "Calling IOC post_reset handler #%d\n",
2571 ioc->alt_ioc->name, cb_idx));
2572 rc += mpt_signal_reset(cb_idx, ioc->alt_ioc, MPT_IOC_POST_RESET);
2573 handlers++;
2574 }
2575 }
2576 /* FIXME? Examine results here? */
2577 }
2578
2579 out: 2545 out:
2580 if ((ret != 0) && irq_allocated) { 2546 if ((ret != 0) && irq_allocated) {
2581 free_irq(ioc->pci_irq, ioc); 2547 free_irq(ioc->pci_irq, ioc);
@@ -3938,6 +3904,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3938 int count = 0; 3904 int count = 0;
3939 u32 diag1val = 0; 3905 u32 diag1val = 0;
3940 MpiFwHeader_t *cached_fw; /* Pointer to FW */ 3906 MpiFwHeader_t *cached_fw; /* Pointer to FW */
3907 u8 cb_idx;
3941 3908
3942 /* Clear any existing interrupts */ 3909 /* Clear any existing interrupts */
3943 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); 3910 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
@@ -3956,6 +3923,18 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3956 else 3923 else
3957 mdelay(1); 3924 mdelay(1);
3958 3925
3926 /*
3927 * Call each currently registered protocol IOC reset handler
3928 * with pre-reset indication.
3929 * NOTE: If we're doing _IOC_BRINGUP, there can be no
3930 * MptResetHandlers[] registered yet.
3931 */
3932 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
3933 if (MptResetHandlers[cb_idx])
3934 (*(MptResetHandlers[cb_idx]))(ioc,
3935 MPT_IOC_PRE_RESET);
3936 }
3937
3959 for (count = 0; count < 60; count ++) { 3938 for (count = 0; count < 60; count ++) {
3960 doorbell = CHIPREG_READ32(&ioc->chip->Doorbell); 3939 doorbell = CHIPREG_READ32(&ioc->chip->Doorbell);
3961 doorbell &= MPI_IOC_STATE_MASK; 3940 doorbell &= MPI_IOC_STATE_MASK;
@@ -4052,25 +4031,15 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
4052 * NOTE: If we're doing _IOC_BRINGUP, there can be no 4031 * NOTE: If we're doing _IOC_BRINGUP, there can be no
4053 * MptResetHandlers[] registered yet. 4032 * MptResetHandlers[] registered yet.
4054 */ 4033 */
4055 { 4034 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
4056 u8 cb_idx; 4035 if (MptResetHandlers[cb_idx]) {
4057 int r = 0; 4036 mpt_signal_reset(cb_idx,
4058 4037 ioc, MPT_IOC_PRE_RESET);
4059 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { 4038 if (ioc->alt_ioc) {
4060 if (MptResetHandlers[cb_idx]) { 4039 mpt_signal_reset(cb_idx,
4061 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT 4040 ioc->alt_ioc, MPT_IOC_PRE_RESET);
4062 "Calling IOC pre_reset handler #%d\n",
4063 ioc->name, cb_idx));
4064 r += mpt_signal_reset(cb_idx, ioc, MPT_IOC_PRE_RESET);
4065 if (ioc->alt_ioc) {
4066 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
4067 "Calling alt-%s pre_reset handler #%d\n",
4068 ioc->name, ioc->alt_ioc->name, cb_idx));
4069 r += mpt_signal_reset(cb_idx, ioc->alt_ioc, MPT_IOC_PRE_RESET);
4070 }
4071 } 4041 }
4072 } 4042 }
4073 /* FIXME? Examine results here? */
4074 } 4043 }
4075 4044
4076 if (ioc->cached_fw) 4045 if (ioc->cached_fw)
@@ -6956,7 +6925,7 @@ EXPORT_SYMBOL(mpt_halt_firmware);
6956int 6925int
6957mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag) 6926mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6958{ 6927{
6959 int rc; 6928 int rc;
6960 u8 cb_idx; 6929 u8 cb_idx;
6961 unsigned long flags; 6930 unsigned long flags;
6962 unsigned long time_count; 6931 unsigned long time_count;
@@ -6982,8 +6951,6 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6982 ioc->alt_ioc->ioc_reset_in_progress = 1; 6951 ioc->alt_ioc->ioc_reset_in_progress = 1;
6983 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); 6952 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6984 6953
6985 /* FIXME: If do_ioc_recovery fails, repeat....
6986 */
6987 6954
6988 /* The SCSI driver needs to adjust timeouts on all current 6955 /* The SCSI driver needs to adjust timeouts on all current
6989 * commands prior to the diagnostic reset being issued. 6956 * commands prior to the diagnostic reset being issued.
@@ -7020,6 +6987,15 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7020 } 6987 }
7021 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); 6988 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7022 6989
6990 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
6991 if (MptResetHandlers[cb_idx]) {
6992 mpt_signal_reset(cb_idx, ioc, MPT_IOC_POST_RESET);
6993 if (ioc->alt_ioc)
6994 mpt_signal_reset(cb_idx,
6995 ioc->alt_ioc, MPT_IOC_POST_RESET);
6996 }
6997 }
6998
7023 dtmprintk(ioc, 6999 dtmprintk(ioc,
7024 printk(MYIOC_s_DEBUG_FMT 7000 printk(MYIOC_s_DEBUG_FMT
7025 "HardResetHandler: completed (%d seconds): %s\n", ioc->name, 7001 "HardResetHandler: completed (%d seconds): %s\n", ioc->name,
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 1c8514dc31ca..8dd4d219e433 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -76,8 +76,8 @@
76#define COPYRIGHT "Copyright (c) 1999-2008 " MODULEAUTHOR 76#define COPYRIGHT "Copyright (c) 1999-2008 " MODULEAUTHOR
77#endif 77#endif
78 78
79#define MPT_LINUX_VERSION_COMMON "3.04.10" 79#define MPT_LINUX_VERSION_COMMON "3.04.12"
80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.09" 80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.12"
81#define WHAT_MAGIC_STRING "@" "(" "#" ")" 81#define WHAT_MAGIC_STRING "@" "(" "#" ")"
82 82
83#define show_mptmod_ver(s,ver) \ 83#define show_mptmod_ver(s,ver) \
@@ -157,8 +157,9 @@
157/* 157/*
158 * Try to keep these at 2^N-1 158 * Try to keep these at 2^N-1
159 */ 159 */
160#define MPT_FC_CAN_QUEUE 127 160#define MPT_FC_CAN_QUEUE 1024
161#define MPT_SCSI_CAN_QUEUE 127 161#define MPT_SCSI_CAN_QUEUE 127
162#define MPT_SAS_CAN_QUEUE 127
162 163
163/* 164/*
164 * Set the MAX_SGE value based on user input. 165 * Set the MAX_SGE value based on user input.
@@ -879,23 +880,9 @@ typedef enum {
879 880
880typedef struct _MPT_SCSI_HOST { 881typedef struct _MPT_SCSI_HOST {
881 MPT_ADAPTER *ioc; 882 MPT_ADAPTER *ioc;
882 int port;
883 u32 pad0;
884 MPT_LOCAL_REPLY *pLocal; /* used for internal commands */
885 struct timer_list timer;
886 /* Pool of memory for holding SCpnts before doing
887 * OS callbacks. freeQ is the free pool.
888 */
889 u8 negoNvram; /* DV disabled, nego NVRAM */
890 u8 pad1;
891 u8 rsvd[2];
892 MPT_FRAME_HDR *cmdPtr; /* Ptr to nonOS request */
893 struct scsi_cmnd *abortSCpnt;
894 MPT_LOCAL_REPLY localReply; /* internal cmd reply struct */
895 ushort sel_timeout[MPT_MAX_FC_DEVICES]; 883 ushort sel_timeout[MPT_MAX_FC_DEVICES];
896 char *info_kbuf; 884 char *info_kbuf;
897 long last_queue_full; 885 long last_queue_full;
898 u16 tm_iocstatus;
899 u16 spi_pending; 886 u16 spi_pending;
900 struct list_head target_reset_list; 887 struct list_head target_reset_list;
901} MPT_SCSI_HOST; 888} MPT_SCSI_HOST;
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index e61df133a59e..ebf6ae024da4 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -1288,25 +1288,6 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1288 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n", 1288 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
1289 ioc->name, ioc->ScsiLookup)); 1289 ioc->name, ioc->ScsiLookup));
1290 1290
1291 /* Clear the TM flags
1292 */
1293 hd->abortSCpnt = NULL;
1294
1295 /* Clear the pointer used to store
1296 * single-threaded commands, i.e., those
1297 * issued during a bus scan, dv and
1298 * configuration pages.
1299 */
1300 hd->cmdPtr = NULL;
1301
1302 /* Initialize this SCSI Hosts' timers
1303 * To use, set the timer expires field
1304 * and add_timer
1305 */
1306 init_timer(&hd->timer);
1307 hd->timer.data = (unsigned long) hd;
1308 hd->timer.function = mptscsih_timer_expired;
1309
1310 hd->last_queue_full = 0; 1291 hd->last_queue_full = 0;
1311 1292
1312 sh->transportt = mptfc_transport_template; 1293 sh->transportt = mptfc_transport_template;
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 55ff25244af4..83873e3d0ce7 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -72,6 +72,7 @@
72 */ 72 */
73#define MPTSAS_RAID_CHANNEL 1 73#define MPTSAS_RAID_CHANNEL 1
74 74
75#define SAS_CONFIG_PAGE_TIMEOUT 30
75MODULE_AUTHOR(MODULEAUTHOR); 76MODULE_AUTHOR(MODULEAUTHOR);
76MODULE_DESCRIPTION(my_NAME); 77MODULE_DESCRIPTION(my_NAME);
77MODULE_LICENSE("GPL"); 78MODULE_LICENSE("GPL");
@@ -324,7 +325,6 @@ mptsas_cleanup_fw_event_q(MPT_ADAPTER *ioc)
324{ 325{
325 struct fw_event_work *fw_event, *next; 326 struct fw_event_work *fw_event, *next;
326 struct mptsas_target_reset_event *target_reset_list, *n; 327 struct mptsas_target_reset_event *target_reset_list, *n;
327 u8 flush_q;
328 MPT_SCSI_HOST *hd = shost_priv(ioc->sh); 328 MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
329 329
330 /* flush the target_reset_list */ 330 /* flush the target_reset_list */
@@ -344,15 +344,10 @@ mptsas_cleanup_fw_event_q(MPT_ADAPTER *ioc)
344 !ioc->fw_event_q || in_interrupt()) 344 !ioc->fw_event_q || in_interrupt())
345 return; 345 return;
346 346
347 flush_q = 0;
348 list_for_each_entry_safe(fw_event, next, &ioc->fw_event_list, list) { 347 list_for_each_entry_safe(fw_event, next, &ioc->fw_event_list, list) {
349 if (cancel_delayed_work(&fw_event->work)) 348 if (cancel_delayed_work(&fw_event->work))
350 mptsas_free_fw_event(ioc, fw_event); 349 mptsas_free_fw_event(ioc, fw_event);
351 else
352 flush_q = 1;
353 } 350 }
354 if (flush_q)
355 flush_workqueue(ioc->fw_event_q);
356} 351}
357 352
358 353
@@ -661,7 +656,7 @@ mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc,
661 cfg.pageAddr = starget->id; 656 cfg.pageAddr = starget->id;
662 cfg.cfghdr.hdr = &hdr; 657 cfg.cfghdr.hdr = &hdr;
663 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; 658 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
664 cfg.timeout = 10; 659 cfg.timeout = SAS_CONFIG_PAGE_TIMEOUT;
665 660
666 if (mpt_config(ioc, &cfg) != 0) 661 if (mpt_config(ioc, &cfg) != 0)
667 goto out; 662 goto out;
@@ -851,7 +846,13 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
851 port_details->num_phys--; 846 port_details->num_phys--;
852 port_details->phy_bitmask &= ~ (1 << phy_info->phy_id); 847 port_details->phy_bitmask &= ~ (1 << phy_info->phy_id);
853 memset(&phy_info->attached, 0, sizeof(struct mptsas_devinfo)); 848 memset(&phy_info->attached, 0, sizeof(struct mptsas_devinfo));
854 sas_port_delete_phy(port_details->port, phy_info->phy); 849 if (phy_info->phy) {
850 devtprintk(ioc, dev_printk(KERN_DEBUG,
851 &phy_info->phy->dev, MYIOC_s_FMT
852 "delete phy %d, phy-obj (0x%p)\n", ioc->name,
853 phy_info->phy_id, phy_info->phy));
854 sas_port_delete_phy(port_details->port, phy_info->phy);
855 }
855 phy_info->port_details = NULL; 856 phy_info->port_details = NULL;
856 } 857 }
857 858
@@ -1272,7 +1273,6 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
1272 } 1273 }
1273 mptsas_cleanup_fw_event_q(ioc); 1274 mptsas_cleanup_fw_event_q(ioc);
1274 mptsas_queue_rescan(ioc); 1275 mptsas_queue_rescan(ioc);
1275 mptsas_fw_event_on(ioc);
1276 break; 1276 break;
1277 default: 1277 default:
1278 break; 1278 break;
@@ -1318,7 +1318,7 @@ mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
1318 cfg.pageAddr = form + form_specific; 1318 cfg.pageAddr = form + form_specific;
1319 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; 1319 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
1320 cfg.dir = 0; /* read */ 1320 cfg.dir = 0; /* read */
1321 cfg.timeout = 10; 1321 cfg.timeout = SAS_CONFIG_PAGE_TIMEOUT;
1322 1322
1323 error = mpt_config(ioc, &cfg); 1323 error = mpt_config(ioc, &cfg);
1324 if (error) 1324 if (error)
@@ -1592,6 +1592,7 @@ mptsas_firmware_event_work(struct work_struct *work)
1592 mptsas_scan_sas_topology(ioc); 1592 mptsas_scan_sas_topology(ioc);
1593 ioc->in_rescan = 0; 1593 ioc->in_rescan = 0;
1594 mptsas_free_fw_event(ioc, fw_event); 1594 mptsas_free_fw_event(ioc, fw_event);
1595 mptsas_fw_event_on(ioc);
1595 return; 1596 return;
1596 } 1597 }
1597 1598
@@ -1891,7 +1892,7 @@ static struct scsi_host_template mptsas_driver_template = {
1891 .eh_bus_reset_handler = mptscsih_bus_reset, 1892 .eh_bus_reset_handler = mptscsih_bus_reset,
1892 .eh_host_reset_handler = mptscsih_host_reset, 1893 .eh_host_reset_handler = mptscsih_host_reset,
1893 .bios_param = mptscsih_bios_param, 1894 .bios_param = mptscsih_bios_param,
1894 .can_queue = MPT_FC_CAN_QUEUE, 1895 .can_queue = MPT_SAS_CAN_QUEUE,
1895 .this_id = -1, 1896 .this_id = -1,
1896 .sg_tablesize = MPT_SCSI_SG_DEPTH, 1897 .sg_tablesize = MPT_SCSI_SG_DEPTH,
1897 .max_sectors = 8192, 1898 .max_sectors = 8192,
@@ -1926,7 +1927,7 @@ static int mptsas_get_linkerrors(struct sas_phy *phy)
1926 cfg.pageAddr = phy->identify.phy_identifier; 1927 cfg.pageAddr = phy->identify.phy_identifier;
1927 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; 1928 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
1928 cfg.dir = 0; /* read */ 1929 cfg.dir = 0; /* read */
1929 cfg.timeout = 10; 1930 cfg.timeout = SAS_CONFIG_PAGE_TIMEOUT;
1930 1931
1931 error = mpt_config(ioc, &cfg); 1932 error = mpt_config(ioc, &cfg);
1932 if (error) 1933 if (error)
@@ -2278,7 +2279,7 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
2278 cfg.pageAddr = 0; 2279 cfg.pageAddr = 0;
2279 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; 2280 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
2280 cfg.dir = 0; /* read */ 2281 cfg.dir = 0; /* read */
2281 cfg.timeout = 10; 2282 cfg.timeout = SAS_CONFIG_PAGE_TIMEOUT;
2282 2283
2283 error = mpt_config(ioc, &cfg); 2284 error = mpt_config(ioc, &cfg);
2284 if (error) 2285 if (error)
@@ -2349,7 +2350,7 @@ mptsas_sas_io_unit_pg1(MPT_ADAPTER *ioc)
2349 2350
2350 cfg.cfghdr.ehdr = &hdr; 2351 cfg.cfghdr.ehdr = &hdr;
2351 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; 2352 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
2352 cfg.timeout = 10; 2353 cfg.timeout = SAS_CONFIG_PAGE_TIMEOUT;
2353 cfg.cfghdr.ehdr->PageType = MPI_CONFIG_PAGETYPE_EXTENDED; 2354 cfg.cfghdr.ehdr->PageType = MPI_CONFIG_PAGETYPE_EXTENDED;
2354 cfg.cfghdr.ehdr->ExtPageType = MPI_CONFIG_EXTPAGETYPE_SAS_IO_UNIT; 2355 cfg.cfghdr.ehdr->ExtPageType = MPI_CONFIG_EXTPAGETYPE_SAS_IO_UNIT;
2355 cfg.cfghdr.ehdr->PageVersion = MPI_SASIOUNITPAGE1_PAGEVERSION; 2356 cfg.cfghdr.ehdr->PageVersion = MPI_SASIOUNITPAGE1_PAGEVERSION;
@@ -2411,7 +2412,7 @@ mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
2411 2412
2412 cfg.cfghdr.ehdr = &hdr; 2413 cfg.cfghdr.ehdr = &hdr;
2413 cfg.dir = 0; /* read */ 2414 cfg.dir = 0; /* read */
2414 cfg.timeout = 10; 2415 cfg.timeout = SAS_CONFIG_PAGE_TIMEOUT;
2415 2416
2416 /* Get Phy Pg 0 for each Phy. */ 2417 /* Get Phy Pg 0 for each Phy. */
2417 cfg.physAddr = -1; 2418 cfg.physAddr = -1;
@@ -2479,7 +2480,7 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
2479 cfg.physAddr = -1; 2480 cfg.physAddr = -1;
2480 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; 2481 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
2481 cfg.dir = 0; /* read */ 2482 cfg.dir = 0; /* read */
2482 cfg.timeout = 10; 2483 cfg.timeout = SAS_CONFIG_PAGE_TIMEOUT;
2483 2484
2484 memset(device_info, 0, sizeof(struct mptsas_devinfo)); 2485 memset(device_info, 0, sizeof(struct mptsas_devinfo));
2485 error = mpt_config(ioc, &cfg); 2486 error = mpt_config(ioc, &cfg);
@@ -2554,7 +2555,7 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
2554 cfg.pageAddr = form + form_specific; 2555 cfg.pageAddr = form + form_specific;
2555 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; 2556 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
2556 cfg.dir = 0; /* read */ 2557 cfg.dir = 0; /* read */
2557 cfg.timeout = 10; 2558 cfg.timeout = SAS_CONFIG_PAGE_TIMEOUT;
2558 2559
2559 memset(port_info, 0, sizeof(struct mptsas_portinfo)); 2560 memset(port_info, 0, sizeof(struct mptsas_portinfo));
2560 error = mpt_config(ioc, &cfg); 2561 error = mpt_config(ioc, &cfg);
@@ -2635,7 +2636,7 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
2635 cfg.pageAddr = form + form_specific; 2636 cfg.pageAddr = form + form_specific;
2636 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; 2637 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
2637 cfg.dir = 0; /* read */ 2638 cfg.dir = 0; /* read */
2638 cfg.timeout = 10; 2639 cfg.timeout = SAS_CONFIG_PAGE_TIMEOUT;
2639 2640
2640 error = mpt_config(ioc, &cfg); 2641 error = mpt_config(ioc, &cfg);
2641 if (error) 2642 if (error)
@@ -3307,6 +3308,7 @@ mptsas_send_expander_event(struct fw_event_work *fw_event)
3307 expander_data = (MpiEventDataSasExpanderStatusChange_t *) 3308 expander_data = (MpiEventDataSasExpanderStatusChange_t *)
3308 fw_event->event_data; 3309 fw_event->event_data;
3309 memcpy(&sas_address, &expander_data->SASAddress, sizeof(__le64)); 3310 memcpy(&sas_address, &expander_data->SASAddress, sizeof(__le64));
3311 sas_address = le64_to_cpu(sas_address);
3310 port_info = mptsas_find_portinfo_by_sas_address(ioc, sas_address); 3312 port_info = mptsas_find_portinfo_by_sas_address(ioc, sas_address);
3311 3313
3312 if (expander_data->ReasonCode == MPI_EVENT_SAS_EXP_RC_ADDED) { 3314 if (expander_data->ReasonCode == MPI_EVENT_SAS_EXP_RC_ADDED) {
@@ -4760,10 +4762,9 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
4760 4762
4761 /* set 16 byte cdb's */ 4763 /* set 16 byte cdb's */
4762 sh->max_cmd_len = 16; 4764 sh->max_cmd_len = 16;
4763 4765 sh->can_queue = min_t(int, ioc->req_depth - 10, sh->can_queue);
4764 sh->max_id = ioc->pfacts[0].PortSCSIID; 4766 sh->max_id = -1;
4765 sh->max_lun = max_lun; 4767 sh->max_lun = max_lun;
4766
4767 sh->transportt = mptsas_transport_template; 4768 sh->transportt = mptsas_transport_template;
4768 4769
4769 /* Required entry. 4770 /* Required entry.
@@ -4821,25 +4822,6 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
4821 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n", 4822 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
4822 ioc->name, ioc->ScsiLookup)); 4823 ioc->name, ioc->ScsiLookup));
4823 4824
4824 /* Clear the TM flags
4825 */
4826 hd->abortSCpnt = NULL;
4827
4828 /* Clear the pointer used to store
4829 * single-threaded commands, i.e., those
4830 * issued during a bus scan, dv and
4831 * configuration pages.
4832 */
4833 hd->cmdPtr = NULL;
4834
4835 /* Initialize this SCSI Hosts' timers
4836 * To use, set the timer expires field
4837 * and add_timer
4838 */
4839 init_timer(&hd->timer);
4840 hd->timer.data = (unsigned long) hd;
4841 hd->timer.function = mptscsih_timer_expired;
4842
4843 ioc->sas_data.ptClear = mpt_pt_clear; 4825 ioc->sas_data.ptClear = mpt_pt_clear;
4844 4826
4845 hd->last_queue_full = 0; 4827 hd->last_queue_full = 0;
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 8440f78f6969..c29578614504 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -628,6 +628,16 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
628 return 1; 628 return 1;
629 } 629 }
630 630
631 if (ioc->bus_type == SAS) {
632 VirtDevice *vdevice = sc->device->hostdata;
633
634 if (!vdevice || !vdevice->vtarget ||
635 vdevice->vtarget->deleted) {
636 sc->result = DID_NO_CONNECT << 16;
637 goto out;
638 }
639 }
640
631 sc->host_scribble = NULL; 641 sc->host_scribble = NULL;
632 sc->result = DID_OK << 16; /* Set default reply as OK */ 642 sc->result = DID_OK << 16; /* Set default reply as OK */
633 pScsiReq = (SCSIIORequest_t *) mf; 643 pScsiReq = (SCSIIORequest_t *) mf;
@@ -689,6 +699,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
689 699
690 switch(status) { 700 switch(status) {
691 case MPI_IOCSTATUS_BUSY: /* 0x0002 */ 701 case MPI_IOCSTATUS_BUSY: /* 0x0002 */
702 case MPI_IOCSTATUS_INSUFFICIENT_RESOURCES: /* 0x0006 */
692 /* CHECKME! 703 /* CHECKME!
693 * Maybe: DRIVER_BUSY | SUGGEST_RETRY | DID_SOFT_ERROR (retry) 704 * Maybe: DRIVER_BUSY | SUGGEST_RETRY | DID_SOFT_ERROR (retry)
694 * But not: DID_BUS_BUSY lest one risk 705 * But not: DID_BUS_BUSY lest one risk
@@ -872,7 +883,6 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
872 case MPI_IOCSTATUS_INVALID_SGL: /* 0x0003 */ 883 case MPI_IOCSTATUS_INVALID_SGL: /* 0x0003 */
873 case MPI_IOCSTATUS_INTERNAL_ERROR: /* 0x0004 */ 884 case MPI_IOCSTATUS_INTERNAL_ERROR: /* 0x0004 */
874 case MPI_IOCSTATUS_RESERVED: /* 0x0005 */ 885 case MPI_IOCSTATUS_RESERVED: /* 0x0005 */
875 case MPI_IOCSTATUS_INSUFFICIENT_RESOURCES: /* 0x0006 */
876 case MPI_IOCSTATUS_INVALID_FIELD: /* 0x0007 */ 886 case MPI_IOCSTATUS_INVALID_FIELD: /* 0x0007 */
877 case MPI_IOCSTATUS_INVALID_STATE: /* 0x0008 */ 887 case MPI_IOCSTATUS_INVALID_STATE: /* 0x0008 */
878 case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */ 888 case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */
@@ -892,7 +902,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
892#endif 902#endif
893 903
894 } /* end of address reply case */ 904 } /* end of address reply case */
895 905out:
896 /* Unmap the DMA buffers, if any. */ 906 /* Unmap the DMA buffers, if any. */
897 scsi_dma_unmap(sc); 907 scsi_dma_unmap(sc);
898 908
@@ -1729,9 +1739,6 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1729 */ 1739 */
1730 mf = MPT_INDEX_2_MFPTR(ioc, scpnt_idx); 1740 mf = MPT_INDEX_2_MFPTR(ioc, scpnt_idx);
1731 ctx2abort = mf->u.frame.hwhdr.msgctxu.MsgContext; 1741 ctx2abort = mf->u.frame.hwhdr.msgctxu.MsgContext;
1732
1733 hd->abortSCpnt = SCpnt;
1734
1735 retval = mptscsih_IssueTaskMgmt(hd, 1742 retval = mptscsih_IssueTaskMgmt(hd,
1736 MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, 1743 MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
1737 vdevice->vtarget->channel, 1744 vdevice->vtarget->channel,
@@ -2293,7 +2300,10 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
2293 else 2300 else
2294 max_depth = MPT_SCSI_CMD_PER_DEV_LOW; 2301 max_depth = MPT_SCSI_CMD_PER_DEV_LOW;
2295 } else 2302 } else
2296 max_depth = MPT_SCSI_CMD_PER_DEV_HIGH; 2303 max_depth = ioc->sh->can_queue;
2304
2305 if (!sdev->tagged_supported)
2306 max_depth = 1;
2297 2307
2298 if (qdepth > max_depth) 2308 if (qdepth > max_depth)
2299 qdepth = max_depth; 2309 qdepth = max_depth;
@@ -2627,50 +2637,6 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req,
2627 return 1; 2637 return 1;
2628} 2638}
2629 2639
2630/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2631/* mptscsih_timer_expired - Call back for timer process.
2632 * Used only for dv functionality.
2633 * @data: Pointer to MPT_SCSI_HOST recast as an unsigned long
2634 *
2635 */
2636void
2637mptscsih_timer_expired(unsigned long data)
2638{
2639 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) data;
2640 MPT_ADAPTER *ioc = hd->ioc;
2641
2642 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired! Cmd %p\n", ioc->name, hd->cmdPtr));
2643
2644 if (hd->cmdPtr) {
2645 MPIHeader_t *cmd = (MPIHeader_t *)hd->cmdPtr;
2646
2647 if (cmd->Function == MPI_FUNCTION_SCSI_IO_REQUEST) {
2648 /* Desire to issue a task management request here.
2649 * TM requests MUST be single threaded.
2650 * If old eh code and no TM current, issue request.
2651 * If new eh code, do nothing. Wait for OS cmd timeout
2652 * for bus reset.
2653 */
2654 } else {
2655 /* Perform a FW reload */
2656 if (mpt_HardResetHandler(ioc, NO_SLEEP) < 0) {
2657 printk(MYIOC_s_WARN_FMT "Firmware Reload FAILED!\n", ioc->name);
2658 }
2659 }
2660 } else {
2661 /* This should NEVER happen */
2662 printk(MYIOC_s_WARN_FMT "Null cmdPtr!!!!\n", ioc->name);
2663 }
2664
2665 /* No more processing.
2666 * TM call will generate an interrupt for SCSI TM Management.
2667 * The FW will reply to all outstanding commands, callback will finish cleanup.
2668 * Hard reset clean-up will free all resources.
2669 */
2670 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired Complete!\n", ioc->name));
2671
2672 return;
2673}
2674 2640
2675/** 2641/**
2676 * mptscsih_get_completion_code - 2642 * mptscsih_get_completion_code -
@@ -3265,6 +3231,5 @@ EXPORT_SYMBOL(mptscsih_scandv_complete);
3265EXPORT_SYMBOL(mptscsih_event_process); 3231EXPORT_SYMBOL(mptscsih_event_process);
3266EXPORT_SYMBOL(mptscsih_ioc_reset); 3232EXPORT_SYMBOL(mptscsih_ioc_reset);
3267EXPORT_SYMBOL(mptscsih_change_queue_depth); 3233EXPORT_SYMBOL(mptscsih_change_queue_depth);
3268EXPORT_SYMBOL(mptscsih_timer_expired);
3269 3234
3270/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 3235/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index eb3f677528ac..e0b33e04a33b 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -129,7 +129,6 @@ extern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRA
129extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); 129extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
130extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); 130extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
131extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth); 131extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth);
132extern void mptscsih_timer_expired(unsigned long data);
133extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id); 132extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id);
134extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id); 133extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
135extern struct device_attribute *mptscsih_host_attrs[]; 134extern struct device_attribute *mptscsih_host_attrs[];
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index c5b808fd55ba..69f4257419b5 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -1472,28 +1472,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1472 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n", 1472 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
1473 ioc->name, ioc->ScsiLookup)); 1473 ioc->name, ioc->ScsiLookup));
1474 1474
1475 /* Clear the TM flags
1476 */
1477 hd->abortSCpnt = NULL;
1478
1479 /* Clear the pointer used to store
1480 * single-threaded commands, i.e., those
1481 * issued during a bus scan, dv and
1482 * configuration pages.
1483 */
1484 hd->cmdPtr = NULL;
1485
1486 /* Initialize this SCSI Hosts' timers
1487 * To use, set the timer expires field
1488 * and add_timer
1489 */
1490 init_timer(&hd->timer);
1491 hd->timer.data = (unsigned long) hd;
1492 hd->timer.function = mptscsih_timer_expired;
1493
1494 ioc->spi_data.Saf_Te = mpt_saf_te; 1475 ioc->spi_data.Saf_Te = mpt_saf_te;
1495
1496 hd->negoNvram = MPT_SCSICFG_USE_NVRAM;
1497 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT 1476 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1498 "saf_te %x\n", 1477 "saf_te %x\n",
1499 ioc->name, 1478 ioc->name,