struct scatterlist *sg; int sgnum; int i;
static int i2o_block_transfer(struct request *req){	struct i2o_block_device *dev = req->rq_disk->private_data;	struct i2o_controller *c = dev->i2o_dev->iop;	int tid = dev->i2o_dev->lct_data.tid;	struct i2o_message __iomem *msg;	void __iomem *mptr;	struct i2o_block_request *ireq = req->special;	struct scatterlist *sg;	int sgnum;	int i;	u32 m;	u32 tcntxt;	u32 sg_flags;	int rc;	m = i2o_msg_get(c, &msg);	if (m == I2O_QUEUE_EMPTY) {		rc = -EBUSY;		goto exit;	}	tcntxt = i2o_cntxt_list_add(c, req);	if (!tcntxt) {		rc = -ENOMEM;		goto nop_msg;	}	if ((sgnum = i2o_block_sglist_alloc(ireq)) <= 0) {		rc = -ENOMEM;		goto context_remove;	}	/* Build the message based on the request. */	writel(i2o_block_driver.context, &msg->u.s.icntxt);	writel(tcntxt, &msg->u.s.tcntxt);	writel(req->nr_sectors << 9, &msg->body[1]);	writel((((u64) req->sector) << 9) & 0xffffffff, &msg->body[2]);	writel(req->sector >> 23, &msg->body[3]);	mptr = &msg->body[4];	sg = ireq->sg_table;	if (rq_data_dir(req) == READ) {		writel(I2O_CMD_BLOCK_READ << 24 | HOST_TID << 12 | tid,		       &msg->u.head[1]);		sg_flags = 0x10000000;		switch (dev->rcache) {		case CACHE_NULL:			writel(0, &msg->body[0]);			break;		case CACHE_PREFETCH:			writel(0x201F0008, &msg->body[0]);			break;		case CACHE_SMARTFETCH:			if (req->nr_sectors > 16)				writel(0x201F0008, &msg->body[0]);			else				writel(0x001F0000, &msg->body[0]);			break;		}	} else {		writel(I2O_CMD_BLOCK_WRITE << 24 | HOST_TID << 12 | tid,		       &msg->u.head[1]);		sg_flags = 0x14000000;		switch (dev->wcache) {		case CACHE_NULL:			writel(0, &msg->body[0]);			break;		case CACHE_WRITETHROUGH:			writel(0x001F0008, &msg->body[0]);			break;		case CACHE_WRITEBACK:			writel(0x001F0010, &msg->body[0]);			break;		case CACHE_SMARTBACK:			if (req->nr_sectors > 16)				writel(0x001F0004, &msg->body[0]);			else				writel(0x001F0010, &msg->body[0]);			break;		case CACHE_SMARTTHROUGH:			if (req->nr_sectors > 16)				writel(0x001F0004, &msg->body[0]);			else				writel(0x001F0010, &msg->body[0]);		}	}	for (i = sgnum; i > 0; i--) {		if (i == 1)			sg_flags |= 0x80000000;		writel(sg_flags | sg_dma_len(sg), mptr);		writel(sg_dma_address(sg), mptr + 4);		mptr += 8;		sg++;	}	writel(I2O_MESSAGE_SIZE(mptr - &msg->u.head[0]) | SGL_OFFSET_8,	       &msg->u.head[0]);	list_add_tail(&ireq->queue, &dev->open_queue);	dev->open_queue_depth++;	i2o_msg_post(c, m);	return 0;      context_remove:	i2o_cntxt_list_remove(c, req);      nop_msg:	i2o_msg_nop(c, m);      exit:	return rc;};