dtmprintk((KERN_WARNING MYNAM ": %s: TMHandler target reset: " 
dtmprintk((KERN_INFO MYNAM ": %s: TMHandler target reset: " 
mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout){	MPT_ADAPTER	*ioc;	int		 rc = -1;	int		 doTask = 1;	u32		 ioc_raw_state;	unsigned long	 flags;	/* If FW is being reloaded currently, return success to	 * the calling function.	 */	if (hd == NULL)		return 0;	ioc = hd->ioc;	if (ioc == NULL) {		printk(KERN_ERR MYNAM " TMHandler" " NULL ioc!\n");		return FAILED;	}	dtmprintk((MYIOC_s_INFO_FMT "TMHandler Entered!\n", ioc->name));	// SJR - CHECKME - Can we avoid this here?	// (mpt_HardResetHandler has this check...)	spin_lock_irqsave(&ioc->diagLock, flags);	if ((ioc->diagPending) || (ioc->alt_ioc && ioc->alt_ioc->diagPending)) {		spin_unlock_irqrestore(&ioc->diagLock, flags);		return FAILED;	}	spin_unlock_irqrestore(&ioc->diagLock, flags);	/*  Wait a fixed amount of time for the TM pending flag to be cleared.	 *  If we time out and not bus reset, then we return a FAILED status to the caller.	 *  The call to mptscsih_tm_pending_wait() will set the pending flag if we are	 *  successful. Otherwise, reload the FW.	 */	if (mptscsih_tm_pending_wait(hd) == FAILED) {		if (type == MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK) {			dtmprintk((KERN_WARNING MYNAM ": %s: TMHandler abort: "			   "Timed out waiting for last TM (%d) to complete! \n",			   hd->ioc->name, hd->tmPending));			return FAILED;		} else if (type == MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET) {			dtmprintk((KERN_WARNING MYNAM ": %s: TMHandler target reset: "			   "Timed out waiting for last TM (%d) to complete! \n",			   hd->ioc->name, hd->tmPending));			return FAILED;		} else if (type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS) {			dtmprintk((KERN_WARNING MYNAM ": %s: TMHandler bus reset: "			   "Timed out waiting for last TM (%d) to complete! \n",			   hd->ioc->name, hd->tmPending));			if (hd->tmPending & (1 << MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS))				return FAILED;			doTask = 0;		}	} else {		spin_lock_irqsave(&hd->ioc->FreeQlock, flags);		hd->tmPending |=  (1 << type);		spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);	}	/* Is operational?	 */	ioc_raw_state = mpt_GetIocState(hd->ioc, 0);#ifdef MPT_DEBUG_RESET	if ((ioc_raw_state & MPI_IOC_STATE_MASK) != MPI_IOC_STATE_OPERATIONAL) {		printk(MYIOC_s_WARN_FMT			"TM Handler: IOC Not operational(0x%x)!\n",			hd->ioc->name, ioc_raw_state);	}#endif	if (doTask && ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_OPERATIONAL)				&& !(ioc_raw_state & MPI_DOORBELL_ACTIVE)) {		/* Isse the Task Mgmt request.		 */		if (hd->hard_resets < -1)			hd->hard_resets++;		rc = mptscsih_IssueTaskMgmt(hd, type, channel, target, lun, ctx2abort, timeout);		if (rc) {			printk(MYIOC_s_INFO_FMT "Issue of TaskMgmt failed!\n", hd->ioc->name);		} else {			dtmprintk((MYIOC_s_INFO_FMT "Issue of TaskMgmt Successful!\n", hd->ioc->name));		}	}	/* Only fall through to the HRH if this is a bus reset	 */	if ((type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS) && (rc ||		ioc->reload_fw || (ioc->alt_ioc && ioc->alt_ioc->reload_fw))) {		dtmprintk((MYIOC_s_INFO_FMT "Calling HardReset! \n",			 hd->ioc->name));		rc = mpt_HardResetHandler(hd->ioc, CAN_SLEEP);	}	dtmprintk((MYIOC_s_INFO_FMT "TMHandler rc = %d!\n", hd->ioc->name, rc));	return rc;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c6678e0cfb41b029c3600c54b5bb65954de1230a/mptscsih.c/buggy/drivers/message/fusion/mptscsih.c