msm_iommu_pagetable.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __ARCH_ARM_MACH_MSM_IOMMU_PAGETABLE_H
  13. #define __ARCH_ARM_MACH_MSM_IOMMU_PAGETABLE_H
  14. #define MRC(reg, processor, op1, crn, crm, op2) \
  15. __asm__ __volatile__ ( \
  16. " mrc " #processor "," #op1 ", %0," #crn "," #crm "," #op2 "\n" \
  17. : "=r" (reg))
  18. #define RCP15_PRRR(reg) MRC(reg, p15, 0, c10, c2, 0)
  19. #define RCP15_NMRR(reg) MRC(reg, p15, 0, c10, c2, 1)
  20. #define RCP15_MAIR0(reg) MRC(reg, p15, 0, c10, c2, 0)
  21. #define RCP15_MAIR1(reg) MRC(reg, p15, 0, c10, c2, 1)
  22. struct msm_iommu_pt;
  23. void msm_iommu_pagetable_init(void);
  24. int msm_iommu_pagetable_alloc(struct msm_iommu_pt *pt);
  25. void msm_iommu_pagetable_free(struct msm_iommu_pt *pt);
  26. int msm_iommu_pagetable_map(struct msm_iommu_pt *pt, unsigned long va,
  27. phys_addr_t pa, size_t len, int prot);
  28. size_t msm_iommu_pagetable_unmap(struct msm_iommu_pt *pt, unsigned long va,
  29. size_t len);
  30. int msm_iommu_pagetable_map_range(struct msm_iommu_pt *pt, unsigned int va,
  31. struct scatterlist *sg, unsigned int len, int prot);
  32. void msm_iommu_pagetable_unmap_range(struct msm_iommu_pt *pt, unsigned int va,
  33. unsigned int len);
  34. #endif