aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFUJITA Tomonori <tomof@acm.org>2008-02-05 01:28:13 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:11 -0500
commitd22a6966b8029913fac37d078ab2403898d94c63 (patch)
treef8bf9155b805781cef04ccb6c8de688ab6ea21e1
parent67ec11cf968241c9ae907f8817b6ac74d4dd71d7 (diff)
iommu sg merging: add accessors for segment_boundary_mask in device_dma_parameters()
This adds new accessors for segment_boundary_mask in device_dma_parameters structure in the same way I did for max_segment_size. So we can easily change where to place struct device_dma_parameters in the future. dma_get_segment boundary returns 0xffffffff if dma_parms in struct device isn't set up properly. 0xffffffff is the default value used in the block layer and the scsi mid layer. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Jens Axboe <jens.axboe@oracle.com> Cc: Greg KH <greg@kroah.com> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/dma-mapping.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index df3a3610caf0..332030709623 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -75,6 +75,21 @@ static inline unsigned int dma_set_max_seg_size(struct device *dev,
75 return -EIO; 75 return -EIO;
76} 76}
77 77
78static inline unsigned long dma_get_seg_boundary(struct device *dev)
79{
80 return dev->dma_parms ?
81 dev->dma_parms->segment_boundary_mask : 0xffffffff;
82}
83
84static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
85{
86 if (dev->dma_parms) {
87 dev->dma_parms->segment_boundary_mask = mask;
88 return 0;
89 } else
90 return -EIO;
91}
92
78/* flags for the coherent memory api */ 93/* flags for the coherent memory api */
79#define DMA_MEMORY_MAP 0x01 94#define DMA_MEMORY_MAP 0x01
80#define DMA_MEMORY_IO 0x02 95#define DMA_MEMORY_IO 0x02