diff options
Diffstat (limited to 'drivers/iommu/omap-iovmm.c')
-rw-r--r-- | drivers/iommu/omap-iovmm.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c index 6edc4ceba197..2e10c3e0a7ae 100644 --- a/drivers/iommu/omap-iovmm.c +++ b/drivers/iommu/omap-iovmm.c | |||
@@ -231,12 +231,14 @@ static struct iovm_struct *__find_iovm_area(struct omap_iommu *obj, | |||
231 | 231 | ||
232 | /** | 232 | /** |
233 | * omap_find_iovm_area - find iovma which includes @da | 233 | * omap_find_iovm_area - find iovma which includes @da |
234 | * @dev: client device | ||
234 | * @da: iommu device virtual address | 235 | * @da: iommu device virtual address |
235 | * | 236 | * |
236 | * Find the existing iovma starting at @da | 237 | * Find the existing iovma starting at @da |
237 | */ | 238 | */ |
238 | struct iovm_struct *omap_find_iovm_area(struct omap_iommu *obj, u32 da) | 239 | struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da) |
239 | { | 240 | { |
241 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
240 | struct iovm_struct *area; | 242 | struct iovm_struct *area; |
241 | 243 | ||
242 | mutex_lock(&obj->mmap_lock); | 244 | mutex_lock(&obj->mmap_lock); |
@@ -343,14 +345,15 @@ static void free_iovm_area(struct omap_iommu *obj, struct iovm_struct *area) | |||
343 | 345 | ||
344 | /** | 346 | /** |
345 | * omap_da_to_va - convert (d) to (v) | 347 | * omap_da_to_va - convert (d) to (v) |
346 | * @obj: objective iommu | 348 | * @dev: client device |
347 | * @da: iommu device virtual address | 349 | * @da: iommu device virtual address |
348 | * @va: mpu virtual address | 350 | * @va: mpu virtual address |
349 | * | 351 | * |
350 | * Returns mpu virtual addr which corresponds to a given device virtual addr | 352 | * Returns mpu virtual addr which corresponds to a given device virtual addr |
351 | */ | 353 | */ |
352 | void *omap_da_to_va(struct omap_iommu *obj, u32 da) | 354 | void *omap_da_to_va(struct device *dev, u32 da) |
353 | { | 355 | { |
356 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
354 | void *va = NULL; | 357 | void *va = NULL; |
355 | struct iovm_struct *area; | 358 | struct iovm_struct *area; |
356 | 359 | ||
@@ -577,16 +580,18 @@ __iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, | |||
577 | 580 | ||
578 | /** | 581 | /** |
579 | * omap_iommu_vmap - (d)-(p)-(v) address mapper | 582 | * omap_iommu_vmap - (d)-(p)-(v) address mapper |
580 | * @obj: objective iommu | 583 | * @domain: iommu domain |
584 | * @dev: client device | ||
581 | * @sgt: address of scatter gather table | 585 | * @sgt: address of scatter gather table |
582 | * @flags: iovma and page property | 586 | * @flags: iovma and page property |
583 | * | 587 | * |
584 | * Creates 1-n-1 mapping with given @sgt and returns @da. | 588 | * Creates 1-n-1 mapping with given @sgt and returns @da. |
585 | * All @sgt element must be io page size aligned. | 589 | * All @sgt element must be io page size aligned. |
586 | */ | 590 | */ |
587 | u32 omap_iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, | 591 | u32 omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da, |
588 | const struct sg_table *sgt, u32 flags) | 592 | const struct sg_table *sgt, u32 flags) |
589 | { | 593 | { |
594 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
590 | size_t bytes; | 595 | size_t bytes; |
591 | void *va = NULL; | 596 | void *va = NULL; |
592 | 597 | ||
@@ -617,15 +622,17 @@ EXPORT_SYMBOL_GPL(omap_iommu_vmap); | |||
617 | 622 | ||
618 | /** | 623 | /** |
619 | * omap_iommu_vunmap - release virtual mapping obtained by 'omap_iommu_vmap()' | 624 | * omap_iommu_vunmap - release virtual mapping obtained by 'omap_iommu_vmap()' |
620 | * @obj: objective iommu | 625 | * @domain: iommu domain |
626 | * @dev: client device | ||
621 | * @da: iommu device virtual address | 627 | * @da: iommu device virtual address |
622 | * | 628 | * |
623 | * Free the iommu virtually contiguous memory area starting at | 629 | * Free the iommu virtually contiguous memory area starting at |
624 | * @da, which was returned by 'omap_iommu_vmap()'. | 630 | * @da, which was returned by 'omap_iommu_vmap()'. |
625 | */ | 631 | */ |
626 | struct sg_table * | 632 | struct sg_table * |
627 | omap_iommu_vunmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da) | 633 | omap_iommu_vunmap(struct iommu_domain *domain, struct device *dev, u32 da) |
628 | { | 634 | { |
635 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
629 | struct sg_table *sgt; | 636 | struct sg_table *sgt; |
630 | /* | 637 | /* |
631 | * 'sgt' is allocated before 'omap_iommu_vmalloc()' is called. | 638 | * 'sgt' is allocated before 'omap_iommu_vmalloc()' is called. |
@@ -642,7 +649,7 @@ EXPORT_SYMBOL_GPL(omap_iommu_vunmap); | |||
642 | 649 | ||
643 | /** | 650 | /** |
644 | * omap_iommu_vmalloc - (d)-(p)-(v) address allocator and mapper | 651 | * omap_iommu_vmalloc - (d)-(p)-(v) address allocator and mapper |
645 | * @obj: objective iommu | 652 | * @dev: client device |
646 | * @da: contiguous iommu virtual memory | 653 | * @da: contiguous iommu virtual memory |
647 | * @bytes: allocation size | 654 | * @bytes: allocation size |
648 | * @flags: iovma and page property | 655 | * @flags: iovma and page property |
@@ -651,9 +658,10 @@ EXPORT_SYMBOL_GPL(omap_iommu_vunmap); | |||
651 | * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set. | 658 | * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set. |
652 | */ | 659 | */ |
653 | u32 | 660 | u32 |
654 | omap_iommu_vmalloc(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, | 661 | omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev, u32 da, |
655 | size_t bytes, u32 flags) | 662 | size_t bytes, u32 flags) |
656 | { | 663 | { |
664 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
657 | void *va; | 665 | void *va; |
658 | struct sg_table *sgt; | 666 | struct sg_table *sgt; |
659 | 667 | ||
@@ -693,15 +701,16 @@ EXPORT_SYMBOL_GPL(omap_iommu_vmalloc); | |||
693 | 701 | ||
694 | /** | 702 | /** |
695 | * omap_iommu_vfree - release memory allocated by 'omap_iommu_vmalloc()' | 703 | * omap_iommu_vfree - release memory allocated by 'omap_iommu_vmalloc()' |
696 | * @obj: objective iommu | 704 | * @dev: client device |
697 | * @da: iommu device virtual address | 705 | * @da: iommu device virtual address |
698 | * | 706 | * |
699 | * Frees the iommu virtually continuous memory area starting at | 707 | * Frees the iommu virtually continuous memory area starting at |
700 | * @da, as obtained from 'omap_iommu_vmalloc()'. | 708 | * @da, as obtained from 'omap_iommu_vmalloc()'. |
701 | */ | 709 | */ |
702 | void omap_iommu_vfree(struct iommu_domain *domain, struct omap_iommu *obj, | 710 | void omap_iommu_vfree(struct iommu_domain *domain, struct device *dev, |
703 | const u32 da) | 711 | const u32 da) |
704 | { | 712 | { |
713 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
705 | struct sg_table *sgt; | 714 | struct sg_table *sgt; |
706 | 715 | ||
707 | sgt = unmap_vm_area(domain, obj, da, vfree, | 716 | sgt = unmap_vm_area(domain, obj, da, vfree, |