Commit d7ef1533 authored by Konrad Rzeszutek Wilk's avatar Konrad Rzeszutek Wilk

swiotlb: Make swiotlb bookkeeping functions visible in the header file.

We put the functions dealing with the operations on
the SWIOTLB buffer in the header and make those functions non-static.
And also make the functions exported via EXPORT_SYMBOL_GPL.

See "swiotlb: swiotlb: add swiotlb_tbl_map_single library function" for
full description of patchset.

[v2: swiotlb_sync_single_range_for_* no more. Remove usage.]
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tested-by: default avatarAlbert Herranz <albert_herranz@yahoo.es>
parent 22d48269
...@@ -25,6 +25,28 @@ extern int swiotlb_force; ...@@ -25,6 +25,28 @@ extern int swiotlb_force;
extern void swiotlb_init(int verbose); extern void swiotlb_init(int verbose);
extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
/*
* Enumeration for sync targets
*/
enum dma_sync_target {
SYNC_FOR_CPU = 0,
SYNC_FOR_DEVICE = 1,
};
extern void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr,
phys_addr_t phys, size_t size,
enum dma_data_direction dir);
extern void swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr,
size_t size, enum dma_data_direction dir);
extern void swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr,
size_t size, enum dma_data_direction dir,
enum dma_sync_target target);
/* Accessory functions. */
extern void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
enum dma_data_direction dir);
extern void extern void
*swiotlb_alloc_coherent(struct device *hwdev, size_t size, *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
dma_addr_t *dma_handle, gfp_t flags); dma_addr_t *dma_handle, gfp_t flags);
......
...@@ -50,14 +50,6 @@ ...@@ -50,14 +50,6 @@
*/ */
#define IO_TLB_MIN_SLABS ((1<<20) >> IO_TLB_SHIFT) #define IO_TLB_MIN_SLABS ((1<<20) >> IO_TLB_SHIFT)
/*
* Enumeration for sync targets
*/
enum dma_sync_target {
SYNC_FOR_CPU = 0,
SYNC_FOR_DEVICE = 1,
};
int swiotlb_force; int swiotlb_force;
/* /*
...@@ -335,7 +327,7 @@ static int is_swiotlb_buffer(phys_addr_t paddr) ...@@ -335,7 +327,7 @@ static int is_swiotlb_buffer(phys_addr_t paddr)
/* /*
* Bounce: copy the swiotlb buffer back to the original dma location * Bounce: copy the swiotlb buffer back to the original dma location
*/ */
static void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size, void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
enum dma_data_direction dir) enum dma_data_direction dir)
{ {
unsigned long pfn = PFN_DOWN(phys); unsigned long pfn = PFN_DOWN(phys);
...@@ -372,6 +364,7 @@ static void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size, ...@@ -372,6 +364,7 @@ static void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
memcpy(phys_to_virt(phys), dma_addr, size); memcpy(phys_to_virt(phys), dma_addr, size);
} }
} }
EXPORT_SYMBOL_GPL(swiotlb_bounce);
void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr, void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr,
phys_addr_t phys, size_t size, phys_addr_t phys, size_t size,
...@@ -476,6 +469,7 @@ void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr, ...@@ -476,6 +469,7 @@ void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr,
return dma_addr; return dma_addr;
} }
EXPORT_SYMBOL_GPL(swiotlb_tbl_map_single);
/* /*
* Allocates bounce buffer and returns its kernel virtual address. * Allocates bounce buffer and returns its kernel virtual address.
...@@ -493,7 +487,7 @@ map_single(struct device *hwdev, phys_addr_t phys, size_t size, ...@@ -493,7 +487,7 @@ map_single(struct device *hwdev, phys_addr_t phys, size_t size,
/* /*
* dma_addr is the kernel virtual address of the bounce buffer to unmap. * dma_addr is the kernel virtual address of the bounce buffer to unmap.
*/ */
static void void
swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, size_t size, swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, size_t size,
enum dma_data_direction dir) enum dma_data_direction dir)
{ {
...@@ -533,10 +527,12 @@ swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, size_t size, ...@@ -533,10 +527,12 @@ swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, size_t size,
} }
spin_unlock_irqrestore(&io_tlb_lock, flags); spin_unlock_irqrestore(&io_tlb_lock, flags);
} }
EXPORT_SYMBOL_GPL(swiotlb_tbl_unmap_single);
static void void
swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr, size_t size, swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr, size_t size,
enum dma_data_direction dir, int target) enum dma_data_direction dir,
enum dma_sync_target target)
{ {
int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT; int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT;
phys_addr_t phys = io_tlb_orig_addr[index]; phys_addr_t phys = io_tlb_orig_addr[index];
...@@ -560,6 +556,7 @@ swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr, size_t size, ...@@ -560,6 +556,7 @@ swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr, size_t size,
BUG(); BUG();
} }
} }
EXPORT_SYMBOL_GPL(swiotlb_tbl_sync_single);
void * void *
swiotlb_alloc_coherent(struct device *hwdev, size_t size, swiotlb_alloc_coherent(struct device *hwdev, size_t size,
...@@ -748,7 +745,8 @@ EXPORT_SYMBOL_GPL(swiotlb_unmap_page); ...@@ -748,7 +745,8 @@ EXPORT_SYMBOL_GPL(swiotlb_unmap_page);
*/ */
static void static void
swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr, swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr,
size_t size, enum dma_data_direction dir, int target) size_t size, enum dma_data_direction dir,
enum dma_sync_target target)
{ {
phys_addr_t paddr = dma_to_phys(hwdev, dev_addr); phys_addr_t paddr = dma_to_phys(hwdev, dev_addr);
...@@ -877,7 +875,8 @@ EXPORT_SYMBOL(swiotlb_unmap_sg); ...@@ -877,7 +875,8 @@ EXPORT_SYMBOL(swiotlb_unmap_sg);
*/ */
static void static void
swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sgl, swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sgl,
int nelems, enum dma_data_direction dir, int target) int nelems, enum dma_data_direction dir,
enum dma_sync_target target)
{ {
struct scatterlist *sg; struct scatterlist *sg;
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment