diff options
author | Arthur Kepner <akepner@sgi.com> | 2008-04-29 04:00:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:06:11 -0400 |
commit | a75b0a2f68d3937f96ed39525e4750601483e3b4 (patch) | |
tree | 1a84f2ef16515880f00e2db9a931299f22a07071 /Documentation/DMA-API.txt | |
parent | 74bc7ceebfa1c84ddd3a843ebfb56df013bf7ef5 (diff) |
dma: document dma_*map*_attrs() interfaces
Document the new dma_*map*_attrs() functions.
[markn@au1.ibm.com: fix up for dma-add-dma_map_attrs-interfaces and update docs]
Signed-off-by: Arthur Kepner <akepner@sgi.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Jes Sorensen <jes@sgi.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Mark Nelson <markn@au1.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/DMA-API.txt')
-rw-r--r-- | Documentation/DMA-API.txt | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt index b939ebb62871..5f9f9df4d957 100644 --- a/Documentation/DMA-API.txt +++ b/Documentation/DMA-API.txt | |||
@@ -395,6 +395,71 @@ Notes: You must do this: | |||
395 | 395 | ||
396 | See also dma_map_single(). | 396 | See also dma_map_single(). |
397 | 397 | ||
398 | dma_addr_t | ||
399 | dma_map_single_attrs(struct device *dev, void *cpu_addr, size_t size, | ||
400 | enum dma_data_direction dir, | ||
401 | struct dma_attrs *attrs) | ||
402 | |||
403 | void | ||
404 | dma_unmap_single_attrs(struct device *dev, dma_addr_t dma_addr, | ||
405 | size_t size, enum dma_data_direction dir, | ||
406 | struct dma_attrs *attrs) | ||
407 | |||
408 | int | ||
409 | dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, | ||
410 | int nents, enum dma_data_direction dir, | ||
411 | struct dma_attrs *attrs) | ||
412 | |||
413 | void | ||
414 | dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sgl, | ||
415 | int nents, enum dma_data_direction dir, | ||
416 | struct dma_attrs *attrs) | ||
417 | |||
418 | The four functions above are just like the counterpart functions | ||
419 | without the _attrs suffixes, except that they pass an optional | ||
420 | struct dma_attrs*. | ||
421 | |||
422 | struct dma_attrs encapsulates a set of "dma attributes". For the | ||
423 | definition of struct dma_attrs see linux/dma-attrs.h. | ||
424 | |||
425 | The interpretation of dma attributes is architecture-specific, and | ||
426 | each attribute should be documented in Documentation/DMA-attributes.txt. | ||
427 | |||
428 | If struct dma_attrs* is NULL, the semantics of each of these | ||
429 | functions is identical to those of the corresponding function | ||
430 | without the _attrs suffix. As a result dma_map_single_attrs() | ||
431 | can generally replace dma_map_single(), etc. | ||
432 | |||
433 | As an example of the use of the *_attrs functions, here's how | ||
434 | you could pass an attribute DMA_ATTR_FOO when mapping memory | ||
435 | for DMA: | ||
436 | |||
437 | #include <linux/dma-attrs.h> | ||
438 | /* DMA_ATTR_FOO should be defined in linux/dma-attrs.h and | ||
439 | * documented in Documentation/DMA-attributes.txt */ | ||
440 | ... | ||
441 | |||
442 | DEFINE_DMA_ATTRS(attrs); | ||
443 | dma_set_attr(DMA_ATTR_FOO, &attrs); | ||
444 | .... | ||
445 | n = dma_map_sg_attrs(dev, sg, nents, DMA_TO_DEVICE, &attr); | ||
446 | .... | ||
447 | |||
448 | Architectures that care about DMA_ATTR_FOO would check for its | ||
449 | presence in their implementations of the mapping and unmapping | ||
450 | routines, e.g.: | ||
451 | |||
452 | void whizco_dma_map_sg_attrs(struct device *dev, dma_addr_t dma_addr, | ||
453 | size_t size, enum dma_data_direction dir, | ||
454 | struct dma_attrs *attrs) | ||
455 | { | ||
456 | .... | ||
457 | int foo = dma_get_attr(DMA_ATTR_FOO, attrs); | ||
458 | .... | ||
459 | if (foo) | ||
460 | /* twizzle the frobnozzle */ | ||
461 | .... | ||
462 | |||
398 | 463 | ||
399 | Part II - Advanced dma_ usage | 464 | Part II - Advanced dma_ usage |
400 | ----------------------------- | 465 | ----------------------------- |