diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device.h | 11 | ||||
-rw-r--r-- | include/linux/dma-mapping.h | 15 |
2 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 479c0b31593c..2258d89bf523 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -410,6 +410,15 @@ extern int devres_release_group(struct device *dev, void *id); | |||
410 | extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); | 410 | extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); |
411 | extern void devm_kfree(struct device *dev, void *p); | 411 | extern void devm_kfree(struct device *dev, void *p); |
412 | 412 | ||
413 | struct device_dma_parameters { | ||
414 | /* | ||
415 | * a low level driver may set these to teach IOMMU code about | ||
416 | * sg limitations. | ||
417 | */ | ||
418 | unsigned int max_segment_size; | ||
419 | unsigned long segment_boundary_mask; | ||
420 | }; | ||
421 | |||
413 | struct device { | 422 | struct device { |
414 | struct klist klist_children; | 423 | struct klist klist_children; |
415 | struct klist_node knode_parent; /* node in sibling list */ | 424 | struct klist_node knode_parent; /* node in sibling list */ |
@@ -445,6 +454,8 @@ struct device { | |||
445 | 64 bit addresses for consistent | 454 | 64 bit addresses for consistent |
446 | allocations such descriptors. */ | 455 | allocations such descriptors. */ |
447 | 456 | ||
457 | struct device_dma_parameters *dma_parms; | ||
458 | |||
448 | struct list_head dma_pools; /* dma pools (if dma'ble) */ | 459 | struct list_head dma_pools; /* dma pools (if dma'ble) */ |
449 | 460 | ||
450 | struct dma_coherent_mem *dma_mem; /* internal for coherent mem | 461 | struct dma_coherent_mem *dma_mem; /* internal for coherent mem |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 4470950892be..df3a3610caf0 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -60,6 +60,21 @@ static inline int is_device_dma_capable(struct device *dev) | |||
60 | 60 | ||
61 | extern u64 dma_get_required_mask(struct device *dev); | 61 | extern u64 dma_get_required_mask(struct device *dev); |
62 | 62 | ||
63 | static inline unsigned int dma_get_max_seg_size(struct device *dev) | ||
64 | { | ||
65 | return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536; | ||
66 | } | ||
67 | |||
68 | static inline unsigned int dma_set_max_seg_size(struct device *dev, | ||
69 | unsigned int size) | ||
70 | { | ||
71 | if (dev->dma_parms) { | ||
72 | dev->dma_parms->max_segment_size = size; | ||
73 | return 0; | ||
74 | } else | ||
75 | return -EIO; | ||
76 | } | ||
77 | |||
63 | /* flags for the coherent memory api */ | 78 | /* flags for the coherent memory api */ |
64 | #define DMA_MEMORY_MAP 0x01 | 79 | #define DMA_MEMORY_MAP 0x01 |
65 | #define DMA_MEMORY_IO 0x02 | 80 | #define DMA_MEMORY_IO 0x02 |