summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-10-20 03:05:52 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-20 03:05:52 -0700
commita9ce970684c1365b6bc9a46e8fb35ccfe1a9928f (patch)
treeeac99863f5b1a55091a7364d01f83f665fe5e7e2 /include
parentde9c91437d17c5354dbc194ee88cc20e28b29b6b (diff)
[PATCH] i2o: missing bits from merge
A couple of functions got themselves lost. cc: <Markus.Lidel@shadowconnect.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/i2o.h39
1 files changed, 39 insertions, 0 deletions
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
@@ -502,6 +502,45 @@ static inline void i2o_flush_reply(struct i2o_controller *c, u32 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
* @addr: i2o_dma struct which should get the DMA buffer