aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/message
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/lsi/mpi_cnfg.h1
-rw-r--r--drivers/message/fusion/lsi/mpi_ioc.h2
-rw-r--r--drivers/message/fusion/mptbase.c130
-rw-r--r--drivers/message/fusion/mptbase.h73
-rw-r--r--drivers/message/fusion/mptctl.c4
-rw-r--r--drivers/message/fusion/mptfc.c7
-rw-r--r--drivers/message/fusion/mptlan.h1
-rw-r--r--drivers/message/fusion/mptsas.c53
-rw-r--r--drivers/message/fusion/mptscsih.c19
-rw-r--r--drivers/message/fusion/mptscsih.h1
-rw-r--r--drivers/message/fusion/mptspi.c2
-rw-r--r--drivers/message/i2o/README.ioctl12
-rw-r--r--drivers/message/i2o/i2o_block.c2
-rw-r--r--drivers/message/i2o/i2o_config.c7
-rw-r--r--drivers/message/i2o/i2o_proc.c52
-rw-r--r--drivers/message/i2o/i2o_scsi.c1
-rw-r--r--drivers/message/i2o/pci.c12
17 files changed, 118 insertions, 261 deletions
diff --git a/drivers/message/fusion/lsi/mpi_cnfg.h b/drivers/message/fusion/lsi/mpi_cnfg.h
index d9bcfba6b04..22027e7946f 100644
--- a/drivers/message/fusion/lsi/mpi_cnfg.h
+++ b/drivers/message/fusion/lsi/mpi_cnfg.h
@@ -583,7 +583,6 @@ typedef struct _MSG_CONFIG_REPLY
583#define MPI_MANUFACTPAGE_DEVID_SAS1066E (0x005A) 583#define MPI_MANUFACTPAGE_DEVID_SAS1066E (0x005A)
584#define MPI_MANUFACTPAGE_DEVID_SAS1068 (0x0054) 584#define MPI_MANUFACTPAGE_DEVID_SAS1068 (0x0054)
585#define MPI_MANUFACTPAGE_DEVID_SAS1068E (0x0058) 585#define MPI_MANUFACTPAGE_DEVID_SAS1068E (0x0058)
586#define MPI_MANUFACTPAGE_DEVID_SAS1068_820XELP (0x0059)
587#define MPI_MANUFACTPAGE_DEVID_SAS1078 (0x0062) 586#define MPI_MANUFACTPAGE_DEVID_SAS1078 (0x0062)
588 587
589 588
diff --git a/drivers/message/fusion/lsi/mpi_ioc.h b/drivers/message/fusion/lsi/mpi_ioc.h
index 19fb21b8f0c..fd6222882a0 100644
--- a/drivers/message/fusion/lsi/mpi_ioc.h
+++ b/drivers/message/fusion/lsi/mpi_ioc.h
@@ -857,7 +857,7 @@ typedef struct _EVENT_DATA_SAS_DISCOVERY
857#define MPI_EVENT_SAS_DSCVRY_PHY_BITS_MASK (0xFFFF0000) 857#define MPI_EVENT_SAS_DSCVRY_PHY_BITS_MASK (0xFFFF0000)
858#define MPI_EVENT_SAS_DSCVRY_PHY_BITS_SHIFT (16) 858#define MPI_EVENT_SAS_DSCVRY_PHY_BITS_SHIFT (16)
859 859
860/* SAS Discovery Error Event data */ 860/* SAS Discovery Errror Event data */
861 861
862typedef struct _EVENT_DATA_DISCOVERY_ERROR 862typedef struct _EVENT_DATA_DISCOVERY_ERROR
863{ 863{
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index fb69baa06ca..7956a10f948 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -63,8 +63,6 @@
63#ifdef CONFIG_MTRR 63#ifdef CONFIG_MTRR
64#include <asm/mtrr.h> 64#include <asm/mtrr.h>
65#endif 65#endif
66#include <linux/kthread.h>
67#include <scsi/scsi_host.h>
68 66
69#include "mptbase.h" 67#include "mptbase.h"
70#include "lsi/mpi_log_fc.h" 68#include "lsi/mpi_log_fc.h"
@@ -115,8 +113,7 @@ module_param(mpt_fwfault_debug, int, 0600);
115MODULE_PARM_DESC(mpt_fwfault_debug, 113MODULE_PARM_DESC(mpt_fwfault_debug,
116 "Enable detection of Firmware fault and halt Firmware on fault - (default=0)"); 114 "Enable detection of Firmware fault and halt Firmware on fault - (default=0)");
117 115
118static char MptCallbacksName[MPT_MAX_PROTOCOL_DRIVERS] 116static char MptCallbacksName[MPT_MAX_PROTOCOL_DRIVERS][50];
119 [MPT_MAX_CALLBACKNAME_LEN+1];
120 117
121#ifdef MFCNT 118#ifdef MFCNT
122static int mfcounter = 0; 119static int mfcounter = 0;
@@ -326,32 +323,6 @@ mpt_is_discovery_complete(MPT_ADAPTER *ioc)
326 return rc; 323 return rc;
327} 324}
328 325
329
330/**
331 * mpt_remove_dead_ioc_func - kthread context to remove dead ioc
332 * @arg: input argument, used to derive ioc
333 *
334 * Return 0 if controller is removed from pci subsystem.
335 * Return -1 for other case.
336 */
337static int mpt_remove_dead_ioc_func(void *arg)
338{
339 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
340 struct pci_dev *pdev;
341
342 if ((ioc == NULL))
343 return -1;
344
345 pdev = ioc->pcidev;
346 if ((pdev == NULL))
347 return -1;
348
349 pci_stop_and_remove_bus_device(pdev);
350 return 0;
351}
352
353
354
355/** 326/**
356 * mpt_fault_reset_work - work performed on workq after ioc fault 327 * mpt_fault_reset_work - work performed on workq after ioc fault
357 * @work: input argument, used to derive ioc 328 * @work: input argument, used to derive ioc
@@ -365,45 +336,12 @@ mpt_fault_reset_work(struct work_struct *work)
365 u32 ioc_raw_state; 336 u32 ioc_raw_state;
366 int rc; 337 int rc;
367 unsigned long flags; 338 unsigned long flags;
368 MPT_SCSI_HOST *hd;
369 struct task_struct *p;
370 339
371 if (ioc->ioc_reset_in_progress || !ioc->active) 340 if (ioc->ioc_reset_in_progress || !ioc->active)
372 goto out; 341 goto out;
373 342
374
375 ioc_raw_state = mpt_GetIocState(ioc, 0); 343 ioc_raw_state = mpt_GetIocState(ioc, 0);
376 if ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_MASK) { 344 if ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_FAULT) {
377 printk(MYIOC_s_INFO_FMT "%s: IOC is non-operational !!!!\n",
378 ioc->name, __func__);
379
380 /*
381 * Call mptscsih_flush_pending_cmds callback so that we
382 * flush all pending commands back to OS.
383 * This call is required to aovid deadlock at block layer.
384 * Dead IOC will fail to do diag reset,and this call is safe
385 * since dead ioc will never return any command back from HW.
386 */
387 hd = shost_priv(ioc->sh);
388 ioc->schedule_dead_ioc_flush_running_cmds(hd);
389
390 /*Remove the Dead Host */
391 p = kthread_run(mpt_remove_dead_ioc_func, ioc,
392 "mpt_dead_ioc_%d", ioc->id);
393 if (IS_ERR(p)) {
394 printk(MYIOC_s_ERR_FMT
395 "%s: Running mpt_dead_ioc thread failed !\n",
396 ioc->name, __func__);
397 } else {
398 printk(MYIOC_s_WARN_FMT
399 "%s: Running mpt_dead_ioc thread success !\n",
400 ioc->name, __func__);
401 }
402 return; /* don't rearm timer */
403 }
404
405 if ((ioc_raw_state & MPI_IOC_STATE_MASK)
406 == MPI_IOC_STATE_FAULT) {
407 printk(MYIOC_s_WARN_FMT "IOC is in FAULT state (%04xh)!!!\n", 345 printk(MYIOC_s_WARN_FMT "IOC is in FAULT state (%04xh)!!!\n",
408 ioc->name, ioc_raw_state & MPI_DOORBELL_DATA_MASK); 346 ioc->name, ioc_raw_state & MPI_DOORBELL_DATA_MASK);
409 printk(MYIOC_s_WARN_FMT "Issuing HardReset from %s!!\n", 347 printk(MYIOC_s_WARN_FMT "Issuing HardReset from %s!!\n",
@@ -718,8 +656,8 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass, char *func_name)
718 MptDriverClass[cb_idx] = dclass; 656 MptDriverClass[cb_idx] = dclass;
719 MptEvHandlers[cb_idx] = NULL; 657 MptEvHandlers[cb_idx] = NULL;
720 last_drv_idx = cb_idx; 658 last_drv_idx = cb_idx;
721 strlcpy(MptCallbacksName[cb_idx], func_name, 659 memcpy(MptCallbacksName[cb_idx], func_name,
722 MPT_MAX_CALLBACKNAME_LEN+1); 660 strlen(func_name) > 50 ? 50 : strlen(func_name));
723 break; 661 break;
724 } 662 }
725 } 663 }
@@ -1653,6 +1591,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1653 unsigned long port; 1591 unsigned long port;
1654 u32 msize; 1592 u32 msize;
1655 u32 psize; 1593 u32 psize;
1594 u8 revision;
1656 int r = -ENODEV; 1595 int r = -ENODEV;
1657 struct pci_dev *pdev; 1596 struct pci_dev *pdev;
1658 1597
@@ -1666,9 +1605,11 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1666 if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) { 1605 if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) {
1667 printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with " 1606 printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with "
1668 "MEM failed\n", ioc->name); 1607 "MEM failed\n", ioc->name);
1669 goto out_pci_disable_device; 1608 return r;
1670 } 1609 }
1671 1610
1611 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
1612
1672 if (sizeof(dma_addr_t) > 4) { 1613 if (sizeof(dma_addr_t) > 4) {
1673 const uint64_t required_mask = dma_get_required_mask 1614 const uint64_t required_mask = dma_get_required_mask
1674 (&pdev->dev); 1615 (&pdev->dev);
@@ -1690,7 +1631,8 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1690 } else { 1631 } else {
1691 printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", 1632 printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n",
1692 ioc->name, pci_name(pdev)); 1633 ioc->name, pci_name(pdev));
1693 goto out_pci_release_region; 1634 pci_release_selected_regions(pdev, ioc->bars);
1635 return r;
1694 } 1636 }
1695 } else { 1637 } else {
1696 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) 1638 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
@@ -1703,7 +1645,8 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1703 } else { 1645 } else {
1704 printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", 1646 printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n",
1705 ioc->name, pci_name(pdev)); 1647 ioc->name, pci_name(pdev));
1706 goto out_pci_release_region; 1648 pci_release_selected_regions(pdev, ioc->bars);
1649 return r;
1707 } 1650 }
1708 } 1651 }
1709 1652
@@ -1733,8 +1676,8 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1733 if (mem == NULL) { 1676 if (mem == NULL) {
1734 printk(MYIOC_s_ERR_FMT ": ERROR - Unable to map adapter" 1677 printk(MYIOC_s_ERR_FMT ": ERROR - Unable to map adapter"
1735 " memory!\n", ioc->name); 1678 " memory!\n", ioc->name);
1736 r = -EINVAL; 1679 pci_release_selected_regions(pdev, ioc->bars);
1737 goto out_pci_release_region; 1680 return -EINVAL;
1738 } 1681 }
1739 ioc->memmap = mem; 1682 ioc->memmap = mem;
1740 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %llx\n", 1683 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %llx\n",
@@ -1748,12 +1691,6 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1748 ioc->pio_chip = (SYSIF_REGS __iomem *)port; 1691 ioc->pio_chip = (SYSIF_REGS __iomem *)port;
1749 1692
1750 return 0; 1693 return 0;
1751
1752out_pci_release_region:
1753 pci_release_selected_regions(pdev, ioc->bars);
1754out_pci_disable_device:
1755 pci_disable_device(pdev);
1756 return r;
1757} 1694}
1758 1695
1759/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1696/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1780,6 +1717,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1780 MPT_ADAPTER *ioc; 1717 MPT_ADAPTER *ioc;
1781 u8 cb_idx; 1718 u8 cb_idx;
1782 int r = -ENODEV; 1719 int r = -ENODEV;
1720 u8 revision;
1783 u8 pcixcmd; 1721 u8 pcixcmd;
1784 static int mpt_ids = 0; 1722 static int mpt_ids = 0;
1785#ifdef CONFIG_PROC_FS 1723#ifdef CONFIG_PROC_FS
@@ -1887,8 +1825,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1887 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "facts @ %p, pfacts[0] @ %p\n", 1825 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "facts @ %p, pfacts[0] @ %p\n",
1888 ioc->name, &ioc->facts, &ioc->pfacts[0])); 1826 ioc->name, &ioc->facts, &ioc->pfacts[0]));
1889 1827
1890 mpt_get_product_name(pdev->vendor, pdev->device, pdev->revision, 1828 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
1891 ioc->prod_name); 1829 mpt_get_product_name(pdev->vendor, pdev->device, revision, ioc->prod_name);
1892 1830
1893 switch (pdev->device) 1831 switch (pdev->device)
1894 { 1832 {
@@ -1903,7 +1841,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1903 break; 1841 break;
1904 1842
1905 case MPI_MANUFACTPAGE_DEVICEID_FC929X: 1843 case MPI_MANUFACTPAGE_DEVICEID_FC929X:
1906 if (pdev->revision < XL_929) { 1844 if (revision < XL_929) {
1907 /* 929X Chip Fix. Set Split transactions level 1845 /* 929X Chip Fix. Set Split transactions level
1908 * for PCIX. Set MOST bits to zero. 1846 * for PCIX. Set MOST bits to zero.
1909 */ 1847 */
@@ -1934,7 +1872,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1934 /* 1030 Chip Fix. Disable Split transactions 1872 /* 1030 Chip Fix. Disable Split transactions
1935 * for PCIX. Set MOST bits to zero if Rev < C0( = 8). 1873 * for PCIX. Set MOST bits to zero if Rev < C0( = 8).
1936 */ 1874 */
1937 if (pdev->revision < C0_1030) { 1875 if (revision < C0_1030) {
1938 pci_read_config_byte(pdev, 0x6a, &pcixcmd); 1876 pci_read_config_byte(pdev, 0x6a, &pcixcmd);
1939 pcixcmd &= 0x8F; 1877 pcixcmd &= 0x8F;
1940 pci_write_config_byte(pdev, 0x6a, pcixcmd); 1878 pci_write_config_byte(pdev, 0x6a, pcixcmd);
@@ -6475,20 +6413,8 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
6475 pReq->Action, ioc->mptbase_cmds.status, timeleft)); 6413 pReq->Action, ioc->mptbase_cmds.status, timeleft));
6476 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) 6414 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET)
6477 goto out; 6415 goto out;
6478 if (!timeleft) { 6416 if (!timeleft)
6479 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
6480 if (ioc->ioc_reset_in_progress) {
6481 spin_unlock_irqrestore(&ioc->taskmgmt_lock,
6482 flags);
6483 printk(MYIOC_s_INFO_FMT "%s: host reset in"
6484 " progress mpt_config timed out.!!\n",
6485 __func__, ioc->name);
6486 mutex_unlock(&ioc->mptbase_cmds.mutex);
6487 return -EFAULT;
6488 }
6489 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6490 issue_hard_reset = 1; 6417 issue_hard_reset = 1;
6491 }
6492 goto out; 6418 goto out;
6493 } 6419 }
6494 6420
@@ -7202,18 +7128,7 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7202 spin_lock_irqsave(&ioc->taskmgmt_lock, flags); 7128 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
7203 if (ioc->ioc_reset_in_progress) { 7129 if (ioc->ioc_reset_in_progress) {
7204 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); 7130 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7205 ioc->wait_on_reset_completion = 1; 7131 return 0;
7206 do {
7207 ssleep(1);
7208 } while (ioc->ioc_reset_in_progress == 1);
7209 ioc->wait_on_reset_completion = 0;
7210 return ioc->reset_status;
7211 }
7212 if (ioc->wait_on_reset_completion) {
7213 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7214 rc = 0;
7215 time_count = jiffies;
7216 goto exit;
7217 } 7132 }
7218 ioc->ioc_reset_in_progress = 1; 7133 ioc->ioc_reset_in_progress = 1;
7219 if (ioc->alt_ioc) 7134 if (ioc->alt_ioc)
@@ -7250,7 +7165,6 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7250 ioc->ioc_reset_in_progress = 0; 7165 ioc->ioc_reset_in_progress = 0;
7251 ioc->taskmgmt_quiesce_io = 0; 7166 ioc->taskmgmt_quiesce_io = 0;
7252 ioc->taskmgmt_in_progress = 0; 7167 ioc->taskmgmt_in_progress = 0;
7253 ioc->reset_status = rc;
7254 if (ioc->alt_ioc) { 7168 if (ioc->alt_ioc) {
7255 ioc->alt_ioc->ioc_reset_in_progress = 0; 7169 ioc->alt_ioc->ioc_reset_in_progress = 0;
7256 ioc->alt_ioc->taskmgmt_quiesce_io = 0; 7170 ioc->alt_ioc->taskmgmt_quiesce_io = 0;
@@ -7266,7 +7180,7 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7266 ioc->alt_ioc, MPT_IOC_POST_RESET); 7180 ioc->alt_ioc, MPT_IOC_POST_RESET);
7267 } 7181 }
7268 } 7182 }
7269exit: 7183
7270 dtmprintk(ioc, 7184 dtmprintk(ioc,
7271 printk(MYIOC_s_DEBUG_FMT 7185 printk(MYIOC_s_DEBUG_FMT
7272 "HardResetHandler: completed (%d seconds): %s\n", ioc->name, 7186 "HardResetHandler: completed (%d seconds): %s\n", ioc->name,
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 76c05bc24cb..fe902338539 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.20" 79#define MPT_LINUX_VERSION_COMMON "3.04.19"
80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.20" 80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.19"
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) \
@@ -89,7 +89,6 @@
89 */ 89 */
90#define MPT_MAX_ADAPTERS 18 90#define MPT_MAX_ADAPTERS 18
91#define MPT_MAX_PROTOCOL_DRIVERS 16 91#define MPT_MAX_PROTOCOL_DRIVERS 16
92#define MPT_MAX_CALLBACKNAME_LEN 49
93#define MPT_MAX_BUS 1 /* Do not change */ 92#define MPT_MAX_BUS 1 /* Do not change */
94#define MPT_MAX_FC_DEVICES 255 93#define MPT_MAX_FC_DEVICES 255
95#define MPT_MAX_SCSI_DEVICES 16 94#define MPT_MAX_SCSI_DEVICES 16
@@ -555,47 +554,10 @@ struct mptfc_rport_info
555 u8 flags; 554 u8 flags;
556}; 555};
557 556
558/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
559
560/*
561 * MPT_SCSI_HOST defines - Used by the IOCTL and the SCSI drivers
562 * Private to the driver.
563 */
564
565#define MPT_HOST_BUS_UNKNOWN (0xFF)
566#define MPT_HOST_TOO_MANY_TM (0x05)
567#define MPT_HOST_NVRAM_INVALID (0xFFFFFFFF)
568#define MPT_HOST_NO_CHAIN (0xFFFFFFFF)
569#define MPT_NVRAM_MASK_TIMEOUT (0x000000FF)
570#define MPT_NVRAM_SYNC_MASK (0x0000FF00)
571#define MPT_NVRAM_SYNC_SHIFT (8)
572#define MPT_NVRAM_DISCONNECT_ENABLE (0x00010000)
573#define MPT_NVRAM_ID_SCAN_ENABLE (0x00020000)
574#define MPT_NVRAM_LUN_SCAN_ENABLE (0x00040000)
575#define MPT_NVRAM_TAG_QUEUE_ENABLE (0x00080000)
576#define MPT_NVRAM_WIDE_DISABLE (0x00100000)
577#define MPT_NVRAM_BOOT_CHOICE (0x00200000)
578
579typedef enum {
580 FC,
581 SPI,
582 SAS
583} BUS_TYPE;
584
585typedef struct _MPT_SCSI_HOST {
586 struct _MPT_ADAPTER *ioc;
587 ushort sel_timeout[MPT_MAX_FC_DEVICES];
588 char *info_kbuf;
589 long last_queue_full;
590 u16 spi_pending;
591 struct list_head target_reset_list;
592} MPT_SCSI_HOST;
593
594typedef void (*MPT_ADD_SGE)(void *pAddr, u32 flagslength, dma_addr_t dma_addr); 557typedef void (*MPT_ADD_SGE)(void *pAddr, u32 flagslength, dma_addr_t dma_addr);
595typedef void (*MPT_ADD_CHAIN)(void *pAddr, u8 next, u16 length, 558typedef void (*MPT_ADD_CHAIN)(void *pAddr, u8 next, u16 length,
596 dma_addr_t dma_addr); 559 dma_addr_t dma_addr);
597typedef void (*MPT_SCHEDULE_TARGET_RESET)(void *ioc); 560typedef void (*MPT_SCHEDULE_TARGET_RESET)(void *ioc);
598typedef void (*MPT_FLUSH_RUNNING_CMDS)(MPT_SCSI_HOST *hd);
599 561
600/* 562/*
601 * Adapter Structure - pci_dev specific. Maximum: MPT_MAX_ADAPTERS 563 * Adapter Structure - pci_dev specific. Maximum: MPT_MAX_ADAPTERS
@@ -754,10 +716,7 @@ typedef struct _MPT_ADAPTER
754 int taskmgmt_in_progress; 716 int taskmgmt_in_progress;
755 u8 taskmgmt_quiesce_io; 717 u8 taskmgmt_quiesce_io;
756 u8 ioc_reset_in_progress; 718 u8 ioc_reset_in_progress;
757 u8 reset_status;
758 u8 wait_on_reset_completion;
759 MPT_SCHEDULE_TARGET_RESET schedule_target_reset; 719 MPT_SCHEDULE_TARGET_RESET schedule_target_reset;
760 MPT_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds;
761 struct work_struct sas_persist_task; 720 struct work_struct sas_persist_task;
762 721
763 struct work_struct fc_setup_reset_work; 722 struct work_struct fc_setup_reset_work;
@@ -871,6 +830,19 @@ typedef struct _MPT_LOCAL_REPLY {
871 u32 pad; 830 u32 pad;
872} MPT_LOCAL_REPLY; 831} MPT_LOCAL_REPLY;
873 832
833#define MPT_HOST_BUS_UNKNOWN (0xFF)
834#define MPT_HOST_TOO_MANY_TM (0x05)
835#define MPT_HOST_NVRAM_INVALID (0xFFFFFFFF)
836#define MPT_HOST_NO_CHAIN (0xFFFFFFFF)
837#define MPT_NVRAM_MASK_TIMEOUT (0x000000FF)
838#define MPT_NVRAM_SYNC_MASK (0x0000FF00)
839#define MPT_NVRAM_SYNC_SHIFT (8)
840#define MPT_NVRAM_DISCONNECT_ENABLE (0x00010000)
841#define MPT_NVRAM_ID_SCAN_ENABLE (0x00020000)
842#define MPT_NVRAM_LUN_SCAN_ENABLE (0x00040000)
843#define MPT_NVRAM_TAG_QUEUE_ENABLE (0x00080000)
844#define MPT_NVRAM_WIDE_DISABLE (0x00100000)
845#define MPT_NVRAM_BOOT_CHOICE (0x00200000)
874 846
875/* The TM_STATE variable is used to provide strict single threading of TM 847/* The TM_STATE variable is used to provide strict single threading of TM
876 * requests as well as communicate TM error conditions. 848 * requests as well as communicate TM error conditions.
@@ -879,6 +851,21 @@ typedef struct _MPT_LOCAL_REPLY {
879#define TM_STATE_IN_PROGRESS (1) 851#define TM_STATE_IN_PROGRESS (1)
880#define TM_STATE_ERROR (2) 852#define TM_STATE_ERROR (2)
881 853
854typedef enum {
855 FC,
856 SPI,
857 SAS
858} BUS_TYPE;
859
860typedef struct _MPT_SCSI_HOST {
861 MPT_ADAPTER *ioc;
862 ushort sel_timeout[MPT_MAX_FC_DEVICES];
863 char *info_kbuf;
864 long last_queue_full;
865 u16 spi_pending;
866 struct list_head target_reset_list;
867} MPT_SCSI_HOST;
868
882/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 869/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
883/* 870/*
884 * More Dynamic Multi-Pathing stuff... 871 * More Dynamic Multi-Pathing stuff...
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index b383b6961e5..6e6e16aab9d 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -1250,6 +1250,7 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1250 int iocnum; 1250 int iocnum;
1251 unsigned int port; 1251 unsigned int port;
1252 int cim_rev; 1252 int cim_rev;
1253 u8 revision;
1253 struct scsi_device *sdev; 1254 struct scsi_device *sdev;
1254 VirtDevice *vdevice; 1255 VirtDevice *vdevice;
1255 1256
@@ -1323,7 +1324,8 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1323 pdev = (struct pci_dev *) ioc->pcidev; 1324 pdev = (struct pci_dev *) ioc->pcidev;
1324 1325
1325 karg->pciId = pdev->device; 1326 karg->pciId = pdev->device;
1326 karg->hwRev = pdev->revision; 1327 pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
1328 karg->hwRev = revision;
1327 karg->subSystemDevice = pdev->subsystem_device; 1329 karg->subSystemDevice = pdev->subsystem_device;
1328 karg->subSystemVendor = pdev->subsystem_vendor; 1330 karg->subSystemVendor = pdev->subsystem_vendor;
1329 1331
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index c13cd9bc590..d784c36707c 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -100,7 +100,7 @@ static int mptfc_slave_alloc(struct scsi_device *sdev);
100static int mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt); 100static int mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt);
101static void mptfc_target_destroy(struct scsi_target *starget); 101static void mptfc_target_destroy(struct scsi_target *starget);
102static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout); 102static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout);
103static void mptfc_remove(struct pci_dev *pdev); 103static void __devexit mptfc_remove(struct pci_dev *pdev);
104static int mptfc_abort(struct scsi_cmnd *SCpnt); 104static int mptfc_abort(struct scsi_cmnd *SCpnt);
105static int mptfc_dev_reset(struct scsi_cmnd *SCpnt); 105static int mptfc_dev_reset(struct scsi_cmnd *SCpnt);
106static int mptfc_bus_reset(struct scsi_cmnd *SCpnt); 106static int mptfc_bus_reset(struct scsi_cmnd *SCpnt);
@@ -1360,7 +1360,7 @@ static struct pci_driver mptfc_driver = {
1360 .name = "mptfc", 1360 .name = "mptfc",
1361 .id_table = mptfc_pci_table, 1361 .id_table = mptfc_pci_table,
1362 .probe = mptfc_probe, 1362 .probe = mptfc_probe,
1363 .remove = mptfc_remove, 1363 .remove = __devexit_p(mptfc_remove),
1364 .shutdown = mptscsih_shutdown, 1364 .shutdown = mptscsih_shutdown,
1365#ifdef CONFIG_PM 1365#ifdef CONFIG_PM
1366 .suspend = mptscsih_suspend, 1366 .suspend = mptscsih_suspend,
@@ -1496,7 +1496,8 @@ mptfc_init(void)
1496 * @pdev: Pointer to pci_dev structure 1496 * @pdev: Pointer to pci_dev structure
1497 * 1497 *
1498 */ 1498 */
1499static void mptfc_remove(struct pci_dev *pdev) 1499static void __devexit
1500mptfc_remove(struct pci_dev *pdev)
1500{ 1501{
1501 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 1502 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
1502 struct mptfc_rport_info *p, *n; 1503 struct mptfc_rport_info *p, *n;
diff --git a/drivers/message/fusion/mptlan.h b/drivers/message/fusion/mptlan.h
index 69e9d546356..c171afa9323 100644
--- a/drivers/message/fusion/mptlan.h
+++ b/drivers/message/fusion/mptlan.h
@@ -69,6 +69,7 @@
69#include <linux/spinlock.h> 69#include <linux/spinlock.h>
70#include <linux/workqueue.h> 70#include <linux/workqueue.h>
71#include <linux/delay.h> 71#include <linux/delay.h>
72// #include <linux/trdevice.h>
72 73
73#include <asm/uaccess.h> 74#include <asm/uaccess.h>
74#include <asm/io.h> 75#include <asm/io.h>
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index fa43c391c8e..7596aecd507 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -92,11 +92,6 @@ static int max_lun = MPTSAS_MAX_LUN;
92module_param(max_lun, int, 0); 92module_param(max_lun, int, 0);
93MODULE_PARM_DESC(max_lun, " max lun, default=16895 "); 93MODULE_PARM_DESC(max_lun, " max lun, default=16895 ");
94 94
95static int mpt_loadtime_max_sectors = 8192;
96module_param(mpt_loadtime_max_sectors, int, 0);
97MODULE_PARM_DESC(mpt_loadtime_max_sectors,
98 " Maximum sector define for Host Bus Adaptor.Range 64 to 8192 default=8192");
99
100static u8 mptsasDoneCtx = MPT_MAX_PROTOCOL_DRIVERS; 95static u8 mptsasDoneCtx = MPT_MAX_PROTOCOL_DRIVERS;
101static u8 mptsasTaskCtx = MPT_MAX_PROTOCOL_DRIVERS; 96static u8 mptsasTaskCtx = MPT_MAX_PROTOCOL_DRIVERS;
102static u8 mptsasInternalCtx = MPT_MAX_PROTOCOL_DRIVERS; /* Used only for internal commands */ 97static u8 mptsasInternalCtx = MPT_MAX_PROTOCOL_DRIVERS; /* Used only for internal commands */
@@ -290,11 +285,10 @@ mptsas_add_fw_event(MPT_ADAPTER *ioc, struct fw_event_work *fw_event,
290 spin_lock_irqsave(&ioc->fw_event_lock, flags); 285 spin_lock_irqsave(&ioc->fw_event_lock, flags);
291 list_add_tail(&fw_event->list, &ioc->fw_event_list); 286 list_add_tail(&fw_event->list, &ioc->fw_event_list);
292 INIT_DELAYED_WORK(&fw_event->work, mptsas_firmware_event_work); 287 INIT_DELAYED_WORK(&fw_event->work, mptsas_firmware_event_work);
293 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: add (fw_event=0x%p)" 288 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: add (fw_event=0x%p)\n",
294 "on cpuid %d\n", ioc->name, __func__, 289 ioc->name, __func__, fw_event));
295 fw_event, smp_processor_id())); 290 queue_delayed_work(ioc->fw_event_q, &fw_event->work,
296 queue_delayed_work_on(smp_processor_id(), ioc->fw_event_q, 291 delay);
297 &fw_event->work, delay);
298 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); 292 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
299} 293}
300 294
@@ -306,11 +300,10 @@ mptsas_requeue_fw_event(MPT_ADAPTER *ioc, struct fw_event_work *fw_event,
306 unsigned long flags; 300 unsigned long flags;
307 spin_lock_irqsave(&ioc->fw_event_lock, flags); 301 spin_lock_irqsave(&ioc->fw_event_lock, flags);
308 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: reschedule task " 302 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: reschedule task "
309 "(fw_event=0x%p)on cpuid %d\n", ioc->name, __func__, 303 "(fw_event=0x%p)\n", ioc->name, __func__, fw_event));
310 fw_event, smp_processor_id()));
311 fw_event->retries++; 304 fw_event->retries++;
312 queue_delayed_work_on(smp_processor_id(), ioc->fw_event_q, 305 queue_delayed_work(ioc->fw_event_q, &fw_event->work,
313 &fw_event->work, msecs_to_jiffies(delay)); 306 msecs_to_jiffies(delay));
314 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); 307 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
315} 308}
316 309
@@ -1950,15 +1943,6 @@ static enum blk_eh_timer_return mptsas_eh_timed_out(struct scsi_cmnd *sc)
1950 goto done; 1943 goto done;
1951 } 1944 }
1952 1945
1953 /* In case if IOC is in reset from internal context.
1954 * Do not execute EEH for the same IOC. SML should to reset timer.
1955 */
1956 if (ioc->ioc_reset_in_progress) {
1957 dtmprintk(ioc, printk(MYIOC_s_WARN_FMT ": %s: ioc is in reset,"
1958 "SML need to reset the timer (sc=%p)\n",
1959 ioc->name, __func__, sc));
1960 rc = BLK_EH_RESET_TIMER;
1961 }
1962 vdevice = sc->device->hostdata; 1946 vdevice = sc->device->hostdata;
1963 if (vdevice && vdevice->vtarget && (vdevice->vtarget->inDMD 1947 if (vdevice && vdevice->vtarget && (vdevice->vtarget->inDMD
1964 || vdevice->vtarget->deleted)) { 1948 || vdevice->vtarget->deleted)) {
@@ -5158,8 +5142,6 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
5158 ioc->TaskCtx = mptsasTaskCtx; 5142 ioc->TaskCtx = mptsasTaskCtx;
5159 ioc->InternalCtx = mptsasInternalCtx; 5143 ioc->InternalCtx = mptsasInternalCtx;
5160 ioc->schedule_target_reset = &mptsas_schedule_target_reset; 5144 ioc->schedule_target_reset = &mptsas_schedule_target_reset;
5161 ioc->schedule_dead_ioc_flush_running_cmds =
5162 &mptscsih_flush_running_cmds;
5163 /* Added sanity check on readiness of the MPT adapter. 5145 /* Added sanity check on readiness of the MPT adapter.
5164 */ 5146 */
5165 if (ioc->last_state != MPI_IOC_STATE_OPERATIONAL) { 5147 if (ioc->last_state != MPI_IOC_STATE_OPERATIONAL) {
@@ -5257,21 +5239,6 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
5257 sh->sg_tablesize = numSGE; 5239 sh->sg_tablesize = numSGE;
5258 } 5240 }
5259 5241
5260 if (mpt_loadtime_max_sectors) {
5261 if (mpt_loadtime_max_sectors < 64 ||
5262 mpt_loadtime_max_sectors > 8192) {
5263 printk(MYIOC_s_INFO_FMT "Invalid value passed for"
5264 "mpt_loadtime_max_sectors %d."
5265 "Range from 64 to 8192\n", ioc->name,
5266 mpt_loadtime_max_sectors);
5267 }
5268 mpt_loadtime_max_sectors &= 0xFFFFFFFE;
5269 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5270 "Resetting max sector to %d from %d\n",
5271 ioc->name, mpt_loadtime_max_sectors, sh->max_sectors));
5272 sh->max_sectors = mpt_loadtime_max_sectors;
5273 }
5274
5275 hd = shost_priv(sh); 5242 hd = shost_priv(sh);
5276 hd->ioc = ioc; 5243 hd->ioc = ioc;
5277 5244
@@ -5332,7 +5299,7 @@ mptsas_shutdown(struct pci_dev *pdev)
5332 mptsas_cleanup_fw_event_q(ioc); 5299 mptsas_cleanup_fw_event_q(ioc);
5333} 5300}
5334 5301
5335static void mptsas_remove(struct pci_dev *pdev) 5302static void __devexit mptsas_remove(struct pci_dev *pdev)
5336{ 5303{
5337 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 5304 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
5338 struct mptsas_portinfo *p, *n; 5305 struct mptsas_portinfo *p, *n;
@@ -5376,8 +5343,6 @@ static struct pci_device_id mptsas_pci_table[] = {
5376 PCI_ANY_ID, PCI_ANY_ID }, 5343 PCI_ANY_ID, PCI_ANY_ID },
5377 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_SAS1078, 5344 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_SAS1078,
5378 PCI_ANY_ID, PCI_ANY_ID }, 5345 PCI_ANY_ID, PCI_ANY_ID },
5379 { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_SAS1068_820XELP,
5380 PCI_ANY_ID, PCI_ANY_ID },
5381 {0} /* Terminating entry */ 5346 {0} /* Terminating entry */
5382}; 5347};
5383MODULE_DEVICE_TABLE(pci, mptsas_pci_table); 5348MODULE_DEVICE_TABLE(pci, mptsas_pci_table);
@@ -5387,7 +5352,7 @@ static struct pci_driver mptsas_driver = {
5387 .name = "mptsas", 5352 .name = "mptsas",
5388 .id_table = mptsas_pci_table, 5353 .id_table = mptsas_pci_table,
5389 .probe = mptsas_probe, 5354 .probe = mptsas_probe,
5390 .remove = mptsas_remove, 5355 .remove = __devexit_p(mptsas_remove),
5391 .shutdown = mptsas_shutdown, 5356 .shutdown = mptsas_shutdown,
5392#ifdef CONFIG_PM 5357#ifdef CONFIG_PM
5393 .suspend = mptscsih_suspend, 5358 .suspend = mptscsih_suspend,
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 164afa71bba..ce61a576976 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -792,7 +792,6 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
792 * than an unsolicited DID_ABORT. 792 * than an unsolicited DID_ABORT.
793 */ 793 */
794 sc->result = DID_RESET << 16; 794 sc->result = DID_RESET << 16;
795 break;
796 795
797 case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */ 796 case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */
798 if (ioc->bus_type == FC) 797 if (ioc->bus_type == FC)
@@ -831,8 +830,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
831 if ((pScsiReq->CDB[0] == READ_6 && ((pScsiReq->CDB[1] & 0x02) == 0)) || 830 if ((pScsiReq->CDB[0] == READ_6 && ((pScsiReq->CDB[1] & 0x02) == 0)) ||
832 pScsiReq->CDB[0] == READ_10 || 831 pScsiReq->CDB[0] == READ_10 ||
833 pScsiReq->CDB[0] == READ_12 || 832 pScsiReq->CDB[0] == READ_12 ||
834 (pScsiReq->CDB[0] == READ_16 && 833 pScsiReq->CDB[0] == READ_16 ||
835 ((pScsiReq->CDB[1] & 0x02) == 0)) ||
836 pScsiReq->CDB[0] == VERIFY || 834 pScsiReq->CDB[0] == VERIFY ||
837 pScsiReq->CDB[0] == VERIFY_16) { 835 pScsiReq->CDB[0] == VERIFY_16) {
838 if (scsi_bufflen(sc) != 836 if (scsi_bufflen(sc) !=
@@ -1026,7 +1024,7 @@ out:
1026 * 1024 *
1027 * Must be called while new I/Os are being queued. 1025 * Must be called while new I/Os are being queued.
1028 */ 1026 */
1029void 1027static void
1030mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd) 1028mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
1031{ 1029{
1032 MPT_ADAPTER *ioc = hd->ioc; 1030 MPT_ADAPTER *ioc = hd->ioc;
@@ -1057,7 +1055,6 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
1057 sc->scsi_done(sc); 1055 sc->scsi_done(sc);
1058 } 1056 }
1059} 1057}
1060EXPORT_SYMBOL(mptscsih_flush_running_cmds);
1061 1058
1062/* 1059/*
1063 * mptscsih_search_running_cmds - Delete any commands associated 1060 * mptscsih_search_running_cmds - Delete any commands associated
@@ -1632,13 +1629,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun,
1632 return 0; 1629 return 0;
1633 } 1630 }
1634 1631
1635 /* DOORBELL ACTIVE check is not required if 1632 if (ioc_raw_state & MPI_DOORBELL_ACTIVE) {
1636 * MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q is supported.
1637 */
1638
1639 if (!((ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q)
1640 && (ioc->facts.MsgVersion >= MPI_VERSION_01_05)) &&
1641 (ioc_raw_state & MPI_DOORBELL_ACTIVE)) {
1642 printk(MYIOC_s_WARN_FMT 1633 printk(MYIOC_s_WARN_FMT
1643 "TaskMgmt type=%x: ioc_state: " 1634 "TaskMgmt type=%x: ioc_state: "
1644 "DOORBELL_ACTIVE (0x%x)!\n", 1635 "DOORBELL_ACTIVE (0x%x)!\n",
@@ -1737,9 +1728,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun,
1737 printk(MYIOC_s_WARN_FMT 1728 printk(MYIOC_s_WARN_FMT
1738 "Issuing Reset from %s!! doorbell=0x%08x\n", 1729 "Issuing Reset from %s!! doorbell=0x%08x\n",
1739 ioc->name, __func__, mpt_GetIocState(ioc, 0)); 1730 ioc->name, __func__, mpt_GetIocState(ioc, 0));
1740 retval = (ioc->bus_type == SAS) ? 1731 retval = mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
1741 mpt_HardResetHandler(ioc, CAN_SLEEP) :
1742 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
1743 mpt_free_msg_frame(ioc, mf); 1732 mpt_free_msg_frame(ioc, mf);
1744 } 1733 }
1745 1734
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index 43e75ff3992..45a5ff3eff6 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -135,4 +135,3 @@ extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
135extern struct device_attribute *mptscsih_host_attrs[]; 135extern struct device_attribute *mptscsih_host_attrs[];
136extern struct scsi_cmnd *mptscsih_get_scsi_lookup(MPT_ADAPTER *ioc, int i); 136extern struct scsi_cmnd *mptscsih_get_scsi_lookup(MPT_ADAPTER *ioc, int i);
137extern void mptscsih_taskmgmt_response_code(MPT_ADAPTER *ioc, u8 response_code); 137extern void mptscsih_taskmgmt_response_code(MPT_ADAPTER *ioc, u8 response_code);
138extern void mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd);
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index c3aabde2dc4..8f61ba6aac2 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -1550,7 +1550,7 @@ static struct pci_driver mptspi_driver = {
1550 .name = "mptspi", 1550 .name = "mptspi",
1551 .id_table = mptspi_pci_table, 1551 .id_table = mptspi_pci_table,
1552 .probe = mptspi_probe, 1552 .probe = mptspi_probe,
1553 .remove = mptscsih_remove, 1553 .remove = __devexit_p(mptscsih_remove),
1554 .shutdown = mptscsih_shutdown, 1554 .shutdown = mptscsih_shutdown,
1555#ifdef CONFIG_PM 1555#ifdef CONFIG_PM
1556 .suspend = mptscsih_suspend, 1556 .suspend = mptscsih_suspend,
diff --git a/drivers/message/i2o/README.ioctl b/drivers/message/i2o/README.ioctl
index 4a7d2ebdfc9..5fb195af43e 100644
--- a/drivers/message/i2o/README.ioctl
+++ b/drivers/message/i2o/README.ioctl
@@ -138,7 +138,7 @@ VI. Setting Parameters
138 138
139 The return value is the size in bytes of the data written into 139 The return value is the size in bytes of the data written into
140 ops->resbuf if no errors occur. If an error occurs, -1 is returned 140 ops->resbuf if no errors occur. If an error occurs, -1 is returned
141 and errno is set appropriately: 141 and errno is set appropriatly:
142 142
143 EFAULT Invalid user space pointer was passed 143 EFAULT Invalid user space pointer was passed
144 ENXIO Invalid IOP number 144 ENXIO Invalid IOP number
@@ -222,7 +222,7 @@ VIII. Downloading Software
222 RETURNS 222 RETURNS
223 223
224 This function returns 0 no errors occur. If an error occurs, -1 224 This function returns 0 no errors occur. If an error occurs, -1
225 is returned and errno is set appropriately: 225 is returned and errno is set appropriatly:
226 226
227 EFAULT Invalid user space pointer was passed 227 EFAULT Invalid user space pointer was passed
228 ENXIO Invalid IOP number 228 ENXIO Invalid IOP number
@@ -264,7 +264,7 @@ IX. Uploading Software
264 RETURNS 264 RETURNS
265 265
266 This function returns 0 if no errors occur. If an error occurs, -1 266 This function returns 0 if no errors occur. If an error occurs, -1
267 is returned and errno is set appropriately: 267 is returned and errno is set appropriatly:
268 268
269 EFAULT Invalid user space pointer was passed 269 EFAULT Invalid user space pointer was passed
270 ENXIO Invalid IOP number 270 ENXIO Invalid IOP number
@@ -301,7 +301,7 @@ X. Removing Software
301 RETURNS 301 RETURNS
302 302
303 This function returns 0 if no errors occur. If an error occurs, -1 303 This function returns 0 if no errors occur. If an error occurs, -1
304 is returned and errno is set appropriately: 304 is returned and errno is set appropriatly:
305 305
306 EFAULT Invalid user space pointer was passed 306 EFAULT Invalid user space pointer was passed
307 ENXIO Invalid IOP number 307 ENXIO Invalid IOP number
@@ -325,7 +325,7 @@ X. Validating Configuration
325 RETURNS 325 RETURNS
326 326
327 This function returns 0 if no erro occur. If an error occurs, -1 is 327 This function returns 0 if no erro occur. If an error occurs, -1 is
328 returned and errno is set appropriately: 328 returned and errno is set appropriatly:
329 329
330 ETIMEDOUT Timeout waiting for reply message 330 ETIMEDOUT Timeout waiting for reply message
331 ENXIO Invalid IOP number 331 ENXIO Invalid IOP number
@@ -360,7 +360,7 @@ XI. Configuration Dialog
360 RETURNS 360 RETURNS
361 361
362 This function returns 0 if no error occur. If an error occurs, -1 362 This function returns 0 if no error occur. If an error occurs, -1
363 is returned and errno is set appropriately: 363 is returned and errno is set appropriatly:
364 364
365 EFAULT Invalid user space pointer was passed 365 EFAULT Invalid user space pointer was passed
366 ENXIO Invalid IOP number 366 ENXIO Invalid IOP number
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 49e86aed2bc..4796bbf0ae4 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -609,7 +609,7 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode)
609 u8 operation; 609 u8 operation;
610 610
611 /* 611 /*
612 * This is to deal with the case of an application 612 * This is to deail with the case of an application
613 * opening a device and then the device disappears while 613 * opening a device and then the device disappears while
614 * it's in use, and then the application tries to release 614 * it's in use, and then the application tries to release
615 * it. ex: Unmounting a deleted RAID volume at reboot. 615 * it. ex: Unmounting a deleted RAID volume at reboot.
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index 5451beff183..098de2b3578 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -188,13 +188,6 @@ static int i2o_cfg_parms(unsigned long arg, unsigned int type)
188 if (!dev) 188 if (!dev)
189 return -ENXIO; 189 return -ENXIO;
190 190
191 /*
192 * Stop users being able to try and allocate arbitrary amounts
193 * of DMA space. 64K is way more than sufficient for this.
194 */
195 if (kcmd.oplen > 65536)
196 return -EMSGSIZE;
197
198 ops = memdup_user(kcmd.opbuf, kcmd.oplen); 191 ops = memdup_user(kcmd.opbuf, kcmd.oplen);
199 if (IS_ERR(ops)) 192 if (IS_ERR(ops))
200 return PTR_ERR(ops); 193 return PTR_ERR(ops);
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 8001aa6bfb4..07dbeaf9df9 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -56,7 +56,7 @@
56/* Structure used to define /proc entries */ 56/* Structure used to define /proc entries */
57typedef struct _i2o_proc_entry_t { 57typedef struct _i2o_proc_entry_t {
58 char *name; /* entry name */ 58 char *name; /* entry name */
59 umode_t mode; /* mode */ 59 mode_t mode; /* mode */
60 const struct file_operations *fops; /* open function */ 60 const struct file_operations *fops; /* open function */
61} i2o_proc_entry; 61} i2o_proc_entry;
62 62
@@ -255,8 +255,9 @@ static char *scsi_devices[] = {
255 "Array Controller Device" 255 "Array Controller Device"
256}; 256};
257 257
258static char *chtostr(char *tmp, u8 *chars, int n) 258static char *chtostr(u8 * chars, int n)
259{ 259{
260 char tmp[256];
260 tmp[0] = 0; 261 tmp[0] = 0;
261 return strncat(tmp, (char *)chars, n); 262 return strncat(tmp, (char *)chars, n);
262} 263}
@@ -282,6 +283,7 @@ static char *bus_strings[] = {
282 "Local Bus", 283 "Local Bus",
283 "ISA", 284 "ISA",
284 "EISA", 285 "EISA",
286 "MCA",
285 "PCI", 287 "PCI",
286 "PCMCIA", 288 "PCMCIA",
287 "NUBUS", 289 "NUBUS",
@@ -349,6 +351,18 @@ static int i2o_seq_show_hrt(struct seq_file *seq, void *v)
349 EisaSlotNumber); 351 EisaSlotNumber);
350 break; 352 break;
351 353
354 case I2O_BUS_MCA:
355 seq_printf(seq, " IOBase: %0#6x,",
356 hrt->hrt_entry[i].bus.mca_bus.
357 McaBaseIOPort);
358 seq_printf(seq, " MemoryBase: %0#10x,",
359 hrt->hrt_entry[i].bus.mca_bus.
360 McaBaseMemoryAddress);
361 seq_printf(seq, " Slot: %0#4x,",
362 hrt->hrt_entry[i].bus.mca_bus.
363 McaSlotNumber);
364 break;
365
352 case I2O_BUS_PCI: 366 case I2O_BUS_PCI:
353 seq_printf(seq, " Bus: %0#4x", 367 seq_printf(seq, " Bus: %0#4x",
354 hrt->hrt_entry[i].bus.pci_bus. 368 hrt->hrt_entry[i].bus.pci_bus.
@@ -790,7 +804,6 @@ static int i2o_seq_show_ddm_table(struct seq_file *seq, void *v)
790 } *result; 804 } *result;
791 805
792 i2o_exec_execute_ddm_table ddm_table; 806 i2o_exec_execute_ddm_table ddm_table;
793 char tmp[28 + 1];
794 807
795 result = kmalloc(sizeof(*result), GFP_KERNEL); 808 result = kmalloc(sizeof(*result), GFP_KERNEL);
796 if (!result) 809 if (!result)
@@ -826,7 +839,7 @@ static int i2o_seq_show_ddm_table(struct seq_file *seq, void *v)
826 seq_printf(seq, "%-#7x", ddm_table.i2o_vendor_id); 839 seq_printf(seq, "%-#7x", ddm_table.i2o_vendor_id);
827 seq_printf(seq, "%-#8x", ddm_table.module_id); 840 seq_printf(seq, "%-#8x", ddm_table.module_id);
828 seq_printf(seq, "%-29s", 841 seq_printf(seq, "%-29s",
829 chtostr(tmp, ddm_table.module_name_version, 28)); 842 chtostr(ddm_table.module_name_version, 28));
830 seq_printf(seq, "%9d ", ddm_table.data_size); 843 seq_printf(seq, "%9d ", ddm_table.data_size);
831 seq_printf(seq, "%8d", ddm_table.code_size); 844 seq_printf(seq, "%8d", ddm_table.code_size);
832 845
@@ -893,7 +906,6 @@ static int i2o_seq_show_drivers_stored(struct seq_file *seq, void *v)
893 906
894 i2o_driver_result_table *result; 907 i2o_driver_result_table *result;
895 i2o_driver_store_table *dst; 908 i2o_driver_store_table *dst;
896 char tmp[28 + 1];
897 909
898 result = kmalloc(sizeof(i2o_driver_result_table), GFP_KERNEL); 910 result = kmalloc(sizeof(i2o_driver_result_table), GFP_KERNEL);
899 if (result == NULL) 911 if (result == NULL)
@@ -928,9 +940,8 @@ static int i2o_seq_show_drivers_stored(struct seq_file *seq, void *v)
928 940
929 seq_printf(seq, "%-#7x", dst->i2o_vendor_id); 941 seq_printf(seq, "%-#7x", dst->i2o_vendor_id);
930 seq_printf(seq, "%-#8x", dst->module_id); 942 seq_printf(seq, "%-#8x", dst->module_id);
931 seq_printf(seq, "%-29s", 943 seq_printf(seq, "%-29s", chtostr(dst->module_name_version, 28));
932 chtostr(tmp, dst->module_name_version, 28)); 944 seq_printf(seq, "%-9s", chtostr(dst->date, 8));
933 seq_printf(seq, "%-9s", chtostr(tmp, dst->date, 8));
934 seq_printf(seq, "%8d ", dst->module_size); 945 seq_printf(seq, "%8d ", dst->module_size);
935 seq_printf(seq, "%8d ", dst->mpb_size); 946 seq_printf(seq, "%8d ", dst->mpb_size);
936 seq_printf(seq, "0x%04x", dst->module_flags); 947 seq_printf(seq, "0x%04x", dst->module_flags);
@@ -1250,7 +1261,6 @@ static int i2o_seq_show_dev_identity(struct seq_file *seq, void *v)
1250 // == (allow) 512d bytes (max) 1261 // == (allow) 512d bytes (max)
1251 static u16 *work16 = (u16 *) work32; 1262 static u16 *work16 = (u16 *) work32;
1252 int token; 1263 int token;
1253 char tmp[16 + 1];
1254 1264
1255 token = i2o_parm_field_get(d, 0xF100, -1, &work32, sizeof(work32)); 1265 token = i2o_parm_field_get(d, 0xF100, -1, &work32, sizeof(work32));
1256 1266
@@ -1263,13 +1273,13 @@ static int i2o_seq_show_dev_identity(struct seq_file *seq, void *v)
1263 seq_printf(seq, "Owner TID : %0#5x\n", work16[2]); 1273 seq_printf(seq, "Owner TID : %0#5x\n", work16[2]);
1264 seq_printf(seq, "Parent TID : %0#5x\n", work16[3]); 1274 seq_printf(seq, "Parent TID : %0#5x\n", work16[3]);
1265 seq_printf(seq, "Vendor info : %s\n", 1275 seq_printf(seq, "Vendor info : %s\n",
1266 chtostr(tmp, (u8 *) (work32 + 2), 16)); 1276 chtostr((u8 *) (work32 + 2), 16));
1267 seq_printf(seq, "Product info : %s\n", 1277 seq_printf(seq, "Product info : %s\n",
1268 chtostr(tmp, (u8 *) (work32 + 6), 16)); 1278 chtostr((u8 *) (work32 + 6), 16));
1269 seq_printf(seq, "Description : %s\n", 1279 seq_printf(seq, "Description : %s\n",
1270 chtostr(tmp, (u8 *) (work32 + 10), 16)); 1280 chtostr((u8 *) (work32 + 10), 16));
1271 seq_printf(seq, "Product rev. : %s\n", 1281 seq_printf(seq, "Product rev. : %s\n",
1272 chtostr(tmp, (u8 *) (work32 + 14), 8)); 1282 chtostr((u8 *) (work32 + 14), 8));
1273 1283
1274 seq_printf(seq, "Serial number : "); 1284 seq_printf(seq, "Serial number : ");
1275 print_serial_number(seq, (u8 *) (work32 + 16), 1285 print_serial_number(seq, (u8 *) (work32 + 16),
@@ -1306,8 +1316,6 @@ static int i2o_seq_show_ddm_identity(struct seq_file *seq, void *v)
1306 u8 pad[256]; // allow up to 256 byte (max) serial number 1316 u8 pad[256]; // allow up to 256 byte (max) serial number
1307 } result; 1317 } result;
1308 1318
1309 char tmp[24 + 1];
1310
1311 token = i2o_parm_field_get(d, 0xF101, -1, &result, sizeof(result)); 1319 token = i2o_parm_field_get(d, 0xF101, -1, &result, sizeof(result));
1312 1320
1313 if (token < 0) { 1321 if (token < 0) {
@@ -1317,9 +1325,9 @@ static int i2o_seq_show_ddm_identity(struct seq_file *seq, void *v)
1317 1325
1318 seq_printf(seq, "Registering DDM TID : 0x%03x\n", result.ddm_tid); 1326 seq_printf(seq, "Registering DDM TID : 0x%03x\n", result.ddm_tid);
1319 seq_printf(seq, "Module name : %s\n", 1327 seq_printf(seq, "Module name : %s\n",
1320 chtostr(tmp, result.module_name, 24)); 1328 chtostr(result.module_name, 24));
1321 seq_printf(seq, "Module revision : %s\n", 1329 seq_printf(seq, "Module revision : %s\n",
1322 chtostr(tmp, result.module_rev, 8)); 1330 chtostr(result.module_rev, 8));
1323 1331
1324 seq_printf(seq, "Serial number : "); 1332 seq_printf(seq, "Serial number : ");
1325 print_serial_number(seq, result.serial_number, sizeof(result) - 36); 1333 print_serial_number(seq, result.serial_number, sizeof(result) - 36);
@@ -1343,8 +1351,6 @@ static int i2o_seq_show_uinfo(struct seq_file *seq, void *v)
1343 u8 instance_number[4]; 1351 u8 instance_number[4];
1344 } result; 1352 } result;
1345 1353
1346 char tmp[64 + 1];
1347
1348 token = i2o_parm_field_get(d, 0xF102, -1, &result, sizeof(result)); 1354 token = i2o_parm_field_get(d, 0xF102, -1, &result, sizeof(result));
1349 1355
1350 if (token < 0) { 1356 if (token < 0) {
@@ -1353,13 +1359,13 @@ static int i2o_seq_show_uinfo(struct seq_file *seq, void *v)
1353 } 1359 }
1354 1360
1355 seq_printf(seq, "Device name : %s\n", 1361 seq_printf(seq, "Device name : %s\n",
1356 chtostr(tmp, result.device_name, 64)); 1362 chtostr(result.device_name, 64));
1357 seq_printf(seq, "Service name : %s\n", 1363 seq_printf(seq, "Service name : %s\n",
1358 chtostr(tmp, result.service_name, 64)); 1364 chtostr(result.service_name, 64));
1359 seq_printf(seq, "Physical name : %s\n", 1365 seq_printf(seq, "Physical name : %s\n",
1360 chtostr(tmp, result.physical_location, 64)); 1366 chtostr(result.physical_location, 64));
1361 seq_printf(seq, "Instance number : %s\n", 1367 seq_printf(seq, "Instance number : %s\n",
1362 chtostr(tmp, result.instance_number, 4)); 1368 chtostr(result.instance_number, 4));
1363 1369
1364 return 0; 1370 return 0;
1365} 1371}
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index 1d31d7284cb..c8ed7b63fdf 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -57,6 +57,7 @@
57#include <linux/scatterlist.h> 57#include <linux/scatterlist.h>
58 58
59#include <asm/dma.h> 59#include <asm/dma.h>
60#include <asm/system.h>
60#include <asm/io.h> 61#include <asm/io.h>
61#include <linux/atomic.h> 62#include <linux/atomic.h>
62 63
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c
index 0f9f3e1a2b6..73e4658af53 100644
--- a/drivers/message/i2o/pci.c
+++ b/drivers/message/i2o/pci.c
@@ -31,13 +31,12 @@
31#include <linux/interrupt.h> 31#include <linux/interrupt.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/i2o.h> 33#include <linux/i2o.h>
34#include <linux/module.h>
35#include "core.h" 34#include "core.h"
36 35
37#define OSM_DESCRIPTION "I2O-subsystem" 36#define OSM_DESCRIPTION "I2O-subsystem"
38 37
39/* PCI device id table for all I2O controllers */ 38/* PCI device id table for all I2O controllers */
40static struct pci_device_id i2o_pci_ids[] = { 39static struct pci_device_id __devinitdata i2o_pci_ids[] = {
41 {PCI_DEVICE_CLASS(PCI_CLASS_INTELLIGENT_I2O << 8, 0xffff00)}, 40 {PCI_DEVICE_CLASS(PCI_CLASS_INTELLIGENT_I2O << 8, 0xffff00)},
42 {PCI_DEVICE(PCI_VENDOR_ID_DPT, 0xa511)}, 41 {PCI_DEVICE(PCI_VENDOR_ID_DPT, 0xa511)},
43 {.vendor = PCI_VENDOR_ID_INTEL,.device = 0x1962, 42 {.vendor = PCI_VENDOR_ID_INTEL,.device = 0x1962,
@@ -84,7 +83,7 @@ static void i2o_pci_free(struct i2o_controller *c)
84 * 83 *
85 * Returns 0 on success or negative error code on failure. 84 * Returns 0 on success or negative error code on failure.
86 */ 85 */
87static int i2o_pci_alloc(struct i2o_controller *c) 86static int __devinit i2o_pci_alloc(struct i2o_controller *c)
88{ 87{
89 struct pci_dev *pdev = c->pdev; 88 struct pci_dev *pdev = c->pdev;
90 struct device *dev = &pdev->dev; 89 struct device *dev = &pdev->dev;
@@ -315,7 +314,8 @@ static void i2o_pci_irq_disable(struct i2o_controller *c)
315 * 314 *
316 * Returns 0 on success or negative error code on failure. 315 * Returns 0 on success or negative error code on failure.
317 */ 316 */
318static int i2o_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 317static int __devinit i2o_pci_probe(struct pci_dev *pdev,
318 const struct pci_device_id *id)
319{ 319{
320 struct i2o_controller *c; 320 struct i2o_controller *c;
321 int rc; 321 int rc;
@@ -452,7 +452,7 @@ static int i2o_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
452 * Reset the I2O controller, disable interrupts and remove all allocated 452 * Reset the I2O controller, disable interrupts and remove all allocated
453 * resources. 453 * resources.
454 */ 454 */
455static void i2o_pci_remove(struct pci_dev *pdev) 455static void __devexit i2o_pci_remove(struct pci_dev *pdev)
456{ 456{
457 struct i2o_controller *c; 457 struct i2o_controller *c;
458 c = pci_get_drvdata(pdev); 458 c = pci_get_drvdata(pdev);
@@ -473,7 +473,7 @@ static struct pci_driver i2o_pci_driver = {
473 .name = "PCI_I2O", 473 .name = "PCI_I2O",
474 .id_table = i2o_pci_ids, 474 .id_table = i2o_pci_ids,
475 .probe = i2o_pci_probe, 475 .probe = i2o_pci_probe,
476 .remove = i2o_pci_remove, 476 .remove = __devexit_p(i2o_pci_remove),
477}; 477};
478 478
479/** 479/**