Commit 67122b7d authored by James Bottomley's avatar James Bottomley

[PATCH] MPT Fusion driver 2.05.00.05 update

From: 	Moore, Eric Dean <emoore@lsil.com>

2.05.00.05 changes
* error handling fixes, e.g. use of host_lock 

2.05.00.04 changes
* removed __init from mptscsih_setup
* removed __init from get_setup_token
* changed copyright from 2002 to 2003
* added new mailto, and removed Pam.Delaney
* added some fix for 32bit emulation when unloading mptctl module
parent a20480b8
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
* Error Report logging output. This module implements SCSI-3 * Error Report logging output. This module implements SCSI-3
* Opcode lookup and a sorted table of SCSI-3 ASC/ASCQ strings. * Opcode lookup and a sorted table of SCSI-3 ASC/ASCQ strings.
* *
* Copyright (c) 1991-2002 Steven J. Ralston * Copyright (c) 1991-2003 Steven J. Ralston
* Written By: Steven J. Ralston * Written By: Steven J. Ralston
* (yes I wrote some of the orig. code back in 1991!) * (yes I wrote some of the orig. code back in 1991!)
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: isense.c,v 1.33 2002/02/27 18:44:19 sralston Exp $ * $Id: isense.c,v 1.33 2002/02/27 18:44:19 sralston Exp $
*/ */
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
#endif #endif
#define MODULEAUTHOR "Steven J. Ralston" #define MODULEAUTHOR "Steven J. Ralston"
#define COPYRIGHT "Copyright (c) 2001-2002 " MODULEAUTHOR #define COPYRIGHT "Copyright (c) 2001-2003 " MODULEAUTHOR
#include "mptbase.h" #include "mptbase.h"
#include "isense.h" #include "isense.h"
......
...@@ -44,10 +44,10 @@ ...@@ -44,10 +44,10 @@
* for gobs of hard work fixing and optimizing LAN code. * for gobs of hard work fixing and optimizing LAN code.
* THANK YOU! * THANK YOU!
* *
* Copyright (c) 1999-2002 LSI Logic Corporation * Copyright (c) 1999-2003 LSI Logic Corporation
* Originally By: Steven J. Ralston * Originally By: Steven J. Ralston
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: mptbase.c,v 1.126 2002/12/16 15:28:45 pdelaney Exp $ * $Id: mptbase.c,v 1.126 2002/12/16 15:28:45 pdelaney Exp $
*/ */
...@@ -3138,7 +3138,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag) ...@@ -3138,7 +3138,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
{ {
int hard_reset_done = 0; int hard_reset_done = 0;
u32 ioc_state; u32 ioc_state;
int cnt = 0; int cntdn, cnt = 0;
dprintk((KERN_WARNING MYNAM ": KickStarting %s!\n", ioc->name)); dprintk((KERN_WARNING MYNAM ": KickStarting %s!\n", ioc->name));
if ((int)ioc->chip_type > (int)FC929) { if ((int)ioc->chip_type > (int)FC929) {
...@@ -3161,7 +3161,8 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag) ...@@ -3161,7 +3161,8 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
dprintk((MYIOC_s_INFO_FMT "Diagnostic reset successful!\n", dprintk((MYIOC_s_INFO_FMT "Diagnostic reset successful!\n",
ioc->name)); ioc->name));
for (cnt=0; cnt<HZ*20; cnt++) { cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 20; /* 20 seconds */
for (cnt=0; cnt<cntdn; cnt++) {
if ((ioc_state = mpt_GetIocState(ioc, 1)) == MPI_IOC_STATE_READY) { if ((ioc_state = mpt_GetIocState(ioc, 1)) == MPI_IOC_STATE_READY) {
dprintk((MYIOC_s_INFO_FMT "KickStart successful! (cnt=%d)\n", dprintk((MYIOC_s_INFO_FMT "KickStart successful! (cnt=%d)\n",
ioc->name, cnt)); ioc->name, cnt));
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
* Credits: * Credits:
* (see mptbase.c) * (see mptbase.c)
* *
* Copyright (c) 1999-2002 LSI Logic Corporation * Copyright (c) 1999-2003 LSI Logic Corporation
* Originally By: Steven J. Ralston * Originally By: Steven J. Ralston
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: mptbase.h,v 1.144 2003/01/28 21:31:56 pdelaney Exp $ * $Id: mptbase.h,v 1.144 2003/01/28 21:31:56 pdelaney Exp $
*/ */
...@@ -77,11 +77,11 @@ ...@@ -77,11 +77,11 @@
#endif #endif
#ifndef COPYRIGHT #ifndef COPYRIGHT
#define COPYRIGHT "Copyright (c) 1999-2002 " MODULEAUTHOR #define COPYRIGHT "Copyright (c) 1999-2003 " MODULEAUTHOR
#endif #endif
#define MPT_LINUX_VERSION_COMMON "2.05.00.03" #define MPT_LINUX_VERSION_COMMON "2.05.00.05"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-2.05.00.03" #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-2.05.00.05"
#define WHAT_MAGIC_STRING "@" "(" "#" ")" #define WHAT_MAGIC_STRING "@" "(" "#" ")"
#define show_mptmod_ver(s,ver) \ #define show_mptmod_ver(s,ver) \
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
* *
* (see also mptbase.c) * (see also mptbase.c)
* *
* Copyright (c) 1999-2002 LSI Logic Corporation * Copyright (c) 1999-2003 LSI Logic Corporation
* Originally By: Steven J. Ralston, Noah Romer * Originally By: Steven J. Ralston, Noah Romer
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: mptctl.c,v 1.63 2002/12/03 21:26:33 pdelaney Exp $ * $Id: mptctl.c,v 1.63 2002/12/03 21:26:33 pdelaney Exp $
*/ */
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
#include "../../scsi/scsi.h" #include "../../scsi/scsi.h"
#include "../../scsi/hosts.h" #include "../../scsi/hosts.h"
#define COPYRIGHT "Copyright (c) 1999-2001 LSI Logic Corporation" #define COPYRIGHT "Copyright (c) 1999-2003 LSI Logic Corporation"
#define MODULEAUTHOR "Steven J. Ralston, Noah Romer, Pamela Delaney" #define MODULEAUTHOR "Steven J. Ralston, Noah Romer, Pamela Delaney"
#include "mptbase.h" #include "mptbase.h"
#include "mptctl.h" #include "mptctl.h"
...@@ -2985,6 +2985,21 @@ void mptctl_exit(void) ...@@ -2985,6 +2985,21 @@ void mptctl_exit(void)
mpt_deregister(mptctl_id); mpt_deregister(mptctl_id);
printk(KERN_INFO MYNAM ": Deregistered from Fusion MPT base driver\n"); printk(KERN_INFO MYNAM ": Deregistered from Fusion MPT base driver\n");
#ifdef CONFIG_COMPAT
unregister_ioctl32_conversion(MPTIOCINFO);
unregister_ioctl32_conversion(MPTIOCINFO1);
unregister_ioctl32_conversion(MPTTARGETINFO);
unregister_ioctl32_conversion(MPTTEST);
unregister_ioctl32_conversion(MPTEVENTQUERY);
unregister_ioctl32_conversion(MPTEVENTENABLE);
unregister_ioctl32_conversion(MPTEVENTREPORT);
unregister_ioctl32_conversion(MPTHARDRESET);
unregister_ioctl32_conversion(MPTCOMMAND32);
unregister_ioctl32_conversion(MPTFWDOWNLOAD32);
unregister_ioctl32_conversion(HP_GETHOSTINFO);
unregister_ioctl32_conversion(HP_GETTARGETINFO);
#endif
/* Free allocated memory */ /* Free allocated memory */
for (i=0; i<MPT_MAX_ADAPTERS; i++) { for (i=0; i<MPT_MAX_ADAPTERS; i++) {
ioc = NULL; ioc = NULL;
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
* *
* (see also mptbase.c) * (see also mptbase.c)
* *
* Copyright (c) 1999-2002 LSI Logic Corporation * Copyright (c) 1999-2003 LSI Logic Corporation
* Originally By: Steven J. Ralston * Originally By: Steven J. Ralston
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: mptctl.h,v 1.13 2002/12/03 21:26:33 pdelaney Exp $ * $Id: mptctl.h,v 1.13 2002/12/03 21:26:33 pdelaney Exp $
*/ */
......
...@@ -23,8 +23,9 @@ ...@@ -23,8 +23,9 @@
* *
* (see also mptbase.c) * (see also mptbase.c)
* *
* Copyright (c) 2000-2002 LSI Logic Corporation * Copyright (c) 2000-2003 LSI Logic Corporation
* Originally By: Noah Romer * Originally By: Noah Romer
* (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: mptlan.c,v 1.53 2002/10/17 20:15:58 pdelaney Exp $ * $Id: mptlan.c,v 1.53 2002/10/17 20:15:58 pdelaney Exp $
*/ */
......
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
* *
* (see mptbase.c) * (see mptbase.c)
* *
* Copyright (c) 1999-2002 LSI Logic Corporation * Copyright (c) 1999-2003 LSI Logic Corporation
* Original author: Steven J. Ralston * Original author: Steven J. Ralston
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: mptscsih.c,v 1.104 2002/12/03 21:26:34 pdelaney Exp $ * $Id: mptscsih.c,v 1.104 2002/12/03 21:26:34 pdelaney Exp $
*/ */
...@@ -178,9 +178,12 @@ static int mptscsih_writeSDP1(MPT_SCSI_HOST *hd, int portnum, int target, int fl ...@@ -178,9 +178,12 @@ static int mptscsih_writeSDP1(MPT_SCSI_HOST *hd, int portnum, int target, int fl
static int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); static int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r);
static void mptscsih_timer_expired(unsigned long data); static void mptscsih_timer_expired(unsigned long data);
static void mptscsih_taskmgmt_timeout(unsigned long data); static void mptscsih_taskmgmt_timeout(unsigned long data);
static void mptscsih_schedule_reset(void *hd);
static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd); static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd);
static int mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum); static int mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum);
static struct mpt_work_struct mptscsih_rstTask;
#ifndef MPTSCSIH_DISABLE_DOMAIN_VALIDATION #ifndef MPTSCSIH_DISABLE_DOMAIN_VALIDATION
static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io); static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io);
static void mptscsih_domainValidation(void *hd); static void mptscsih_domainValidation(void *hd);
...@@ -1058,7 +1061,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd) ...@@ -1058,7 +1061,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
SCpnt->use_sg, scsi_to_pci_dma_dir(SCpnt->sc_data_direction)); SCpnt->use_sg, scsi_to_pci_dma_dir(SCpnt->sc_data_direction));
} else if (SCpnt->request_bufflen) { } else if (SCpnt->request_bufflen) {
scPrivate *my_priv; scPrivate *my_priv;
my_priv = (scPrivate *) &SCpnt->SCp; my_priv = (scPrivate *) &SCpnt->SCp;
pci_unmap_single(hd->ioc->pcidev, (dma_addr_t)(ulong)my_priv->p1, pci_unmap_single(hd->ioc->pcidev, (dma_addr_t)(ulong)my_priv->p1,
SCpnt->request_bufflen, SCpnt->request_bufflen,
...@@ -2155,7 +2158,7 @@ int mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t ...@@ -2155,7 +2158,7 @@ int mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t
MPT_SCSI_HOST *hd = NULL; MPT_SCSI_HOST *hd = NULL;
int size = 0; int size = 0;
dprintk(("Called mptscsih_proc_info: hostno=%d, func=%d\n", hostno, func)); dprintk(("Called mptscsih_proc_info: hostno=%d, func=%d\n", host->host_no, func));
dprintk(("buffer %p, start=%p (%p) offset=%ld length = %d\n", dprintk(("buffer %p, start=%p (%p) offset=%ld length = %d\n",
buffer, start, *start, offset, length)); buffer, start, *start, offset, length));
...@@ -2788,13 +2791,14 @@ mptscsih_abort(Scsi_Cmnd * SCpnt) ...@@ -2788,13 +2791,14 @@ mptscsih_abort(Scsi_Cmnd * SCpnt)
MPT_FRAME_HDR *mf; MPT_FRAME_HDR *mf;
u32 ctx2abort; u32 ctx2abort;
int scpnt_idx; int scpnt_idx;
spinlock_t *host_lock = SCpnt->device->host->host_lock;
/* If we can't locate our host adapter structure, return FAILED status. /* If we can't locate our host adapter structure, return FAILED status.
*/ */
if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) { if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) {
SCpnt->result = DID_RESET << 16; SCpnt->result = DID_RESET << 16;
SCpnt->scsi_done(SCpnt); SCpnt->scsi_done(SCpnt);
nehprintk((KERN_WARNING MYNAM ": mptscsih_abort: " dtmprintk((KERN_WARNING MYNAM ": mptscsih_abort: "
"Can't locate host! (sc=%p)\n", "Can't locate host! (sc=%p)\n",
SCpnt)); SCpnt));
return FAILED; return FAILED;
...@@ -2816,7 +2820,7 @@ mptscsih_abort(Scsi_Cmnd * SCpnt) ...@@ -2816,7 +2820,7 @@ mptscsih_abort(Scsi_Cmnd * SCpnt)
SCpnt->result = DID_RESET << 16; SCpnt->result = DID_RESET << 16;
SCpnt->scsi_done(SCpnt); SCpnt->scsi_done(SCpnt);
nehprintk((KERN_WARNING MYNAM ": %s: mptscsih_abort: " dtmprintk((KERN_WARNING MYNAM ": %s: mptscsih_abort: "
"Command not in the active list! (sc=%p)\n", "Command not in the active list! (sc=%p)\n",
hd->ioc->name, SCpnt)); hd->ioc->name, SCpnt));
return SUCCESS; return SUCCESS;
...@@ -2827,13 +2831,16 @@ mptscsih_abort(Scsi_Cmnd * SCpnt) ...@@ -2827,13 +2831,16 @@ mptscsih_abort(Scsi_Cmnd * SCpnt)
* call to mptscsih_tm_pending_wait() will set the pending flag if we are * call to mptscsih_tm_pending_wait() will set the pending flag if we are
* successful. * successful.
*/ */
spin_unlock_irq(host_lock);
if (mptscsih_tm_pending_wait(hd) == FAILED){ if (mptscsih_tm_pending_wait(hd) == FAILED){
nehprintk((KERN_WARNING MYNAM ": %s: mptscsih_abort: " dtmprintk((KERN_WARNING MYNAM ": %s: mptscsih_abort: "
"Timed out waiting for previous TM to complete! " "Timed out waiting for previous TM to complete! "
"(sc = %p)\n", "(sc = %p)\n",
hd->ioc->name, SCpnt)); hd->ioc->name, SCpnt));
spin_lock_irq(host_lock);
return FAILED; return FAILED;
} }
spin_lock_irq(host_lock);
/* If this command is pended, then timeout/hang occurred /* If this command is pended, then timeout/hang occurred
* during DV. Post command and flush pending Q * during DV. Post command and flush pending Q
...@@ -2842,7 +2849,7 @@ mptscsih_abort(Scsi_Cmnd * SCpnt) ...@@ -2842,7 +2849,7 @@ mptscsih_abort(Scsi_Cmnd * SCpnt)
if ((mf = mptscsih_search_pendingQ(hd, scpnt_idx)) != NULL) { if ((mf = mptscsih_search_pendingQ(hd, scpnt_idx)) != NULL) {
mptscsih_put_msgframe(ScsiDoneCtx, hd->ioc->id, mf); mptscsih_put_msgframe(ScsiDoneCtx, hd->ioc->id, mf);
post_pendingQ_commands(hd); post_pendingQ_commands(hd);
nehprintk((KERN_WARNING MYNAM ": %s: mptscsih_abort: " dtmprintk((KERN_WARNING MYNAM ": %s: mptscsih_abort: "
"Found command in pending queue! (sc=%p)\n", "Found command in pending queue! (sc=%p)\n",
hd->ioc->name, SCpnt)); hd->ioc->name, SCpnt));
} }
...@@ -2858,8 +2865,10 @@ mptscsih_abort(Scsi_Cmnd * SCpnt) ...@@ -2858,8 +2865,10 @@ mptscsih_abort(Scsi_Cmnd * SCpnt)
ctx2abort = mf->u.frame.hwhdr.msgctxu.MsgContext; ctx2abort = mf->u.frame.hwhdr.msgctxu.MsgContext;
hd->abortSCpnt = SCpnt; hd->abortSCpnt = SCpnt;
spin_unlock_irq(host_lock);
if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
SCpnt->device->id, SCpnt->device->lun, ctx2abort, NO_SLEEP) SCpnt->device->id, SCpnt->device->lun, ctx2abort, CAN_SLEEP)
< 0) { < 0) {
/* The TM request failed and the subsequent FW-reload failed! /* The TM request failed and the subsequent FW-reload failed!
...@@ -2873,8 +2882,10 @@ mptscsih_abort(Scsi_Cmnd * SCpnt) ...@@ -2873,8 +2882,10 @@ mptscsih_abort(Scsi_Cmnd * SCpnt)
hd->tmPending = 0; hd->tmPending = 0;
hd->tmState = TM_STATE_NONE; hd->tmState = TM_STATE_NONE;
spin_lock_irq(host_lock);
return FAILED; return FAILED;
} }
spin_lock_irq(host_lock);
return FAILED; return FAILED;
} }
...@@ -2892,11 +2903,12 @@ int ...@@ -2892,11 +2903,12 @@ int
mptscsih_dev_reset(Scsi_Cmnd * SCpnt) mptscsih_dev_reset(Scsi_Cmnd * SCpnt)
{ {
MPT_SCSI_HOST *hd; MPT_SCSI_HOST *hd;
spinlock_t *host_lock = SCpnt->device->host->host_lock;
/* If we can't locate our host adapter structure, return FAILED status. /* If we can't locate our host adapter structure, return FAILED status.
*/ */
if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
nehprintk((KERN_WARNING MYNAM ": mptscsih_dev_reset: " dtmprintk((KERN_WARNING MYNAM ": mptscsih_dev_reset: "
"Can't locate host! (sc=%p)\n", "Can't locate host! (sc=%p)\n",
SCpnt)); SCpnt));
return FAILED; return FAILED;
...@@ -2915,16 +2927,18 @@ mptscsih_dev_reset(Scsi_Cmnd * SCpnt) ...@@ -2915,16 +2927,18 @@ mptscsih_dev_reset(Scsi_Cmnd * SCpnt)
* call to mptscsih_tm_pending_wait() will set the pending flag if we are * call to mptscsih_tm_pending_wait() will set the pending flag if we are
* successful. * successful.
*/ */
spin_unlock_irq(host_lock);
if (mptscsih_tm_pending_wait(hd) == FAILED) { if (mptscsih_tm_pending_wait(hd) == FAILED) {
nehprintk((KERN_WARNING MYNAM ": %s: mptscsih_dev_reset: " dtmprintk((KERN_WARNING MYNAM ": %s: mptscsih_dev_reset: "
"Timed out waiting for previous TM to complete! " "Timed out waiting for previous TM to complete! "
"(sc = %p)\n", "(sc = %p)\n",
hd->ioc->name, SCpnt)); hd->ioc->name, SCpnt));
spin_lock_irq(host_lock);
return FAILED; return FAILED;
} }
if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
SCpnt->device->id, 0, 0, NO_SLEEP) SCpnt->device->id, 0, 0, CAN_SLEEP)
< 0){ < 0){
/* The TM request failed and the subsequent FW-reload failed! /* The TM request failed and the subsequent FW-reload failed!
* Fatal error case. * Fatal error case.
...@@ -2933,8 +2947,10 @@ mptscsih_dev_reset(Scsi_Cmnd * SCpnt) ...@@ -2933,8 +2947,10 @@ mptscsih_dev_reset(Scsi_Cmnd * SCpnt)
hd->ioc->name, SCpnt); hd->ioc->name, SCpnt);
hd->tmPending = 0; hd->tmPending = 0;
hd->tmState = TM_STATE_NONE; hd->tmState = TM_STATE_NONE;
spin_lock_irq(host_lock);
return FAILED; return FAILED;
} }
spin_lock_irq(host_lock);
return SUCCESS; return SUCCESS;
} }
...@@ -2952,11 +2968,12 @@ int ...@@ -2952,11 +2968,12 @@ int
mptscsih_bus_reset(Scsi_Cmnd * SCpnt) mptscsih_bus_reset(Scsi_Cmnd * SCpnt)
{ {
MPT_SCSI_HOST *hd; MPT_SCSI_HOST *hd;
spinlock_t *host_lock = SCpnt->device->host->host_lock;
/* If we can't locate our host adapter structure, return FAILED status. /* If we can't locate our host adapter structure, return FAILED status.
*/ */
if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
nehprintk((KERN_WARNING MYNAM ": mptscsih_bus_reset: " dtmprintk((KERN_WARNING MYNAM ": mptscsih_bus_reset: "
"Can't locate host! (sc=%p)\n", "Can't locate host! (sc=%p)\n",
SCpnt ) ); SCpnt ) );
return FAILED; return FAILED;
...@@ -2973,17 +2990,19 @@ mptscsih_bus_reset(Scsi_Cmnd * SCpnt) ...@@ -2973,17 +2990,19 @@ mptscsih_bus_reset(Scsi_Cmnd * SCpnt)
* call to mptscsih_tm_pending_wait() will set the pending flag if we are * call to mptscsih_tm_pending_wait() will set the pending flag if we are
* successful. * successful.
*/ */
spin_unlock_irq(host_lock);
if (mptscsih_tm_pending_wait(hd) == FAILED) { if (mptscsih_tm_pending_wait(hd) == FAILED) {
nehprintk((KERN_WARNING MYNAM ": %s: mptscsih_bus_reset: " dtmprintk((KERN_WARNING MYNAM ": %s: mptscsih_bus_reset: "
"Timed out waiting for previous TM to complete! " "Timed out waiting for previous TM to complete! "
"(sc = %p)\n", "(sc = %p)\n",
hd->ioc->name, SCpnt)); hd->ioc->name, SCpnt));
spin_lock_irq(host_lock);
return FAILED; return FAILED;
} }
/* We are now ready to execute the task management request. */ /* We are now ready to execute the task management request. */
if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
0, 0, 0, NO_SLEEP) 0, 0, 0, CAN_SLEEP)
< 0){ < 0){
/* The TM request failed and the subsequent FW-reload failed! /* The TM request failed and the subsequent FW-reload failed!
...@@ -2994,9 +3013,10 @@ mptscsih_bus_reset(Scsi_Cmnd * SCpnt) ...@@ -2994,9 +3013,10 @@ mptscsih_bus_reset(Scsi_Cmnd * SCpnt)
hd->ioc->name, SCpnt); hd->ioc->name, SCpnt);
hd->tmPending = 0; hd->tmPending = 0;
hd->tmState = TM_STATE_NONE; hd->tmState = TM_STATE_NONE;
spin_lock_irq(host_lock);
return FAILED; return FAILED;
} }
spin_lock_irq(host_lock);
return SUCCESS; return SUCCESS;
} }
...@@ -3015,10 +3035,11 @@ mptscsih_host_reset(Scsi_Cmnd *SCpnt) ...@@ -3015,10 +3035,11 @@ mptscsih_host_reset(Scsi_Cmnd *SCpnt)
{ {
MPT_SCSI_HOST * hd; MPT_SCSI_HOST * hd;
int status = SUCCESS; int status = SUCCESS;
spinlock_t *host_lock = SCpnt->device->host->host_lock;
/* If we can't locate the host to reset, then we failed. */ /* If we can't locate the host to reset, then we failed. */
if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
nehprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: " dtmprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: "
"Can't locate host! (sc=%p)\n", "Can't locate host! (sc=%p)\n",
SCpnt ) ); SCpnt ) );
return FAILED; return FAILED;
...@@ -3032,7 +3053,8 @@ mptscsih_host_reset(Scsi_Cmnd *SCpnt) ...@@ -3032,7 +3053,8 @@ mptscsih_host_reset(Scsi_Cmnd *SCpnt)
/* If our attempts to reset the host failed, then return a failed /* If our attempts to reset the host failed, then return a failed
* status. The host will be taken off line by the SCSI mid-layer. * status. The host will be taken off line by the SCSI mid-layer.
*/ */
if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0){ spin_unlock_irq(host_lock);
if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0){
status = FAILED; status = FAILED;
} else { } else {
/* Make sure TM pending is cleared and TM state is set to /* Make sure TM pending is cleared and TM state is set to
...@@ -3041,9 +3063,10 @@ mptscsih_host_reset(Scsi_Cmnd *SCpnt) ...@@ -3041,9 +3063,10 @@ mptscsih_host_reset(Scsi_Cmnd *SCpnt)
hd->tmPending = 0; hd->tmPending = 0;
hd->tmState = TM_STATE_NONE; hd->tmState = TM_STATE_NONE;
} }
spin_lock_irq(host_lock);
nehprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: " dtmprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: "
"Status = %s\n", "Status = %s\n",
(status == SUCCESS) ? "SUCCESS" : "FAILED" ) ); (status == SUCCESS) ? "SUCCESS" : "FAILED" ) );
...@@ -3075,7 +3098,8 @@ mptscsih_tm_pending_wait(MPT_SCSI_HOST * hd) ...@@ -3075,7 +3098,8 @@ mptscsih_tm_pending_wait(MPT_SCSI_HOST * hd)
break; break;
} }
spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
mdelay(250); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/4);
} while (--loop_count); } while (--loop_count);
return status; return status;
...@@ -4716,13 +4740,30 @@ static void mptscsih_taskmgmt_timeout(unsigned long data) ...@@ -4716,13 +4740,30 @@ static void mptscsih_taskmgmt_timeout(unsigned long data)
/* Call the reset handler. Already had a TM request /* Call the reset handler. Already had a TM request
* timeout - so issue a diagnostic reset * timeout - so issue a diagnostic reset
*/ */
if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0) { MPT_INIT_WORK(&mptscsih_rstTask, mptscsih_schedule_reset, (void *)hd);
SCHEDULE_TASK(&mptscsih_rstTask);
return;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* mptscsih_schedule_reset - Call back for timeout on a
* task management request.
* @data: Pointer to MPT_SCSI_HOST recast as an unsigned long
*
*/
static void
mptscsih_schedule_reset(void *arg)
{
MPT_SCSI_HOST *hd;
hd = (MPT_SCSI_HOST *) arg;
if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0) {
printk((KERN_WARNING " Firmware Reload FAILED!!\n")); printk((KERN_WARNING " Firmware Reload FAILED!!\n"));
} else { } else {
/* Because we have reset the IOC, no TM requests can be /* Because we have reset the IOC, no TM requests can be
* pending. So let's make sure the tmPending flag is reset. * pending. So let's make sure the tmPending flag is reset.
*/ */
nehprintk((KERN_WARNING MYNAM dtmprintk((KERN_WARNING MYNAM
": %s: mptscsih_taskmgmt_timeout\n", ": %s: mptscsih_taskmgmt_timeout\n",
hd->ioc->name)); hd->ioc->name));
hd->tmPending = 0; hd->tmPending = 0;
...@@ -6900,7 +6941,7 @@ static char setup_token[] __initdata = ...@@ -6900,7 +6941,7 @@ static char setup_token[] __initdata =
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static int static int
__init get_setup_token(char *p) get_setup_token(char *p)
{ {
char *cur = setup_token; char *cur = setup_token;
char *pc; char *pc;
...@@ -6918,7 +6959,7 @@ __init get_setup_token(char *p) ...@@ -6918,7 +6959,7 @@ __init get_setup_token(char *p)
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static int static int
__init mptscsih_setup(char *str) mptscsih_setup(char *str)
{ {
char *cur = str; char *cur = str;
char *pc, *pv; char *pc, *pv;
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
* *
* (see also mptbase.c) * (see also mptbase.c)
* *
* Copyright (c) 1999-2002 LSI Logic Corporation * Copyright (c) 1999-2003 LSI Logic Corporation
* Originally By: Steven J. Ralston * Originally By: Steven J. Ralston
* (mailto:netscape.net) * (mailto:netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: mptscsih.h,v 1.21 2002/12/03 21:26:35 pdelaney Exp $ * $Id: mptscsih.h,v 1.21 2002/12/03 21:26:35 pdelaney Exp $
*/ */
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
* (Ultimately) SCSI-3 definitions; for now, inheriting * (Ultimately) SCSI-3 definitions; for now, inheriting
* SCSI-2 definitions. * SCSI-2 definitions.
* *
* Copyright (c) 1996-2002 Steven J. Ralston * Copyright (c) 1996-2003 Steven J. Ralston
* Written By: Steven J. Ralston (19960517) * Written By: Steven J. Ralston (19960517)
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:mpt_linux_developer@lsil.com)
* *
* $Id: scsi3.h,v 1.9 2002/02/27 18:45:02 sralston Exp $ * $Id: scsi3.h,v 1.9 2002/02/27 18:45:02 sralston Exp $
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment