diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2010-03-10 18:23:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:40 -0500 |
commit | 9705ef7ec8c67a62474291bb4b235927bdf702db (patch) | |
tree | 8669ef53a193398ab1a4be4be6778efc05feaa0b /Documentation | |
parent | 039956e9199b71ea673954e025f52f319110ca58 (diff) |
DMA-API.txt: add dma_sync_single/sg API description
This adds the description of the following eight function:
dma_sync_single_for_cpu
pci_dma_sync_single_for_cpu
dma_sync_single_for_device
pci_dma_sync_single_for_device
dma_sync_sg_for_cpu
pci_dma_sync_sg_for_cpu
dma_sync_sg_for_device
pci_dma_sync_sg_for_device
It was unclear that the API permits a partial sync (some network drivers
already do though). I made it clear that the sync_single API can do a
partial sync but the sync_sg API can't.
We could do a partial sync with the sync_sg API too, however, it's
difficult for driver writers to correctly use the sync_sg API for a
partial sync since the scatterlists passed in to the mapping API can't be
modified. It's unlikely that driver writers want to do a partial sync
with the sync_sg API (because the sync_sg API are usually used for block
drivers). So I think that it's better to forbid a partial sync with the
sync_sg API.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: David Miller <davem@davemloft.net>
Acked-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/DMA-API.txt | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt index bb0e75e368b2..c8db3d0dba50 100644 --- a/Documentation/DMA-API.txt +++ b/Documentation/DMA-API.txt | |||
@@ -364,6 +364,48 @@ API. | |||
364 | Note: <nents> must be the number you passed in, *not* the number of | 364 | Note: <nents> must be the number you passed in, *not* the number of |
365 | physical entries returned. | 365 | physical entries returned. |
366 | 366 | ||
367 | void | ||
368 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
369 | enum dma_data_direction direction) | ||
370 | void | ||
371 | pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, | ||
372 | size_t size, int direction) | ||
373 | void | ||
374 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
375 | enum dma_data_direction direction) | ||
376 | void | ||
377 | pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, | ||
378 | size_t size, int direction) | ||
379 | void | ||
380 | dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | ||
381 | enum dma_data_direction direction) | ||
382 | void | ||
383 | pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, | ||
384 | int nelems, int direction) | ||
385 | void | ||
386 | dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, | ||
387 | enum dma_data_direction direction) | ||
388 | void | ||
389 | pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, | ||
390 | int nelems, int direction) | ||
391 | |||
392 | Synchronise a single contiguous or scatter/gather mapping for the cpu | ||
393 | and device. With the sync_sg API, all the parameters must be the same | ||
394 | as those passed into the single mapping API. With the sync_single API, | ||
395 | you can use dma_handle and size parameters that aren't identical to | ||
396 | those passed into the single mapping API to do a partial sync. | ||
397 | |||
398 | Notes: You must do this: | ||
399 | |||
400 | - Before reading values that have been written by DMA from the device | ||
401 | (use the DMA_FROM_DEVICE direction) | ||
402 | - After writing values that will be written to the device using DMA | ||
403 | (use the DMA_TO_DEVICE) direction | ||
404 | - before *and* after handing memory to the device if the memory is | ||
405 | DMA_BIDIRECTIONAL | ||
406 | |||
407 | See also dma_map_single(). | ||
408 | |||
367 | dma_addr_t | 409 | dma_addr_t |
368 | dma_map_single_attrs(struct device *dev, void *cpu_addr, size_t size, | 410 | dma_map_single_attrs(struct device *dev, void *cpu_addr, size_t size, |
369 | enum dma_data_direction dir, | 411 | enum dma_data_direction dir, |