Hi,
On 12/6/2012 4:50 AM, benjamin.gaignard@linaro.org wrote:
From: Benjamin Gaignard benjamin.gaignard@linaro.org
<snip>
+/* return physical address in addr */ +static int ion_cma_phys(struct ion_heap *heap, struct ion_buffer *buffer,
ion_phys_addr_t *addr, size_t *len)
+{
- struct device *dev = heap->priv;
- struct ion_cma_buffer_info *info = buffer->priv_virt;
- dev_dbg(dev, "Return buffer %p physical address 0x%x\n", buffer,
virt_to_phys(info->cpu_addr));
- *addr = virt_to_phys(info->cpu_addr);
- *len = buffer->size;
- return 0;
+}
info->handle should give back the physical address so we should be able to use that directly instead of calling virt_to_phys
+struct sg_table *ion_cma_heap_map_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
+{
- struct ion_cma_buffer_info *info = buffer->priv_virt;
- return info->table;
+}
+void ion_cma_heap_unmap_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
+{
- return;
+}
+static int ion_cma_mmap(struct ion_heap *mapper, struct ion_buffer *buffer,
struct vm_area_struct *vma)
+{
- struct device *dev = buffer->heap->priv;
- struct ion_cma_buffer_info *info = buffer->priv_virt;
- return dma_mmap_coherent(dev, vma, info->cpu_addr, info->handle,
buffer->size);
+}
+void *ion_cma_map_kernel(struct ion_heap *heap, struct ion_buffer *buffer) +{
- struct ion_cma_buffer_info *info = buffer->priv_virt;
- /* kernel memory mapping has been done at allocation time */
- return info->cpu_addr;
+}
+static struct ion_heap_ops ion_cma_ops = {
- .allocate = ion_cma_allocate,
- .free = ion_cma_free,
- .map_dma = ion_cma_heap_map_dma,
- .unmap_dma = ion_cma_heap_unmap_dma,
- .phys = ion_cma_phys,
- .map_user = ion_cma_mmap,
- .map_kernel = ion_cma_map_kernel,
+};
Missing the unmap_kernel?
Thanks, Laura