aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptbase.c
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2009-08-05 03:23:51 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-08-22 18:52:26 -0400
commitd130691725e9c4a098a59fc64f5ac3dcb1e2aa3b (patch)
tree6cbf774947b1521609434d0f28ba5c46de14f87c /drivers/message/fusion/mptbase.c
parent79a3ec1ace2329d115ecd2445379b46aed3286b0 (diff)
[SCSI] mptsas : Code cleanup of host page alloc and diag reset.
Code cleanup of host page alloc and diag reset. Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/message/fusion/mptbase.c')
-rw-r--r--drivers/message/fusion/mptbase.c84
1 files changed, 30 insertions, 54 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 5d0ba4f5924c..8ab7b37ed70d 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1297,12 +1297,8 @@ mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init)
1297 psge = (char *)&ioc_init->HostPageBufferSGE; 1297 psge = (char *)&ioc_init->HostPageBufferSGE;
1298 flags_length = MPI_SGE_FLAGS_SIMPLE_ELEMENT | 1298 flags_length = MPI_SGE_FLAGS_SIMPLE_ELEMENT |
1299 MPI_SGE_FLAGS_SYSTEM_ADDRESS | 1299 MPI_SGE_FLAGS_SYSTEM_ADDRESS |
1300 MPI_SGE_FLAGS_32_BIT_ADDRESSING |
1301 MPI_SGE_FLAGS_HOST_TO_IOC | 1300 MPI_SGE_FLAGS_HOST_TO_IOC |
1302 MPI_SGE_FLAGS_END_OF_BUFFER; 1301 MPI_SGE_FLAGS_END_OF_BUFFER;
1303 if (sizeof(dma_addr_t) == sizeof(u64)) {
1304 flags_length |= MPI_SGE_FLAGS_64_BIT_ADDRESSING;
1305 }
1306 flags_length = flags_length << MPI_SGE_FLAGS_SHIFT; 1302 flags_length = flags_length << MPI_SGE_FLAGS_SHIFT;
1307 flags_length |= ioc->HostPageBuffer_sz; 1303 flags_length |= ioc->HostPageBuffer_sz;
1308 ioc->add_sge(psge, flags_length, ioc->HostPageBuffer_dma); 1304 ioc->add_sge(psge, flags_length, ioc->HostPageBuffer_dma);
@@ -2224,8 +2220,6 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
2224 int hard; 2220 int hard;
2225 int rc=0; 2221 int rc=0;
2226 int ii; 2222 int ii;
2227 u8 cb_idx;
2228 int handlers;
2229 int ret = 0; 2223 int ret = 0;
2230 int reset_alt_ioc_active = 0; 2224 int reset_alt_ioc_active = 0;
2231 int irq_allocated = 0; 2225 int irq_allocated = 0;
@@ -2548,34 +2542,6 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
2548 mpt_get_manufacturing_pg_0(ioc); 2542 mpt_get_manufacturing_pg_0(ioc);
2549 } 2543 }
2550 2544
2551 /*
2552 * Call each currently registered protocol IOC reset handler
2553 * with post-reset indication.
2554 * NOTE: If we're doing _IOC_BRINGUP, there can be no
2555 * MptResetHandlers[] registered yet.
2556 */
2557 if (hard_reset_done) {
2558 rc = handlers = 0;
2559 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
2560 if ((ret == 0) && MptResetHandlers[cb_idx]) {
2561 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2562 "Calling IOC post_reset handler #%d\n",
2563 ioc->name, cb_idx));
2564 rc += mpt_signal_reset(cb_idx, ioc, MPT_IOC_POST_RESET);
2565 handlers++;
2566 }
2567
2568 if (alt_ioc_ready && MptResetHandlers[cb_idx]) {
2569 drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2570 "Calling IOC post_reset handler #%d\n",
2571 ioc->alt_ioc->name, cb_idx));
2572 rc += mpt_signal_reset(cb_idx, ioc->alt_ioc, MPT_IOC_POST_RESET);
2573 handlers++;
2574 }
2575 }
2576 /* FIXME? Examine results here? */
2577 }
2578
2579 out: 2545 out:
2580 if ((ret != 0) && irq_allocated) { 2546 if ((ret != 0) && irq_allocated) {
2581 free_irq(ioc->pci_irq, ioc); 2547 free_irq(ioc->pci_irq, ioc);
@@ -3938,6 +3904,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3938 int count = 0; 3904 int count = 0;
3939 u32 diag1val = 0; 3905 u32 diag1val = 0;
3940 MpiFwHeader_t *cached_fw; /* Pointer to FW */ 3906 MpiFwHeader_t *cached_fw; /* Pointer to FW */
3907 u8 cb_idx;
3941 3908
3942 /* Clear any existing interrupts */ 3909 /* Clear any existing interrupts */
3943 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); 3910 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
@@ -3956,6 +3923,18 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3956 else 3923 else
3957 mdelay(1); 3924 mdelay(1);
3958 3925
3926 /*
3927 * Call each currently registered protocol IOC reset handler
3928 * with pre-reset indication.
3929 * NOTE: If we're doing _IOC_BRINGUP, there can be no
3930 * MptResetHandlers[] registered yet.
3931 */
3932 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
3933 if (MptResetHandlers[cb_idx])
3934 (*(MptResetHandlers[cb_idx]))(ioc,
3935 MPT_IOC_PRE_RESET);
3936 }
3937
3959 for (count = 0; count < 60; count ++) { 3938 for (count = 0; count < 60; count ++) {
3960 doorbell = CHIPREG_READ32(&ioc->chip->Doorbell); 3939 doorbell = CHIPREG_READ32(&ioc->chip->Doorbell);
3961 doorbell &= MPI_IOC_STATE_MASK; 3940 doorbell &= MPI_IOC_STATE_MASK;
@@ -4052,25 +4031,15 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
4052 * NOTE: If we're doing _IOC_BRINGUP, there can be no 4031 * NOTE: If we're doing _IOC_BRINGUP, there can be no
4053 * MptResetHandlers[] registered yet. 4032 * MptResetHandlers[] registered yet.
4054 */ 4033 */
4055 { 4034 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
4056 u8 cb_idx; 4035 if (MptResetHandlers[cb_idx]) {
4057 int r = 0; 4036 mpt_signal_reset(cb_idx,
4058 4037 ioc, MPT_IOC_PRE_RESET);
4059 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { 4038 if (ioc->alt_ioc) {
4060 if (MptResetHandlers[cb_idx]) { 4039 mpt_signal_reset(cb_idx,
4061 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT 4040 ioc->alt_ioc, MPT_IOC_PRE_RESET);
4062 "Calling IOC pre_reset handler #%d\n",
4063 ioc->name, cb_idx));
4064 r += mpt_signal_reset(cb_idx, ioc, MPT_IOC_PRE_RESET);
4065 if (ioc->alt_ioc) {
4066 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
4067 "Calling alt-%s pre_reset handler #%d\n",
4068 ioc->name, ioc->alt_ioc->name, cb_idx));
4069 r += mpt_signal_reset(cb_idx, ioc->alt_ioc, MPT_IOC_PRE_RESET);
4070 }
4071 } 4041 }
4072 } 4042 }
4073 /* FIXME? Examine results here? */
4074 } 4043 }
4075 4044
4076 if (ioc->cached_fw) 4045 if (ioc->cached_fw)
@@ -6956,7 +6925,7 @@ EXPORT_SYMBOL(mpt_halt_firmware);
6956int 6925int
6957mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag) 6926mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6958{ 6927{
6959 int rc; 6928 int rc;
6960 u8 cb_idx; 6929 u8 cb_idx;
6961 unsigned long flags; 6930 unsigned long flags;
6962 unsigned long time_count; 6931 unsigned long time_count;
@@ -6982,8 +6951,6 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6982 ioc->alt_ioc->ioc_reset_in_progress = 1; 6951 ioc->alt_ioc->ioc_reset_in_progress = 1;
6983 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); 6952 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6984 6953
6985 /* FIXME: If do_ioc_recovery fails, repeat....
6986 */
6987 6954
6988 /* The SCSI driver needs to adjust timeouts on all current 6955 /* The SCSI driver needs to adjust timeouts on all current
6989 * commands prior to the diagnostic reset being issued. 6956 * commands prior to the diagnostic reset being issued.
@@ -7020,6 +6987,15 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7020 } 6987 }
7021 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); 6988 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7022 6989
6990 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
6991 if (MptResetHandlers[cb_idx]) {
6992 mpt_signal_reset(cb_idx, ioc, MPT_IOC_POST_RESET);
6993 if (ioc->alt_ioc)
6994 mpt_signal_reset(cb_idx,
6995 ioc->alt_ioc, MPT_IOC_POST_RESET);
6996 }
6997 }
6998
7023 dtmprintk(ioc, 6999 dtmprintk(ioc,
7024 printk(MYIOC_s_DEBUG_FMT 7000 printk(MYIOC_s_DEBUG_FMT
7025 "HardResetHandler: completed (%d seconds): %s\n", ioc->name, 7001 "HardResetHandler: completed (%d seconds): %s\n", ioc->name,