From a9ce970684c1365b6bc9a46e8fb35ccfe1a9928f Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 20 Oct 2004 03:05:52 -0700 Subject: [PATCH] i2o: missing bits from merge A couple of functions got themselves lost. cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/i2o.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'include/linux') diff --git a/include/linux/i2o.h b/include/linux/i2o.h index 3481de9c5837..f571709b0443 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h @@ -501,6 +501,45 @@ static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) I2O_REPLY_WRITE32(c, m); }; +/** + * i2o_out_to_virt - Turn an I2O message to a virtual address + * @c: controller + * @m: message engine value + * + * Turn a receive message from an I2O controller bus address into + * a Linux virtual address. The shared page frame is a linear block + * so we simply have to shift the offset. This function does not + * work for sender side messages as they are ioremap objects + * provided by the I2O controller. + */ +static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c, + u32 m) +{ + if (unlikely + (m < c->out_queue.phys + || m >= c->out_queue.phys + c->out_queue.len)) + BUG(); + + return c->out_queue.virt + (m - c->out_queue.phys); +}; + +/** + * i2o_msg_in_to_virt - Turn an I2O message to a virtual address + * @c: controller + * @m: message engine value + * + * Turn a send message from an I2O controller bus address into + * a Linux virtual address. The shared page frame is a linear block + * so we simply have to shift the offset. This function does not + * work for receive side messages as they are kmalloc objects + * in a different pool. + */ +static inline struct i2o_message *i2o_msg_in_to_virt(struct i2o_controller *c, + u32 m) +{ + return c->in_queue.virt + m; +}; + /** * i2o_dma_alloc - Allocate DMA memory * @dev: struct device pointer to the PCI device of the I2O controller -- cgit v1.2.3