ANDROID: GKI: dma-coherent: Expose device base address and size
Allow clients to be able to determine the device base address and size of a dma coherent memory region. This is required for clients that want to explicitly manage that memory. Change-Id: I3e5b721d9d318526422ec26995cc1af7b7f04077 Signed-off-by: Liam Mark <lmark@codeaurora.org> (cherry picked from commit 63585739d1881d987c0c0f06199cf749ad62c6d1) Bug: 155522481 Signed-off-by: Mark Salyzyn <salyzyn@google.com> [saravanak conflict resolution due to file move and Change EXPORT_SYMBOL to EXPORT_SYMBOL_GPL] Signed-off-by: Saravana Kannan <saravanak@google.com>
This commit is contained in:
parent
4ac42c4404
commit
a3c0807605
@ -771,6 +771,10 @@ int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
|
||||
void dma_release_declared_memory(struct device *dev);
|
||||
void *dma_mark_declared_memory_occupied(struct device *dev,
|
||||
dma_addr_t device_addr, size_t size);
|
||||
dma_addr_t dma_get_device_base(struct device *dev,
|
||||
struct dma_coherent_mem *mem);
|
||||
unsigned long dma_get_size(struct dma_coherent_mem *mem);
|
||||
|
||||
#else
|
||||
static inline int
|
||||
dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
|
||||
@ -790,6 +794,17 @@ dma_mark_declared_memory_occupied(struct device *dev,
|
||||
{
|
||||
return ERR_PTR(-EBUSY);
|
||||
}
|
||||
static inline dma_addr_t
|
||||
dma_get_device_base(struct device *dev, struct dma_coherent_mem *mem)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long dma_get_size(struct dma_coherent_mem *mem)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */
|
||||
|
||||
#ifdef CONFIG_HAS_DMA
|
||||
|
@ -29,14 +29,21 @@ static inline struct dma_coherent_mem *dev_get_coherent_memory(struct device *de
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline dma_addr_t dma_get_device_base(struct device *dev,
|
||||
struct dma_coherent_mem * mem)
|
||||
dma_addr_t dma_get_device_base(struct device *dev,
|
||||
struct dma_coherent_mem *mem)
|
||||
{
|
||||
if (mem->use_dev_dma_pfn_offset)
|
||||
return (mem->pfn_base - dev->dma_pfn_offset) << PAGE_SHIFT;
|
||||
else
|
||||
return mem->device_base;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dma_get_device_base);
|
||||
|
||||
unsigned long dma_get_size(struct dma_coherent_mem *mem)
|
||||
{
|
||||
return mem->size << PAGE_SHIFT;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dma_get_size);
|
||||
|
||||
static int dma_init_coherent_memory(
|
||||
phys_addr_t phys_addr, dma_addr_t device_addr, size_t size, int flags,
|
||||
|
Loading…
Reference in New Issue
Block a user