aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2006-06-29 16:01:54 -0400
committerDave Jones <davej@redhat.com>2006-06-29 16:01:54 -0400
commit55b4d6a52195a8f277ffddf755ddaff359878f41 (patch)
tree06a3183a562f8da4688f65023f7a18dcad702956 /drivers/message
parentadf8a287150667feb5747f8beade62acacc17d4e (diff)
parent1f1332f727c3229eb2166a83fec5d3de6a73dce2 (diff)
Merge ../linus
Conflicts: drivers/char/agp/Kconfig
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptbase.c225
-rw-r--r--drivers/message/fusion/mptbase.h16
-rw-r--r--drivers/message/fusion/mptfc.c400
-rw-r--r--drivers/message/fusion/mptsas.c3
-rw-r--r--drivers/message/fusion/mptscsih.c23
-rw-r--r--drivers/message/i2o/i2o_scsi.c4
-rw-r--r--drivers/message/i2o/iop.c15
7 files changed, 460 insertions, 226 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index a30084076ac8..12dd8d493ee2 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -63,9 +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#ifdef __sparc__
67#include <asm/irq.h> /* needed for __irq_itoa() proto */
68#endif
69 66
70#include "mptbase.h" 67#include "mptbase.h"
71 68
@@ -1188,7 +1185,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1188 ioc->pcidev = pdev; 1185 ioc->pcidev = pdev;
1189 ioc->diagPending = 0; 1186 ioc->diagPending = 0;
1190 spin_lock_init(&ioc->diagLock); 1187 spin_lock_init(&ioc->diagLock);
1191 spin_lock_init(&ioc->fc_rescan_work_lock);
1192 spin_lock_init(&ioc->initializing_hba_lock); 1188 spin_lock_init(&ioc->initializing_hba_lock);
1193 1189
1194 /* Initialize the event logging. 1190 /* Initialize the event logging.
@@ -1386,39 +1382,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1386 /* Set lookup ptr. */ 1382 /* Set lookup ptr. */
1387 list_add_tail(&ioc->list, &ioc_list); 1383 list_add_tail(&ioc->list, &ioc_list);
1388 1384
1389 ioc->pci_irq = -1;
1390 if (pdev->irq) {
1391 if (mpt_msi_enable && !pci_enable_msi(pdev))
1392 printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n", ioc->name);
1393
1394 r = request_irq(pdev->irq, mpt_interrupt, SA_SHIRQ, ioc->name, ioc);
1395
1396 if (r < 0) {
1397#ifndef __sparc__
1398 printk(MYIOC_s_ERR_FMT "Unable to allocate interrupt %d!\n",
1399 ioc->name, pdev->irq);
1400#else
1401 printk(MYIOC_s_ERR_FMT "Unable to allocate interrupt %s!\n",
1402 ioc->name, __irq_itoa(pdev->irq));
1403#endif
1404 list_del(&ioc->list);
1405 iounmap(mem);
1406 kfree(ioc);
1407 return -EBUSY;
1408 }
1409
1410 ioc->pci_irq = pdev->irq;
1411
1412 pci_set_master(pdev); /* ?? */
1413 pci_set_drvdata(pdev, ioc);
1414
1415#ifndef __sparc__
1416 dprintk((KERN_INFO MYNAM ": %s installed at interrupt %d\n", ioc->name, pdev->irq));
1417#else
1418 dprintk((KERN_INFO MYNAM ": %s installed at interrupt %s\n", ioc->name, __irq_itoa(pdev->irq)));
1419#endif
1420 }
1421
1422 /* Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets. 1385 /* Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets.
1423 */ 1386 */
1424 mpt_detect_bound_ports(ioc, pdev); 1387 mpt_detect_bound_ports(ioc, pdev);
@@ -1428,11 +1391,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1428 printk(KERN_WARNING MYNAM 1391 printk(KERN_WARNING MYNAM
1429 ": WARNING - %s did not initialize properly! (%d)\n", 1392 ": WARNING - %s did not initialize properly! (%d)\n",
1430 ioc->name, r); 1393 ioc->name, r);
1431
1432 list_del(&ioc->list); 1394 list_del(&ioc->list);
1433 free_irq(ioc->pci_irq, ioc);
1434 if (mpt_msi_enable)
1435 pci_disable_msi(pdev);
1436 if (ioc->alt_ioc) 1395 if (ioc->alt_ioc)
1437 ioc->alt_ioc->alt_ioc = NULL; 1396 ioc->alt_ioc->alt_ioc = NULL;
1438 iounmap(mem); 1397 iounmap(mem);
@@ -1651,6 +1610,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1651 int handlers; 1610 int handlers;
1652 int ret = 0; 1611 int ret = 0;
1653 int reset_alt_ioc_active = 0; 1612 int reset_alt_ioc_active = 0;
1613 int irq_allocated = 0;
1654 1614
1655 printk(KERN_INFO MYNAM ": Initiating %s %s\n", 1615 printk(KERN_INFO MYNAM ": Initiating %s %s\n",
1656 ioc->name, reason==MPT_HOSTEVENT_IOC_BRINGUP ? "bringup" : "recovery"); 1616 ioc->name, reason==MPT_HOSTEVENT_IOC_BRINGUP ? "bringup" : "recovery");
@@ -1734,6 +1694,36 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1734 } 1694 }
1735 } 1695 }
1736 1696
1697 /*
1698 * Device is reset now. It must have de-asserted the interrupt line
1699 * (if it was asserted) and it should be safe to register for the
1700 * interrupt now.
1701 */
1702 if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP)) {
1703 ioc->pci_irq = -1;
1704 if (ioc->pcidev->irq) {
1705 if (mpt_msi_enable && !pci_enable_msi(ioc->pcidev))
1706 printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n",
1707 ioc->name);
1708 rc = request_irq(ioc->pcidev->irq, mpt_interrupt,
1709 SA_SHIRQ, ioc->name, ioc);
1710 if (rc < 0) {
1711 printk(MYIOC_s_ERR_FMT "Unable to allocate "
1712 "interrupt %d!\n", ioc->name,
1713 ioc->pcidev->irq);
1714 if (mpt_msi_enable)
1715 pci_disable_msi(ioc->pcidev);
1716 return -EBUSY;
1717 }
1718 irq_allocated = 1;
1719 ioc->pci_irq = ioc->pcidev->irq;
1720 pci_set_master(ioc->pcidev); /* ?? */
1721 pci_set_drvdata(ioc->pcidev, ioc);
1722 dprintk((KERN_INFO MYNAM ": %s installed at interrupt "
1723 "%d\n", ioc->name, ioc->pcidev->irq));
1724 }
1725 }
1726
1737 /* Prime reply & request queues! 1727 /* Prime reply & request queues!
1738 * (mucho alloc's) Must be done prior to 1728 * (mucho alloc's) Must be done prior to
1739 * init as upper addresses are needed for init. 1729 * init as upper addresses are needed for init.
@@ -1833,7 +1823,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1833 ret = mptbase_sas_persist_operation(ioc, 1823 ret = mptbase_sas_persist_operation(ioc,
1834 MPI_SAS_OP_CLEAR_NOT_PRESENT); 1824 MPI_SAS_OP_CLEAR_NOT_PRESENT);
1835 if(ret != 0) 1825 if(ret != 0)
1836 return -1; 1826 goto out;
1837 } 1827 }
1838 1828
1839 /* Find IM volumes 1829 /* Find IM volumes
@@ -1841,14 +1831,6 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1841 mpt_findImVolumes(ioc); 1831 mpt_findImVolumes(ioc);
1842 1832
1843 } else if (ioc->bus_type == FC) { 1833 } else if (ioc->bus_type == FC) {
1844 /*
1845 * Pre-fetch FC port WWN and stuff...
1846 * (FCPortPage0_t stuff)
1847 */
1848 for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) {
1849 (void) mptbase_GetFcPortPage0(ioc, ii);
1850 }
1851
1852 if ((ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) && 1834 if ((ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) &&
1853 (ioc->lan_cnfg_page0.Header.PageLength == 0)) { 1835 (ioc->lan_cnfg_page0.Header.PageLength == 0)) {
1854 /* 1836 /*
@@ -1914,6 +1896,12 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1914 /* FIXME? Examine results here? */ 1896 /* FIXME? Examine results here? */
1915 } 1897 }
1916 1898
1899out:
1900 if ((ret != 0) && irq_allocated) {
1901 free_irq(ioc->pci_irq, ioc);
1902 if (mpt_msi_enable)
1903 pci_disable_msi(ioc->pcidev);
1904 }
1917 return ret; 1905 return ret;
1918} 1906}
1919 1907
@@ -2288,7 +2276,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
2288 } 2276 }
2289 2277
2290 if (sleepFlag == CAN_SLEEP) { 2278 if (sleepFlag == CAN_SLEEP) {
2291 msleep_interruptible(1); 2279 msleep(1);
2292 } else { 2280 } else {
2293 mdelay (1); /* 1 msec delay */ 2281 mdelay (1); /* 1 msec delay */
2294 } 2282 }
@@ -2676,7 +2664,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
2676 state = mpt_GetIocState(ioc, 1); 2664 state = mpt_GetIocState(ioc, 1);
2677 while (state != MPI_IOC_STATE_OPERATIONAL && --cntdn) { 2665 while (state != MPI_IOC_STATE_OPERATIONAL && --cntdn) {
2678 if (sleepFlag == CAN_SLEEP) { 2666 if (sleepFlag == CAN_SLEEP) {
2679 msleep_interruptible(1); 2667 msleep(1);
2680 } else { 2668 } else {
2681 mdelay(1); 2669 mdelay(1);
2682 } 2670 }
@@ -2928,7 +2916,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
2928 2916
2929 /* wait 1 msec */ 2917 /* wait 1 msec */
2930 if (sleepFlag == CAN_SLEEP) { 2918 if (sleepFlag == CAN_SLEEP) {
2931 msleep_interruptible(1); 2919 msleep(1);
2932 } else { 2920 } else {
2933 mdelay (1); 2921 mdelay (1);
2934 } 2922 }
@@ -2945,7 +2933,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
2945 } 2933 }
2946 /* wait .1 sec */ 2934 /* wait .1 sec */
2947 if (sleepFlag == CAN_SLEEP) { 2935 if (sleepFlag == CAN_SLEEP) {
2948 msleep_interruptible (100); 2936 msleep (100);
2949 } else { 2937 } else {
2950 mdelay (100); 2938 mdelay (100);
2951 } 2939 }
@@ -3035,7 +3023,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3035 3023
3036 /* wait 1 msec */ 3024 /* wait 1 msec */
3037 if (sleepFlag == CAN_SLEEP) { 3025 if (sleepFlag == CAN_SLEEP) {
3038 msleep_interruptible (1); 3026 msleep (1);
3039 } else { 3027 } else {
3040 mdelay (1); 3028 mdelay (1);
3041 } 3029 }
@@ -3083,7 +3071,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3083 return 0; 3071 return 0;
3084 } 3072 }
3085 if (sleepFlag == CAN_SLEEP) { 3073 if (sleepFlag == CAN_SLEEP) {
3086 msleep_interruptible (10); 3074 msleep (10);
3087 } else { 3075 } else {
3088 mdelay (10); 3076 mdelay (10);
3089 } 3077 }
@@ -3134,7 +3122,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
3134 SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, sleepFlag); 3122 SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, sleepFlag);
3135 3123
3136 if (sleepFlag == CAN_SLEEP) { 3124 if (sleepFlag == CAN_SLEEP) {
3137 msleep_interruptible (1000); 3125 msleep (1000);
3138 } else { 3126 } else {
3139 mdelay (1000); 3127 mdelay (1000);
3140 } 3128 }
@@ -3156,7 +3144,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
3156 return hard_reset_done; 3144 return hard_reset_done;
3157 } 3145 }
3158 if (sleepFlag == CAN_SLEEP) { 3146 if (sleepFlag == CAN_SLEEP) {
3159 msleep_interruptible (10); 3147 msleep (10);
3160 } else { 3148 } else {
3161 mdelay (10); 3149 mdelay (10);
3162 } 3150 }
@@ -3227,7 +3215,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3227 3215
3228 /* wait 100 msec */ 3216 /* wait 100 msec */
3229 if (sleepFlag == CAN_SLEEP) { 3217 if (sleepFlag == CAN_SLEEP) {
3230 msleep_interruptible (100); 3218 msleep (100);
3231 } else { 3219 } else {
3232 mdelay (100); 3220 mdelay (100);
3233 } 3221 }
@@ -3306,7 +3294,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3306 3294
3307 /* wait 1 sec */ 3295 /* wait 1 sec */
3308 if (sleepFlag == CAN_SLEEP) { 3296 if (sleepFlag == CAN_SLEEP) {
3309 msleep_interruptible (1000); 3297 msleep (1000);
3310 } else { 3298 } else {
3311 mdelay (1000); 3299 mdelay (1000);
3312 } 3300 }
@@ -3334,7 +3322,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3334 3322
3335 /* wait 1 sec */ 3323 /* wait 1 sec */
3336 if (sleepFlag == CAN_SLEEP) { 3324 if (sleepFlag == CAN_SLEEP) {
3337 msleep_interruptible (1000); 3325 msleep (1000);
3338 } else { 3326 } else {
3339 mdelay (1000); 3327 mdelay (1000);
3340 } 3328 }
@@ -3368,7 +3356,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3368 3356
3369 /* wait 100 msec */ 3357 /* wait 100 msec */
3370 if (sleepFlag == CAN_SLEEP) { 3358 if (sleepFlag == CAN_SLEEP) {
3371 msleep_interruptible (100); 3359 msleep (100);
3372 } else { 3360 } else {
3373 mdelay (100); 3361 mdelay (100);
3374 } 3362 }
@@ -3462,7 +3450,7 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag)
3462 } 3450 }
3463 3451
3464 if (sleepFlag == CAN_SLEEP) { 3452 if (sleepFlag == CAN_SLEEP) {
3465 msleep_interruptible(1); 3453 msleep(1);
3466 } else { 3454 } else {
3467 mdelay (1); /* 1 msec delay */ 3455 mdelay (1); /* 1 msec delay */
3468 } 3456 }
@@ -3902,7 +3890,7 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
3902 intstat = CHIPREG_READ32(&ioc->chip->IntStatus); 3890 intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
3903 if (! (intstat & MPI_HIS_IOP_DOORBELL_STATUS)) 3891 if (! (intstat & MPI_HIS_IOP_DOORBELL_STATUS))
3904 break; 3892 break;
3905 msleep_interruptible (1); 3893 msleep (1);
3906 count++; 3894 count++;
3907 } 3895 }
3908 } else { 3896 } else {
@@ -3951,7 +3939,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
3951 intstat = CHIPREG_READ32(&ioc->chip->IntStatus); 3939 intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
3952 if (intstat & MPI_HIS_DOORBELL_INTERRUPT) 3940 if (intstat & MPI_HIS_DOORBELL_INTERRUPT)
3953 break; 3941 break;
3954 msleep_interruptible(1); 3942 msleep(1);
3955 count++; 3943 count++;
3956 } 3944 }
3957 } else { 3945 } else {
@@ -4174,108 +4162,6 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
4174 4162
4175/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 4163/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
4176/* 4164/*
4177 * mptbase_GetFcPortPage0 - Fetch FCPort config Page0.
4178 * @ioc: Pointer to MPT_ADAPTER structure
4179 * @portnum: IOC Port number
4180 *
4181 * Return: 0 for success
4182 * -ENOMEM if no memory available
4183 * -EPERM if not allowed due to ISR context
4184 * -EAGAIN if no msg frames currently available
4185 * -EFAULT for non-successful reply or no reply (timeout)
4186 */
4187int
4188mptbase_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
4189{
4190 ConfigPageHeader_t hdr;
4191 CONFIGPARMS cfg;
4192 FCPortPage0_t *ppage0_alloc;
4193 FCPortPage0_t *pp0dest;
4194 dma_addr_t page0_dma;
4195 int data_sz;
4196 int copy_sz;
4197 int rc;
4198 int count = 400;
4199
4200
4201 /* Get FCPort Page 0 header */
4202 hdr.PageVersion = 0;
4203 hdr.PageLength = 0;
4204 hdr.PageNumber = 0;
4205 hdr.PageType = MPI_CONFIG_PAGETYPE_FC_PORT;
4206 cfg.cfghdr.hdr = &hdr;
4207 cfg.physAddr = -1;
4208 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
4209 cfg.dir = 0;
4210 cfg.pageAddr = portnum;
4211 cfg.timeout = 0;
4212
4213 if ((rc = mpt_config(ioc, &cfg)) != 0)
4214 return rc;
4215
4216 if (hdr.PageLength == 0)
4217 return 0;
4218
4219 data_sz = hdr.PageLength * 4;
4220 rc = -ENOMEM;
4221 ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
4222 if (ppage0_alloc) {
4223
4224 try_again:
4225 memset((u8 *)ppage0_alloc, 0, data_sz);
4226 cfg.physAddr = page0_dma;
4227 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
4228
4229 if ((rc = mpt_config(ioc, &cfg)) == 0) {
4230 /* save the data */
4231 pp0dest = &ioc->fc_port_page0[portnum];
4232 copy_sz = min_t(int, sizeof(FCPortPage0_t), data_sz);
4233 memcpy(pp0dest, ppage0_alloc, copy_sz);
4234
4235 /*
4236 * Normalize endianness of structure data,
4237 * by byte-swapping all > 1 byte fields!
4238 */
4239 pp0dest->Flags = le32_to_cpu(pp0dest->Flags);
4240 pp0dest->PortIdentifier = le32_to_cpu(pp0dest->PortIdentifier);
4241 pp0dest->WWNN.Low = le32_to_cpu(pp0dest->WWNN.Low);
4242 pp0dest->WWNN.High = le32_to_cpu(pp0dest->WWNN.High);
4243 pp0dest->WWPN.Low = le32_to_cpu(pp0dest->WWPN.Low);
4244 pp0dest->WWPN.High = le32_to_cpu(pp0dest->WWPN.High);
4245 pp0dest->SupportedServiceClass = le32_to_cpu(pp0dest->SupportedServiceClass);
4246 pp0dest->SupportedSpeeds = le32_to_cpu(pp0dest->SupportedSpeeds);
4247 pp0dest->CurrentSpeed = le32_to_cpu(pp0dest->CurrentSpeed);
4248 pp0dest->MaxFrameSize = le32_to_cpu(pp0dest->MaxFrameSize);
4249 pp0dest->FabricWWNN.Low = le32_to_cpu(pp0dest->FabricWWNN.Low);
4250 pp0dest->FabricWWNN.High = le32_to_cpu(pp0dest->FabricWWNN.High);
4251 pp0dest->FabricWWPN.Low = le32_to_cpu(pp0dest->FabricWWPN.Low);
4252 pp0dest->FabricWWPN.High = le32_to_cpu(pp0dest->FabricWWPN.High);
4253 pp0dest->DiscoveredPortsCount = le32_to_cpu(pp0dest->DiscoveredPortsCount);
4254 pp0dest->MaxInitiators = le32_to_cpu(pp0dest->MaxInitiators);
4255
4256 /*
4257 * if still doing discovery,
4258 * hang loose a while until finished
4259 */
4260 if (pp0dest->PortState == MPI_FCPORTPAGE0_PORTSTATE_UNKNOWN) {
4261 if (count-- > 0) {
4262 msleep_interruptible(100);
4263 goto try_again;
4264 }
4265 printk(MYIOC_s_INFO_FMT "Firmware discovery not"
4266 " complete.\n",
4267 ioc->name);
4268 }
4269 }
4270
4271 pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma);
4272 }
4273
4274 return rc;
4275}
4276
4277/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
4278/*
4279 * mptbase_sas_persist_operation - Perform operation on SAS Persitent Table 4165 * mptbase_sas_persist_operation - Perform operation on SAS Persitent Table
4280 * @ioc: Pointer to MPT_ADAPTER structure 4166 * @ioc: Pointer to MPT_ADAPTER structure
4281 * @sas_address: 64bit SAS Address for operation. 4167 * @sas_address: 64bit SAS Address for operation.
@@ -5647,11 +5533,7 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
5647 a[5], a[4], a[3], a[2], a[1], a[0]); 5533 a[5], a[4], a[3], a[2], a[1], a[0]);
5648 } 5534 }
5649 5535
5650#ifndef __sparc__
5651 y += sprintf(buffer+len+y, ", IRQ=%d", ioc->pci_irq); 5536 y += sprintf(buffer+len+y, ", IRQ=%d", ioc->pci_irq);
5652#else
5653 y += sprintf(buffer+len+y, ", IRQ=%s", __irq_itoa(ioc->pci_irq));
5654#endif
5655 5537
5656 if (!ioc->active) 5538 if (!ioc->active)
5657 y += sprintf(buffer+len+y, " (disabled)"); 5539 y += sprintf(buffer+len+y, " (disabled)");
@@ -6483,7 +6365,6 @@ EXPORT_SYMBOL(mpt_findImVolumes);
6483EXPORT_SYMBOL(mpt_alloc_fw_memory); 6365EXPORT_SYMBOL(mpt_alloc_fw_memory);
6484EXPORT_SYMBOL(mpt_free_fw_memory); 6366EXPORT_SYMBOL(mpt_free_fw_memory);
6485EXPORT_SYMBOL(mptbase_sas_persist_operation); 6367EXPORT_SYMBOL(mptbase_sas_persist_operation);
6486EXPORT_SYMBOL(mptbase_GetFcPortPage0);
6487 6368
6488 6369
6489/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6370/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index f673cca507e1..4720f9ae86aa 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -76,8 +76,8 @@
76#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR 76#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR
77#endif 77#endif
78 78
79#define MPT_LINUX_VERSION_COMMON "3.03.09" 79#define MPT_LINUX_VERSION_COMMON "3.03.10"
80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.09" 80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.10"
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) \
@@ -487,6 +487,15 @@ typedef struct _RaidCfgData {
487 int isRaid; /* bit field, 1 if RAID */ 487 int isRaid; /* bit field, 1 if RAID */
488}RaidCfgData; 488}RaidCfgData;
489 489
490typedef struct _FcCfgData {
491 /* will ultimately hold fc_port_page0 also */
492 struct {
493 FCPortPage1_t *data;
494 dma_addr_t dma;
495 int pg_sz;
496 } fc_port_page1[2];
497} FcCfgData;
498
490#define MPT_RPORT_INFO_FLAGS_REGISTERED 0x01 /* rport registered */ 499#define MPT_RPORT_INFO_FLAGS_REGISTERED 0x01 /* rport registered */
491#define MPT_RPORT_INFO_FLAGS_MISSING 0x02 /* missing from DevPage0 scan */ 500#define MPT_RPORT_INFO_FLAGS_MISSING 0x02 /* missing from DevPage0 scan */
492 501
@@ -565,6 +574,7 @@ typedef struct _MPT_ADAPTER
565 SpiCfgData spi_data; /* Scsi config. data */ 574 SpiCfgData spi_data; /* Scsi config. data */
566 RaidCfgData raid_data; /* Raid config. data */ 575 RaidCfgData raid_data; /* Raid config. data */
567 SasCfgData sas_data; /* Sas config. data */ 576 SasCfgData sas_data; /* Sas config. data */
577 FcCfgData fc_data; /* Fc config. data */
568 MPT_IOCTL *ioctl; /* ioctl data pointer */ 578 MPT_IOCTL *ioctl; /* ioctl data pointer */
569 struct proc_dir_entry *ioc_dentry; 579 struct proc_dir_entry *ioc_dentry;
570 struct _MPT_ADAPTER *alt_ioc; /* ptr to 929 bound adapter port */ 580 struct _MPT_ADAPTER *alt_ioc; /* ptr to 929 bound adapter port */
@@ -625,6 +635,7 @@ typedef struct _MPT_ADAPTER
625 int num_ports; 635 int num_ports;
626 struct work_struct mptscsih_persistTask; 636 struct work_struct mptscsih_persistTask;
627 637
638 struct work_struct fc_setup_reset_work;
628 struct list_head fc_rports; 639 struct list_head fc_rports;
629 spinlock_t fc_rescan_work_lock; 640 spinlock_t fc_rescan_work_lock;
630 int fc_rescan_work_count; 641 int fc_rescan_work_count;
@@ -1027,7 +1038,6 @@ extern void mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size);
1027extern void mpt_free_fw_memory(MPT_ADAPTER *ioc); 1038extern void mpt_free_fw_memory(MPT_ADAPTER *ioc);
1028extern int mpt_findImVolumes(MPT_ADAPTER *ioc); 1039extern int mpt_findImVolumes(MPT_ADAPTER *ioc);
1029extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); 1040extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
1030extern int mptbase_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum);
1031 1041
1032/* 1042/*
1033 * Public data decl's... 1043 * Public data decl's...
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 856487741ef4..3ff8378ea660 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -169,13 +169,6 @@ static struct fc_function_template mptfc_transport_functions = {
169 169
170}; 170};
171 171
172/* FIXME! values controlling firmware RESCAN event
173 * need to be set low to allow dev_loss_tmo to
174 * work as expected. Currently, firmware doesn't
175 * notify driver of RESCAN event until some number
176 * of seconds elapse. This value can be set via
177 * lsiutil.
178 */
179static void 172static void
180mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) 173mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
181{ 174{
@@ -312,10 +305,8 @@ mptfc_GetFcDevPage0(MPT_ADAPTER *ioc, int ioc_port,
312 } 305 }
313 306
314 out: 307 out:
315 if (pp0_array) 308 kfree(pp0_array);
316 kfree(pp0_array); 309 kfree(p0_array);
317 if (p0_array)
318 kfree(p0_array);
319 return rc; 310 return rc;
320} 311}
321 312
@@ -587,15 +578,266 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
587#ifdef DMPT_DEBUG_FC 578#ifdef DMPT_DEBUG_FC
588 if (unlikely(err)) { 579 if (unlikely(err)) {
589 dfcprintk ((MYIOC_s_INFO_FMT 580 dfcprintk ((MYIOC_s_INFO_FMT
590 "mptfc_qcmd.%d: %d:%d, mptscsih_qcmd returns non-zero.\n", 581 "mptfc_qcmd.%d: %d:%d, mptscsih_qcmd returns non-zero, (%x).\n",
591 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name, 582 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name,
592 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no, 583 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no,
593 SCpnt->device->id,SCpnt->device->lun)); 584 SCpnt->device->id,SCpnt->device->lun,err));
594 } 585 }
595#endif 586#endif
596 return err; 587 return err;
597} 588}
598 589
590/*
591 * mptfc_GetFcPortPage0 - Fetch FCPort config Page0.
592 * @ioc: Pointer to MPT_ADAPTER structure
593 * @portnum: IOC Port number
594 *
595 * Return: 0 for success
596 * -ENOMEM if no memory available
597 * -EPERM if not allowed due to ISR context
598 * -EAGAIN if no msg frames currently available
599 * -EFAULT for non-successful reply or no reply (timeout)
600 * -EINVAL portnum arg out of range (hardwired to two elements)
601 */
602static int
603mptfc_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
604{
605 ConfigPageHeader_t hdr;
606 CONFIGPARMS cfg;
607 FCPortPage0_t *ppage0_alloc;
608 FCPortPage0_t *pp0dest;
609 dma_addr_t page0_dma;
610 int data_sz;
611 int copy_sz;
612 int rc;
613 int count = 400;
614
615 if (portnum > 1)
616 return -EINVAL;
617
618 /* Get FCPort Page 0 header */
619 hdr.PageVersion = 0;
620 hdr.PageLength = 0;
621 hdr.PageNumber = 0;
622 hdr.PageType = MPI_CONFIG_PAGETYPE_FC_PORT;
623 cfg.cfghdr.hdr = &hdr;
624 cfg.physAddr = -1;
625 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
626 cfg.dir = 0;
627 cfg.pageAddr = portnum;
628 cfg.timeout = 0;
629
630 if ((rc = mpt_config(ioc, &cfg)) != 0)
631 return rc;
632
633 if (hdr.PageLength == 0)
634 return 0;
635
636 data_sz = hdr.PageLength * 4;
637 rc = -ENOMEM;
638 ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
639 if (ppage0_alloc) {
640
641 try_again:
642 memset((u8 *)ppage0_alloc, 0, data_sz);
643 cfg.physAddr = page0_dma;
644 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
645
646 if ((rc = mpt_config(ioc, &cfg)) == 0) {
647 /* save the data */
648 pp0dest = &ioc->fc_port_page0[portnum];
649 copy_sz = min_t(int, sizeof(FCPortPage0_t), data_sz);
650 memcpy(pp0dest, ppage0_alloc, copy_sz);
651
652 /*
653 * Normalize endianness of structure data,
654 * by byte-swapping all > 1 byte fields!
655 */
656 pp0dest->Flags = le32_to_cpu(pp0dest->Flags);
657 pp0dest->PortIdentifier = le32_to_cpu(pp0dest->PortIdentifier);
658 pp0dest->WWNN.Low = le32_to_cpu(pp0dest->WWNN.Low);
659 pp0dest->WWNN.High = le32_to_cpu(pp0dest->WWNN.High);
660 pp0dest->WWPN.Low = le32_to_cpu(pp0dest->WWPN.Low);
661 pp0dest->WWPN.High = le32_to_cpu(pp0dest->WWPN.High);
662 pp0dest->SupportedServiceClass = le32_to_cpu(pp0dest->SupportedServiceClass);
663 pp0dest->SupportedSpeeds = le32_to_cpu(pp0dest->SupportedSpeeds);
664 pp0dest->CurrentSpeed = le32_to_cpu(pp0dest->CurrentSpeed);
665 pp0dest->MaxFrameSize = le32_to_cpu(pp0dest->MaxFrameSize);
666 pp0dest->FabricWWNN.Low = le32_to_cpu(pp0dest->FabricWWNN.Low);
667 pp0dest->FabricWWNN.High = le32_to_cpu(pp0dest->FabricWWNN.High);
668 pp0dest->FabricWWPN.Low = le32_to_cpu(pp0dest->FabricWWPN.Low);
669 pp0dest->FabricWWPN.High = le32_to_cpu(pp0dest->FabricWWPN.High);
670 pp0dest->DiscoveredPortsCount = le32_to_cpu(pp0dest->DiscoveredPortsCount);
671 pp0dest->MaxInitiators = le32_to_cpu(pp0dest->MaxInitiators);
672
673 /*
674 * if still doing discovery,
675 * hang loose a while until finished
676 */
677 if (pp0dest->PortState == MPI_FCPORTPAGE0_PORTSTATE_UNKNOWN) {
678 if (count-- > 0) {
679 msleep(100);
680 goto try_again;
681 }
682 printk(MYIOC_s_INFO_FMT "Firmware discovery not"
683 " complete.\n",
684 ioc->name);
685 }
686 }
687
688 pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma);
689 }
690
691 return rc;
692}
693
694static int
695mptfc_WriteFcPortPage1(MPT_ADAPTER *ioc, int portnum)
696{
697 ConfigPageHeader_t hdr;
698 CONFIGPARMS cfg;
699 int rc;
700
701 if (portnum > 1)
702 return -EINVAL;
703
704 if (!(ioc->fc_data.fc_port_page1[portnum].data))
705 return -EINVAL;
706
707 /* get fcport page 1 header */
708 hdr.PageVersion = 0;
709 hdr.PageLength = 0;
710 hdr.PageNumber = 1;
711 hdr.PageType = MPI_CONFIG_PAGETYPE_FC_PORT;
712 cfg.cfghdr.hdr = &hdr;
713 cfg.physAddr = -1;
714 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
715 cfg.dir = 0;
716 cfg.pageAddr = portnum;
717 cfg.timeout = 0;
718
719 if ((rc = mpt_config(ioc, &cfg)) != 0)
720 return rc;
721
722 if (hdr.PageLength == 0)
723 return -ENODEV;
724
725 if (hdr.PageLength*4 != ioc->fc_data.fc_port_page1[portnum].pg_sz)
726 return -EINVAL;
727
728 cfg.physAddr = ioc->fc_data.fc_port_page1[portnum].dma;
729 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;
730 cfg.dir = 1;
731
732 rc = mpt_config(ioc, &cfg);
733
734 return rc;
735}
736
737static int
738mptfc_GetFcPortPage1(MPT_ADAPTER *ioc, int portnum)
739{
740 ConfigPageHeader_t hdr;
741 CONFIGPARMS cfg;
742 FCPortPage1_t *page1_alloc;
743 dma_addr_t page1_dma;
744 int data_sz;
745 int rc;
746
747 if (portnum > 1)
748 return -EINVAL;
749
750 /* get fcport page 1 header */
751 hdr.PageVersion = 0;
752 hdr.PageLength = 0;
753 hdr.PageNumber = 1;
754 hdr.PageType = MPI_CONFIG_PAGETYPE_FC_PORT;
755 cfg.cfghdr.hdr = &hdr;
756 cfg.physAddr = -1;
757 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
758 cfg.dir = 0;
759 cfg.pageAddr = portnum;
760 cfg.timeout = 0;
761
762 if ((rc = mpt_config(ioc, &cfg)) != 0)
763 return rc;
764
765 if (hdr.PageLength == 0)
766 return -ENODEV;
767
768start_over:
769
770 if (ioc->fc_data.fc_port_page1[portnum].data == NULL) {
771 data_sz = hdr.PageLength * 4;
772 if (data_sz < sizeof(FCPortPage1_t))
773 data_sz = sizeof(FCPortPage1_t);
774
775 page1_alloc = (FCPortPage1_t *) pci_alloc_consistent(ioc->pcidev,
776 data_sz,
777 &page1_dma);
778 if (!page1_alloc)
779 return -ENOMEM;
780 }
781 else {
782 page1_alloc = ioc->fc_data.fc_port_page1[portnum].data;
783 page1_dma = ioc->fc_data.fc_port_page1[portnum].dma;
784 data_sz = ioc->fc_data.fc_port_page1[portnum].pg_sz;
785 if (hdr.PageLength * 4 > data_sz) {
786 ioc->fc_data.fc_port_page1[portnum].data = NULL;
787 pci_free_consistent(ioc->pcidev, data_sz, (u8 *)
788 page1_alloc, page1_dma);
789 goto start_over;
790 }
791 }
792
793 memset(page1_alloc,0,data_sz);
794
795 cfg.physAddr = page1_dma;
796 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
797
798 if ((rc = mpt_config(ioc, &cfg)) == 0) {
799 ioc->fc_data.fc_port_page1[portnum].data = page1_alloc;
800 ioc->fc_data.fc_port_page1[portnum].pg_sz = data_sz;
801 ioc->fc_data.fc_port_page1[portnum].dma = page1_dma;
802 }
803 else {
804 ioc->fc_data.fc_port_page1[portnum].data = NULL;
805 pci_free_consistent(ioc->pcidev, data_sz, (u8 *)
806 page1_alloc, page1_dma);
807 }
808
809 return rc;
810}
811
812static void
813mptfc_SetFcPortPage1_defaults(MPT_ADAPTER *ioc)
814{
815 int ii;
816 FCPortPage1_t *pp1;
817
818 #define MPTFC_FW_DEVICE_TIMEOUT (1)
819 #define MPTFC_FW_IO_PEND_TIMEOUT (1)
820 #define ON_FLAGS (MPI_FCPORTPAGE1_FLAGS_IMMEDIATE_ERROR_REPLY)
821 #define OFF_FLAGS (MPI_FCPORTPAGE1_FLAGS_VERBOSE_RESCAN_EVENTS)
822
823 for (ii=0; ii<ioc->facts.NumberOfPorts; ii++) {
824 if (mptfc_GetFcPortPage1(ioc, ii) != 0)
825 continue;
826 pp1 = ioc->fc_data.fc_port_page1[ii].data;
827 if ((pp1->InitiatorDeviceTimeout == MPTFC_FW_DEVICE_TIMEOUT)
828 && (pp1->InitiatorIoPendTimeout == MPTFC_FW_IO_PEND_TIMEOUT)
829 && ((pp1->Flags & ON_FLAGS) == ON_FLAGS)
830 && ((pp1->Flags & OFF_FLAGS) == 0))
831 continue;
832 pp1->InitiatorDeviceTimeout = MPTFC_FW_DEVICE_TIMEOUT;
833 pp1->InitiatorIoPendTimeout = MPTFC_FW_IO_PEND_TIMEOUT;
834 pp1->Flags &= ~OFF_FLAGS;
835 pp1->Flags |= ON_FLAGS;
836 mptfc_WriteFcPortPage1(ioc, ii);
837 }
838}
839
840
599static void 841static void
600mptfc_init_host_attr(MPT_ADAPTER *ioc,int portnum) 842mptfc_init_host_attr(MPT_ADAPTER *ioc,int portnum)
601{ 843{
@@ -629,6 +871,31 @@ mptfc_init_host_attr(MPT_ADAPTER *ioc,int portnum)
629} 871}
630 872
631static void 873static void
874mptfc_setup_reset(void *arg)
875{
876 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
877 u64 pn;
878 struct mptfc_rport_info *ri;
879
880 /* reset about to happen, delete (block) all rports */
881 list_for_each_entry(ri, &ioc->fc_rports, list) {
882 if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) {
883 ri->flags &= ~MPT_RPORT_INFO_FLAGS_REGISTERED;
884 fc_remote_port_delete(ri->rport); /* won't sleep */
885 ri->rport = NULL;
886
887 pn = (u64)ri->pg0.WWPN.High << 32 |
888 (u64)ri->pg0.WWPN.Low;
889 dfcprintk ((MYIOC_s_INFO_FMT
890 "mptfc_setup_reset.%d: %llx deleted\n",
891 ioc->name,
892 ioc->sh->host_no,
893 (unsigned long long)pn));
894 }
895 }
896}
897
898static void
632mptfc_rescan_devices(void *arg) 899mptfc_rescan_devices(void *arg)
633{ 900{
634 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; 901 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
@@ -651,7 +918,7 @@ mptfc_rescan_devices(void *arg)
651 * will reregister existing rports 918 * will reregister existing rports
652 */ 919 */
653 for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { 920 for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) {
654 (void) mptbase_GetFcPortPage0(ioc, ii); 921 (void) mptfc_GetFcPortPage0(ioc, ii);
655 mptfc_init_host_attr(ioc,ii); /* refresh */ 922 mptfc_init_host_attr(ioc,ii); /* refresh */
656 mptfc_GetFcDevPage0(ioc,ii,mptfc_register_dev); 923 mptfc_GetFcDevPage0(ioc,ii,mptfc_register_dev);
657 } 924 }
@@ -753,7 +1020,9 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
753 goto out_mptfc_probe; 1020 goto out_mptfc_probe;
754 } 1021 }
755 1022
1023 spin_lock_init(&ioc->fc_rescan_work_lock);
756 INIT_WORK(&ioc->fc_rescan_work, mptfc_rescan_devices,(void *)ioc); 1024 INIT_WORK(&ioc->fc_rescan_work, mptfc_rescan_devices,(void *)ioc);
1025 INIT_WORK(&ioc->fc_setup_reset_work, mptfc_setup_reset, (void *)ioc);
757 1026
758 spin_lock_irqsave(&ioc->FreeQlock, flags); 1027 spin_lock_irqsave(&ioc->FreeQlock, flags);
759 1028
@@ -889,6 +1158,15 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
889 goto out_mptfc_probe; 1158 goto out_mptfc_probe;
890 1159
891 /* 1160 /*
1161 * Pre-fetch FC port WWN and stuff...
1162 * (FCPortPage0_t stuff)
1163 */
1164 for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) {
1165 (void) mptfc_GetFcPortPage0(ioc, ii);
1166 }
1167 mptfc_SetFcPortPage1_defaults(ioc);
1168
1169 /*
892 * scan for rports - 1170 * scan for rports -
893 * by doing it via the workqueue, some locking is eliminated 1171 * by doing it via the workqueue, some locking is eliminated
894 */ 1172 */
@@ -917,6 +1195,81 @@ static struct pci_driver mptfc_driver = {
917#endif 1195#endif
918}; 1196};
919 1197
1198static int
1199mptfc_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
1200{
1201 MPT_SCSI_HOST *hd;
1202 u8 event = le32_to_cpu(pEvReply->Event) & 0xFF;
1203 unsigned long flags;
1204 int rc=1;
1205
1206 devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
1207 ioc->name, event));
1208
1209 if (ioc->sh == NULL ||
1210 ((hd = (MPT_SCSI_HOST *)ioc->sh->hostdata) == NULL))
1211 return 1;
1212
1213 switch (event) {
1214 case MPI_EVENT_RESCAN:
1215 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
1216 if (ioc->fc_rescan_work_q) {
1217 if (ioc->fc_rescan_work_count++ == 0) {
1218 queue_work(ioc->fc_rescan_work_q,
1219 &ioc->fc_rescan_work);
1220 }
1221 }
1222 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
1223 break;
1224 default:
1225 rc = mptscsih_event_process(ioc,pEvReply);
1226 break;
1227 }
1228 return rc;
1229}
1230
1231static int
1232mptfc_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
1233{
1234 int rc;
1235 unsigned long flags;
1236
1237 rc = mptscsih_ioc_reset(ioc,reset_phase);
1238 if (rc == 0)
1239 return rc;
1240
1241
1242 dtmprintk((KERN_WARNING MYNAM
1243 ": IOC %s_reset routed to FC host driver!\n",
1244 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
1245 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
1246
1247 if (reset_phase == MPT_IOC_SETUP_RESET) {
1248 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
1249 if (ioc->fc_rescan_work_q) {
1250 queue_work(ioc->fc_rescan_work_q,
1251 &ioc->fc_setup_reset_work);
1252 }
1253 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
1254 }
1255
1256 else if (reset_phase == MPT_IOC_PRE_RESET) {
1257 }
1258
1259 else { /* MPT_IOC_POST_RESET */
1260 mptfc_SetFcPortPage1_defaults(ioc);
1261 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
1262 if (ioc->fc_rescan_work_q) {
1263 if (ioc->fc_rescan_work_count++ == 0) {
1264 queue_work(ioc->fc_rescan_work_q,
1265 &ioc->fc_rescan_work);
1266 }
1267 }
1268 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
1269 }
1270 return 1;
1271}
1272
920/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1273/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
921/** 1274/**
922 * mptfc_init - Register MPT adapter(s) as SCSI host(s) with 1275 * mptfc_init - Register MPT adapter(s) as SCSI host(s) with
@@ -931,8 +1284,8 @@ mptfc_init(void)
931 1284
932 show_mptmod_ver(my_NAME, my_VERSION); 1285 show_mptmod_ver(my_NAME, my_VERSION);
933 1286
934 /* sanity check module parameter */ 1287 /* sanity check module parameters */
935 if (mptfc_dev_loss_tmo == 0) 1288 if (mptfc_dev_loss_tmo <= 0)
936 mptfc_dev_loss_tmo = MPTFC_DEV_LOSS_TMO; 1289 mptfc_dev_loss_tmo = MPTFC_DEV_LOSS_TMO;
937 1290
938 mptfc_transport_template = 1291 mptfc_transport_template =
@@ -945,12 +1298,12 @@ mptfc_init(void)
945 mptfcTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTFC_DRIVER); 1298 mptfcTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTFC_DRIVER);
946 mptfcInternalCtx = mpt_register(mptscsih_scandv_complete, MPTFC_DRIVER); 1299 mptfcInternalCtx = mpt_register(mptscsih_scandv_complete, MPTFC_DRIVER);
947 1300
948 if (mpt_event_register(mptfcDoneCtx, mptscsih_event_process) == 0) { 1301 if (mpt_event_register(mptfcDoneCtx, mptfc_event_process) == 0) {
949 devtverboseprintk((KERN_INFO MYNAM 1302 devtverboseprintk((KERN_INFO MYNAM
950 ": Registered for IOC event notifications\n")); 1303 ": Registered for IOC event notifications\n"));
951 } 1304 }
952 1305
953 if (mpt_reset_register(mptfcDoneCtx, mptscsih_ioc_reset) == 0) { 1306 if (mpt_reset_register(mptfcDoneCtx, mptfc_ioc_reset) == 0) {
954 dprintk((KERN_INFO MYNAM 1307 dprintk((KERN_INFO MYNAM
955 ": Registered for IOC reset notifications\n")); 1308 ": Registered for IOC reset notifications\n"));
956 } 1309 }
@@ -975,6 +1328,7 @@ mptfc_remove(struct pci_dev *pdev)
975 struct mptfc_rport_info *p, *n; 1328 struct mptfc_rport_info *p, *n;
976 struct workqueue_struct *work_q; 1329 struct workqueue_struct *work_q;
977 unsigned long flags; 1330 unsigned long flags;
1331 int ii;
978 1332
979 /* destroy workqueue */ 1333 /* destroy workqueue */
980 if ((work_q=ioc->fc_rescan_work_q)) { 1334 if ((work_q=ioc->fc_rescan_work_q)) {
@@ -991,6 +1345,16 @@ mptfc_remove(struct pci_dev *pdev)
991 kfree(p); 1345 kfree(p);
992 } 1346 }
993 1347
1348 for (ii=0; ii<ioc->facts.NumberOfPorts; ii++) {
1349 if (ioc->fc_data.fc_port_page1[ii].data) {
1350 pci_free_consistent(ioc->pcidev,
1351 ioc->fc_data.fc_port_page1[ii].pg_sz,
1352 (u8 *) ioc->fc_data.fc_port_page1[ii].data,
1353 ioc->fc_data.fc_port_page1[ii].dma);
1354 ioc->fc_data.fc_port_page1[ii].data = NULL;
1355 }
1356 }
1357
994 mptscsih_remove(pdev); 1358 mptscsih_remove(pdev);
995} 1359}
996 1360
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index af6ec553ff7c..85689ab46cbc 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1378,8 +1378,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
1378 return 0; 1378 return 0;
1379 1379
1380 out_free_port_info: 1380 out_free_port_info:
1381 if (hba) 1381 kfree(hba);
1382 kfree(hba);
1383 out: 1382 out:
1384 return error; 1383 return error;
1385} 1384}
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 84fa271eb8f4..8242b16e3168 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1922,7 +1922,7 @@ mptscsih_tm_wait_for_completion(MPT_SCSI_HOST * hd, ulong timeout )
1922 break; 1922 break;
1923 } 1923 }
1924 spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); 1924 spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
1925 msleep_interruptible(250); 1925 msleep(250);
1926 } while (--loop_count); 1926 } while (--loop_count);
1927 1927
1928 return status; 1928 return status;
@@ -2521,18 +2521,6 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
2521 hd->cmdPtr = NULL; 2521 hd->cmdPtr = NULL;
2522 } 2522 }
2523 2523
2524 /* 7. FC: Rescan for blocked rports which might have returned.
2525 */
2526 if (ioc->bus_type == FC) {
2527 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
2528 if (ioc->fc_rescan_work_q) {
2529 if (ioc->fc_rescan_work_count++ == 0) {
2530 queue_work(ioc->fc_rescan_work_q,
2531 &ioc->fc_rescan_work);
2532 }
2533 }
2534 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
2535 }
2536 dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name)); 2524 dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name));
2537 2525
2538 } 2526 }
@@ -2546,7 +2534,6 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
2546{ 2534{
2547 MPT_SCSI_HOST *hd; 2535 MPT_SCSI_HOST *hd;
2548 u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; 2536 u8 event = le32_to_cpu(pEvReply->Event) & 0xFF;
2549 unsigned long flags;
2550 2537
2551 devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n", 2538 devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
2552 ioc->name, event)); 2539 ioc->name, event));
@@ -2569,14 +2556,6 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
2569 break; 2556 break;
2570 2557
2571 case MPI_EVENT_RESCAN: /* 06 */ 2558 case MPI_EVENT_RESCAN: /* 06 */
2572 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
2573 if (ioc->fc_rescan_work_q) {
2574 if (ioc->fc_rescan_work_count++ == 0) {
2575 queue_work(ioc->fc_rescan_work_q,
2576 &ioc->fc_rescan_work);
2577 }
2578 }
2579 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
2580 break; 2559 break;
2581 2560
2582 /* 2561 /*
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index c08ddac3717d..6ebf38213f9f 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -65,9 +65,7 @@
65#include <scsi/scsi_host.h> 65#include <scsi/scsi_host.h>
66#include <scsi/scsi_device.h> 66#include <scsi/scsi_device.h>
67#include <scsi/scsi_cmnd.h> 67#include <scsi/scsi_cmnd.h>
68#include <scsi/scsi_request.h>
69#include <scsi/sg.h> 68#include <scsi/sg.h>
70#include <scsi/sg_request.h>
71 69
72#define OSM_NAME "scsi-osm" 70#define OSM_NAME "scsi-osm"
73#define OSM_VERSION "1.316" 71#define OSM_VERSION "1.316"
@@ -588,6 +586,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
588 586
589 mptr = &msg->body[0]; 587 mptr = &msg->body[0];
590 588
589#if 0 /* this code can't work */
591#ifdef CONFIG_I2O_EXT_ADAPTEC 590#ifdef CONFIG_I2O_EXT_ADAPTEC
592 if (c->adaptec) { 591 if (c->adaptec) {
593 u32 adpt_flags = 0; 592 u32 adpt_flags = 0;
@@ -625,6 +624,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
625 *mptr++ = cpu_to_le32(adpt_flags | tid); 624 *mptr++ = cpu_to_le32(adpt_flags | tid);
626 } 625 }
627#endif 626#endif
627#endif
628 628
629 msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid); 629 msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid);
630 msg->u.s.icntxt = cpu_to_le32(i2o_scsi_driver.context); 630 msg->u.s.icntxt = cpu_to_le32(i2o_scsi_driver.context);
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index febbdd4e0605..3305c12372a2 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -683,9 +683,10 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
683 c->mem_alloc = 1; 683 c->mem_alloc = 1;
684 sb->current_mem_size = 1 + res->end - res->start; 684 sb->current_mem_size = 1 + res->end - res->start;
685 sb->current_mem_base = res->start; 685 sb->current_mem_base = res->start;
686 osm_info("%s: allocated %ld bytes of PCI memory at " 686 osm_info("%s: allocated %llu bytes of PCI memory at "
687 "0x%08lX.\n", c->name, 687 "0x%016llX.\n", c->name,
688 1 + res->end - res->start, res->start); 688 (unsigned long long)(1 + res->end - res->start),
689 (unsigned long long)res->start);
689 } 690 }
690 } 691 }
691 692
@@ -704,9 +705,10 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
704 c->io_alloc = 1; 705 c->io_alloc = 1;
705 sb->current_io_size = 1 + res->end - res->start; 706 sb->current_io_size = 1 + res->end - res->start;
706 sb->current_mem_base = res->start; 707 sb->current_mem_base = res->start;
707 osm_info("%s: allocated %ld bytes of PCI I/O at 0x%08lX" 708 osm_info("%s: allocated %llu bytes of PCI I/O at "
708 ".\n", c->name, 1 + res->end - res->start, 709 "0x%016llX.\n", c->name,
709 res->start); 710 (unsigned long long)(1 + res->end - res->start),
711 (unsigned long long)res->start);
710 } 712 }
711 } 713 }
712 714
@@ -1239,7 +1241,6 @@ EXPORT_SYMBOL(i2o_cntxt_list_remove);
1239EXPORT_SYMBOL(i2o_cntxt_list_get_ptr); 1241EXPORT_SYMBOL(i2o_cntxt_list_get_ptr);
1240#endif 1242#endif
1241EXPORT_SYMBOL(i2o_msg_get_wait); 1243EXPORT_SYMBOL(i2o_msg_get_wait);
1242EXPORT_SYMBOL(i2o_msg_nop);
1243EXPORT_SYMBOL(i2o_find_iop); 1244EXPORT_SYMBOL(i2o_find_iop);
1244EXPORT_SYMBOL(i2o_iop_find_device); 1245EXPORT_SYMBOL(i2o_iop_find_device);
1245EXPORT_SYMBOL(i2o_event_register); 1246EXPORT_SYMBOL(i2o_event_register);