if (pr->ActionStatus == MPI_RAID_ACTION_ASTATUS_SUCCESS) 
if (le16_to_cpu(pr->ActionStatus) == MPI_RAID_ACTION_ASTATUS_SUCCESS) 
mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr){	MPT_SCSI_HOST	*hd;	SCSIIORequest_t *pReq;	int		 completionCode;	u16		 req_idx;	hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;	if ((mf == NULL) ||	    (mf >= MPT_INDEX_2_MFPTR(ioc, ioc->req_depth))) {		printk(MYIOC_s_ERR_FMT			"ScanDvComplete, %s req frame ptr! (=%p)\n",				ioc->name, mf?"BAD":"NULL", (void *) mf);		goto wakeup;	}	del_timer(&hd->timer);	req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);	hd->ScsiLookup[req_idx] = NULL;	pReq = (SCSIIORequest_t *) mf;	if (mf != hd->cmdPtr) {		printk(MYIOC_s_WARN_FMT "ScanDvComplete (mf=%p, cmdPtr=%p, idx=%d)\n",				hd->ioc->name, (void *)mf, (void *) hd->cmdPtr, req_idx);	}	hd->cmdPtr = NULL;	ddvprintk((MYIOC_s_INFO_FMT "ScanDvComplete (mf=%p,mr=%p,idx=%d)\n",			hd->ioc->name, mf, mr, req_idx));	hd->pLocal = &hd->localReply;	hd->pLocal->scsiStatus = 0;	/* If target struct exists, clear sense valid flag.	 */	if (mr == NULL) {		completionCode = MPT_SCANDV_GOOD;	} else {		SCSIIOReply_t	*pReply;		u16		 status;		u8		 scsi_status;		pReply = (SCSIIOReply_t *) mr;		status = le16_to_cpu(pReply->IOCStatus) & MPI_IOCSTATUS_MASK;		scsi_status = pReply->SCSIStatus;		ddvtprintk((KERN_NOTICE "  IOCStatus=%04xh, SCSIState=%02xh, SCSIStatus=%02xh, IOCLogInfo=%08xh\n",			     status, pReply->SCSIState, scsi_status,			     le32_to_cpu(pReply->IOCLogInfo)));		switch(status) {		case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE:	/* 0x0043 */			completionCode = MPT_SCANDV_SELECTION_TIMEOUT;			break;		case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR:		/* 0x0046 */		case MPI_IOCSTATUS_SCSI_TASK_TERMINATED:	/* 0x0048 */		case MPI_IOCSTATUS_SCSI_IOC_TERMINATED:		/* 0x004B */		case MPI_IOCSTATUS_SCSI_EXT_TERMINATED:		/* 0x004C */			completionCode = MPT_SCANDV_DID_RESET;			break;		case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN:		/* 0x0045 */		case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR:	/* 0x0040 */		case MPI_IOCSTATUS_SUCCESS:			/* 0x0000 */			if (pReply->Function == MPI_FUNCTION_CONFIG) {				ConfigReply_t *pr = (ConfigReply_t *)mr;				completionCode = MPT_SCANDV_GOOD;				hd->pLocal->header.PageVersion = pr->Header.PageVersion;				hd->pLocal->header.PageLength = pr->Header.PageLength;				hd->pLocal->header.PageNumber = pr->Header.PageNumber;				hd->pLocal->header.PageType = pr->Header.PageType;			} else if (pReply->Function == MPI_FUNCTION_RAID_ACTION) {				/* If the RAID Volume request is successful,				 * return GOOD, else indicate that				 * some type of error occurred.				 */				MpiRaidActionReply_t	*pr = (MpiRaidActionReply_t *)mr;				if (pr->ActionStatus == MPI_RAID_ACTION_ASTATUS_SUCCESS)					completionCode = MPT_SCANDV_GOOD;				else					completionCode = MPT_SCANDV_SOME_ERROR;			} else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) {				u8		*sense_data;				int		 sz;				/* save sense data in global structure				 */				completionCode = MPT_SCANDV_SENSE;				hd->pLocal->scsiStatus = scsi_status;				sense_data = ((u8 *)hd->ioc->sense_buf_pool +					(req_idx * MPT_SENSE_BUFFER_ALLOC));				sz = min_t(int, pReq->SenseBufferLength,							SCSI_STD_SENSE_BYTES);				memcpy(hd->pLocal->sense, sense_data, sz);				ddvprintk((KERN_NOTICE "  Check Condition, sense ptr %p\n",						sense_data));			} else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_FAILED) {				if (pReq->CDB[0] == INQUIRY)					completionCode = MPT_SCANDV_ISSUE_SENSE;				else					completionCode = MPT_SCANDV_DID_RESET;			}			else if (pReply->SCSIState & MPI_SCSI_STATE_NO_SCSI_STATUS)				completionCode = MPT_SCANDV_DID_RESET;			else if (pReply->SCSIState & MPI_SCSI_STATE_TERMINATED)				completionCode = MPT_SCANDV_DID_RESET;			else {				completionCode = MPT_SCANDV_GOOD;				hd->pLocal->scsiStatus = scsi_status;			}			break;		case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR:		/* 0x0047 */			if (pReply->SCSIState & MPI_SCSI_STATE_TERMINATED)				completionCode = MPT_SCANDV_DID_RESET;			else				completionCode = MPT_SCANDV_SOME_ERROR;			break;		default:			completionCode = MPT_SCANDV_SOME_ERROR;			break;		}	/* switch(status) */		ddvtprintk((KERN_NOTICE "  completionCode set to %08xh\n",				completionCode));	} /* end of address reply case */	hd->pLocal->completion = completionCode;	/* MF and RF are freed in mpt_interrupt	 */wakeup:	/* Free Chain buffers (will never chain) in scan or dv */	//mptscsih_freeChainBuffers(ioc, req_idx);	/*	 * Wake up the original calling thread	 */	hd->scandv_wait_done = 1;	wake_up(&hd->scandv_waitq);	return 1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/637fa99b86a00a0b5767a982b83a512ff48ad6d2/mptscsih.c/buggy/drivers/message/fusion/mptscsih.c