diff options
Diffstat (limited to 'drivers/ieee1394/dma.c')
-rw-r--r-- | drivers/ieee1394/dma.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c index c68f328e1a29..45d605581922 100644 --- a/drivers/ieee1394/dma.c +++ b/drivers/ieee1394/dma.c | |||
@@ -62,6 +62,9 @@ void dma_prog_region_free(struct dma_prog_region *prog) | |||
62 | 62 | ||
63 | /* dma_region */ | 63 | /* dma_region */ |
64 | 64 | ||
65 | /** | ||
66 | * dma_region_init - clear out all fields but do not allocate anything | ||
67 | */ | ||
65 | void dma_region_init(struct dma_region *dma) | 68 | void dma_region_init(struct dma_region *dma) |
66 | { | 69 | { |
67 | dma->kvirt = NULL; | 70 | dma->kvirt = NULL; |
@@ -71,6 +74,9 @@ void dma_region_init(struct dma_region *dma) | |||
71 | dma->sglist = NULL; | 74 | dma->sglist = NULL; |
72 | } | 75 | } |
73 | 76 | ||
77 | /** | ||
78 | * dma_region_alloc - allocate the buffer and map it to the IOMMU | ||
79 | */ | ||
74 | int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, | 80 | int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, |
75 | struct pci_dev *dev, int direction) | 81 | struct pci_dev *dev, int direction) |
76 | { | 82 | { |
@@ -128,6 +134,9 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, | |||
128 | return -ENOMEM; | 134 | return -ENOMEM; |
129 | } | 135 | } |
130 | 136 | ||
137 | /** | ||
138 | * dma_region_free - unmap and free the buffer | ||
139 | */ | ||
131 | void dma_region_free(struct dma_region *dma) | 140 | void dma_region_free(struct dma_region *dma) |
132 | { | 141 | { |
133 | if (dma->n_dma_pages) { | 142 | if (dma->n_dma_pages) { |
@@ -167,6 +176,12 @@ static inline int dma_region_find(struct dma_region *dma, unsigned long offset, | |||
167 | return i; | 176 | return i; |
168 | } | 177 | } |
169 | 178 | ||
179 | /** | ||
180 | * dma_region_offset_to_bus - get bus address of an offset within a DMA region | ||
181 | * | ||
182 | * Returns the DMA bus address of the byte with the given @offset relative to | ||
183 | * the beginning of the @dma. | ||
184 | */ | ||
170 | dma_addr_t dma_region_offset_to_bus(struct dma_region * dma, | 185 | dma_addr_t dma_region_offset_to_bus(struct dma_region * dma, |
171 | unsigned long offset) | 186 | unsigned long offset) |
172 | { | 187 | { |
@@ -177,6 +192,9 @@ dma_addr_t dma_region_offset_to_bus(struct dma_region * dma, | |||
177 | return sg_dma_address(sg) + rem; | 192 | return sg_dma_address(sg) + rem; |
178 | } | 193 | } |
179 | 194 | ||
195 | /** | ||
196 | * dma_region_sync_for_cpu - sync the CPU's view of the buffer | ||
197 | */ | ||
180 | void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, | 198 | void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, |
181 | unsigned long len) | 199 | unsigned long len) |
182 | { | 200 | { |
@@ -193,6 +211,9 @@ void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, | |||
193 | dma->direction); | 211 | dma->direction); |
194 | } | 212 | } |
195 | 213 | ||
214 | /** | ||
215 | * dma_region_sync_for_device - sync the IO bus' view of the buffer | ||
216 | */ | ||
196 | void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, | 217 | void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, |
197 | unsigned long len) | 218 | unsigned long len) |
198 | { | 219 | { |
@@ -244,6 +265,9 @@ static struct vm_operations_struct dma_region_vm_ops = { | |||
244 | .nopage = dma_region_pagefault, | 265 | .nopage = dma_region_pagefault, |
245 | }; | 266 | }; |
246 | 267 | ||
268 | /** | ||
269 | * dma_region_mmap - map the buffer into a user space process | ||
270 | */ | ||
247 | int dma_region_mmap(struct dma_region *dma, struct file *file, | 271 | int dma_region_mmap(struct dma_region *dma, struct file *file, |
248 | struct vm_area_struct *vma) | 272 | struct vm_area_struct *vma) |
249 | { | 273 | { |