dprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", 
drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", 
mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag){	int	 hard_reset_done = 0;	int	 alt_ioc_ready = 0;	int	 hard;	int	 rc=0;	int	 ii;	int	 handlers;	int	 ret = 0;	int	 reset_alt_ioc_active = 0;	printk(KERN_INFO MYNAM ": Initiating %s %s\n",			ioc->name, reason==MPT_HOSTEVENT_IOC_BRINGUP ? "bringup" : "recovery");	/* Disable reply interrupts (also blocks FreeQ) */	CHIPREG_WRITE32(&ioc->chip->IntMask, 0xFFFFFFFF);	ioc->active = 0;	if (ioc->alt_ioc) {		if (ioc->alt_ioc->active)			reset_alt_ioc_active = 1;		/* Disable alt-IOC's reply interrupts (and FreeQ) for a bit ... */		CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, 0xFFFFFFFF);		ioc->alt_ioc->active = 0;	}	hard = 1;	if (reason == MPT_HOSTEVENT_IOC_BRINGUP)		hard = 0;	if ((hard_reset_done = MakeIocReady(ioc, hard, sleepFlag)) < 0) {		if (hard_reset_done == -4) {			printk(KERN_WARNING MYNAM ": %s Owned by PEER..skipping!\n",					ioc->name);			if (reset_alt_ioc_active && ioc->alt_ioc) {				/* (re)Enable alt-IOC! (reply interrupt, FreeQ) */				dprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n",						ioc->alt_ioc->name));				CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, ~(MPI_HIM_RIM));				ioc->alt_ioc->active = 1;			}		} else {			printk(KERN_WARNING MYNAM ": %s NOT READY WARNING!\n",					ioc->name);		}		return -1;	}	/* hard_reset_done = 0 if a soft reset was performed	 * and 1 if a hard reset was performed.	 */	if (hard_reset_done && reset_alt_ioc_active && ioc->alt_ioc) {		if ((rc = MakeIocReady(ioc->alt_ioc, 0, sleepFlag)) == 0)			alt_ioc_ready = 1;		else			printk(KERN_WARNING MYNAM					": alt-%s: Not ready WARNING!\n",					ioc->alt_ioc->name);	}	for (ii=0; ii<5; ii++) {		/* Get IOC facts! Allow 5 retries */		if ((rc = GetIocFacts(ioc, sleepFlag, reason)) == 0)			break;	}		if (ii == 5) {		dinitprintk((MYIOC_s_INFO_FMT "Retry IocFacts failed rc=%x\n", ioc->name, rc));		ret = -2;	} else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {		MptDisplayIocCapabilities(ioc);	}		if (alt_ioc_ready) {		if ((rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason)) != 0) {			dinitprintk((MYIOC_s_INFO_FMT "Initial Alt IocFacts failed rc=%x\n", ioc->name, rc));			/* Retry - alt IOC was initialized once			 */			rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason);		}		if (rc) {			dinitprintk((MYIOC_s_INFO_FMT "Retry Alt IocFacts failed rc=%x\n", ioc->name, rc));			alt_ioc_ready = 0;			reset_alt_ioc_active = 0;		} else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {			MptDisplayIocCapabilities(ioc->alt_ioc);		}	}	/* Prime reply & request queues!	 * (mucho alloc's) Must be done prior to	 * init as upper addresses are needed for init.	 * If fails, continue with alt-ioc processing	 */	if ((ret == 0) && ((rc = PrimeIocFifos(ioc)) != 0))		ret = -3;	/* May need to check/upload firmware & data here!	 * If fails, continue with alt-ioc processing	 */	if ((ret == 0) && ((rc = SendIocInit(ioc, sleepFlag)) != 0))		ret = -4;// NEW!	if (alt_ioc_ready && ((rc = PrimeIocFifos(ioc->alt_ioc)) != 0)) {		printk(KERN_WARNING MYNAM ": alt-%s: (%d) FIFO mgmt alloc WARNING!\n",				ioc->alt_ioc->name, rc);		alt_ioc_ready = 0;		reset_alt_ioc_active = 0;	}	if (alt_ioc_ready) {		if ((rc = SendIocInit(ioc->alt_ioc, sleepFlag)) != 0) {			alt_ioc_ready = 0;			reset_alt_ioc_active = 0;			printk(KERN_WARNING MYNAM				": alt-%s: (%d) init failure WARNING!\n",					ioc->alt_ioc->name, rc);		}	}	if (reason == MPT_HOSTEVENT_IOC_BRINGUP){		if (ioc->upload_fw) {			ddlprintk((MYIOC_s_INFO_FMT				"firmware upload required!\n", ioc->name));			/* Controller is not operational, cannot do upload			 */			if (ret == 0) {				rc = mpt_do_upload(ioc, sleepFlag);				if (rc != 0)					printk(KERN_WARNING MYNAM ": firmware upload failure!\n");			}		}	}	if (ret == 0) {		/* Enable! (reply interrupt) */		CHIPREG_WRITE32(&ioc->chip->IntMask, ~(MPI_HIM_RIM));		ioc->active = 1;	}	if (reset_alt_ioc_active && ioc->alt_ioc) {		/* (re)Enable alt-IOC! (reply interrupt) */		dprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n",				ioc->alt_ioc->name));		CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, ~(MPI_HIM_RIM));		ioc->alt_ioc->active = 1;	}	/*  Enable MPT base driver management of EventNotification	 *  and EventAck handling.	 */	if ((ret == 0) && (!ioc->facts.EventState))		(void) SendEventNotification(ioc, 1);	/* 1=Enable EventNotification */	if (ioc->alt_ioc && alt_ioc_ready && !ioc->alt_ioc->facts.EventState)		(void) SendEventNotification(ioc->alt_ioc, 1);	/* 1=Enable EventNotification */	/*	Add additional "reason" check before call to GetLanConfigPages	 *	(combined with GetIoUnitPage2 call).  This prevents a somewhat	 *	recursive scenario; GetLanConfigPages times out, timer expired	 *	routine calls HardResetHandler, which calls into here again,	 *	and we try GetLanConfigPages again...	 */	if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP)) {		if (ioc->bus_type == FC) {			/*			 *  Pre-fetch FC port WWN and stuff...			 *  (FCPortPage0_t stuff)			 */			for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) {				(void) GetFcPortPage0(ioc, ii);			}			if ((ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) &&			    (ioc->lan_cnfg_page0.Header.PageLength == 0)) {				/*				 *  Pre-fetch the ports LAN MAC address!				 *  (LANPage1_t stuff)				 */				(void) GetLanConfigPages(ioc);#ifdef MPT_DEBUG				{					u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;					dprintk((MYIOC_s_INFO_FMT "LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",							ioc->name, a[5], a[4], a[3], a[2], a[1], a[0] ));				}#endif			}		} else {			/* Get NVRAM and adapter maximums from SPP 0 and 2			 */			mpt_GetScsiPortSettings(ioc, 0);			/* Get version and length of SDP 1			 */			mpt_readScsiDevicePageHeaders(ioc, 0);			/* Find IM volumes			 */			if (ioc->facts.MsgVersion >= 0x0102)				mpt_findImVolumes(ioc);			/* Check, and possibly reset, the coalescing value			 */			mpt_read_ioc_pg_1(ioc);			mpt_read_ioc_pg_4(ioc);		}		GetIoUnitPage2(ioc);	}	/*	 * Call each currently registered protocol IOC reset handler	 * with post-reset indication.	 * NOTE: If we're doing _IOC_BRINGUP, there can be no	 * MptResetHandlers[] registered yet.	 */	if (hard_reset_done) {		rc = handlers = 0;		for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {			if ((ret == 0) && MptResetHandlers[ii]) {				dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n",						ioc->name, ii));				rc += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_POST_RESET);				handlers++;			}			if (alt_ioc_ready && MptResetHandlers[ii]) {				dprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n",						ioc->name, ioc->alt_ioc->name, ii));				rc += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_POST_RESET);				handlers++;			}		}		/* FIXME?  Examine results here? */	}	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c6678e0cfb41b029c3600c54b5bb65954de1230a/mptbase.c/clean/drivers/message/fusion/mptbase.c