/* 
/* FIXME: implement 
static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,				 void (*done) (struct scsi_cmnd *)){	struct i2o_controller *c;	struct i2o_device *i2o_dev;	int tid;	struct i2o_message __iomem *msg;	u32 m;	/*	 * ENABLE_DISCONNECT	 * SIMPLE_TAG	 * RETURN_SENSE_DATA_IN_REPLY_MESSAGE_FRAME	 */	u32 scsi_flags = 0x20a00000;	u32 sgl_offset;	u32 __iomem *mptr;	u32 cmd = I2O_CMD_SCSI_EXEC << 24;	int rc = 0;	/*	 *      Do the incoming paperwork	 */	i2o_dev = SCpnt->device->hostdata;	c = i2o_dev->iop;	SCpnt->scsi_done = done;	if (unlikely(!i2o_dev)) {		osm_warn("no I2O device in request\n");		SCpnt->result = DID_NO_CONNECT << 16;		done(SCpnt);		goto exit;	}	tid = i2o_dev->lct_data.tid;	osm_debug("qcmd: Tid = %03x\n", tid);	osm_debug("Real scsi messages.\n");	/*	 *      Put together a scsi execscb message	 */	switch (SCpnt->sc_data_direction) {	case PCI_DMA_NONE:		/* DATA NO XFER */		sgl_offset = SGL_OFFSET_0;		break;	case PCI_DMA_TODEVICE:		/* DATA OUT (iop-->dev) */		scsi_flags |= 0x80000000;		sgl_offset = SGL_OFFSET_10;		break;	case PCI_DMA_FROMDEVICE:		/* DATA IN  (iop<--dev) */		scsi_flags |= 0x40000000;		sgl_offset = SGL_OFFSET_10;		break;	default:		/* Unknown - kill the command */		SCpnt->result = DID_NO_CONNECT << 16;		done(SCpnt);		goto exit;	}	/*	 *      Obtain an I2O message. If there are none free then	 *      throw it back to the scsi layer	 */	m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);	if (m == I2O_QUEUE_EMPTY) {		rc = SCSI_MLQUEUE_HOST_BUSY;		goto exit;	}	mptr = &msg->body[0];#ifdef CONFIG_I2O_EXT_ADAPTEC	if (c->adaptec) {		u32 adpt_flags = 0;		if (SCpnt->sc_request && SCpnt->sc_request->upper_private_data) {			i2o_sg_io_hdr_t __user *usr_ptr =			    ((Sg_request *) (SCpnt->sc_request->					     upper_private_data))->header.			    usr_ptr;			if (usr_ptr)				get_user(adpt_flags, &usr_ptr->flags);		}		switch (i2o_dev->lct_data.class_id) {		case I2O_CLASS_EXECUTIVE:		case I2O_CLASS_RANDOM_BLOCK_STORAGE:			/* interpret flag has to be set for executive */			adpt_flags ^= I2O_DPT_SG_FLAG_INTERPRET;			break;		default:			break;		}		/*		 * for Adaptec controllers we use the PRIVATE command, because		 * the normal SCSI EXEC doesn't support all SCSI commands on		 * all controllers (for example READ CAPACITY).		 */		if (sgl_offset == SGL_OFFSET_10)			sgl_offset = SGL_OFFSET_12;		cmd = I2O_CMD_PRIVATE << 24;		writel(I2O_VENDOR_DPT << 16 | I2O_CMD_SCSI_EXEC, mptr++);		writel(adpt_flags | tid, mptr++);	}#endif	writel(cmd | HOST_TID << 12 | tid, &msg->u.head[1]);	writel(i2o_scsi_driver.context, &msg->u.s.icntxt);	/* We want the SCSI control block back */	writel(i2o_cntxt_list_add(c, SCpnt), &msg->u.s.tcntxt);	/* LSI_920_PCI_QUIRK	 *	 *      Intermittant observations of msg frame word data corruption	 *      observed on msg[4] after:	 *        WRITE, READ-MODIFY-WRITE	 *      operations.  19990606 -sralston	 *	 *      (Hence we build this word via tag. Its good practice anyway	 *       we don't want fetches over PCI needlessly)	 */	/* Attach tags to the devices */	/*	   if(SCpnt->device->tagged_supported) {	   if(SCpnt->tag == HEAD_OF_QUEUE_TAG)	   scsi_flags |= 0x01000000;	   else if(SCpnt->tag == ORDERED_QUEUE_TAG)	   scsi_flags |= 0x01800000;	   }	 */	writel(scsi_flags | SCpnt->cmd_len, mptr++);	/* Write SCSI command into the message - always 16 byte block */	memcpy_toio(mptr, SCpnt->cmnd, 16);	mptr += 4;	if (sgl_offset != SGL_OFFSET_0) {		/* write size of data addressed by SGL */		writel(SCpnt->request_bufflen, mptr++);		/* Now fill in the SGList and command */		if (SCpnt->use_sg) {			if (!i2o_dma_map_sg(c, SCpnt->request_buffer,					    SCpnt->use_sg,					    SCpnt->sc_data_direction, &mptr))				goto nomem;		} else {			SCpnt->SCp.dma_handle =			    i2o_dma_map_single(c, SCpnt->request_buffer,					       SCpnt->request_bufflen,					       SCpnt->sc_data_direction, &mptr);			if (dma_mapping_error(SCpnt->SCp.dma_handle))				goto nomem;		}	}	/* Stick the headers on */	writel(I2O_MESSAGE_SIZE(mptr - &msg->u.head[0]) | sgl_offset,	       &msg->u.head[0]);	/* Queue the message */	i2o_msg_post(c, m);	osm_debug("Issued %ld\n", SCpnt->serial_number);	return 0;      nomem:	rc = -ENOMEM;	i2o_msg_nop(c, m);      exit:	return rc;};
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/9e87545f06930c1d294423a8091d1077e7444a47/i2o_scsi.c/clean/drivers/message/i2o/i2o_scsi.c