summaryrefslogtreecommitdiff
path: root/drivers/firewire/fw-transaction.h
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-02-16 17:34:38 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-09 22:02:57 +0100
commit9aad8125389a7a2990dee72d7892e22330a945eb (patch)
tree2566a8985837b000990db7e16b17547d3747141b /drivers/firewire/fw-transaction.h
parent6e2e8424d310507fa044649435114217826ed78a (diff)
firewire: Split the iso buffer out from fw_iso_context and avoid vmalloc.
This patch splits out the iso buffer so we can initialize it at mmap time with the size provided in the mmap call. Furthermore, allocate the backing pages using alloc_page to avoid setting up kernel side virtual memory mappings for the pages. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-transaction.h')
-rw-r--r--drivers/firewire/fw-transaction.h38
1 files changed, 30 insertions, 8 deletions
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index 8f0283cf1a7a..89c6dda27936 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -27,6 +27,7 @@
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/fs.h>
+#include <linux/dma-mapping.h>
#define TCODE_WRITE_QUADLET_REQUEST 0
#define TCODE_WRITE_BLOCK_REQUEST 1
@@ -336,6 +337,18 @@ struct fw_iso_context;
typedef void (*fw_iso_callback_t) (struct fw_iso_context *context,
int status, u32 cycle, void *data);
+/* An iso buffer is just a set of pages mapped for DMA in the
+ * specified direction. Since the pages are to be used for DMA, they
+ * are not mapped into the kernel virtual address space. We store the
+ * DMA address in the page private. The helper function
+ * fw_iso_buffer_map() will map the pages into a given vma. */
+
+struct fw_iso_buffer {
+ enum dma_data_direction direction;
+ struct page **pages;
+ int page_count;
+};
+
struct fw_iso_context {
struct fw_card *card;
int type;
@@ -343,19 +356,24 @@ struct fw_iso_context {
int speed;
fw_iso_callback_t callback;
void *callback_data;
-
- void *buffer;
- size_t buffer_size;
- dma_addr_t *pages;
- int page_count;
};
+int
+fw_iso_buffer_init(struct fw_iso_buffer *buffer,
+ struct fw_card *card,
+ int page_count,
+ enum dma_data_direction direction);
+int
+fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma);
+void
+fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
+
struct fw_iso_context *
fw_iso_context_create(struct fw_card *card, int type,
- size_t buffer_size,
fw_iso_callback_t callback,
void *callback_data);
+
void
fw_iso_context_destroy(struct fw_iso_context *ctx);
@@ -365,7 +383,9 @@ fw_iso_context_start(struct fw_iso_context *ctx,
int
fw_iso_context_queue(struct fw_iso_context *ctx,
- struct fw_iso_packet *packet, void *payload);
+ struct fw_iso_packet *packet,
+ struct fw_iso_buffer *buffer,
+ unsigned long payload);
int
fw_iso_context_send(struct fw_iso_context *ctx,
@@ -410,7 +430,9 @@ struct fw_card_driver {
int (*send_iso)(struct fw_iso_context *ctx, s32 cycle);
int (*queue_iso)(struct fw_iso_context *ctx,
- struct fw_iso_packet *packet, void *payload);
+ struct fw_iso_packet *packet,
+ struct fw_iso_buffer *buffer,
+ unsigned long payload);
};
int