aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/dma-mapping.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-i386/dma-mapping.h')
-rw-r--r--include/asm-i386/dma-mapping.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h
index e56c335f8ef9..9cf20cacf76e 100644
--- a/include/asm-i386/dma-mapping.h
+++ b/include/asm-i386/dma-mapping.h
@@ -6,6 +6,7 @@
6#include <asm/cache.h> 6#include <asm/cache.h>
7#include <asm/io.h> 7#include <asm/io.h>
8#include <asm/scatterlist.h> 8#include <asm/scatterlist.h>
9#include <asm/bug.h>
9 10
10#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 11#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
11#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 12#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
@@ -20,7 +21,9 @@ static inline dma_addr_t
20dma_map_single(struct device *dev, void *ptr, size_t size, 21dma_map_single(struct device *dev, void *ptr, size_t size,
21 enum dma_data_direction direction) 22 enum dma_data_direction direction)
22{ 23{
23 BUG_ON(direction == DMA_NONE); 24 if (direction == DMA_NONE)
25 BUG();
26 WARN_ON(size == 0);
24 flush_write_buffers(); 27 flush_write_buffers();
25 return virt_to_phys(ptr); 28 return virt_to_phys(ptr);
26} 29}
@@ -29,7 +32,8 @@ static inline void
29dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, 32dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
30 enum dma_data_direction direction) 33 enum dma_data_direction direction)
31{ 34{
32 BUG_ON(direction == DMA_NONE); 35 if (direction == DMA_NONE)
36 BUG();
33} 37}
34 38
35static inline int 39static inline int
@@ -38,7 +42,9 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
38{ 42{
39 int i; 43 int i;
40 44
41 BUG_ON(direction == DMA_NONE); 45 if (direction == DMA_NONE)
46 BUG();
47 WARN_ON(nents == 0 || sg[0].length == 0);
42 48
43 for (i = 0; i < nents; i++ ) { 49 for (i = 0; i < nents; i++ ) {
44 BUG_ON(!sg[i].page); 50 BUG_ON(!sg[i].page);
@@ -150,7 +156,7 @@ dma_get_cache_alignment(void)
150{ 156{
151 /* no easy way to get cache size on all x86, so return the 157 /* no easy way to get cache size on all x86, so return the
152 * maximum possible, to be safe */ 158 * maximum possible, to be safe */
153 return (1 << L1_CACHE_SHIFT_MAX); 159 return (1 << INTERNODE_CACHE_SHIFT);
154} 160}
155 161
156#define dma_is_consistent(d) (1) 162#define dma_is_consistent(d) (1)