aboutsummaryrefslogtreecommitdiffstats
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 16:02:57 -0500
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 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/list.h> 28#include <linux/list.h>
29#include <linux/fs.h> 29#include <linux/fs.h>
30#include <linux/dma-mapping.h>
30 31
31#define TCODE_WRITE_QUADLET_REQUEST 0 32#define TCODE_WRITE_QUADLET_REQUEST 0
32#define TCODE_WRITE_BLOCK_REQUEST 1 33#define TCODE_WRITE_BLOCK_REQUEST 1
@@ -336,6 +337,18 @@ struct fw_iso_context;
336typedef void (*fw_iso_callback_t) (struct fw_iso_context *context, 337typedef void (*fw_iso_callback_t) (struct fw_iso_context *context,
337 int status, u32 cycle, void *data); 338 int status, u32 cycle, void *data);
338 339
340/* An iso buffer is just a set of pages mapped for DMA in the
341 * specified direction. Since the pages are to be used for DMA, they
342 * are not mapped into the kernel virtual address space. We store the
343 * DMA address in the page private. The helper function
344 * fw_iso_buffer_map() will map the pages into a given vma. */
345
346struct fw_iso_buffer {
347 enum dma_data_direction direction;
348 struct page **pages;
349 int page_count;
350};
351
339struct fw_iso_context { 352struct fw_iso_context {
340 struct fw_card *card; 353 struct fw_card *card;
341 int type; 354 int type;
@@ -343,19 +356,24 @@ struct fw_iso_context {
343 int speed; 356 int speed;
344 fw_iso_callback_t callback; 357 fw_iso_callback_t callback;
345 void *callback_data; 358 void *callback_data;
346
347 void *buffer;
348 size_t buffer_size;
349 dma_addr_t *pages;
350 int page_count;
351}; 359};
352 360
361int
362fw_iso_buffer_init(struct fw_iso_buffer *buffer,
363 struct fw_card *card,
364 int page_count,
365 enum dma_data_direction direction);
366int
367fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma);
368void
369fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
370
353struct fw_iso_context * 371struct fw_iso_context *
354fw_iso_context_create(struct fw_card *card, int type, 372fw_iso_context_create(struct fw_card *card, int type,
355 size_t buffer_size,
356 fw_iso_callback_t callback, 373 fw_iso_callback_t callback,
357 void *callback_data); 374 void *callback_data);
358 375
376
359void 377void
360fw_iso_context_destroy(struct fw_iso_context *ctx); 378fw_iso_context_destroy(struct fw_iso_context *ctx);
361 379
@@ -365,7 +383,9 @@ fw_iso_context_start(struct fw_iso_context *ctx,
365 383
366int 384int
367fw_iso_context_queue(struct fw_iso_context *ctx, 385fw_iso_context_queue(struct fw_iso_context *ctx,
368 struct fw_iso_packet *packet, void *payload); 386 struct fw_iso_packet *packet,
387 struct fw_iso_buffer *buffer,
388 unsigned long payload);
369 389
370int 390int
371fw_iso_context_send(struct fw_iso_context *ctx, 391fw_iso_context_send(struct fw_iso_context *ctx,
@@ -410,7 +430,9 @@ struct fw_card_driver {
410 int (*send_iso)(struct fw_iso_context *ctx, s32 cycle); 430 int (*send_iso)(struct fw_iso_context *ctx, s32 cycle);
411 431
412 int (*queue_iso)(struct fw_iso_context *ctx, 432 int (*queue_iso)(struct fw_iso_context *ctx,
413 struct fw_iso_packet *packet, void *payload); 433 struct fw_iso_packet *packet,
434 struct fw_iso_buffer *buffer,
435 unsigned long payload);
414}; 436};
415 437
416int 438int