diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2009-05-29 07:22:37 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-09 18:43:06 -0400 |
commit | 2f187862e579f1f5e883188cab6bd867cb60387f (patch) | |
tree | 85785a2e0e176da653323f1a8cf133f7e9e86ca6 /drivers/message/fusion/mptscsih.c | |
parent | eedf92b99806aeff18dc21c9dfb28999ce374413 (diff) |
[SCSI] mpt fusion: Code Cleanup patch
Resending patch considering Grants G's code review.
Main goal to submit this patch is code cleaup.
1. Better driver debug prints and code indentation.
2. fault_reset_work_lock is not used anywhere. driver is using taskmgmt_lock
instead of fault_reset_work_lock.
3. setting pci_set_drvdata properly.
4. Ingore config request when IOC is in reset state.( ioc_reset_in_progress
is set).
5. Init/clear managment frame proprely.(INITIALIZE_MGMT_STATUS and
CLEAR_MGMT_STATUS)
Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/message/fusion/mptscsih.c')
-rw-r--r-- | drivers/message/fusion/mptscsih.c | 174 |
1 files changed, 62 insertions, 112 deletions
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 477f6f8251e5..6424dcbd5908 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -80,7 +80,6 @@ MODULE_VERSION(my_VERSION); | |||
80 | /* | 80 | /* |
81 | * Other private/forward protos... | 81 | * Other private/forward protos... |
82 | */ | 82 | */ |
83 | static struct scsi_cmnd * mptscsih_get_scsi_lookup(MPT_ADAPTER *ioc, int i); | ||
84 | static struct scsi_cmnd * mptscsih_getclear_scsi_lookup(MPT_ADAPTER *ioc, int i); | 83 | static struct scsi_cmnd * mptscsih_getclear_scsi_lookup(MPT_ADAPTER *ioc, int i); |
85 | static void mptscsih_set_scsi_lookup(MPT_ADAPTER *ioc, int i, struct scsi_cmnd *scmd); | 84 | static void mptscsih_set_scsi_lookup(MPT_ADAPTER *ioc, int i, struct scsi_cmnd *scmd); |
86 | static int SCPNT_TO_LOOKUP_IDX(MPT_ADAPTER *ioc, struct scsi_cmnd *scmd); | 85 | static int SCPNT_TO_LOOKUP_IDX(MPT_ADAPTER *ioc, struct scsi_cmnd *scmd); |
@@ -236,7 +235,8 @@ nextSGEset: | |||
236 | for (ii=0; ii < (numSgeThisFrame-1); ii++) { | 235 | for (ii=0; ii < (numSgeThisFrame-1); ii++) { |
237 | thisxfer = sg_dma_len(sg); | 236 | thisxfer = sg_dma_len(sg); |
238 | if (thisxfer == 0) { | 237 | if (thisxfer == 0) { |
239 | sg = sg_next(sg); /* Get next SG element from the OS */ | 238 | /* Get next SG element from the OS */ |
239 | sg = sg_next(sg); | ||
240 | sg_done++; | 240 | sg_done++; |
241 | continue; | 241 | continue; |
242 | } | 242 | } |
@@ -244,7 +244,8 @@ nextSGEset: | |||
244 | v2 = sg_dma_address(sg); | 244 | v2 = sg_dma_address(sg); |
245 | ioc->add_sge(psge, sgflags | thisxfer, v2); | 245 | ioc->add_sge(psge, sgflags | thisxfer, v2); |
246 | 246 | ||
247 | sg = sg_next(sg); /* Get next SG element from the OS */ | 247 | /* Get next SG element from the OS */ |
248 | sg = sg_next(sg); | ||
248 | psge += ioc->SGE_size; | 249 | psge += ioc->SGE_size; |
249 | sgeOffset += ioc->SGE_size; | 250 | sgeOffset += ioc->SGE_size; |
250 | sg_done++; | 251 | sg_done++; |
@@ -533,14 +534,15 @@ mptscsih_info_scsiio(MPT_ADAPTER *ioc, struct scsi_cmnd *sc, SCSIIOReply_t * pSc | |||
533 | } | 534 | } |
534 | 535 | ||
535 | scsi_print_command(sc); | 536 | scsi_print_command(sc); |
536 | printk(MYIOC_s_DEBUG_FMT "\tfw_channel = %d, fw_id = %d\n", | 537 | printk(MYIOC_s_DEBUG_FMT "\tfw_channel = %d, fw_id = %d, lun = %d\n", |
537 | ioc->name, pScsiReply->Bus, pScsiReply->TargetID); | 538 | ioc->name, pScsiReply->Bus, pScsiReply->TargetID, sc->device->lun); |
538 | printk(MYIOC_s_DEBUG_FMT "\trequest_len = %d, underflow = %d, " | 539 | printk(MYIOC_s_DEBUG_FMT "\trequest_len = %d, underflow = %d, " |
539 | "resid = %d\n", ioc->name, scsi_bufflen(sc), sc->underflow, | 540 | "resid = %d\n", ioc->name, scsi_bufflen(sc), sc->underflow, |
540 | scsi_get_resid(sc)); | 541 | scsi_get_resid(sc)); |
541 | printk(MYIOC_s_DEBUG_FMT "\ttag = %d, transfer_count = %d, " | 542 | printk(MYIOC_s_DEBUG_FMT "\ttag = %d, transfer_count = %d, " |
542 | "sc->result = %08X\n", ioc->name, le16_to_cpu(pScsiReply->TaskTag), | 543 | "sc->result = %08X\n", ioc->name, le16_to_cpu(pScsiReply->TaskTag), |
543 | le32_to_cpu(pScsiReply->TransferCount), sc->result); | 544 | le32_to_cpu(pScsiReply->TransferCount), sc->result); |
545 | |||
544 | printk(MYIOC_s_DEBUG_FMT "\tiocstatus = %s (0x%04x), " | 546 | printk(MYIOC_s_DEBUG_FMT "\tiocstatus = %s (0x%04x), " |
545 | "scsi_status = %s (0x%02x), scsi_state = (0x%02x)\n", | 547 | "scsi_status = %s (0x%02x), scsi_state = (0x%02x)\n", |
546 | ioc->name, desc, ioc_status, desc1, pScsiReply->SCSIStatus, | 548 | ioc->name, desc, ioc_status, desc1, pScsiReply->SCSIStatus, |
@@ -595,16 +597,14 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
595 | req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); | 597 | req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); |
596 | req_idx_MR = (mr != NULL) ? | 598 | req_idx_MR = (mr != NULL) ? |
597 | le16_to_cpu(mr->u.frame.hwhdr.msgctxu.fld.req_idx) : req_idx; | 599 | le16_to_cpu(mr->u.frame.hwhdr.msgctxu.fld.req_idx) : req_idx; |
600 | |||
601 | /* Special case, where already freed message frame is received from | ||
602 | * Firmware. It happens with Resetting IOC. | ||
603 | * Return immediately. Do not care | ||
604 | */ | ||
598 | if ((req_idx != req_idx_MR) || | 605 | if ((req_idx != req_idx_MR) || |
599 | (mf->u.frame.linkage.arg1 == 0xdeadbeaf)) { | 606 | (le32_to_cpu(mf->u.frame.linkage.arg1) == 0xdeadbeaf)) |
600 | printk(MYIOC_s_ERR_FMT "Received a mf that was already freed\n", | ||
601 | ioc->name); | ||
602 | printk (MYIOC_s_ERR_FMT | ||
603 | "req_idx=%x req_idx_MR=%x mf=%p mr=%p sc=%p\n", | ||
604 | ioc->name, req_idx, req_idx_MR, mf, mr, | ||
605 | mptscsih_get_scsi_lookup(ioc, req_idx_MR)); | ||
606 | return 0; | 607 | return 0; |
607 | } | ||
608 | 608 | ||
609 | sc = mptscsih_getclear_scsi_lookup(ioc, req_idx); | 609 | sc = mptscsih_getclear_scsi_lookup(ioc, req_idx); |
610 | if (sc == NULL) { | 610 | if (sc == NULL) { |
@@ -751,12 +751,16 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
751 | */ | 751 | */ |
752 | 752 | ||
753 | case MPI_IOCSTATUS_SCSI_TASK_TERMINATED: /* 0x0048 */ | 753 | case MPI_IOCSTATUS_SCSI_TASK_TERMINATED: /* 0x0048 */ |
754 | case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */ | ||
755 | /* Linux handles an unsolicited DID_RESET better | 754 | /* Linux handles an unsolicited DID_RESET better |
756 | * than an unsolicited DID_ABORT. | 755 | * than an unsolicited DID_ABORT. |
757 | */ | 756 | */ |
758 | sc->result = DID_RESET << 16; | 757 | sc->result = DID_RESET << 16; |
759 | 758 | ||
759 | case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */ | ||
760 | if (ioc->bus_type == FC) | ||
761 | sc->result = DID_ERROR << 16; | ||
762 | else | ||
763 | sc->result = DID_RESET << 16; | ||
760 | break; | 764 | break; |
761 | 765 | ||
762 | case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */ | 766 | case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */ |
@@ -933,9 +937,9 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd) | |||
933 | scsi_dma_unmap(sc); | 937 | scsi_dma_unmap(sc); |
934 | sc->result = DID_RESET << 16; | 938 | sc->result = DID_RESET << 16; |
935 | sc->host_scribble = NULL; | 939 | sc->host_scribble = NULL; |
936 | sdev_printk(KERN_INFO, sc->device, MYIOC_s_FMT | 940 | dtmprintk(ioc, sdev_printk(KERN_INFO, sc->device, MYIOC_s_FMT |
937 | "completing cmds: fw_channel %d, fw_id %d, sc=%p," | 941 | "completing cmds: fw_channel %d, fw_id %d, sc=%p, mf = %p, " |
938 | " mf = %p, idx=%x\n", ioc->name, channel, id, sc, mf, ii); | 942 | "idx=%x\n", ioc->name, channel, id, sc, mf, ii)); |
939 | sc->scsi_done(sc); | 943 | sc->scsi_done(sc); |
940 | } | 944 | } |
941 | } | 945 | } |
@@ -994,9 +998,11 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice) | |||
994 | scsi_dma_unmap(sc); | 998 | scsi_dma_unmap(sc); |
995 | sc->host_scribble = NULL; | 999 | sc->host_scribble = NULL; |
996 | sc->result = DID_NO_CONNECT << 16; | 1000 | sc->result = DID_NO_CONNECT << 16; |
997 | sdev_printk(KERN_INFO, sc->device, MYIOC_s_FMT "completing cmds: fw_channel %d," | 1001 | dtmprintk(ioc, sdev_printk(KERN_INFO, sc->device, |
998 | "fw_id %d, sc=%p, mf = %p, idx=%x\n", ioc->name, vdevice->vtarget->channel, | 1002 | MYIOC_s_FMT "completing cmds: fw_channel %d, " |
999 | vdevice->vtarget->id, sc, mf, ii); | 1003 | "fw_id %d, sc=%p, mf = %p, idx=%x\n", ioc->name, |
1004 | vdevice->vtarget->channel, vdevice->vtarget->id, | ||
1005 | sc, mf, ii)); | ||
1000 | sc->scsi_done(sc); | 1006 | sc->scsi_done(sc); |
1001 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | 1007 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); |
1002 | } | 1008 | } |
@@ -1287,7 +1293,6 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
1287 | MPT_FRAME_HDR *mf; | 1293 | MPT_FRAME_HDR *mf; |
1288 | SCSIIORequest_t *pScsiReq; | 1294 | SCSIIORequest_t *pScsiReq; |
1289 | VirtDevice *vdevice = SCpnt->device->hostdata; | 1295 | VirtDevice *vdevice = SCpnt->device->hostdata; |
1290 | int lun; | ||
1291 | u32 datalen; | 1296 | u32 datalen; |
1292 | u32 scsictl; | 1297 | u32 scsictl; |
1293 | u32 scsidir; | 1298 | u32 scsidir; |
@@ -1298,7 +1303,6 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
1298 | 1303 | ||
1299 | hd = shost_priv(SCpnt->device->host); | 1304 | hd = shost_priv(SCpnt->device->host); |
1300 | ioc = hd->ioc; | 1305 | ioc = hd->ioc; |
1301 | lun = SCpnt->device->lun; | ||
1302 | SCpnt->scsi_done = done; | 1306 | SCpnt->scsi_done = done; |
1303 | 1307 | ||
1304 | dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "qcmd: SCpnt=%p, done()=%p\n", | 1308 | dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "qcmd: SCpnt=%p, done()=%p\n", |
@@ -1709,8 +1713,8 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) | |||
1709 | goto out; | 1713 | goto out; |
1710 | } | 1714 | } |
1711 | 1715 | ||
1712 | if (hd->timeouts < -1) | 1716 | if (ioc->timeouts < -1) |
1713 | hd->timeouts++; | 1717 | ioc->timeouts++; |
1714 | 1718 | ||
1715 | if (mpt_fwfault_debug) | 1719 | if (mpt_fwfault_debug) |
1716 | mpt_halt_firmware(ioc); | 1720 | mpt_halt_firmware(ioc); |
@@ -1734,17 +1738,23 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) | |||
1734 | ctx2abort, mptscsih_get_tm_timeout(ioc)); | 1738 | ctx2abort, mptscsih_get_tm_timeout(ioc)); |
1735 | 1739 | ||
1736 | if (SCPNT_TO_LOOKUP_IDX(ioc, SCpnt) == scpnt_idx && | 1740 | if (SCPNT_TO_LOOKUP_IDX(ioc, SCpnt) == scpnt_idx && |
1737 | SCpnt->serial_number == sn) | 1741 | SCpnt->serial_number == sn) { |
1742 | dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT | ||
1743 | "task abort: command still in active list! (sc=%p)\n", | ||
1744 | ioc->name, SCpnt)); | ||
1738 | retval = FAILED; | 1745 | retval = FAILED; |
1746 | } else { | ||
1747 | dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT | ||
1748 | "task abort: command cleared from active list! (sc=%p)\n", | ||
1749 | ioc->name, SCpnt)); | ||
1750 | retval = SUCCESS; | ||
1751 | } | ||
1739 | 1752 | ||
1740 | out: | 1753 | out: |
1741 | printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n", | 1754 | printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n", |
1742 | ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); | 1755 | ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), SCpnt); |
1743 | 1756 | ||
1744 | if (retval == 0) | 1757 | return retval; |
1745 | return SUCCESS; | ||
1746 | else | ||
1747 | return FAILED; | ||
1748 | } | 1758 | } |
1749 | 1759 | ||
1750 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1760 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -1779,7 +1789,7 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt) | |||
1779 | 1789 | ||
1780 | vdevice = SCpnt->device->hostdata; | 1790 | vdevice = SCpnt->device->hostdata; |
1781 | if (!vdevice || !vdevice->vtarget) { | 1791 | if (!vdevice || !vdevice->vtarget) { |
1782 | retval = 0; | 1792 | retval = SUCCESS; |
1783 | goto out; | 1793 | goto out; |
1784 | } | 1794 | } |
1785 | 1795 | ||
@@ -1837,10 +1847,12 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt) | |||
1837 | ioc->name, SCpnt); | 1847 | ioc->name, SCpnt); |
1838 | scsi_print_command(SCpnt); | 1848 | scsi_print_command(SCpnt); |
1839 | 1849 | ||
1840 | if (hd->timeouts < -1) | 1850 | if (ioc->timeouts < -1) |
1841 | hd->timeouts++; | 1851 | ioc->timeouts++; |
1842 | 1852 | ||
1843 | vdevice = SCpnt->device->hostdata; | 1853 | vdevice = SCpnt->device->hostdata; |
1854 | if (!vdevice || !vdevice->vtarget) | ||
1855 | return SUCCESS; | ||
1844 | retval = mptscsih_IssueTaskMgmt(hd, | 1856 | retval = mptscsih_IssueTaskMgmt(hd, |
1845 | MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, | 1857 | MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, |
1846 | vdevice->vtarget->channel, 0, 0, 0, | 1858 | vdevice->vtarget->channel, 0, 0, 0, |
@@ -1868,8 +1880,9 @@ int | |||
1868 | mptscsih_host_reset(struct scsi_cmnd *SCpnt) | 1880 | mptscsih_host_reset(struct scsi_cmnd *SCpnt) |
1869 | { | 1881 | { |
1870 | MPT_SCSI_HOST * hd; | 1882 | MPT_SCSI_HOST * hd; |
1871 | int retval; | 1883 | int status = SUCCESS; |
1872 | MPT_ADAPTER *ioc; | 1884 | MPT_ADAPTER *ioc; |
1885 | int retval; | ||
1873 | 1886 | ||
1874 | /* If we can't locate the host to reset, then we failed. */ | 1887 | /* If we can't locate the host to reset, then we failed. */ |
1875 | if ((hd = shost_priv(SCpnt->device->host)) == NULL){ | 1888 | if ((hd = shost_priv(SCpnt->device->host)) == NULL){ |
@@ -1888,19 +1901,16 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt) | |||
1888 | /* If our attempts to reset the host failed, then return a failed | 1901 | /* If our attempts to reset the host failed, then return a failed |
1889 | * status. The host will be taken off line by the SCSI mid-layer. | 1902 | * status. The host will be taken off line by the SCSI mid-layer. |
1890 | */ | 1903 | */ |
1891 | if (mpt_HardResetHandler(ioc, CAN_SLEEP) < 0) { | 1904 | retval = mpt_HardResetHandler(ioc, CAN_SLEEP); |
1892 | retval = FAILED; | 1905 | if (retval < 0) |
1893 | } else { | 1906 | status = FAILED; |
1894 | /* Make sure TM pending is cleared and TM state is set to | 1907 | else |
1895 | * NONE. | 1908 | status = SUCCESS; |
1896 | */ | ||
1897 | retval = 0; | ||
1898 | } | ||
1899 | 1909 | ||
1900 | printk(MYIOC_s_INFO_FMT "host reset: %s (sc=%p)\n", | 1910 | printk(MYIOC_s_INFO_FMT "host reset: %s (sc=%p)\n", |
1901 | ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); | 1911 | ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); |
1902 | 1912 | ||
1903 | return retval; | 1913 | return status; |
1904 | } | 1914 | } |
1905 | 1915 | ||
1906 | static int | 1916 | static int |
@@ -2244,7 +2254,6 @@ mptscsih_slave_configure(struct scsi_device *sdev) | |||
2244 | sdev->ppr, sdev->inquiry_len)); | 2254 | sdev->ppr, sdev->inquiry_len)); |
2245 | 2255 | ||
2246 | vdevice->configured_lun = 1; | 2256 | vdevice->configured_lun = 1; |
2247 | mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH); | ||
2248 | 2257 | ||
2249 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT | 2258 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
2250 | "Queue depth=%d, tflags=%x\n", | 2259 | "Queue depth=%d, tflags=%x\n", |
@@ -2256,6 +2265,7 @@ mptscsih_slave_configure(struct scsi_device *sdev) | |||
2256 | ioc->name, vtarget->negoFlags, vtarget->maxOffset, | 2265 | ioc->name, vtarget->negoFlags, vtarget->maxOffset, |
2257 | vtarget->minSyncFactor)); | 2266 | vtarget->minSyncFactor)); |
2258 | 2267 | ||
2268 | mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH); | ||
2259 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT | 2269 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
2260 | "tagged %d, simple %d, ordered %d\n", | 2270 | "tagged %d, simple %d, ordered %d\n", |
2261 | ioc->name,sdev->tagged_supported, sdev->simple_tags, | 2271 | ioc->name,sdev->tagged_supported, sdev->simple_tags, |
@@ -2328,36 +2338,17 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR | |||
2328 | } | 2338 | } |
2329 | } | 2339 | } |
2330 | 2340 | ||
2331 | /** | ||
2332 | * mptscsih_get_scsi_lookup | ||
2333 | * @ioc: Pointer to MPT_ADAPTER structure | ||
2334 | * @i: index into the array | ||
2335 | * | ||
2336 | * retrieves scmd entry from ScsiLookup[] array list | ||
2337 | * | ||
2338 | * Returns the scsi_cmd pointer | ||
2339 | **/ | ||
2340 | static struct scsi_cmnd * | ||
2341 | mptscsih_get_scsi_lookup(MPT_ADAPTER *ioc, int i) | ||
2342 | { | ||
2343 | unsigned long flags; | ||
2344 | struct scsi_cmnd *scmd; | ||
2345 | |||
2346 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | ||
2347 | scmd = ioc->ScsiLookup[i]; | ||
2348 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); | ||
2349 | |||
2350 | return scmd; | ||
2351 | } | ||
2352 | 2341 | ||
2353 | /** | 2342 | /** |
2354 | * mptscsih_getclear_scsi_lookup | 2343 | * mptscsih_getclear_scsi_lookup |
2355 | * @ioc: Pointer to MPT_ADAPTER structure | ||
2356 | * @i: index into the array | ||
2357 | * | 2344 | * |
2358 | * retrieves and clears scmd entry from ScsiLookup[] array list | 2345 | * retrieves and clears scmd entry from ScsiLookup[] array list |
2359 | * | 2346 | * |
2347 | * @ioc: Pointer to MPT_ADAPTER structure | ||
2348 | * @i: index into the array | ||
2349 | * | ||
2360 | * Returns the scsi_cmd pointer | 2350 | * Returns the scsi_cmd pointer |
2351 | * | ||
2361 | **/ | 2352 | **/ |
2362 | static struct scsi_cmnd * | 2353 | static struct scsi_cmnd * |
2363 | mptscsih_getclear_scsi_lookup(MPT_ADAPTER *ioc, int i) | 2354 | mptscsih_getclear_scsi_lookup(MPT_ADAPTER *ioc, int i) |
@@ -2456,57 +2447,16 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
2456 | int | 2447 | int |
2457 | mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | 2448 | mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) |
2458 | { | 2449 | { |
2459 | MPT_SCSI_HOST *hd; | ||
2460 | u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; | 2450 | u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; |
2461 | 2451 | ||
2462 | devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT | 2452 | devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
2463 | "MPT event (=%02Xh) routed to SCSI host driver!\n", | 2453 | "MPT event (=%02Xh) routed to SCSI host driver!\n", |
2464 | ioc->name, event)); | 2454 | ioc->name, event)); |
2465 | 2455 | ||
2466 | if (ioc->sh == NULL || | 2456 | if ((event == MPI_EVENT_IOC_BUS_RESET || |
2467 | ((hd = shost_priv(ioc->sh)) == NULL)) | 2457 | event == MPI_EVENT_EXT_BUS_RESET) && |
2468 | return 1; | 2458 | (ioc->bus_type == SPI) && (ioc->soft_resets < -1)) |
2469 | 2459 | ioc->soft_resets++; | |
2470 | switch (event) { | ||
2471 | case MPI_EVENT_UNIT_ATTENTION: /* 03 */ | ||
2472 | /* FIXME! */ | ||
2473 | break; | ||
2474 | case MPI_EVENT_IOC_BUS_RESET: /* 04 */ | ||
2475 | case MPI_EVENT_EXT_BUS_RESET: /* 05 */ | ||
2476 | if (hd && (ioc->bus_type == SPI) && (hd->soft_resets < -1)) | ||
2477 | hd->soft_resets++; | ||
2478 | break; | ||
2479 | case MPI_EVENT_LOGOUT: /* 09 */ | ||
2480 | /* FIXME! */ | ||
2481 | break; | ||
2482 | |||
2483 | case MPI_EVENT_RESCAN: /* 06 */ | ||
2484 | break; | ||
2485 | |||
2486 | /* | ||
2487 | * CHECKME! Don't think we need to do | ||
2488 | * anything for these, but... | ||
2489 | */ | ||
2490 | case MPI_EVENT_LINK_STATUS_CHANGE: /* 07 */ | ||
2491 | case MPI_EVENT_LOOP_STATE_CHANGE: /* 08 */ | ||
2492 | /* | ||
2493 | * CHECKME! Falling thru... | ||
2494 | */ | ||
2495 | break; | ||
2496 | |||
2497 | case MPI_EVENT_INTEGRATED_RAID: /* 0B */ | ||
2498 | break; | ||
2499 | |||
2500 | case MPI_EVENT_NONE: /* 00 */ | ||
2501 | case MPI_EVENT_LOG_DATA: /* 01 */ | ||
2502 | case MPI_EVENT_STATE_CHANGE: /* 02 */ | ||
2503 | case MPI_EVENT_EVENT_CHANGE: /* 0A */ | ||
2504 | default: | ||
2505 | dprintk(ioc, printk(MYIOC_s_DEBUG_FMT | ||
2506 | ": Ignoring event (=%02Xh)\n", | ||
2507 | ioc->name, event)); | ||
2508 | break; | ||
2509 | } | ||
2510 | 2460 | ||
2511 | return 1; /* currently means nothing really */ | 2461 | return 1; /* currently means nothing really */ |
2512 | } | 2462 | } |