diff options
author | Ohad Ben-Cohen <ohad@wizery.com> | 2011-08-17 15:57:56 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2011-08-26 05:46:01 -0400 |
commit | 6c32df437c7c5b1fc29d3ca29b0ff44f8dfafc56 (patch) | |
tree | 939d751cbae86291f6b5152cee4615284165fece /drivers/iommu | |
parent | 384fa675795ae3796dbc263e5d0f35b9a27d6462 (diff) |
omap: iommu: omapify 'struct iommu' and exposed API
Prepend 'omap_' to OMAP's 'struct iommu' and exposed API, to prevent
namespace pollution and generally to improve readability of the code
that still uses the driver directly.
Update the users as needed as well.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/omap-iommu-debug.c | 34 | ||||
-rw-r--r-- | drivers/iommu/omap-iommu.c | 146 | ||||
-rw-r--r-- | drivers/iommu/omap-iovmm.c | 62 |
3 files changed, 124 insertions, 118 deletions
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 0f8c8dd55018..9c192e79f806 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c | |||
@@ -32,7 +32,7 @@ static struct dentry *iommu_debug_root; | |||
32 | static ssize_t debug_read_ver(struct file *file, char __user *userbuf, | 32 | static ssize_t debug_read_ver(struct file *file, char __user *userbuf, |
33 | size_t count, loff_t *ppos) | 33 | size_t count, loff_t *ppos) |
34 | { | 34 | { |
35 | u32 ver = iommu_arch_version(); | 35 | u32 ver = omap_iommu_arch_version(); |
36 | char buf[MAXCOLUMN], *p = buf; | 36 | char buf[MAXCOLUMN], *p = buf; |
37 | 37 | ||
38 | p += sprintf(p, "H/W version: %d.%d\n", (ver >> 4) & 0xf , ver & 0xf); | 38 | p += sprintf(p, "H/W version: %d.%d\n", (ver >> 4) & 0xf , ver & 0xf); |
@@ -43,7 +43,7 @@ static ssize_t debug_read_ver(struct file *file, char __user *userbuf, | |||
43 | static ssize_t debug_read_regs(struct file *file, char __user *userbuf, | 43 | static ssize_t debug_read_regs(struct file *file, char __user *userbuf, |
44 | size_t count, loff_t *ppos) | 44 | size_t count, loff_t *ppos) |
45 | { | 45 | { |
46 | struct iommu *obj = file->private_data; | 46 | struct omap_iommu *obj = file->private_data; |
47 | char *p, *buf; | 47 | char *p, *buf; |
48 | ssize_t bytes; | 48 | ssize_t bytes; |
49 | 49 | ||
@@ -54,7 +54,7 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf, | |||
54 | 54 | ||
55 | mutex_lock(&iommu_debug_lock); | 55 | mutex_lock(&iommu_debug_lock); |
56 | 56 | ||
57 | bytes = iommu_dump_ctx(obj, p, count); | 57 | bytes = omap_iommu_dump_ctx(obj, p, count); |
58 | bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes); | 58 | bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes); |
59 | 59 | ||
60 | mutex_unlock(&iommu_debug_lock); | 60 | mutex_unlock(&iommu_debug_lock); |
@@ -66,7 +66,7 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf, | |||
66 | static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, | 66 | static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, |
67 | size_t count, loff_t *ppos) | 67 | size_t count, loff_t *ppos) |
68 | { | 68 | { |
69 | struct iommu *obj = file->private_data; | 69 | struct omap_iommu *obj = file->private_data; |
70 | char *p, *buf; | 70 | char *p, *buf; |
71 | ssize_t bytes, rest; | 71 | ssize_t bytes, rest; |
72 | 72 | ||
@@ -80,7 +80,7 @@ static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, | |||
80 | p += sprintf(p, "%8s %8s\n", "cam:", "ram:"); | 80 | p += sprintf(p, "%8s %8s\n", "cam:", "ram:"); |
81 | p += sprintf(p, "-----------------------------------------\n"); | 81 | p += sprintf(p, "-----------------------------------------\n"); |
82 | rest = count - (p - buf); | 82 | rest = count - (p - buf); |
83 | p += dump_tlb_entries(obj, p, rest); | 83 | p += omap_dump_tlb_entries(obj, p, rest); |
84 | 84 | ||
85 | bytes = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); | 85 | bytes = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); |
86 | 86 | ||
@@ -96,7 +96,7 @@ static ssize_t debug_write_pagetable(struct file *file, | |||
96 | struct iotlb_entry e; | 96 | struct iotlb_entry e; |
97 | struct cr_regs cr; | 97 | struct cr_regs cr; |
98 | int err; | 98 | int err; |
99 | struct iommu *obj = file->private_data; | 99 | struct omap_iommu *obj = file->private_data; |
100 | char buf[MAXCOLUMN], *p = buf; | 100 | char buf[MAXCOLUMN], *p = buf; |
101 | 101 | ||
102 | count = min(count, sizeof(buf)); | 102 | count = min(count, sizeof(buf)); |
@@ -113,8 +113,8 @@ static ssize_t debug_write_pagetable(struct file *file, | |||
113 | return -EINVAL; | 113 | return -EINVAL; |
114 | } | 114 | } |
115 | 115 | ||
116 | iotlb_cr_to_e(&cr, &e); | 116 | omap_iotlb_cr_to_e(&cr, &e); |
117 | err = iopgtable_store_entry(obj, &e); | 117 | err = omap_iopgtable_store_entry(obj, &e); |
118 | if (err) | 118 | if (err) |
119 | dev_err(obj->dev, "%s: fail to store cr\n", __func__); | 119 | dev_err(obj->dev, "%s: fail to store cr\n", __func__); |
120 | 120 | ||
@@ -136,7 +136,7 @@ static ssize_t debug_write_pagetable(struct file *file, | |||
136 | __err; \ | 136 | __err; \ |
137 | }) | 137 | }) |
138 | 138 | ||
139 | static ssize_t dump_ioptable(struct iommu *obj, char *buf, ssize_t len) | 139 | static ssize_t dump_ioptable(struct omap_iommu *obj, char *buf, ssize_t len) |
140 | { | 140 | { |
141 | int i; | 141 | int i; |
142 | u32 *iopgd; | 142 | u32 *iopgd; |
@@ -183,7 +183,7 @@ out: | |||
183 | static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, | 183 | static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, |
184 | size_t count, loff_t *ppos) | 184 | size_t count, loff_t *ppos) |
185 | { | 185 | { |
186 | struct iommu *obj = file->private_data; | 186 | struct omap_iommu *obj = file->private_data; |
187 | char *p, *buf; | 187 | char *p, *buf; |
188 | size_t bytes; | 188 | size_t bytes; |
189 | 189 | ||
@@ -211,7 +211,7 @@ static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, | |||
211 | static ssize_t debug_read_mmap(struct file *file, char __user *userbuf, | 211 | static ssize_t debug_read_mmap(struct file *file, char __user *userbuf, |
212 | size_t count, loff_t *ppos) | 212 | size_t count, loff_t *ppos) |
213 | { | 213 | { |
214 | struct iommu *obj = file->private_data; | 214 | struct omap_iommu *obj = file->private_data; |
215 | char *p, *buf; | 215 | char *p, *buf; |
216 | struct iovm_struct *tmp; | 216 | struct iovm_struct *tmp; |
217 | int uninitialized_var(i); | 217 | int uninitialized_var(i); |
@@ -253,7 +253,7 @@ static ssize_t debug_read_mmap(struct file *file, char __user *userbuf, | |||
253 | static ssize_t debug_read_mem(struct file *file, char __user *userbuf, | 253 | static ssize_t debug_read_mem(struct file *file, char __user *userbuf, |
254 | size_t count, loff_t *ppos) | 254 | size_t count, loff_t *ppos) |
255 | { | 255 | { |
256 | struct iommu *obj = file->private_data; | 256 | struct omap_iommu *obj = file->private_data; |
257 | char *p, *buf; | 257 | char *p, *buf; |
258 | struct iovm_struct *area; | 258 | struct iovm_struct *area; |
259 | ssize_t bytes; | 259 | ssize_t bytes; |
@@ -267,7 +267,7 @@ static ssize_t debug_read_mem(struct file *file, char __user *userbuf, | |||
267 | 267 | ||
268 | mutex_lock(&iommu_debug_lock); | 268 | mutex_lock(&iommu_debug_lock); |
269 | 269 | ||
270 | area = find_iovm_area(obj, (u32)ppos); | 270 | area = omap_find_iovm_area(obj, (u32)ppos); |
271 | if (IS_ERR(area)) { | 271 | if (IS_ERR(area)) { |
272 | bytes = -EINVAL; | 272 | bytes = -EINVAL; |
273 | goto err_out; | 273 | goto err_out; |
@@ -286,7 +286,7 @@ err_out: | |||
286 | static ssize_t debug_write_mem(struct file *file, const char __user *userbuf, | 286 | static ssize_t debug_write_mem(struct file *file, const char __user *userbuf, |
287 | size_t count, loff_t *ppos) | 287 | size_t count, loff_t *ppos) |
288 | { | 288 | { |
289 | struct iommu *obj = file->private_data; | 289 | struct omap_iommu *obj = file->private_data; |
290 | struct iovm_struct *area; | 290 | struct iovm_struct *area; |
291 | char *p, *buf; | 291 | char *p, *buf; |
292 | 292 | ||
@@ -304,7 +304,7 @@ static ssize_t debug_write_mem(struct file *file, const char __user *userbuf, | |||
304 | goto err_out; | 304 | goto err_out; |
305 | } | 305 | } |
306 | 306 | ||
307 | area = find_iovm_area(obj, (u32)ppos); | 307 | area = omap_find_iovm_area(obj, (u32)ppos); |
308 | if (IS_ERR(area)) { | 308 | if (IS_ERR(area)) { |
309 | count = -EINVAL; | 309 | count = -EINVAL; |
310 | goto err_out; | 310 | goto err_out; |
@@ -360,7 +360,7 @@ DEBUG_FOPS(mem); | |||
360 | static int iommu_debug_register(struct device *dev, void *data) | 360 | static int iommu_debug_register(struct device *dev, void *data) |
361 | { | 361 | { |
362 | struct platform_device *pdev = to_platform_device(dev); | 362 | struct platform_device *pdev = to_platform_device(dev); |
363 | struct iommu *obj = platform_get_drvdata(pdev); | 363 | struct omap_iommu *obj = platform_get_drvdata(pdev); |
364 | struct dentry *d, *parent; | 364 | struct dentry *d, *parent; |
365 | 365 | ||
366 | if (!obj || !obj->dev) | 366 | if (!obj || !obj->dev) |
@@ -396,7 +396,7 @@ static int __init iommu_debug_init(void) | |||
396 | return -ENOMEM; | 396 | return -ENOMEM; |
397 | iommu_debug_root = d; | 397 | iommu_debug_root = d; |
398 | 398 | ||
399 | err = foreach_iommu_device(d, iommu_debug_register); | 399 | err = omap_foreach_iommu_device(d, iommu_debug_register); |
400 | if (err) | 400 | if (err) |
401 | goto err_out; | 401 | goto err_out; |
402 | return 0; | 402 | return 0; |
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index d0f28e73be67..dad45ab8cce3 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c | |||
@@ -42,7 +42,7 @@ | |||
42 | */ | 42 | */ |
43 | struct omap_iommu_domain { | 43 | struct omap_iommu_domain { |
44 | u32 *pgtable; | 44 | u32 *pgtable; |
45 | struct iommu *iommu_dev; | 45 | struct omap_iommu *iommu_dev; |
46 | spinlock_t lock; | 46 | spinlock_t lock; |
47 | }; | 47 | }; |
48 | 48 | ||
@@ -53,13 +53,13 @@ static struct platform_driver omap_iommu_driver; | |||
53 | static struct kmem_cache *iopte_cachep; | 53 | static struct kmem_cache *iopte_cachep; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * install_iommu_arch - Install archtecure specific iommu functions | 56 | * omap_install_iommu_arch - Install archtecure specific iommu functions |
57 | * @ops: a pointer to architecture specific iommu functions | 57 | * @ops: a pointer to architecture specific iommu functions |
58 | * | 58 | * |
59 | * There are several kind of iommu algorithm(tlb, pagetable) among | 59 | * There are several kind of iommu algorithm(tlb, pagetable) among |
60 | * omap series. This interface installs such an iommu algorighm. | 60 | * omap series. This interface installs such an iommu algorighm. |
61 | **/ | 61 | **/ |
62 | int install_iommu_arch(const struct iommu_functions *ops) | 62 | int omap_install_iommu_arch(const struct iommu_functions *ops) |
63 | { | 63 | { |
64 | if (arch_iommu) | 64 | if (arch_iommu) |
65 | return -EBUSY; | 65 | return -EBUSY; |
@@ -67,53 +67,53 @@ int install_iommu_arch(const struct iommu_functions *ops) | |||
67 | arch_iommu = ops; | 67 | arch_iommu = ops; |
68 | return 0; | 68 | return 0; |
69 | } | 69 | } |
70 | EXPORT_SYMBOL_GPL(install_iommu_arch); | 70 | EXPORT_SYMBOL_GPL(omap_install_iommu_arch); |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * uninstall_iommu_arch - Uninstall archtecure specific iommu functions | 73 | * omap_uninstall_iommu_arch - Uninstall archtecure specific iommu functions |
74 | * @ops: a pointer to architecture specific iommu functions | 74 | * @ops: a pointer to architecture specific iommu functions |
75 | * | 75 | * |
76 | * This interface uninstalls the iommu algorighm installed previously. | 76 | * This interface uninstalls the iommu algorighm installed previously. |
77 | **/ | 77 | **/ |
78 | void uninstall_iommu_arch(const struct iommu_functions *ops) | 78 | void omap_uninstall_iommu_arch(const struct iommu_functions *ops) |
79 | { | 79 | { |
80 | if (arch_iommu != ops) | 80 | if (arch_iommu != ops) |
81 | pr_err("%s: not your arch\n", __func__); | 81 | pr_err("%s: not your arch\n", __func__); |
82 | 82 | ||
83 | arch_iommu = NULL; | 83 | arch_iommu = NULL; |
84 | } | 84 | } |
85 | EXPORT_SYMBOL_GPL(uninstall_iommu_arch); | 85 | EXPORT_SYMBOL_GPL(omap_uninstall_iommu_arch); |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * iommu_save_ctx - Save registers for pm off-mode support | 88 | * omap_iommu_save_ctx - Save registers for pm off-mode support |
89 | * @obj: target iommu | 89 | * @obj: target iommu |
90 | **/ | 90 | **/ |
91 | void iommu_save_ctx(struct iommu *obj) | 91 | void omap_iommu_save_ctx(struct omap_iommu *obj) |
92 | { | 92 | { |
93 | arch_iommu->save_ctx(obj); | 93 | arch_iommu->save_ctx(obj); |
94 | } | 94 | } |
95 | EXPORT_SYMBOL_GPL(iommu_save_ctx); | 95 | EXPORT_SYMBOL_GPL(omap_iommu_save_ctx); |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * iommu_restore_ctx - Restore registers for pm off-mode support | 98 | * omap_iommu_restore_ctx - Restore registers for pm off-mode support |
99 | * @obj: target iommu | 99 | * @obj: target iommu |
100 | **/ | 100 | **/ |
101 | void iommu_restore_ctx(struct iommu *obj) | 101 | void omap_iommu_restore_ctx(struct omap_iommu *obj) |
102 | { | 102 | { |
103 | arch_iommu->restore_ctx(obj); | 103 | arch_iommu->restore_ctx(obj); |
104 | } | 104 | } |
105 | EXPORT_SYMBOL_GPL(iommu_restore_ctx); | 105 | EXPORT_SYMBOL_GPL(omap_iommu_restore_ctx); |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * iommu_arch_version - Return running iommu arch version | 108 | * omap_iommu_arch_version - Return running iommu arch version |
109 | **/ | 109 | **/ |
110 | u32 iommu_arch_version(void) | 110 | u32 omap_iommu_arch_version(void) |
111 | { | 111 | { |
112 | return arch_iommu->version; | 112 | return arch_iommu->version; |
113 | } | 113 | } |
114 | EXPORT_SYMBOL_GPL(iommu_arch_version); | 114 | EXPORT_SYMBOL_GPL(omap_iommu_arch_version); |
115 | 115 | ||
116 | static int iommu_enable(struct iommu *obj) | 116 | static int iommu_enable(struct omap_iommu *obj) |
117 | { | 117 | { |
118 | int err; | 118 | int err; |
119 | 119 | ||
@@ -131,7 +131,7 @@ static int iommu_enable(struct iommu *obj) | |||
131 | return err; | 131 | return err; |
132 | } | 132 | } |
133 | 133 | ||
134 | static void iommu_disable(struct iommu *obj) | 134 | static void iommu_disable(struct omap_iommu *obj) |
135 | { | 135 | { |
136 | if (!obj) | 136 | if (!obj) |
137 | return; | 137 | return; |
@@ -146,13 +146,13 @@ static void iommu_disable(struct iommu *obj) | |||
146 | /* | 146 | /* |
147 | * TLB operations | 147 | * TLB operations |
148 | */ | 148 | */ |
149 | void iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e) | 149 | void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e) |
150 | { | 150 | { |
151 | BUG_ON(!cr || !e); | 151 | BUG_ON(!cr || !e); |
152 | 152 | ||
153 | arch_iommu->cr_to_e(cr, e); | 153 | arch_iommu->cr_to_e(cr, e); |
154 | } | 154 | } |
155 | EXPORT_SYMBOL_GPL(iotlb_cr_to_e); | 155 | EXPORT_SYMBOL_GPL(omap_iotlb_cr_to_e); |
156 | 156 | ||
157 | static inline int iotlb_cr_valid(struct cr_regs *cr) | 157 | static inline int iotlb_cr_valid(struct cr_regs *cr) |
158 | { | 158 | { |
@@ -162,7 +162,7 @@ static inline int iotlb_cr_valid(struct cr_regs *cr) | |||
162 | return arch_iommu->cr_valid(cr); | 162 | return arch_iommu->cr_valid(cr); |
163 | } | 163 | } |
164 | 164 | ||
165 | static inline struct cr_regs *iotlb_alloc_cr(struct iommu *obj, | 165 | static inline struct cr_regs *iotlb_alloc_cr(struct omap_iommu *obj, |
166 | struct iotlb_entry *e) | 166 | struct iotlb_entry *e) |
167 | { | 167 | { |
168 | if (!e) | 168 | if (!e) |
@@ -181,12 +181,12 @@ static u32 get_iopte_attr(struct iotlb_entry *e) | |||
181 | return arch_iommu->get_pte_attr(e); | 181 | return arch_iommu->get_pte_attr(e); |
182 | } | 182 | } |
183 | 183 | ||
184 | static u32 iommu_report_fault(struct iommu *obj, u32 *da) | 184 | static u32 iommu_report_fault(struct omap_iommu *obj, u32 *da) |
185 | { | 185 | { |
186 | return arch_iommu->fault_isr(obj, da); | 186 | return arch_iommu->fault_isr(obj, da); |
187 | } | 187 | } |
188 | 188 | ||
189 | static void iotlb_lock_get(struct iommu *obj, struct iotlb_lock *l) | 189 | static void iotlb_lock_get(struct omap_iommu *obj, struct iotlb_lock *l) |
190 | { | 190 | { |
191 | u32 val; | 191 | u32 val; |
192 | 192 | ||
@@ -197,7 +197,7 @@ static void iotlb_lock_get(struct iommu *obj, struct iotlb_lock *l) | |||
197 | 197 | ||
198 | } | 198 | } |
199 | 199 | ||
200 | static void iotlb_lock_set(struct iommu *obj, struct iotlb_lock *l) | 200 | static void iotlb_lock_set(struct omap_iommu *obj, struct iotlb_lock *l) |
201 | { | 201 | { |
202 | u32 val; | 202 | u32 val; |
203 | 203 | ||
@@ -207,12 +207,12 @@ static void iotlb_lock_set(struct iommu *obj, struct iotlb_lock *l) | |||
207 | iommu_write_reg(obj, val, MMU_LOCK); | 207 | iommu_write_reg(obj, val, MMU_LOCK); |
208 | } | 208 | } |
209 | 209 | ||
210 | static void iotlb_read_cr(struct iommu *obj, struct cr_regs *cr) | 210 | static void iotlb_read_cr(struct omap_iommu *obj, struct cr_regs *cr) |
211 | { | 211 | { |
212 | arch_iommu->tlb_read_cr(obj, cr); | 212 | arch_iommu->tlb_read_cr(obj, cr); |
213 | } | 213 | } |
214 | 214 | ||
215 | static void iotlb_load_cr(struct iommu *obj, struct cr_regs *cr) | 215 | static void iotlb_load_cr(struct omap_iommu *obj, struct cr_regs *cr) |
216 | { | 216 | { |
217 | arch_iommu->tlb_load_cr(obj, cr); | 217 | arch_iommu->tlb_load_cr(obj, cr); |
218 | 218 | ||
@@ -226,7 +226,7 @@ static void iotlb_load_cr(struct iommu *obj, struct cr_regs *cr) | |||
226 | * @cr: contents of cam and ram register | 226 | * @cr: contents of cam and ram register |
227 | * @buf: output buffer | 227 | * @buf: output buffer |
228 | **/ | 228 | **/ |
229 | static inline ssize_t iotlb_dump_cr(struct iommu *obj, struct cr_regs *cr, | 229 | static inline ssize_t iotlb_dump_cr(struct omap_iommu *obj, struct cr_regs *cr, |
230 | char *buf) | 230 | char *buf) |
231 | { | 231 | { |
232 | BUG_ON(!cr || !buf); | 232 | BUG_ON(!cr || !buf); |
@@ -235,7 +235,7 @@ static inline ssize_t iotlb_dump_cr(struct iommu *obj, struct cr_regs *cr, | |||
235 | } | 235 | } |
236 | 236 | ||
237 | /* only used in iotlb iteration for-loop */ | 237 | /* only used in iotlb iteration for-loop */ |
238 | static struct cr_regs __iotlb_read_cr(struct iommu *obj, int n) | 238 | static struct cr_regs __iotlb_read_cr(struct omap_iommu *obj, int n) |
239 | { | 239 | { |
240 | struct cr_regs cr; | 240 | struct cr_regs cr; |
241 | struct iotlb_lock l; | 241 | struct iotlb_lock l; |
@@ -254,7 +254,7 @@ static struct cr_regs __iotlb_read_cr(struct iommu *obj, int n) | |||
254 | * @e: an iommu tlb entry info | 254 | * @e: an iommu tlb entry info |
255 | **/ | 255 | **/ |
256 | #ifdef PREFETCH_IOTLB | 256 | #ifdef PREFETCH_IOTLB |
257 | static int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) | 257 | static int load_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e) |
258 | { | 258 | { |
259 | int err = 0; | 259 | int err = 0; |
260 | struct iotlb_lock l; | 260 | struct iotlb_lock l; |
@@ -313,14 +313,14 @@ out: | |||
313 | 313 | ||
314 | #else /* !PREFETCH_IOTLB */ | 314 | #else /* !PREFETCH_IOTLB */ |
315 | 315 | ||
316 | static int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) | 316 | static int load_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e) |
317 | { | 317 | { |
318 | return 0; | 318 | return 0; |
319 | } | 319 | } |
320 | 320 | ||
321 | #endif /* !PREFETCH_IOTLB */ | 321 | #endif /* !PREFETCH_IOTLB */ |
322 | 322 | ||
323 | static int prefetch_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) | 323 | static int prefetch_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e) |
324 | { | 324 | { |
325 | return load_iotlb_entry(obj, e); | 325 | return load_iotlb_entry(obj, e); |
326 | } | 326 | } |
@@ -332,7 +332,7 @@ static int prefetch_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) | |||
332 | * | 332 | * |
333 | * Clear an iommu tlb entry which includes 'da' address. | 333 | * Clear an iommu tlb entry which includes 'da' address. |
334 | **/ | 334 | **/ |
335 | static void flush_iotlb_page(struct iommu *obj, u32 da) | 335 | static void flush_iotlb_page(struct omap_iommu *obj, u32 da) |
336 | { | 336 | { |
337 | int i; | 337 | int i; |
338 | struct cr_regs cr; | 338 | struct cr_regs cr; |
@@ -366,7 +366,7 @@ static void flush_iotlb_page(struct iommu *obj, u32 da) | |||
366 | * flush_iotlb_all - Clear all iommu tlb entries | 366 | * flush_iotlb_all - Clear all iommu tlb entries |
367 | * @obj: target iommu | 367 | * @obj: target iommu |
368 | **/ | 368 | **/ |
369 | static void flush_iotlb_all(struct iommu *obj) | 369 | static void flush_iotlb_all(struct omap_iommu *obj) |
370 | { | 370 | { |
371 | struct iotlb_lock l; | 371 | struct iotlb_lock l; |
372 | 372 | ||
@@ -383,7 +383,7 @@ static void flush_iotlb_all(struct iommu *obj) | |||
383 | 383 | ||
384 | #if defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE) | 384 | #if defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE) |
385 | 385 | ||
386 | ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t bytes) | 386 | ssize_t omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t bytes) |
387 | { | 387 | { |
388 | if (!obj || !buf) | 388 | if (!obj || !buf) |
389 | return -EINVAL; | 389 | return -EINVAL; |
@@ -396,9 +396,10 @@ ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t bytes) | |||
396 | 396 | ||
397 | return bytes; | 397 | return bytes; |
398 | } | 398 | } |
399 | EXPORT_SYMBOL_GPL(iommu_dump_ctx); | 399 | EXPORT_SYMBOL_GPL(omap_iommu_dump_ctx); |
400 | 400 | ||
401 | static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs, int num) | 401 | static int |
402 | __dump_tlb_entries(struct omap_iommu *obj, struct cr_regs *crs, int num) | ||
402 | { | 403 | { |
403 | int i; | 404 | int i; |
404 | struct iotlb_lock saved; | 405 | struct iotlb_lock saved; |
@@ -421,11 +422,11 @@ static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs, int num) | |||
421 | } | 422 | } |
422 | 423 | ||
423 | /** | 424 | /** |
424 | * dump_tlb_entries - dump cr arrays to given buffer | 425 | * omap_dump_tlb_entries - dump cr arrays to given buffer |
425 | * @obj: target iommu | 426 | * @obj: target iommu |
426 | * @buf: output buffer | 427 | * @buf: output buffer |
427 | **/ | 428 | **/ |
428 | size_t dump_tlb_entries(struct iommu *obj, char *buf, ssize_t bytes) | 429 | size_t omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t bytes) |
429 | { | 430 | { |
430 | int i, num; | 431 | int i, num; |
431 | struct cr_regs *cr; | 432 | struct cr_regs *cr; |
@@ -445,14 +446,14 @@ size_t dump_tlb_entries(struct iommu *obj, char *buf, ssize_t bytes) | |||
445 | 446 | ||
446 | return p - buf; | 447 | return p - buf; |
447 | } | 448 | } |
448 | EXPORT_SYMBOL_GPL(dump_tlb_entries); | 449 | EXPORT_SYMBOL_GPL(omap_dump_tlb_entries); |
449 | 450 | ||
450 | int foreach_iommu_device(void *data, int (*fn)(struct device *, void *)) | 451 | int omap_foreach_iommu_device(void *data, int (*fn)(struct device *, void *)) |
451 | { | 452 | { |
452 | return driver_for_each_device(&omap_iommu_driver.driver, | 453 | return driver_for_each_device(&omap_iommu_driver.driver, |
453 | NULL, data, fn); | 454 | NULL, data, fn); |
454 | } | 455 | } |
455 | EXPORT_SYMBOL_GPL(foreach_iommu_device); | 456 | EXPORT_SYMBOL_GPL(omap_foreach_iommu_device); |
456 | 457 | ||
457 | #endif /* CONFIG_OMAP_IOMMU_DEBUG_MODULE */ | 458 | #endif /* CONFIG_OMAP_IOMMU_DEBUG_MODULE */ |
458 | 459 | ||
@@ -485,7 +486,7 @@ static void iopte_free(u32 *iopte) | |||
485 | kmem_cache_free(iopte_cachep, iopte); | 486 | kmem_cache_free(iopte_cachep, iopte); |
486 | } | 487 | } |
487 | 488 | ||
488 | static u32 *iopte_alloc(struct iommu *obj, u32 *iopgd, u32 da) | 489 | static u32 *iopte_alloc(struct omap_iommu *obj, u32 *iopgd, u32 da) |
489 | { | 490 | { |
490 | u32 *iopte; | 491 | u32 *iopte; |
491 | 492 | ||
@@ -523,7 +524,7 @@ pte_ready: | |||
523 | return iopte; | 524 | return iopte; |
524 | } | 525 | } |
525 | 526 | ||
526 | static int iopgd_alloc_section(struct iommu *obj, u32 da, u32 pa, u32 prot) | 527 | static int iopgd_alloc_section(struct omap_iommu *obj, u32 da, u32 pa, u32 prot) |
527 | { | 528 | { |
528 | u32 *iopgd = iopgd_offset(obj, da); | 529 | u32 *iopgd = iopgd_offset(obj, da); |
529 | 530 | ||
@@ -538,7 +539,7 @@ static int iopgd_alloc_section(struct iommu *obj, u32 da, u32 pa, u32 prot) | |||
538 | return 0; | 539 | return 0; |
539 | } | 540 | } |
540 | 541 | ||
541 | static int iopgd_alloc_super(struct iommu *obj, u32 da, u32 pa, u32 prot) | 542 | static int iopgd_alloc_super(struct omap_iommu *obj, u32 da, u32 pa, u32 prot) |
542 | { | 543 | { |
543 | u32 *iopgd = iopgd_offset(obj, da); | 544 | u32 *iopgd = iopgd_offset(obj, da); |
544 | int i; | 545 | int i; |
@@ -555,7 +556,7 @@ static int iopgd_alloc_super(struct iommu *obj, u32 da, u32 pa, u32 prot) | |||
555 | return 0; | 556 | return 0; |
556 | } | 557 | } |
557 | 558 | ||
558 | static int iopte_alloc_page(struct iommu *obj, u32 da, u32 pa, u32 prot) | 559 | static int iopte_alloc_page(struct omap_iommu *obj, u32 da, u32 pa, u32 prot) |
559 | { | 560 | { |
560 | u32 *iopgd = iopgd_offset(obj, da); | 561 | u32 *iopgd = iopgd_offset(obj, da); |
561 | u32 *iopte = iopte_alloc(obj, iopgd, da); | 562 | u32 *iopte = iopte_alloc(obj, iopgd, da); |
@@ -572,7 +573,7 @@ static int iopte_alloc_page(struct iommu *obj, u32 da, u32 pa, u32 prot) | |||
572 | return 0; | 573 | return 0; |
573 | } | 574 | } |
574 | 575 | ||
575 | static int iopte_alloc_large(struct iommu *obj, u32 da, u32 pa, u32 prot) | 576 | static int iopte_alloc_large(struct omap_iommu *obj, u32 da, u32 pa, u32 prot) |
576 | { | 577 | { |
577 | u32 *iopgd = iopgd_offset(obj, da); | 578 | u32 *iopgd = iopgd_offset(obj, da); |
578 | u32 *iopte = iopte_alloc(obj, iopgd, da); | 579 | u32 *iopte = iopte_alloc(obj, iopgd, da); |
@@ -593,9 +594,10 @@ static int iopte_alloc_large(struct iommu *obj, u32 da, u32 pa, u32 prot) | |||
593 | return 0; | 594 | return 0; |
594 | } | 595 | } |
595 | 596 | ||
596 | static int iopgtable_store_entry_core(struct iommu *obj, struct iotlb_entry *e) | 597 | static int |
598 | iopgtable_store_entry_core(struct omap_iommu *obj, struct iotlb_entry *e) | ||
597 | { | 599 | { |
598 | int (*fn)(struct iommu *, u32, u32, u32); | 600 | int (*fn)(struct omap_iommu *, u32, u32, u32); |
599 | u32 prot; | 601 | u32 prot; |
600 | int err; | 602 | int err; |
601 | 603 | ||
@@ -631,11 +633,11 @@ static int iopgtable_store_entry_core(struct iommu *obj, struct iotlb_entry *e) | |||
631 | } | 633 | } |
632 | 634 | ||
633 | /** | 635 | /** |
634 | * iopgtable_store_entry - Make an iommu pte entry | 636 | * omap_iopgtable_store_entry - Make an iommu pte entry |
635 | * @obj: target iommu | 637 | * @obj: target iommu |
636 | * @e: an iommu tlb entry info | 638 | * @e: an iommu tlb entry info |
637 | **/ | 639 | **/ |
638 | int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e) | 640 | int omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e) |
639 | { | 641 | { |
640 | int err; | 642 | int err; |
641 | 643 | ||
@@ -645,7 +647,7 @@ int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e) | |||
645 | prefetch_iotlb_entry(obj, e); | 647 | prefetch_iotlb_entry(obj, e); |
646 | return err; | 648 | return err; |
647 | } | 649 | } |
648 | EXPORT_SYMBOL_GPL(iopgtable_store_entry); | 650 | EXPORT_SYMBOL_GPL(omap_iopgtable_store_entry); |
649 | 651 | ||
650 | /** | 652 | /** |
651 | * iopgtable_lookup_entry - Lookup an iommu pte entry | 653 | * iopgtable_lookup_entry - Lookup an iommu pte entry |
@@ -670,7 +672,7 @@ out: | |||
670 | *ppte = iopte; | 672 | *ppte = iopte; |
671 | } | 673 | } |
672 | 674 | ||
673 | static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da) | 675 | static size_t iopgtable_clear_entry_core(struct omap_iommu *obj, u32 da) |
674 | { | 676 | { |
675 | size_t bytes; | 677 | size_t bytes; |
676 | u32 *iopgd = iopgd_offset(obj, da); | 678 | u32 *iopgd = iopgd_offset(obj, da); |
@@ -723,7 +725,7 @@ out: | |||
723 | * @obj: target iommu | 725 | * @obj: target iommu |
724 | * @da: iommu device virtual address | 726 | * @da: iommu device virtual address |
725 | **/ | 727 | **/ |
726 | static size_t iopgtable_clear_entry(struct iommu *obj, u32 da) | 728 | static size_t iopgtable_clear_entry(struct omap_iommu *obj, u32 da) |
727 | { | 729 | { |
728 | size_t bytes; | 730 | size_t bytes; |
729 | 731 | ||
@@ -737,7 +739,7 @@ static size_t iopgtable_clear_entry(struct iommu *obj, u32 da) | |||
737 | return bytes; | 739 | return bytes; |
738 | } | 740 | } |
739 | 741 | ||
740 | static void iopgtable_clear_entry_all(struct iommu *obj) | 742 | static void iopgtable_clear_entry_all(struct omap_iommu *obj) |
741 | { | 743 | { |
742 | int i; | 744 | int i; |
743 | 745 | ||
@@ -772,7 +774,7 @@ static irqreturn_t iommu_fault_handler(int irq, void *data) | |||
772 | { | 774 | { |
773 | u32 da, errs; | 775 | u32 da, errs; |
774 | u32 *iopgd, *iopte; | 776 | u32 *iopgd, *iopte; |
775 | struct iommu *obj = data; | 777 | struct omap_iommu *obj = data; |
776 | 778 | ||
777 | if (!obj->refcount) | 779 | if (!obj->refcount) |
778 | return IRQ_NONE; | 780 | return IRQ_NONE; |
@@ -808,7 +810,7 @@ static irqreturn_t iommu_fault_handler(int irq, void *data) | |||
808 | 810 | ||
809 | static int device_match_by_alias(struct device *dev, void *data) | 811 | static int device_match_by_alias(struct device *dev, void *data) |
810 | { | 812 | { |
811 | struct iommu *obj = to_iommu(dev); | 813 | struct omap_iommu *obj = to_iommu(dev); |
812 | const char *name = data; | 814 | const char *name = data; |
813 | 815 | ||
814 | pr_debug("%s: %s %s\n", __func__, obj->name, name); | 816 | pr_debug("%s: %s %s\n", __func__, obj->name, name); |
@@ -842,10 +844,10 @@ EXPORT_SYMBOL_GPL(omap_find_iommu_device); | |||
842 | * @dev: target omap iommu device | 844 | * @dev: target omap iommu device |
843 | * @iopgd: page table | 845 | * @iopgd: page table |
844 | **/ | 846 | **/ |
845 | static struct iommu *omap_iommu_attach(struct device *dev, u32 *iopgd) | 847 | static struct omap_iommu *omap_iommu_attach(struct device *dev, u32 *iopgd) |
846 | { | 848 | { |
847 | int err = -ENOMEM; | 849 | int err = -ENOMEM; |
848 | struct iommu *obj = to_iommu(dev); | 850 | struct omap_iommu *obj = to_iommu(dev); |
849 | 851 | ||
850 | spin_lock(&obj->iommu_lock); | 852 | spin_lock(&obj->iommu_lock); |
851 | 853 | ||
@@ -883,7 +885,7 @@ err_enable: | |||
883 | * omap_iommu_detach - release iommu device | 885 | * omap_iommu_detach - release iommu device |
884 | * @obj: target iommu | 886 | * @obj: target iommu |
885 | **/ | 887 | **/ |
886 | static void omap_iommu_detach(struct iommu *obj) | 888 | static void omap_iommu_detach(struct omap_iommu *obj) |
887 | { | 889 | { |
888 | if (!obj || IS_ERR(obj)) | 890 | if (!obj || IS_ERR(obj)) |
889 | return; | 891 | return; |
@@ -902,13 +904,13 @@ static void omap_iommu_detach(struct iommu *obj) | |||
902 | dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name); | 904 | dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name); |
903 | } | 905 | } |
904 | 906 | ||
905 | int iommu_set_isr(const char *name, | 907 | int omap_iommu_set_isr(const char *name, |
906 | int (*isr)(struct iommu *obj, u32 da, u32 iommu_errs, | 908 | int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs, |
907 | void *priv), | 909 | void *priv), |
908 | void *isr_priv) | 910 | void *isr_priv) |
909 | { | 911 | { |
910 | struct device *dev; | 912 | struct device *dev; |
911 | struct iommu *obj; | 913 | struct omap_iommu *obj; |
912 | 914 | ||
913 | dev = driver_find_device(&omap_iommu_driver.driver, NULL, (void *)name, | 915 | dev = driver_find_device(&omap_iommu_driver.driver, NULL, (void *)name, |
914 | device_match_by_alias); | 916 | device_match_by_alias); |
@@ -927,7 +929,7 @@ int iommu_set_isr(const char *name, | |||
927 | 929 | ||
928 | return 0; | 930 | return 0; |
929 | } | 931 | } |
930 | EXPORT_SYMBOL_GPL(iommu_set_isr); | 932 | EXPORT_SYMBOL_GPL(omap_iommu_set_isr); |
931 | 933 | ||
932 | /* | 934 | /* |
933 | * OMAP Device MMU(IOMMU) detection | 935 | * OMAP Device MMU(IOMMU) detection |
@@ -936,7 +938,7 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev) | |||
936 | { | 938 | { |
937 | int err = -ENODEV; | 939 | int err = -ENODEV; |
938 | int irq; | 940 | int irq; |
939 | struct iommu *obj; | 941 | struct omap_iommu *obj; |
940 | struct resource *res; | 942 | struct resource *res; |
941 | struct iommu_platform_data *pdata = pdev->dev.platform_data; | 943 | struct iommu_platform_data *pdata = pdev->dev.platform_data; |
942 | 944 | ||
@@ -1011,7 +1013,7 @@ static int __devexit omap_iommu_remove(struct platform_device *pdev) | |||
1011 | { | 1013 | { |
1012 | int irq; | 1014 | int irq; |
1013 | struct resource *res; | 1015 | struct resource *res; |
1014 | struct iommu *obj = platform_get_drvdata(pdev); | 1016 | struct omap_iommu *obj = platform_get_drvdata(pdev); |
1015 | 1017 | ||
1016 | platform_set_drvdata(pdev, NULL); | 1018 | platform_set_drvdata(pdev, NULL); |
1017 | 1019 | ||
@@ -1046,7 +1048,7 @@ static int omap_iommu_map(struct iommu_domain *domain, unsigned long da, | |||
1046 | phys_addr_t pa, int order, int prot) | 1048 | phys_addr_t pa, int order, int prot) |
1047 | { | 1049 | { |
1048 | struct omap_iommu_domain *omap_domain = domain->priv; | 1050 | struct omap_iommu_domain *omap_domain = domain->priv; |
1049 | struct iommu *oiommu = omap_domain->iommu_dev; | 1051 | struct omap_iommu *oiommu = omap_domain->iommu_dev; |
1050 | struct device *dev = oiommu->dev; | 1052 | struct device *dev = oiommu->dev; |
1051 | size_t bytes = PAGE_SIZE << order; | 1053 | size_t bytes = PAGE_SIZE << order; |
1052 | struct iotlb_entry e; | 1054 | struct iotlb_entry e; |
@@ -1066,9 +1068,9 @@ static int omap_iommu_map(struct iommu_domain *domain, unsigned long da, | |||
1066 | 1068 | ||
1067 | iotlb_init_entry(&e, da, pa, flags); | 1069 | iotlb_init_entry(&e, da, pa, flags); |
1068 | 1070 | ||
1069 | ret = iopgtable_store_entry(oiommu, &e); | 1071 | ret = omap_iopgtable_store_entry(oiommu, &e); |
1070 | if (ret) { | 1072 | if (ret) { |
1071 | dev_err(dev, "iopgtable_store_entry failed: %d\n", ret); | 1073 | dev_err(dev, "omap_iopgtable_store_entry failed: %d\n", ret); |
1072 | return ret; | 1074 | return ret; |
1073 | } | 1075 | } |
1074 | 1076 | ||
@@ -1079,7 +1081,7 @@ static int omap_iommu_unmap(struct iommu_domain *domain, unsigned long da, | |||
1079 | int order) | 1081 | int order) |
1080 | { | 1082 | { |
1081 | struct omap_iommu_domain *omap_domain = domain->priv; | 1083 | struct omap_iommu_domain *omap_domain = domain->priv; |
1082 | struct iommu *oiommu = omap_domain->iommu_dev; | 1084 | struct omap_iommu *oiommu = omap_domain->iommu_dev; |
1083 | struct device *dev = oiommu->dev; | 1085 | struct device *dev = oiommu->dev; |
1084 | size_t bytes = PAGE_SIZE << order; | 1086 | size_t bytes = PAGE_SIZE << order; |
1085 | size_t ret; | 1087 | size_t ret; |
@@ -1099,7 +1101,7 @@ static int | |||
1099 | omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev) | 1101 | omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev) |
1100 | { | 1102 | { |
1101 | struct omap_iommu_domain *omap_domain = domain->priv; | 1103 | struct omap_iommu_domain *omap_domain = domain->priv; |
1102 | struct iommu *oiommu; | 1104 | struct omap_iommu *oiommu; |
1103 | int ret = 0; | 1105 | int ret = 0; |
1104 | 1106 | ||
1105 | spin_lock(&omap_domain->lock); | 1107 | spin_lock(&omap_domain->lock); |
@@ -1130,7 +1132,7 @@ static void omap_iommu_detach_dev(struct iommu_domain *domain, | |||
1130 | struct device *dev) | 1132 | struct device *dev) |
1131 | { | 1133 | { |
1132 | struct omap_iommu_domain *omap_domain = domain->priv; | 1134 | struct omap_iommu_domain *omap_domain = domain->priv; |
1133 | struct iommu *oiommu = to_iommu(dev); | 1135 | struct omap_iommu *oiommu = to_iommu(dev); |
1134 | 1136 | ||
1135 | spin_lock(&omap_domain->lock); | 1137 | spin_lock(&omap_domain->lock); |
1136 | 1138 | ||
@@ -1200,7 +1202,7 @@ static phys_addr_t omap_iommu_iova_to_phys(struct iommu_domain *domain, | |||
1200 | unsigned long da) | 1202 | unsigned long da) |
1201 | { | 1203 | { |
1202 | struct omap_iommu_domain *omap_domain = domain->priv; | 1204 | struct omap_iommu_domain *omap_domain = domain->priv; |
1203 | struct iommu *oiommu = omap_domain->iommu_dev; | 1205 | struct omap_iommu *oiommu = omap_domain->iommu_dev; |
1204 | struct device *dev = oiommu->dev; | 1206 | struct device *dev = oiommu->dev; |
1205 | u32 *pgd, *pte; | 1207 | u32 *pgd, *pte; |
1206 | phys_addr_t ret = 0; | 1208 | phys_addr_t ret = 0; |
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c index 996bec0b4a2b..5e7f97dc76ef 100644 --- a/drivers/iommu/omap-iovmm.c +++ b/drivers/iommu/omap-iovmm.c | |||
@@ -191,7 +191,8 @@ static inline void vunmap_sg(const void *va) | |||
191 | vunmap(va); | 191 | vunmap(va); |
192 | } | 192 | } |
193 | 193 | ||
194 | static struct iovm_struct *__find_iovm_area(struct iommu *obj, const u32 da) | 194 | static struct iovm_struct *__find_iovm_area(struct omap_iommu *obj, |
195 | const u32 da) | ||
195 | { | 196 | { |
196 | struct iovm_struct *tmp; | 197 | struct iovm_struct *tmp; |
197 | 198 | ||
@@ -213,12 +214,12 @@ static struct iovm_struct *__find_iovm_area(struct iommu *obj, const u32 da) | |||
213 | } | 214 | } |
214 | 215 | ||
215 | /** | 216 | /** |
216 | * find_iovm_area - find iovma which includes @da | 217 | * omap_find_iovm_area - find iovma which includes @da |
217 | * @da: iommu device virtual address | 218 | * @da: iommu device virtual address |
218 | * | 219 | * |
219 | * Find the existing iovma starting at @da | 220 | * Find the existing iovma starting at @da |
220 | */ | 221 | */ |
221 | struct iovm_struct *find_iovm_area(struct iommu *obj, u32 da) | 222 | struct iovm_struct *omap_find_iovm_area(struct omap_iommu *obj, u32 da) |
222 | { | 223 | { |
223 | struct iovm_struct *area; | 224 | struct iovm_struct *area; |
224 | 225 | ||
@@ -228,13 +229,13 @@ struct iovm_struct *find_iovm_area(struct iommu *obj, u32 da) | |||
228 | 229 | ||
229 | return area; | 230 | return area; |
230 | } | 231 | } |
231 | EXPORT_SYMBOL_GPL(find_iovm_area); | 232 | EXPORT_SYMBOL_GPL(omap_find_iovm_area); |
232 | 233 | ||
233 | /* | 234 | /* |
234 | * This finds the hole(area) which fits the requested address and len | 235 | * This finds the hole(area) which fits the requested address and len |
235 | * in iovmas mmap, and returns the new allocated iovma. | 236 | * in iovmas mmap, and returns the new allocated iovma. |
236 | */ | 237 | */ |
237 | static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da, | 238 | static struct iovm_struct *alloc_iovm_area(struct omap_iommu *obj, u32 da, |
238 | size_t bytes, u32 flags) | 239 | size_t bytes, u32 flags) |
239 | { | 240 | { |
240 | struct iovm_struct *new, *tmp; | 241 | struct iovm_struct *new, *tmp; |
@@ -309,7 +310,7 @@ found: | |||
309 | return new; | 310 | return new; |
310 | } | 311 | } |
311 | 312 | ||
312 | static void free_iovm_area(struct iommu *obj, struct iovm_struct *area) | 313 | static void free_iovm_area(struct omap_iommu *obj, struct iovm_struct *area) |
313 | { | 314 | { |
314 | size_t bytes; | 315 | size_t bytes; |
315 | 316 | ||
@@ -325,14 +326,14 @@ static void free_iovm_area(struct iommu *obj, struct iovm_struct *area) | |||
325 | } | 326 | } |
326 | 327 | ||
327 | /** | 328 | /** |
328 | * da_to_va - convert (d) to (v) | 329 | * omap_da_to_va - convert (d) to (v) |
329 | * @obj: objective iommu | 330 | * @obj: objective iommu |
330 | * @da: iommu device virtual address | 331 | * @da: iommu device virtual address |
331 | * @va: mpu virtual address | 332 | * @va: mpu virtual address |
332 | * | 333 | * |
333 | * Returns mpu virtual addr which corresponds to a given device virtual addr | 334 | * Returns mpu virtual addr which corresponds to a given device virtual addr |
334 | */ | 335 | */ |
335 | void *da_to_va(struct iommu *obj, u32 da) | 336 | void *omap_da_to_va(struct omap_iommu *obj, u32 da) |
336 | { | 337 | { |
337 | void *va = NULL; | 338 | void *va = NULL; |
338 | struct iovm_struct *area; | 339 | struct iovm_struct *area; |
@@ -350,7 +351,7 @@ out: | |||
350 | 351 | ||
351 | return va; | 352 | return va; |
352 | } | 353 | } |
353 | EXPORT_SYMBOL_GPL(da_to_va); | 354 | EXPORT_SYMBOL_GPL(omap_da_to_va); |
354 | 355 | ||
355 | static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va) | 356 | static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va) |
356 | { | 357 | { |
@@ -364,7 +365,7 @@ static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va) | |||
364 | const size_t bytes = PAGE_SIZE; | 365 | const size_t bytes = PAGE_SIZE; |
365 | 366 | ||
366 | /* | 367 | /* |
367 | * iommu 'superpage' isn't supported with 'iommu_vmalloc()' | 368 | * iommu 'superpage' isn't supported with 'omap_iommu_vmalloc()' |
368 | */ | 369 | */ |
369 | pg = vmalloc_to_page(va); | 370 | pg = vmalloc_to_page(va); |
370 | BUG_ON(!pg); | 371 | BUG_ON(!pg); |
@@ -443,7 +444,7 @@ err_out: | |||
443 | } | 444 | } |
444 | 445 | ||
445 | /* release 'da' <-> 'pa' mapping */ | 446 | /* release 'da' <-> 'pa' mapping */ |
446 | static void unmap_iovm_area(struct iommu_domain *domain, struct iommu *obj, | 447 | static void unmap_iovm_area(struct iommu_domain *domain, struct omap_iommu *obj, |
447 | struct iovm_struct *area) | 448 | struct iovm_struct *area) |
448 | { | 449 | { |
449 | u32 start; | 450 | u32 start; |
@@ -480,7 +481,7 @@ static void unmap_iovm_area(struct iommu_domain *domain, struct iommu *obj, | |||
480 | 481 | ||
481 | /* template function for all unmapping */ | 482 | /* template function for all unmapping */ |
482 | static struct sg_table *unmap_vm_area(struct iommu_domain *domain, | 483 | static struct sg_table *unmap_vm_area(struct iommu_domain *domain, |
483 | struct iommu *obj, const u32 da, | 484 | struct omap_iommu *obj, const u32 da, |
484 | void (*fn)(const void *), u32 flags) | 485 | void (*fn)(const void *), u32 flags) |
485 | { | 486 | { |
486 | struct sg_table *sgt = NULL; | 487 | struct sg_table *sgt = NULL; |
@@ -521,7 +522,7 @@ out: | |||
521 | return sgt; | 522 | return sgt; |
522 | } | 523 | } |
523 | 524 | ||
524 | static u32 map_iommu_region(struct iommu_domain *domain, struct iommu *obj, | 525 | static u32 map_iommu_region(struct iommu_domain *domain, struct omap_iommu *obj, |
525 | u32 da, const struct sg_table *sgt, void *va, | 526 | u32 da, const struct sg_table *sgt, void *va, |
526 | size_t bytes, u32 flags) | 527 | size_t bytes, u32 flags) |
527 | { | 528 | { |
@@ -555,7 +556,8 @@ err_alloc_iovma: | |||
555 | return err; | 556 | return err; |
556 | } | 557 | } |
557 | 558 | ||
558 | static inline u32 __iommu_vmap(struct iommu_domain *domain, struct iommu *obj, | 559 | static inline u32 |
560 | __iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, | ||
559 | u32 da, const struct sg_table *sgt, | 561 | u32 da, const struct sg_table *sgt, |
560 | void *va, size_t bytes, u32 flags) | 562 | void *va, size_t bytes, u32 flags) |
561 | { | 563 | { |
@@ -563,7 +565,7 @@ static inline u32 __iommu_vmap(struct iommu_domain *domain, struct iommu *obj, | |||
563 | } | 565 | } |
564 | 566 | ||
565 | /** | 567 | /** |
566 | * iommu_vmap - (d)-(p)-(v) address mapper | 568 | * omap_iommu_vmap - (d)-(p)-(v) address mapper |
567 | * @obj: objective iommu | 569 | * @obj: objective iommu |
568 | * @sgt: address of scatter gather table | 570 | * @sgt: address of scatter gather table |
569 | * @flags: iovma and page property | 571 | * @flags: iovma and page property |
@@ -571,7 +573,7 @@ static inline u32 __iommu_vmap(struct iommu_domain *domain, struct iommu *obj, | |||
571 | * Creates 1-n-1 mapping with given @sgt and returns @da. | 573 | * Creates 1-n-1 mapping with given @sgt and returns @da. |
572 | * All @sgt element must be io page size aligned. | 574 | * All @sgt element must be io page size aligned. |
573 | */ | 575 | */ |
574 | u32 iommu_vmap(struct iommu_domain *domain, struct iommu *obj, u32 da, | 576 | u32 omap_iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, |
575 | const struct sg_table *sgt, u32 flags) | 577 | const struct sg_table *sgt, u32 flags) |
576 | { | 578 | { |
577 | size_t bytes; | 579 | size_t bytes; |
@@ -600,22 +602,22 @@ u32 iommu_vmap(struct iommu_domain *domain, struct iommu *obj, u32 da, | |||
600 | 602 | ||
601 | return da; | 603 | return da; |
602 | } | 604 | } |
603 | EXPORT_SYMBOL_GPL(iommu_vmap); | 605 | EXPORT_SYMBOL_GPL(omap_iommu_vmap); |
604 | 606 | ||
605 | /** | 607 | /** |
606 | * iommu_vunmap - release virtual mapping obtained by 'iommu_vmap()' | 608 | * omap_iommu_vunmap - release virtual mapping obtained by 'omap_iommu_vmap()' |
607 | * @obj: objective iommu | 609 | * @obj: objective iommu |
608 | * @da: iommu device virtual address | 610 | * @da: iommu device virtual address |
609 | * | 611 | * |
610 | * Free the iommu virtually contiguous memory area starting at | 612 | * Free the iommu virtually contiguous memory area starting at |
611 | * @da, which was returned by 'iommu_vmap()'. | 613 | * @da, which was returned by 'omap_iommu_vmap()'. |
612 | */ | 614 | */ |
613 | struct sg_table * | 615 | struct sg_table * |
614 | iommu_vunmap(struct iommu_domain *domain, struct iommu *obj, u32 da) | 616 | omap_iommu_vunmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da) |
615 | { | 617 | { |
616 | struct sg_table *sgt; | 618 | struct sg_table *sgt; |
617 | /* | 619 | /* |
618 | * 'sgt' is allocated before 'iommu_vmalloc()' is called. | 620 | * 'sgt' is allocated before 'omap_iommu_vmalloc()' is called. |
619 | * Just returns 'sgt' to the caller to free | 621 | * Just returns 'sgt' to the caller to free |
620 | */ | 622 | */ |
621 | sgt = unmap_vm_area(domain, obj, da, vunmap_sg, | 623 | sgt = unmap_vm_area(domain, obj, da, vunmap_sg, |
@@ -624,10 +626,10 @@ iommu_vunmap(struct iommu_domain *domain, struct iommu *obj, u32 da) | |||
624 | dev_dbg(obj->dev, "%s: No sgt\n", __func__); | 626 | dev_dbg(obj->dev, "%s: No sgt\n", __func__); |
625 | return sgt; | 627 | return sgt; |
626 | } | 628 | } |
627 | EXPORT_SYMBOL_GPL(iommu_vunmap); | 629 | EXPORT_SYMBOL_GPL(omap_iommu_vunmap); |
628 | 630 | ||
629 | /** | 631 | /** |
630 | * iommu_vmalloc - (d)-(p)-(v) address allocator and mapper | 632 | * omap_iommu_vmalloc - (d)-(p)-(v) address allocator and mapper |
631 | * @obj: objective iommu | 633 | * @obj: objective iommu |
632 | * @da: contiguous iommu virtual memory | 634 | * @da: contiguous iommu virtual memory |
633 | * @bytes: allocation size | 635 | * @bytes: allocation size |
@@ -636,7 +638,8 @@ EXPORT_SYMBOL_GPL(iommu_vunmap); | |||
636 | * Allocate @bytes linearly and creates 1-n-1 mapping and returns | 638 | * Allocate @bytes linearly and creates 1-n-1 mapping and returns |
637 | * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set. | 639 | * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set. |
638 | */ | 640 | */ |
639 | u32 iommu_vmalloc(struct iommu_domain *domain, struct iommu *obj, u32 da, | 641 | u32 |
642 | omap_iommu_vmalloc(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, | ||
640 | size_t bytes, u32 flags) | 643 | size_t bytes, u32 flags) |
641 | { | 644 | { |
642 | void *va; | 645 | void *va; |
@@ -674,17 +677,18 @@ err_sgt_alloc: | |||
674 | vfree(va); | 677 | vfree(va); |
675 | return da; | 678 | return da; |
676 | } | 679 | } |
677 | EXPORT_SYMBOL_GPL(iommu_vmalloc); | 680 | EXPORT_SYMBOL_GPL(omap_iommu_vmalloc); |
678 | 681 | ||
679 | /** | 682 | /** |
680 | * iommu_vfree - release memory allocated by 'iommu_vmalloc()' | 683 | * omap_iommu_vfree - release memory allocated by 'omap_iommu_vmalloc()' |
681 | * @obj: objective iommu | 684 | * @obj: objective iommu |
682 | * @da: iommu device virtual address | 685 | * @da: iommu device virtual address |
683 | * | 686 | * |
684 | * Frees the iommu virtually continuous memory area starting at | 687 | * Frees the iommu virtually continuous memory area starting at |
685 | * @da, as obtained from 'iommu_vmalloc()'. | 688 | * @da, as obtained from 'omap_iommu_vmalloc()'. |
686 | */ | 689 | */ |
687 | void iommu_vfree(struct iommu_domain *domain, struct iommu *obj, const u32 da) | 690 | void omap_iommu_vfree(struct iommu_domain *domain, struct omap_iommu *obj, |
691 | const u32 da) | ||
688 | { | 692 | { |
689 | struct sg_table *sgt; | 693 | struct sg_table *sgt; |
690 | 694 | ||
@@ -694,7 +698,7 @@ void iommu_vfree(struct iommu_domain *domain, struct iommu *obj, const u32 da) | |||
694 | dev_dbg(obj->dev, "%s: No sgt\n", __func__); | 698 | dev_dbg(obj->dev, "%s: No sgt\n", __func__); |
695 | sgtable_free(sgt); | 699 | sgtable_free(sgt); |
696 | } | 700 | } |
697 | EXPORT_SYMBOL_GPL(iommu_vfree); | 701 | EXPORT_SYMBOL_GPL(omap_iommu_vfree); |
698 | 702 | ||
699 | static int __init iovmm_init(void) | 703 | static int __init iovmm_init(void) |
700 | { | 704 | { |