summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorVandana Salve <vsalve@nvidia.com>2013-11-09 00:45:58 +0530
committerKrishna Reddy <vdumpa@nvidia.com>2013-11-13 15:57:12 -0800
commit7097bb2b1e8ccbb2c6b92ad3d40c7e294cc2f5be (patch)
treeee20c414b40dd8963a28dbd2ad6067361f7b6bf0 /drivers/base
parent72009667f7620da7578e3a665ffdc69757db09f0 (diff)
drivers: cma: add dma_contiguous_stats()
Added the dma_contiguous_stats() to get CMA stats such as base and size from the given dev bug 1279160 Change-Id: I066e35e7fda140f8613a3d4364464587d3bd251d Signed-off-by: Vandana Salve <vsalve@nvidia.com> Reviewed-on: http://git-master/r/328412 GVS: Gerrit_Virtual_Submit Reviewed-by: Krishna Reddy <vdumpa@nvidia.com> Tested-by: Krishna Reddy <vdumpa@nvidia.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/dma-contiguous.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
index 0ca54421ce97..5e3bf5607746 100644
--- a/drivers/base/dma-contiguous.c
+++ b/drivers/base/dma-contiguous.c
@@ -388,3 +388,23 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
return true;
}
+
+int dma_get_contiguous_stats(struct device *dev,
+ struct dma_contiguous_stats *stats)
+{
+ struct cma *cma = NULL;
+
+ if ((!dev) || !stats)
+ return -EINVAL;
+
+ if (dev->cma_area)
+ cma = dev->cma_area;
+
+ if (!cma)
+ return -EINVAL;
+
+ stats->size = (cma->count) << PAGE_SHIFT;
+ stats->base = (cma->base_pfn) << PAGE_SHIFT;
+
+ return 0;
+}