Olav Haugan | 090614f | 2013-03-22 12:14:18 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 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 | |
| 13 | #ifndef __ARCH_ARM_MACH_MSM_IOMMU_PAGETABLE_H |
| 14 | #define __ARCH_ARM_MACH_MSM_IOMMU_PAGETABLE_H |
| 15 | |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 16 | #define MRC(reg, processor, op1, crn, crm, op2) \ |
| 17 | __asm__ __volatile__ ( \ |
| 18 | " mrc " #processor "," #op1 ", %0," #crn "," #crm "," #op2 "\n" \ |
| 19 | : "=r" (reg)) |
| 20 | |
| 21 | #define RCP15_PRRR(reg) MRC(reg, p15, 0, c10, c2, 0) |
| 22 | #define RCP15_NMRR(reg) MRC(reg, p15, 0, c10, c2, 1) |
| 23 | |
Olav Haugan | 580c07e | 2013-06-17 16:09:22 -0700 | [diff] [blame] | 24 | #define RCP15_MAIR0(reg) MRC(reg, p15, 0, c10, c2, 0) |
| 25 | #define RCP15_MAIR1(reg) MRC(reg, p15, 0, c10, c2, 1) |
| 26 | |
| 27 | struct msm_iommu_pt; |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 28 | |
| 29 | void msm_iommu_pagetable_init(void); |
Olav Haugan | 090614f | 2013-03-22 12:14:18 -0700 | [diff] [blame] | 30 | int msm_iommu_pagetable_alloc(struct msm_iommu_pt *pt); |
| 31 | void msm_iommu_pagetable_free(struct msm_iommu_pt *pt); |
| 32 | int msm_iommu_pagetable_map(struct msm_iommu_pt *pt, unsigned long va, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 33 | phys_addr_t pa, size_t len, int prot); |
Olav Haugan | 090614f | 2013-03-22 12:14:18 -0700 | [diff] [blame] | 34 | size_t msm_iommu_pagetable_unmap(struct msm_iommu_pt *pt, unsigned long va, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 35 | size_t len); |
Olav Haugan | 090614f | 2013-03-22 12:14:18 -0700 | [diff] [blame] | 36 | int msm_iommu_pagetable_map_range(struct msm_iommu_pt *pt, unsigned int va, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 37 | struct scatterlist *sg, unsigned int len, int prot); |
Olav Haugan | 090614f | 2013-03-22 12:14:18 -0700 | [diff] [blame] | 38 | void msm_iommu_pagetable_unmap_range(struct msm_iommu_pt *pt, unsigned int va, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 39 | unsigned int len); |
| 40 | #endif |