diff options
Diffstat (limited to 'drivers/iommu/omap-iommu.c')
-rw-r--r-- | drivers/iommu/omap-iommu.c | 146 |
1 files changed, 74 insertions, 72 deletions
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; |