lpfc_sli_txcmpl_ring_search_slow(pring, saveq)))) { 
lpfc_sli_iocbq_lookup(phba, pring, saveq)))) { 
lpfc_sli_handle_slow_ring_event(struct lpfc_hba * phba,			   struct lpfc_sli_ring * pring, uint32_t mask){	IOCB_t *entry;	IOCB_t *irsp = NULL;	struct lpfc_iocbq *rspiocbp = NULL;	struct lpfc_iocbq *next_iocb;	struct lpfc_iocbq *cmdiocbp;	struct lpfc_iocbq *saveq;	struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list;	struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno];	uint8_t iocb_cmd_type;	lpfc_iocb_type type;	uint32_t status, free_saveq;	uint32_t portRspPut, portRspMax;	int rc = 1;	unsigned long iflag;	void __iomem  *to_slim;	spin_lock_irqsave(phba->host->host_lock, iflag);	pring->stats.iocb_event++;	/*	 * The next available response entry should never exceed the maximum	 * entries.  If it does, treat it as an adapter hardware error.	 */	portRspMax = pring->numRiocb;	portRspPut = le32_to_cpu(pgp->rspPutInx);	if (portRspPut >= portRspMax) {		/*		 * Ring <ringno> handler: portRspPut <portRspPut> is bigger then		 * rsp ring <portRspMax>		 */		lpfc_printf_log(phba,				KERN_ERR,				LOG_SLI,				"%d:0312 Ring %d handler: portRspPut %d "				"is bigger then rsp ring %d\n",				phba->brd_no,				pring->ringno, portRspPut, portRspMax);		phba->hba_state = LPFC_HBA_ERROR;		spin_unlock_irqrestore(phba->host->host_lock, iflag);		phba->work_hs = HS_FFER3;		lpfc_handle_eratt(phba);		return 1;	}	rmb();	lpfc_iocb_list = &phba->lpfc_iocb_list;	while (pring->rspidx != portRspPut) {		/*		 * Build a completion list and call the appropriate handler.		 * The process is to get the next available response iocb, get		 * a free iocb from the list, copy the response data into the		 * free iocb, insert to the continuation list, and update the		 * next response index to slim.  This process makes response		 * iocb's in the ring available to DMA as fast as possible but		 * pays a penalty for a copy operation.  Since the iocb is		 * only 32 bytes, this penalty is considered small relative to		 * the PCI reads for register values and a slim write.  When		 * the ulpLe field is set, the entire Command has been		 * received.		 */		entry = IOCB_ENTRY(pring->rspringaddr, pring->rspidx);		list_remove_head(lpfc_iocb_list, rspiocbp, struct lpfc_iocbq,				 list);		if (rspiocbp == NULL) {			printk(KERN_ERR "%s: out of buffers! Failing "			       "completion.\n", __FUNCTION__);			break;		}		lpfc_sli_pcimem_bcopy(entry, &rspiocbp->iocb, sizeof (IOCB_t));		irsp = &rspiocbp->iocb;		if (++pring->rspidx >= portRspMax)			pring->rspidx = 0;		to_slim = phba->MBslimaddr + (SLIMOFF + (pring->ringno * 2)					      + 1) * 4;		writel(pring->rspidx, to_slim);		if (list_empty(&(pring->iocb_continueq))) {			list_add(&rspiocbp->list, &(pring->iocb_continueq));		} else {			list_add_tail(&rspiocbp->list,				      &(pring->iocb_continueq));		}		pring->iocb_continueq_cnt++;		if (irsp->ulpLe) {			/*			 * By default, the driver expects to free all resources			 * associated with this iocb completion.			 */			free_saveq = 1;			saveq = list_get_first(&pring->iocb_continueq,					       struct lpfc_iocbq, list);			irsp = &(saveq->iocb);			list_del_init(&pring->iocb_continueq);			pring->iocb_continueq_cnt = 0;			pring->stats.iocb_rsp++;			if (irsp->ulpStatus) {				/* Rsp ring <ringno> error: IOCB */				lpfc_printf_log(phba,					KERN_WARNING,					LOG_SLI,					"%d:0328 Rsp Ring %d error: IOCB Data: "					"x%x x%x x%x x%x x%x x%x x%x x%x\n",					phba->brd_no,					pring->ringno,					irsp->un.ulpWord[0],					irsp->un.ulpWord[1],					irsp->un.ulpWord[2],					irsp->un.ulpWord[3],					irsp->un.ulpWord[4],					irsp->un.ulpWord[5],					*(((uint32_t *) irsp) + 6),					*(((uint32_t *) irsp) + 7));			}			/*			 * Fetch the IOCB command type and call the correct			 * completion routine.  Solicited and Unsolicited			 * IOCBs on the ELS ring get freed back to the			 * lpfc_iocb_list by the discovery kernel thread.			 */			iocb_cmd_type = irsp->ulpCommand & CMD_IOCB_MASK;			type = lpfc_sli_iocb_cmd_type(iocb_cmd_type);			if (type == LPFC_SOL_IOCB) {				spin_unlock_irqrestore(phba->host->host_lock,						       iflag);				rc = lpfc_sli_process_sol_iocb(phba, pring,					saveq);				spin_lock_irqsave(phba->host->host_lock, iflag);			} else if (type == LPFC_UNSOL_IOCB) {				spin_unlock_irqrestore(phba->host->host_lock,						       iflag);				rc = lpfc_sli_process_unsol_iocb(phba, pring,					saveq);				spin_lock_irqsave(phba->host->host_lock, iflag);			} else if (type == LPFC_ABORT_IOCB) {				if ((irsp->ulpCommand != CMD_XRI_ABORTED_CX) &&				    ((cmdiocbp =				      lpfc_sli_txcmpl_ring_search_slow(pring,						saveq)))) {					/* Call the specified completion					   routine */					if (cmdiocbp->iocb_cmpl) {						spin_unlock_irqrestore(						       phba->host->host_lock,						       iflag);						(cmdiocbp->iocb_cmpl) (phba,							     cmdiocbp, saveq);						spin_lock_irqsave(							  phba->host->host_lock,							  iflag);					} else {						list_add_tail(&cmdiocbp->list,								lpfc_iocb_list);					}				}			} else if (type == LPFC_UNKNOWN_IOCB) {				if (irsp->ulpCommand == CMD_ADAPTER_MSG) {					char adaptermsg[LPFC_MAX_ADPTMSG];					memset(adaptermsg, 0,					       LPFC_MAX_ADPTMSG);					memcpy(&adaptermsg[0], (uint8_t *) irsp,					       MAX_MSG_DATA);					dev_warn(&((phba->pcidev)->dev),						 "lpfc%d: %s",						 phba->brd_no, adaptermsg);				} else {					/* Unknown IOCB command */					lpfc_printf_log(phba,						KERN_ERR,						LOG_SLI,						"%d:0321 Unknown IOCB command "						"Data: x%x x%x x%x x%x\n",						phba->brd_no,						irsp->ulpCommand,						irsp->ulpStatus,						irsp->ulpIoTag,						irsp->ulpContext);				}			}			if (free_saveq) {				if (!list_empty(&saveq->list)) {					list_for_each_entry_safe(rspiocbp,								 next_iocb,								 &saveq->list,								 list) {						list_add_tail(&rspiocbp->list,							      lpfc_iocb_list);					}				}				list_add_tail(&saveq->list, lpfc_iocb_list);			}		}		/*		 * If the port response put pointer has not been updated, sync		 * the pgp->rspPutInx in the MAILBOX_tand fetch the new port		 * response put pointer.		 */		if (pring->rspidx == portRspPut) {			portRspPut = le32_to_cpu(pgp->rspPutInx);		}	} /* while (pring->rspidx != portRspPut) */	if ((rspiocbp != 0) && (mask & HA_R0RE_REQ)) {		/* At least one response entry has been freed */		pring->stats.iocb_rsp_full++;		/* SET RxRE_RSP in Chip Att register */		status = ((CA_R0ATT | CA_R0RE_RSP) << (pring->ringno * 4));		writel(status, phba->CAregaddr);		readl(phba->CAregaddr); /* flush */	}	if ((mask & HA_R0CE_RSP) && (pring->flag & LPFC_CALL_RING_AVAILABLE)) {		pring->flag &= ~LPFC_CALL_RING_AVAILABLE;		pring->stats.iocb_cmd_empty++;		/* Force update of the local copy of cmdGetInx */		pring->local_getidx = le32_to_cpu(pgp->cmdGetInx);		lpfc_sli_resume_iocb(phba, pring);		if ((pring->lpfc_sli_cmd_available))			(pring->lpfc_sli_cmd_available) (phba, pring);	}	spin_unlock_irqrestore(phba->host->host_lock, iflag);	return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/604a3e3042eb89ffaa4f735ef9208281aae786c7/lpfc_sli.c/buggy/drivers/scsi/lpfc/lpfc_sli.c