diff options
| -rw-r--r-- | Documentation/DMA-API.txt | 30 | ||||
| -rw-r--r-- | arch/metag/include/asm/dma-mapping.h | 2 | ||||
| -rw-r--r-- | arch/nios2/include/asm/dma-mapping.h | 2 | ||||
| -rw-r--r-- | arch/tile/include/asm/dma-mapping.h | 4 | ||||
| -rw-r--r-- | include/linux/dma-mapping.h | 14 |
5 files changed, 20 insertions, 32 deletions
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt index 45b29326d719..ef3a04fcad65 100644 --- a/Documentation/DMA-API.txt +++ b/Documentation/DMA-API.txt | |||
| @@ -515,14 +515,15 @@ API at all. | |||
| 515 | :: | 515 | :: |
| 516 | 516 | ||
| 517 | void * | 517 | void * |
| 518 | dma_alloc_noncoherent(struct device *dev, size_t size, | 518 | dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, |
| 519 | dma_addr_t *dma_handle, gfp_t flag) | 519 | gfp_t flag, unsigned long attrs) |
| 520 | 520 | ||
| 521 | Identical to dma_alloc_coherent() except that the platform will | 521 | Identical to dma_alloc_coherent() except that when the |
| 522 | choose to return either consistent or non-consistent memory as it sees | 522 | DMA_ATTR_NON_CONSISTENT flags is passed in the attrs argument, the |
| 523 | fit. By using this API, you are guaranteeing to the platform that you | 523 | platform will choose to return either consistent or non-consistent memory |
| 524 | have all the correct and necessary sync points for this memory in the | 524 | as it sees fit. By using this API, you are guaranteeing to the platform |
| 525 | driver should it choose to return non-consistent memory. | 525 | that you have all the correct and necessary sync points for this memory |
| 526 | in the driver should it choose to return non-consistent memory. | ||
| 526 | 527 | ||
| 527 | Note: where the platform can return consistent memory, it will | 528 | Note: where the platform can return consistent memory, it will |
| 528 | guarantee that the sync points become nops. | 529 | guarantee that the sync points become nops. |
| @@ -535,12 +536,13 @@ that simply cannot make consistent memory. | |||
| 535 | :: | 536 | :: |
| 536 | 537 | ||
| 537 | void | 538 | void |
| 538 | dma_free_noncoherent(struct device *dev, size_t size, void *cpu_addr, | 539 | dma_free_attrs(struct device *dev, size_t size, void *cpu_addr, |
| 539 | dma_addr_t dma_handle) | 540 | dma_addr_t dma_handle, unsigned long attrs) |
| 540 | 541 | ||
| 541 | Free memory allocated by the nonconsistent API. All parameters must | 542 | Free memory allocated by the dma_alloc_attrs(). All parameters common |
| 542 | be identical to those passed in (and returned by | 543 | parameters must identical to those otherwise passed to dma_fre_coherent, |
| 543 | dma_alloc_noncoherent()). | 544 | and the attrs argument must be identical to the attrs passed to |
| 545 | dma_alloc_attrs(). | ||
| 544 | 546 | ||
| 545 | :: | 547 | :: |
| 546 | 548 | ||
| @@ -564,8 +566,8 @@ memory or doing partial flushes. | |||
| 564 | dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 566 | dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
| 565 | enum dma_data_direction direction) | 567 | enum dma_data_direction direction) |
| 566 | 568 | ||
| 567 | Do a partial sync of memory that was allocated by | 569 | Do a partial sync of memory that was allocated by dma_alloc_attrs() with |
| 568 | dma_alloc_noncoherent(), starting at virtual address vaddr and | 570 | the DMA_ATTR_NON_CONSISTENT flag starting at virtual address vaddr and |
| 569 | continuing on for size. Again, you *must* observe the cache line | 571 | continuing on for size. Again, you *must* observe the cache line |
| 570 | boundaries when doing this. | 572 | boundaries when doing this. |
| 571 | 573 | ||
diff --git a/arch/metag/include/asm/dma-mapping.h b/arch/metag/include/asm/dma-mapping.h index fad3dc3cb210..ea573be2b6d0 100644 --- a/arch/metag/include/asm/dma-mapping.h +++ b/arch/metag/include/asm/dma-mapping.h | |||
| @@ -9,7 +9,7 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) | |||
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | /* | 11 | /* |
| 12 | * dma_alloc_noncoherent() returns non-cacheable memory, so there's no need to | 12 | * dma_alloc_attrs() always returns non-cacheable memory, so there's no need to |
| 13 | * do any flushing here. | 13 | * do any flushing here. |
| 14 | */ | 14 | */ |
| 15 | static inline void | 15 | static inline void |
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h index 7b3c6f280293..f8dc62222741 100644 --- a/arch/nios2/include/asm/dma-mapping.h +++ b/arch/nios2/include/asm/dma-mapping.h | |||
| @@ -18,7 +18,7 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) | |||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | /* | 20 | /* |
| 21 | * dma_alloc_noncoherent() returns non-cacheable memory, so there's no need to | 21 | * dma_alloc_attrs() always returns non-cacheable memory, so there's no need to |
| 22 | * do any flushing here. | 22 | * do any flushing here. |
| 23 | */ | 23 | */ |
| 24 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 24 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
diff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h index bbc71a29b2c6..7061dc8af43a 100644 --- a/arch/tile/include/asm/dma-mapping.h +++ b/arch/tile/include/asm/dma-mapping.h | |||
| @@ -68,8 +68,8 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | |||
| 68 | int dma_set_mask(struct device *dev, u64 mask); | 68 | int dma_set_mask(struct device *dev, u64 mask); |
| 69 | 69 | ||
| 70 | /* | 70 | /* |
| 71 | * dma_alloc_noncoherent() is #defined to return coherent memory, | 71 | * dma_alloc_attrs() always returns non-cacheable memory, so there's no need to |
| 72 | * so there's no need to do any flushing here. | 72 | * do any flushing here. |
| 73 | */ | 73 | */ |
| 74 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 74 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
| 75 | enum dma_data_direction direction) | 75 | enum dma_data_direction direction) |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 66d8ea68f40b..4c98cc96971f 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
| @@ -549,20 +549,6 @@ static inline void dma_free_coherent(struct device *dev, size_t size, | |||
| 549 | return dma_free_attrs(dev, size, cpu_addr, dma_handle, 0); | 549 | return dma_free_attrs(dev, size, cpu_addr, dma_handle, 0); |
| 550 | } | 550 | } |
| 551 | 551 | ||
| 552 | static inline void *dma_alloc_noncoherent(struct device *dev, size_t size, | ||
| 553 | dma_addr_t *dma_handle, gfp_t gfp) | ||
| 554 | { | ||
| 555 | return dma_alloc_attrs(dev, size, dma_handle, gfp, | ||
| 556 | DMA_ATTR_NON_CONSISTENT); | ||
| 557 | } | ||
| 558 | |||
| 559 | static inline void dma_free_noncoherent(struct device *dev, size_t size, | ||
| 560 | void *cpu_addr, dma_addr_t dma_handle) | ||
| 561 | { | ||
| 562 | dma_free_attrs(dev, size, cpu_addr, dma_handle, | ||
| 563 | DMA_ATTR_NON_CONSISTENT); | ||
| 564 | } | ||
| 565 | |||
| 566 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 552 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
| 567 | { | 553 | { |
| 568 | const struct dma_map_ops *ops = get_dma_ops(dev); | 554 | const struct dma_map_ops *ops = get_dma_ops(dev); |
