aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/iommu.c')
-rw-r--r--arch/powerpc/kernel/iommu.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 45f47c97fd14..1bfa706b96e7 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -565,21 +565,23 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name)
565} 565}
566 566
567/* Creates TCEs for a user provided buffer. The user buffer must be 567/* Creates TCEs for a user provided buffer. The user buffer must be
568 * contiguous real kernel storage (not vmalloc). The address of the buffer 568 * contiguous real kernel storage (not vmalloc). The address passed here
569 * passed here is the kernel (virtual) address of the buffer. The buffer 569 * comprises a page address and offset into that page. The dma_addr_t
570 * need not be page aligned, the dma_addr_t returned will point to the same 570 * returned will point to the same byte within the page as was passed in.
571 * byte within the page as vaddr.
572 */ 571 */
573dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl, 572dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl,
574 void *vaddr, size_t size, unsigned long mask, 573 struct page *page, unsigned long offset, size_t size,
575 enum dma_data_direction direction, struct dma_attrs *attrs) 574 unsigned long mask, enum dma_data_direction direction,
575 struct dma_attrs *attrs)
576{ 576{
577 dma_addr_t dma_handle = DMA_ERROR_CODE; 577 dma_addr_t dma_handle = DMA_ERROR_CODE;
578 void *vaddr;
578 unsigned long uaddr; 579 unsigned long uaddr;
579 unsigned int npages, align; 580 unsigned int npages, align;
580 581
581 BUG_ON(direction == DMA_NONE); 582 BUG_ON(direction == DMA_NONE);
582 583
584 vaddr = page_address(page) + offset;
583 uaddr = (unsigned long)vaddr; 585 uaddr = (unsigned long)vaddr;
584 npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE); 586 npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE);
585 587
@@ -605,9 +607,9 @@ dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
605 return dma_handle; 607 return dma_handle;
606} 608}
607 609
608void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, 610void iommu_unmap_page(struct iommu_table *tbl, dma_addr_t dma_handle,
609 size_t size, enum dma_data_direction direction, 611 size_t size, enum dma_data_direction direction,
610 struct dma_attrs *attrs) 612 struct dma_attrs *attrs)
611{ 613{
612 unsigned int npages; 614 unsigned int npages;
613 615