提交 42d7c5e3 编写于 作者: B Becky Bruce 提交者: Ingo Molnar

swiotlb: change swiotlb_bus_to[phys,virt] prototypes

Add a hwdev argument that is needed on some architectures
in order to access a per-device offset that is taken into
account when producing a physical address (also needed to
get from bus address to virtual address because the physical
address is an intermediate step).

Also make swiotlb_bus_to_virt weak so architectures can
override it.
Signed-off-by: NBecky Bruce <beckyb@kernel.crashing.org>
Acked-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: NKumar Gala <galak@kernel.crashing.org>
Cc: jeremy@goop.org
Cc: ian.campbell@citrix.com
LKML-Reference: <1239199761-22886-8-git-send-email-galak@kernel.crashing.org>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 380d6878
...@@ -28,7 +28,7 @@ dma_addr_t swiotlb_phys_to_bus(struct device *hwdev, phys_addr_t paddr) ...@@ -28,7 +28,7 @@ dma_addr_t swiotlb_phys_to_bus(struct device *hwdev, phys_addr_t paddr)
return paddr; return paddr;
} }
phys_addr_t swiotlb_bus_to_phys(dma_addr_t baddr) phys_addr_t swiotlb_bus_to_phys(struct device *hwdev, dma_addr_t baddr)
{ {
return baddr; return baddr;
} }
......
...@@ -29,7 +29,8 @@ extern void *swiotlb_alloc(unsigned order, unsigned long nslabs); ...@@ -29,7 +29,8 @@ extern void *swiotlb_alloc(unsigned order, unsigned long nslabs);
extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev, extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev,
phys_addr_t address); phys_addr_t address);
extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address); extern phys_addr_t swiotlb_bus_to_phys(struct device *hwdev,
dma_addr_t address);
extern int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size); extern int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size);
......
...@@ -129,7 +129,7 @@ dma_addr_t __weak swiotlb_phys_to_bus(struct device *hwdev, phys_addr_t paddr) ...@@ -129,7 +129,7 @@ dma_addr_t __weak swiotlb_phys_to_bus(struct device *hwdev, phys_addr_t paddr)
return paddr; return paddr;
} }
phys_addr_t __weak swiotlb_bus_to_phys(dma_addr_t baddr) phys_addr_t __weak swiotlb_bus_to_phys(struct device *hwdev, dma_addr_t baddr)
{ {
return baddr; return baddr;
} }
...@@ -140,9 +140,9 @@ static dma_addr_t swiotlb_virt_to_bus(struct device *hwdev, ...@@ -140,9 +140,9 @@ static dma_addr_t swiotlb_virt_to_bus(struct device *hwdev,
return swiotlb_phys_to_bus(hwdev, virt_to_phys(address)); return swiotlb_phys_to_bus(hwdev, virt_to_phys(address));
} }
static void *swiotlb_bus_to_virt(dma_addr_t address) void * __weak swiotlb_bus_to_virt(struct device *hwdev, dma_addr_t address)
{ {
return phys_to_virt(swiotlb_bus_to_phys(address)); return phys_to_virt(swiotlb_bus_to_phys(hwdev, address));
} }
int __weak swiotlb_arch_address_needs_mapping(struct device *hwdev, int __weak swiotlb_arch_address_needs_mapping(struct device *hwdev,
...@@ -691,7 +691,7 @@ EXPORT_SYMBOL_GPL(swiotlb_map_page); ...@@ -691,7 +691,7 @@ EXPORT_SYMBOL_GPL(swiotlb_map_page);
static void unmap_single(struct device *hwdev, dma_addr_t dev_addr, static void unmap_single(struct device *hwdev, dma_addr_t dev_addr,
size_t size, int dir) size_t size, int dir)
{ {
char *dma_addr = swiotlb_bus_to_virt(dev_addr); char *dma_addr = swiotlb_bus_to_virt(hwdev, dev_addr);
BUG_ON(dir == DMA_NONE); BUG_ON(dir == DMA_NONE);
...@@ -728,7 +728,7 @@ static void ...@@ -728,7 +728,7 @@ 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, int dir, int target) size_t size, int dir, int target)
{ {
char *dma_addr = swiotlb_bus_to_virt(dev_addr); char *dma_addr = swiotlb_bus_to_virt(hwdev, dev_addr);
BUG_ON(dir == DMA_NONE); BUG_ON(dir == DMA_NONE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册