dprintk((KERN_WARNING MYNAM ": whoinit 0x%x\n statefault %d force %d\n", 
dinitprintk((KERN_INFO MYNAM ": whoinit 0x%x statefault %d force %d\n", 
MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag){	u32	 ioc_state;	int	 statefault = 0;	int	 cntdn;	int	 hard_reset_done = 0;	int	 r;	int	 ii;	int	 whoinit;	/* Get current [raw] IOC state  */	ioc_state = mpt_GetIocState(ioc, 0);	dhsprintk((KERN_INFO MYNAM "::MakeIocReady, %s [raw] state=%08x\n", ioc->name, ioc_state));	/*	 *	Check to see if IOC got left/stuck in doorbell handshake	 *	grip of death.  If so, hard reset the IOC.	 */	if (ioc_state & MPI_DOORBELL_ACTIVE) {		statefault = 1;		printk(MYIOC_s_WARN_FMT "Unexpected doorbell active!\n",				ioc->name);	}	/* Is it already READY? */	if (!statefault && (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY) 		return 0;	/*	 *	Check to see if IOC is in FAULT state.	 */	if ((ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_FAULT) {		statefault = 2;		printk(MYIOC_s_WARN_FMT "IOC is in FAULT state!!!\n",				ioc->name);		printk(KERN_WARNING "           FAULT code = %04xh\n",				ioc_state & MPI_DOORBELL_DATA_MASK);	}	/*	 *	Hmmm...  Did it get left operational?	 */	if ((ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_OPERATIONAL) {		dinitprintk((MYIOC_s_WARN_FMT "IOC operational unexpected\n",				ioc->name));		/* Check WhoInit.		 * If PCI Peer, exit.		 * Else, if no fault conditions are present, issue a MessageUnitReset		 * Else, fall through to KickStart case		 */		whoinit = (ioc_state & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT;		dprintk((KERN_WARNING MYNAM			": whoinit 0x%x\n statefault %d force %d\n",			whoinit, statefault, force));		if (whoinit == MPI_WHOINIT_PCI_PEER)			return -4;		else {			if ((statefault == 0 ) && (force == 0)) {				if ((r = SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, sleepFlag)) == 0)					return 0;			}			statefault = 3;		}	}	hard_reset_done = KickStart(ioc, statefault||force, sleepFlag);	if (hard_reset_done < 0)		return -1;	/*	 *  Loop here waiting for IOC to come READY.	 */	ii = 0;	cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 15;	/* 15 seconds */	while ((ioc_state = mpt_GetIocState(ioc, 1)) != MPI_IOC_STATE_READY) {		if (ioc_state == MPI_IOC_STATE_OPERATIONAL) {			/*			 *  BIOS or previous driver load left IOC in OP state.			 *  Reset messaging FIFOs.			 */			if ((r = SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, sleepFlag)) != 0) {				printk(MYIOC_s_ERR_FMT "IOC msg unit reset failed!\n", ioc->name);				return -2;			}		} else if (ioc_state == MPI_IOC_STATE_RESET) {			/*			 *  Something is wrong.  Try to get IOC back			 *  to a known state.			 */			if ((r = SendIocReset(ioc, MPI_FUNCTION_IO_UNIT_RESET, sleepFlag)) != 0) {				printk(MYIOC_s_ERR_FMT "IO unit reset failed!\n", ioc->name);				return -3;			}		}		ii++; cntdn--;		if (!cntdn) {			printk(MYIOC_s_ERR_FMT "Wait IOC_READY state timeout(%d)!\n",					ioc->name, (int)((ii+5)/HZ));			return -ETIME;		}		if (sleepFlag == CAN_SLEEP) {			msleep_interruptible(1);		} else {			mdelay (1);	/* 1 msec delay */		}	}	if (statefault < 3) {		printk(MYIOC_s_INFO_FMT "Recovered from %s\n",				ioc->name,				statefault==1 ? "stuck handshake" : "IOC FAULT");	}	return hard_reset_done;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c6678e0cfb41b029c3600c54b5bb65954de1230a/mptbase.c/clean/drivers/message/fusion/mptbase.c