dprintk((MYIOC_s_WARN_FMT "write SDP1: no msg frames!\n", ioc->name)); 
dfailprintk((MYIOC_s_WARN_FMT "write SDP1: no msg frames!\n", ioc->name)); 
mptscsih_writeSDP1(MPT_SCSI_HOST *hd, int portnum, int target_id, int flags){	MPT_ADAPTER		*ioc = hd->ioc;	Config_t		*pReq;	SCSIDevicePage1_t	*pData;	VirtDevice		*pTarget;	MPT_FRAME_HDR		*mf;	dma_addr_t		 dataDma;	u16			 req_idx;	u32			 frameOffset;	u32			 requested, configuration, flagsLength;	int			 ii, nvram;	int			 id = 0, maxid = 0;	u8			 width;	u8			 factor;	u8			 offset;	u8			 bus = 0;	u8			 negoFlags;	u8			 maxwidth, maxoffset, maxfactor;	if (ioc->spi_data.sdp1length == 0)		return 0;	if (flags & MPT_SCSICFG_ALL_IDS) {		id = 0;		maxid = ioc->sh->max_id - 1;	} else if (ioc->sh) {		id = target_id;		maxid = min_t(int, id, ioc->sh->max_id - 1);	}	for (; id <= maxid; id++) {		if (id == ioc->pfacts[portnum].PortSCSIID)			continue;		/* Use NVRAM to get adapter and target maximums		 * Data over-riden by target structure information, if present		 */		maxwidth = ioc->spi_data.maxBusWidth;		maxoffset = ioc->spi_data.maxSyncOffset;		maxfactor = ioc->spi_data.minSyncFactor;		if (ioc->spi_data.nvram && (ioc->spi_data.nvram[id] != MPT_HOST_NVRAM_INVALID)) {			nvram = ioc->spi_data.nvram[id];			if (maxwidth)				maxwidth = nvram & MPT_NVRAM_WIDE_DISABLE ? 0 : 1;			if (maxoffset > 0) {				maxfactor = (nvram & MPT_NVRAM_SYNC_MASK) >> 8;				if (maxfactor == 0) {					/* Key for async */					maxfactor = MPT_ASYNC;					maxoffset = 0;				} else if (maxfactor < ioc->spi_data.minSyncFactor) {					maxfactor = ioc->spi_data.minSyncFactor;				}			} else				maxfactor = MPT_ASYNC;		}		/* Set the negotiation flags.		 */		negoFlags = ioc->spi_data.noQas;		if (!maxwidth)			negoFlags |= MPT_TARGET_NO_NEGO_WIDE;		if (!maxoffset)			negoFlags |= MPT_TARGET_NO_NEGO_SYNC;		if (flags & MPT_SCSICFG_USE_NVRAM) {			width = maxwidth;			factor = maxfactor;			offset = maxoffset;		} else {			width = 0;			factor = MPT_ASYNC;			offset = 0;			//negoFlags = 0;			//negoFlags = MPT_TARGET_NO_NEGO_SYNC;		}		/* If id is not a raid volume, get the updated		 * transmission settings from the target structure.		 */		if (hd->Targets && (pTarget = hd->Targets[id]) && !pTarget->raidVolume) {			width = pTarget->maxWidth;			factor = pTarget->minSyncFactor;			offset = pTarget->maxOffset;			negoFlags = pTarget->negoFlags;		}#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION		/* Force to async and narrow if DV has not been executed		 * for this ID		 */		if ((hd->ioc->spi_data.dvStatus[id] & MPT_SCSICFG_DV_NOT_DONE) != 0) {			width = 0;			factor = MPT_ASYNC;			offset = 0;		}#endif		if (flags & MPT_SCSICFG_BLK_NEGO)			negoFlags = MPT_TARGET_NO_NEGO_WIDE | MPT_TARGET_NO_NEGO_SYNC;		mptscsih_setDevicePage1Flags(width, factor, offset,					&requested, &configuration, negoFlags);		dnegoprintk(("writeSDP1: id=%d width=%d factor=%x offset=%x negoFlags=%x request=%x config=%x\n",			target_id, width, factor, offset, negoFlags, requested, configuration));		/* Get a MF for this command.		 */		if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) {			dprintk((MYIOC_s_WARN_FMT "write SDP1: no msg frames!\n",						ioc->name));			return -EAGAIN;		}		ddvprintk((MYIOC_s_INFO_FMT "WriteSDP1 (mf=%p, id=%d, req=0x%x, cfg=0x%x)\n",			hd->ioc->name, mf, id, requested, configuration));		/* Set the request and the data pointers.		 * Request takes: 36 bytes (32 bit SGE)		 * SCSI Device Page 1 requires 16 bytes		 * 40 + 16 <= size of SCSI IO Request = 56 bytes		 * and MF size >= 64 bytes.		 * Place data at end of MF.		 */		pReq = (Config_t *)mf;		req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);		frameOffset = ioc->req_sz - sizeof(SCSIDevicePage1_t);		pData = (SCSIDevicePage1_t *)((u8 *) mf + frameOffset);		dataDma = ioc->req_frames_dma + (req_idx * ioc->req_sz) + frameOffset;		/* Complete the request frame (same for all requests).		 */		pReq->Action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;		pReq->Reserved = 0;		pReq->ChainOffset = 0;		pReq->Function = MPI_FUNCTION_CONFIG;		pReq->ExtPageLength = 0;		pReq->ExtPageType = 0;		pReq->MsgFlags = 0;		for (ii=0; ii < 8; ii++) {			pReq->Reserved2[ii] = 0;		}		pReq->Header.PageVersion = ioc->spi_data.sdp1version;		pReq->Header.PageLength = ioc->spi_data.sdp1length;		pReq->Header.PageNumber = 1;		pReq->Header.PageType = MPI_CONFIG_PAGETYPE_SCSI_DEVICE;		pReq->PageAddress = cpu_to_le32(id | (bus << 8 ));		/* Add a SGE to the config request.		 */		flagsLength = MPT_SGE_FLAGS_SSIMPLE_WRITE | ioc->spi_data.sdp1length * 4;		mpt_add_sge((char *)&pReq->PageBufferSGE, flagsLength, dataDma);		/* Set up the common data portion		 */		pData->Header.PageVersion = pReq->Header.PageVersion;		pData->Header.PageLength = pReq->Header.PageLength;		pData->Header.PageNumber = pReq->Header.PageNumber;		pData->Header.PageType = pReq->Header.PageType;		pData->RequestedParameters = cpu_to_le32(requested);		pData->Reserved = 0;		pData->Configuration = cpu_to_le32(configuration);		dprintk((MYIOC_s_INFO_FMT			"write SDP1: id %d pgaddr 0x%x req 0x%x config 0x%x\n",				ioc->name, id, (id | (bus<<8)),				requested, configuration));		mpt_put_msg_frame(ioc->DoneCtx, ioc, mf);	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c6678e0cfb41b029c3600c54b5bb65954de1230a/mptscsih.c/buggy/drivers/message/fusion/mptscsih.c