• Home
  • Raw
  • Download

Lines Matching refs:buf

86 			      char *buf)  in dmabounce_show()  argument
89 return sprintf(buf, "%lu %lu %lu %lu %lu %lu\n", in dmabounce_show()
108 struct safe_buffer *buf; in alloc_safe_buffer() local
124 buf = kmalloc(sizeof(struct safe_buffer), GFP_ATOMIC); in alloc_safe_buffer()
125 if (buf == NULL) { in alloc_safe_buffer()
130 buf->ptr = ptr; in alloc_safe_buffer()
131 buf->size = size; in alloc_safe_buffer()
132 buf->direction = dir; in alloc_safe_buffer()
133 buf->pool = pool; in alloc_safe_buffer()
136 buf->safe = dma_pool_alloc(pool->pool, GFP_ATOMIC, in alloc_safe_buffer()
137 &buf->safe_dma_addr); in alloc_safe_buffer()
139 buf->safe = dma_alloc_coherent(dev, size, &buf->safe_dma_addr, in alloc_safe_buffer()
143 if (buf->safe == NULL) { in alloc_safe_buffer()
147 kfree(buf); in alloc_safe_buffer()
158 list_add(&buf->node, &device_info->safe_buffers); in alloc_safe_buffer()
161 return buf; in alloc_safe_buffer()
185 free_safe_buffer(struct dmabounce_device_info *device_info, struct safe_buffer *buf) in free_safe_buffer() argument
189 dev_dbg(device_info->dev, "%s(buf=%p)\n", __func__, buf); in free_safe_buffer()
193 list_del(&buf->node); in free_safe_buffer()
197 if (buf->pool) in free_safe_buffer()
198 dma_pool_free(buf->pool->pool, buf->safe, buf->safe_dma_addr); in free_safe_buffer()
200 dma_free_coherent(device_info->dev, buf->size, buf->safe, in free_safe_buffer()
201 buf->safe_dma_addr); in free_safe_buffer()
203 kfree(buf); in free_safe_buffer()
248 struct safe_buffer *buf; in map_single() local
253 buf = alloc_safe_buffer(device_info, ptr, size, dir); in map_single()
254 if (buf == NULL) { in map_single()
261 __func__, buf->ptr, virt_to_dma(dev, buf->ptr), in map_single()
262 buf->safe, buf->safe_dma_addr); in map_single()
267 __func__, ptr, buf->safe, size); in map_single()
268 memcpy(buf->safe, ptr, size); in map_single()
271 return buf->safe_dma_addr; in map_single()
274 static inline void unmap_single(struct device *dev, struct safe_buffer *buf, in unmap_single() argument
278 BUG_ON(buf->size != size); in unmap_single()
279 BUG_ON(buf->direction != dir); in unmap_single()
282 __func__, buf->ptr, virt_to_dma(dev, buf->ptr), in unmap_single()
283 buf->safe, buf->safe_dma_addr); in unmap_single()
289 void *ptr = buf->ptr; in unmap_single()
292 __func__, buf->safe, ptr, size); in unmap_single()
293 memcpy(ptr, buf->safe, size); in unmap_single()
302 free_safe_buffer(dev->archdata.dmabounce, buf); in unmap_single()
351 struct safe_buffer *buf; in dmabounce_unmap_page() local
356 buf = find_safe_buffer_dev(dev, dma_addr, __func__); in dmabounce_unmap_page()
357 if (!buf) { in dmabounce_unmap_page()
362 unmap_single(dev, buf, size, dir, attrs); in dmabounce_unmap_page()
368 struct safe_buffer *buf; in __dmabounce_sync_for_cpu() local
374 buf = find_safe_buffer_dev(dev, addr, __func__); in __dmabounce_sync_for_cpu()
375 if (!buf) in __dmabounce_sync_for_cpu()
378 off = addr - buf->safe_dma_addr; in __dmabounce_sync_for_cpu()
380 BUG_ON(buf->direction != dir); in __dmabounce_sync_for_cpu()
383 __func__, buf->ptr, virt_to_dma(dev, buf->ptr), off, in __dmabounce_sync_for_cpu()
384 buf->safe, buf->safe_dma_addr); in __dmabounce_sync_for_cpu()
390 __func__, buf->safe + off, buf->ptr + off, sz); in __dmabounce_sync_for_cpu()
391 memcpy(buf->ptr + off, buf->safe + off, sz); in __dmabounce_sync_for_cpu()
408 struct safe_buffer *buf; in __dmabounce_sync_for_device() local
414 buf = find_safe_buffer_dev(dev, addr, __func__); in __dmabounce_sync_for_device()
415 if (!buf) in __dmabounce_sync_for_device()
418 off = addr - buf->safe_dma_addr; in __dmabounce_sync_for_device()
420 BUG_ON(buf->direction != dir); in __dmabounce_sync_for_device()
423 __func__, buf->ptr, virt_to_dma(dev, buf->ptr), off, in __dmabounce_sync_for_device()
424 buf->safe, buf->safe_dma_addr); in __dmabounce_sync_for_device()
430 __func__,buf->ptr + off, buf->safe + off, sz); in __dmabounce_sync_for_device()
431 memcpy(buf->safe + off, buf->ptr + off, sz); in __dmabounce_sync_for_device()