1 // SPDX-License-Identifier: GPL-2.0
2 /* iommu.c: Generic sparc64 IOMMU support.
4 * Copyright (C) 1999, 2007, 2008 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com)
8 #include <linux/kernel.h>
9 #include <linux/export.h>
10 #include <linux/slab.h>
11 #include <linux/delay.h>
12 #include <linux/device.h>
13 #include <linux/dma-mapping.h>
14 #include <linux/errno.h>
15 #include <linux/iommu-helper.h>
16 #include <linux/bitmap.h>
17 #include <linux/iommu-common.h>
20 #include <linux/pci.h>
23 #include <asm/iommu.h>
25 #include "iommu_common.h"
28 #define STC_CTXMATCH_ADDR(STC, CTX) \
29 ((STC)->strbuf_ctxmatch_base + ((CTX) << 3))
30 #define STC_FLUSHFLAG_INIT(STC) \
31 (*((STC)->strbuf_flushflag) = 0UL)
32 #define STC_FLUSHFLAG_SET(STC) \
33 (*((STC)->strbuf_flushflag) != 0UL)
35 #define iommu_read(__reg) \
37 __asm__ __volatile__("ldxa [%1] %2, %0" \
39 : "r" (__reg), "i" (ASI_PHYS_BYPASS_EC_E) \
43 #define iommu_write(__reg, __val) \
44 __asm__ __volatile__("stxa %0, [%1] %2" \
46 : "r" (__val), "r" (__reg), \
47 "i" (ASI_PHYS_BYPASS_EC_E))
49 /* Must be invoked under the IOMMU lock. */
50 static void iommu_flushall(struct iommu_map_table
*iommu_map_table
)
52 struct iommu
*iommu
= container_of(iommu_map_table
, struct iommu
, tbl
);
53 if (iommu
->iommu_flushinv
) {
54 iommu_write(iommu
->iommu_flushinv
, ~(u64
)0);
59 tag
= iommu
->iommu_tags
;
60 for (entry
= 0; entry
< 16; entry
++) {
65 /* Ensure completion of previous PIO writes. */
66 (void) iommu_read(iommu
->write_complete_reg
);
70 #define IOPTE_CONSISTENT(CTX) \
71 (IOPTE_VALID | IOPTE_CACHE | \
72 (((CTX) << 47) & IOPTE_CONTEXT))
74 #define IOPTE_STREAMING(CTX) \
75 (IOPTE_CONSISTENT(CTX) | IOPTE_STBUF)
77 /* Existing mappings are never marked invalid, instead they
78 * are pointed to a dummy page.
80 #define IOPTE_IS_DUMMY(iommu, iopte) \
81 ((iopte_val(*iopte) & IOPTE_PAGE) == (iommu)->dummy_page_pa)
83 static inline void iopte_make_dummy(struct iommu
*iommu
, iopte_t
*iopte
)
85 unsigned long val
= iopte_val(*iopte
);
88 val
|= iommu
->dummy_page_pa
;
90 iopte_val(*iopte
) = val
;
93 int iommu_table_init(struct iommu
*iommu
, int tsbsize
,
94 u32 dma_offset
, u32 dma_addr_mask
,
97 unsigned long i
, order
, sz
, num_tsb_entries
;
100 num_tsb_entries
= tsbsize
/ sizeof(iopte_t
);
102 /* Setup initial software IOMMU state. */
103 spin_lock_init(&iommu
->lock
);
104 iommu
->ctx_lowest_free
= 1;
105 iommu
->tbl
.table_map_base
= dma_offset
;
106 iommu
->dma_addr_mask
= dma_addr_mask
;
108 /* Allocate and initialize the free area map. */
109 sz
= num_tsb_entries
/ 8;
110 sz
= (sz
+ 7UL) & ~7UL;
111 iommu
->tbl
.map
= kmalloc_node(sz
, GFP_KERNEL
, numa_node
);
114 memset(iommu
->tbl
.map
, 0, sz
);
116 iommu_tbl_pool_init(&iommu
->tbl
, num_tsb_entries
, IO_PAGE_SHIFT
,
117 (tlb_type
!= hypervisor
? iommu_flushall
: NULL
),
120 /* Allocate and initialize the dummy page which we
121 * set inactive IO PTEs to point to.
123 page
= alloc_pages_node(numa_node
, GFP_KERNEL
, 0);
125 printk(KERN_ERR
"IOMMU: Error, gfp(dummy_page) failed.\n");
128 iommu
->dummy_page
= (unsigned long) page_address(page
);
129 memset((void *)iommu
->dummy_page
, 0, PAGE_SIZE
);
130 iommu
->dummy_page_pa
= (unsigned long) __pa(iommu
->dummy_page
);
132 /* Now allocate and setup the IOMMU page table itself. */
133 order
= get_order(tsbsize
);
134 page
= alloc_pages_node(numa_node
, GFP_KERNEL
, order
);
136 printk(KERN_ERR
"IOMMU: Error, gfp(tsb) failed.\n");
137 goto out_free_dummy_page
;
139 iommu
->page_table
= (iopte_t
*)page_address(page
);
141 for (i
= 0; i
< num_tsb_entries
; i
++)
142 iopte_make_dummy(iommu
, &iommu
->page_table
[i
]);
147 free_page(iommu
->dummy_page
);
148 iommu
->dummy_page
= 0UL;
151 kfree(iommu
->tbl
.map
);
152 iommu
->tbl
.map
= NULL
;
157 static inline iopte_t
*alloc_npages(struct device
*dev
,
159 unsigned long npages
)
163 entry
= iommu_tbl_range_alloc(dev
, &iommu
->tbl
, npages
, NULL
,
164 (unsigned long)(-1), 0);
165 if (unlikely(entry
== IOMMU_ERROR_CODE
))
168 return iommu
->page_table
+ entry
;
171 static int iommu_alloc_ctx(struct iommu
*iommu
)
173 int lowest
= iommu
->ctx_lowest_free
;
174 int n
= find_next_zero_bit(iommu
->ctx_bitmap
, IOMMU_NUM_CTXS
, lowest
);
176 if (unlikely(n
== IOMMU_NUM_CTXS
)) {
177 n
= find_next_zero_bit(iommu
->ctx_bitmap
, lowest
, 1);
178 if (unlikely(n
== lowest
)) {
179 printk(KERN_WARNING
"IOMMU: Ran out of contexts.\n");
184 __set_bit(n
, iommu
->ctx_bitmap
);
189 static inline void iommu_free_ctx(struct iommu
*iommu
, int ctx
)
192 __clear_bit(ctx
, iommu
->ctx_bitmap
);
193 if (ctx
< iommu
->ctx_lowest_free
)
194 iommu
->ctx_lowest_free
= ctx
;
198 static void *dma_4u_alloc_coherent(struct device
*dev
, size_t size
,
199 dma_addr_t
*dma_addrp
, gfp_t gfp
,
202 unsigned long order
, first_page
;
209 size
= IO_PAGE_ALIGN(size
);
210 order
= get_order(size
);
214 nid
= dev
->archdata
.numa_node
;
215 page
= alloc_pages_node(nid
, gfp
, order
);
219 first_page
= (unsigned long) page_address(page
);
220 memset((char *)first_page
, 0, PAGE_SIZE
<< order
);
222 iommu
= dev
->archdata
.iommu
;
224 iopte
= alloc_npages(dev
, iommu
, size
>> IO_PAGE_SHIFT
);
226 if (unlikely(iopte
== NULL
)) {
227 free_pages(first_page
, order
);
231 *dma_addrp
= (iommu
->tbl
.table_map_base
+
232 ((iopte
- iommu
->page_table
) << IO_PAGE_SHIFT
));
233 ret
= (void *) first_page
;
234 npages
= size
>> IO_PAGE_SHIFT
;
235 first_page
= __pa(first_page
);
237 iopte_val(*iopte
) = (IOPTE_CONSISTENT(0UL) |
239 (first_page
& IOPTE_PAGE
));
241 first_page
+= IO_PAGE_SIZE
;
247 static void dma_4u_free_coherent(struct device
*dev
, size_t size
,
248 void *cpu
, dma_addr_t dvma
,
252 unsigned long order
, npages
;
254 npages
= IO_PAGE_ALIGN(size
) >> IO_PAGE_SHIFT
;
255 iommu
= dev
->archdata
.iommu
;
257 iommu_tbl_range_free(&iommu
->tbl
, dvma
, npages
, IOMMU_ERROR_CODE
);
259 order
= get_order(size
);
261 free_pages((unsigned long)cpu
, order
);
264 static dma_addr_t
dma_4u_map_page(struct device
*dev
, struct page
*page
,
265 unsigned long offset
, size_t sz
,
266 enum dma_data_direction direction
,
270 struct strbuf
*strbuf
;
272 unsigned long flags
, npages
, oaddr
;
273 unsigned long i
, base_paddr
, ctx
;
275 unsigned long iopte_protection
;
277 iommu
= dev
->archdata
.iommu
;
278 strbuf
= dev
->archdata
.stc
;
280 if (unlikely(direction
== DMA_NONE
))
283 oaddr
= (unsigned long)(page_address(page
) + offset
);
284 npages
= IO_PAGE_ALIGN(oaddr
+ sz
) - (oaddr
& IO_PAGE_MASK
);
285 npages
>>= IO_PAGE_SHIFT
;
287 base
= alloc_npages(dev
, iommu
, npages
);
288 spin_lock_irqsave(&iommu
->lock
, flags
);
290 if (iommu
->iommu_ctxflush
)
291 ctx
= iommu_alloc_ctx(iommu
);
292 spin_unlock_irqrestore(&iommu
->lock
, flags
);
297 bus_addr
= (iommu
->tbl
.table_map_base
+
298 ((base
- iommu
->page_table
) << IO_PAGE_SHIFT
));
299 ret
= bus_addr
| (oaddr
& ~IO_PAGE_MASK
);
300 base_paddr
= __pa(oaddr
& IO_PAGE_MASK
);
301 if (strbuf
->strbuf_enabled
)
302 iopte_protection
= IOPTE_STREAMING(ctx
);
304 iopte_protection
= IOPTE_CONSISTENT(ctx
);
305 if (direction
!= DMA_TO_DEVICE
)
306 iopte_protection
|= IOPTE_WRITE
;
308 for (i
= 0; i
< npages
; i
++, base
++, base_paddr
+= IO_PAGE_SIZE
)
309 iopte_val(*base
) = iopte_protection
| base_paddr
;
314 iommu_free_ctx(iommu
, ctx
);
316 if (printk_ratelimit())
318 return SPARC_MAPPING_ERROR
;
321 static void strbuf_flush(struct strbuf
*strbuf
, struct iommu
*iommu
,
322 u32 vaddr
, unsigned long ctx
, unsigned long npages
,
323 enum dma_data_direction direction
)
327 if (strbuf
->strbuf_ctxflush
&&
328 iommu
->iommu_ctxflush
) {
329 unsigned long matchreg
, flushreg
;
332 flushreg
= strbuf
->strbuf_ctxflush
;
333 matchreg
= STC_CTXMATCH_ADDR(strbuf
, ctx
);
335 iommu_write(flushreg
, ctx
);
336 val
= iommu_read(matchreg
);
343 iommu_write(flushreg
, ctx
);
346 val
= iommu_read(matchreg
);
348 printk(KERN_WARNING
"strbuf_flush: ctx flush "
349 "timeout matchreg[%llx] ctx[%lx]\n",
357 for (i
= 0; i
< npages
; i
++, vaddr
+= IO_PAGE_SIZE
)
358 iommu_write(strbuf
->strbuf_pflush
, vaddr
);
362 /* If the device could not have possibly put dirty data into
363 * the streaming cache, no flush-flag synchronization needs
366 if (direction
== DMA_TO_DEVICE
)
369 STC_FLUSHFLAG_INIT(strbuf
);
370 iommu_write(strbuf
->strbuf_fsync
, strbuf
->strbuf_flushflag_pa
);
371 (void) iommu_read(iommu
->write_complete_reg
);
374 while (!STC_FLUSHFLAG_SET(strbuf
)) {
382 printk(KERN_WARNING
"strbuf_flush: flushflag timeout "
383 "vaddr[%08x] ctx[%lx] npages[%ld]\n",
387 static void dma_4u_unmap_page(struct device
*dev
, dma_addr_t bus_addr
,
388 size_t sz
, enum dma_data_direction direction
,
392 struct strbuf
*strbuf
;
394 unsigned long flags
, npages
, ctx
, i
;
396 if (unlikely(direction
== DMA_NONE
)) {
397 if (printk_ratelimit())
402 iommu
= dev
->archdata
.iommu
;
403 strbuf
= dev
->archdata
.stc
;
405 npages
= IO_PAGE_ALIGN(bus_addr
+ sz
) - (bus_addr
& IO_PAGE_MASK
);
406 npages
>>= IO_PAGE_SHIFT
;
407 base
= iommu
->page_table
+
408 ((bus_addr
- iommu
->tbl
.table_map_base
) >> IO_PAGE_SHIFT
);
409 bus_addr
&= IO_PAGE_MASK
;
411 spin_lock_irqsave(&iommu
->lock
, flags
);
413 /* Record the context, if any. */
415 if (iommu
->iommu_ctxflush
)
416 ctx
= (iopte_val(*base
) & IOPTE_CONTEXT
) >> 47UL;
418 /* Step 1: Kick data out of streaming buffers if necessary. */
419 if (strbuf
->strbuf_enabled
&& !(attrs
& DMA_ATTR_SKIP_CPU_SYNC
))
420 strbuf_flush(strbuf
, iommu
, bus_addr
, ctx
,
423 /* Step 2: Clear out TSB entries. */
424 for (i
= 0; i
< npages
; i
++)
425 iopte_make_dummy(iommu
, base
+ i
);
427 iommu_free_ctx(iommu
, ctx
);
428 spin_unlock_irqrestore(&iommu
->lock
, flags
);
430 iommu_tbl_range_free(&iommu
->tbl
, bus_addr
, npages
, IOMMU_ERROR_CODE
);
433 static int dma_4u_map_sg(struct device
*dev
, struct scatterlist
*sglist
,
434 int nelems
, enum dma_data_direction direction
,
437 struct scatterlist
*s
, *outs
, *segstart
;
438 unsigned long flags
, handle
, prot
, ctx
;
439 dma_addr_t dma_next
= 0, dma_addr
;
440 unsigned int max_seg_size
;
441 unsigned long seg_boundary_size
;
442 int outcount
, incount
, i
;
443 struct strbuf
*strbuf
;
445 unsigned long base_shift
;
447 BUG_ON(direction
== DMA_NONE
);
449 iommu
= dev
->archdata
.iommu
;
450 strbuf
= dev
->archdata
.stc
;
451 if (nelems
== 0 || !iommu
)
454 spin_lock_irqsave(&iommu
->lock
, flags
);
457 if (iommu
->iommu_ctxflush
)
458 ctx
= iommu_alloc_ctx(iommu
);
460 if (strbuf
->strbuf_enabled
)
461 prot
= IOPTE_STREAMING(ctx
);
463 prot
= IOPTE_CONSISTENT(ctx
);
464 if (direction
!= DMA_TO_DEVICE
)
467 outs
= s
= segstart
= &sglist
[0];
472 /* Init first segment length for backout at failure */
473 outs
->dma_length
= 0;
475 max_seg_size
= dma_get_max_seg_size(dev
);
476 seg_boundary_size
= ALIGN(dma_get_seg_boundary(dev
) + 1,
477 IO_PAGE_SIZE
) >> IO_PAGE_SHIFT
;
478 base_shift
= iommu
->tbl
.table_map_base
>> IO_PAGE_SHIFT
;
479 for_each_sg(sglist
, s
, nelems
, i
) {
480 unsigned long paddr
, npages
, entry
, out_entry
= 0, slen
;
489 /* Allocate iommu entries for that segment */
490 paddr
= (unsigned long) SG_ENT_PHYS_ADDRESS(s
);
491 npages
= iommu_num_pages(paddr
, slen
, IO_PAGE_SIZE
);
492 entry
= iommu_tbl_range_alloc(dev
, &iommu
->tbl
, npages
,
493 &handle
, (unsigned long)(-1), 0);
496 if (unlikely(entry
== IOMMU_ERROR_CODE
)) {
497 if (printk_ratelimit())
498 printk(KERN_INFO
"iommu_alloc failed, iommu %p paddr %lx"
499 " npages %lx\n", iommu
, paddr
, npages
);
500 goto iommu_map_failed
;
503 base
= iommu
->page_table
+ entry
;
505 /* Convert entry to a dma_addr_t */
506 dma_addr
= iommu
->tbl
.table_map_base
+
507 (entry
<< IO_PAGE_SHIFT
);
508 dma_addr
|= (s
->offset
& ~IO_PAGE_MASK
);
510 /* Insert into HW table */
511 paddr
&= IO_PAGE_MASK
;
513 iopte_val(*base
) = prot
| paddr
;
515 paddr
+= IO_PAGE_SIZE
;
518 /* If we are in an open segment, try merging */
520 /* We cannot merge if:
521 * - allocated dma_addr isn't contiguous to previous allocation
523 if ((dma_addr
!= dma_next
) ||
524 (outs
->dma_length
+ s
->length
> max_seg_size
) ||
525 (is_span_boundary(out_entry
, base_shift
,
526 seg_boundary_size
, outs
, s
))) {
527 /* Can't merge: create a new segment */
530 outs
= sg_next(outs
);
532 outs
->dma_length
+= s
->length
;
537 /* This is a new segment, fill entries */
538 outs
->dma_address
= dma_addr
;
539 outs
->dma_length
= slen
;
543 /* Calculate next page pointer for contiguous check */
544 dma_next
= dma_addr
+ slen
;
547 spin_unlock_irqrestore(&iommu
->lock
, flags
);
549 if (outcount
< incount
) {
550 outs
= sg_next(outs
);
551 outs
->dma_address
= SPARC_MAPPING_ERROR
;
552 outs
->dma_length
= 0;
558 for_each_sg(sglist
, s
, nelems
, i
) {
559 if (s
->dma_length
!= 0) {
560 unsigned long vaddr
, npages
, entry
, j
;
563 vaddr
= s
->dma_address
& IO_PAGE_MASK
;
564 npages
= iommu_num_pages(s
->dma_address
, s
->dma_length
,
567 entry
= (vaddr
- iommu
->tbl
.table_map_base
)
569 base
= iommu
->page_table
+ entry
;
571 for (j
= 0; j
< npages
; j
++)
572 iopte_make_dummy(iommu
, base
+ j
);
574 iommu_tbl_range_free(&iommu
->tbl
, vaddr
, npages
,
577 s
->dma_address
= SPARC_MAPPING_ERROR
;
583 spin_unlock_irqrestore(&iommu
->lock
, flags
);
588 /* If contexts are being used, they are the same in all of the mappings
589 * we make for a particular SG.
591 static unsigned long fetch_sg_ctx(struct iommu
*iommu
, struct scatterlist
*sg
)
593 unsigned long ctx
= 0;
595 if (iommu
->iommu_ctxflush
) {
598 struct iommu_map_table
*tbl
= &iommu
->tbl
;
600 bus_addr
= sg
->dma_address
& IO_PAGE_MASK
;
601 base
= iommu
->page_table
+
602 ((bus_addr
- tbl
->table_map_base
) >> IO_PAGE_SHIFT
);
604 ctx
= (iopte_val(*base
) & IOPTE_CONTEXT
) >> 47UL;
609 static void dma_4u_unmap_sg(struct device
*dev
, struct scatterlist
*sglist
,
610 int nelems
, enum dma_data_direction direction
,
613 unsigned long flags
, ctx
;
614 struct scatterlist
*sg
;
615 struct strbuf
*strbuf
;
618 BUG_ON(direction
== DMA_NONE
);
620 iommu
= dev
->archdata
.iommu
;
621 strbuf
= dev
->archdata
.stc
;
623 ctx
= fetch_sg_ctx(iommu
, sglist
);
625 spin_lock_irqsave(&iommu
->lock
, flags
);
629 dma_addr_t dma_handle
= sg
->dma_address
;
630 unsigned int len
= sg
->dma_length
;
631 unsigned long npages
, entry
;
637 npages
= iommu_num_pages(dma_handle
, len
, IO_PAGE_SIZE
);
639 entry
= ((dma_handle
- iommu
->tbl
.table_map_base
)
641 base
= iommu
->page_table
+ entry
;
643 dma_handle
&= IO_PAGE_MASK
;
644 if (strbuf
->strbuf_enabled
&& !(attrs
& DMA_ATTR_SKIP_CPU_SYNC
))
645 strbuf_flush(strbuf
, iommu
, dma_handle
, ctx
,
648 for (i
= 0; i
< npages
; i
++)
649 iopte_make_dummy(iommu
, base
+ i
);
651 iommu_tbl_range_free(&iommu
->tbl
, dma_handle
, npages
,
656 iommu_free_ctx(iommu
, ctx
);
658 spin_unlock_irqrestore(&iommu
->lock
, flags
);
661 static void dma_4u_sync_single_for_cpu(struct device
*dev
,
662 dma_addr_t bus_addr
, size_t sz
,
663 enum dma_data_direction direction
)
666 struct strbuf
*strbuf
;
667 unsigned long flags
, ctx
, npages
;
669 iommu
= dev
->archdata
.iommu
;
670 strbuf
= dev
->archdata
.stc
;
672 if (!strbuf
->strbuf_enabled
)
675 spin_lock_irqsave(&iommu
->lock
, flags
);
677 npages
= IO_PAGE_ALIGN(bus_addr
+ sz
) - (bus_addr
& IO_PAGE_MASK
);
678 npages
>>= IO_PAGE_SHIFT
;
679 bus_addr
&= IO_PAGE_MASK
;
681 /* Step 1: Record the context, if any. */
683 if (iommu
->iommu_ctxflush
&&
684 strbuf
->strbuf_ctxflush
) {
686 struct iommu_map_table
*tbl
= &iommu
->tbl
;
688 iopte
= iommu
->page_table
+
689 ((bus_addr
- tbl
->table_map_base
)>>IO_PAGE_SHIFT
);
690 ctx
= (iopte_val(*iopte
) & IOPTE_CONTEXT
) >> 47UL;
693 /* Step 2: Kick data out of streaming buffers. */
694 strbuf_flush(strbuf
, iommu
, bus_addr
, ctx
, npages
, direction
);
696 spin_unlock_irqrestore(&iommu
->lock
, flags
);
699 static void dma_4u_sync_sg_for_cpu(struct device
*dev
,
700 struct scatterlist
*sglist
, int nelems
,
701 enum dma_data_direction direction
)
704 struct strbuf
*strbuf
;
705 unsigned long flags
, ctx
, npages
, i
;
706 struct scatterlist
*sg
, *sgprv
;
709 iommu
= dev
->archdata
.iommu
;
710 strbuf
= dev
->archdata
.stc
;
712 if (!strbuf
->strbuf_enabled
)
715 spin_lock_irqsave(&iommu
->lock
, flags
);
717 /* Step 1: Record the context, if any. */
719 if (iommu
->iommu_ctxflush
&&
720 strbuf
->strbuf_ctxflush
) {
722 struct iommu_map_table
*tbl
= &iommu
->tbl
;
724 iopte
= iommu
->page_table
+ ((sglist
[0].dma_address
-
725 tbl
->table_map_base
) >> IO_PAGE_SHIFT
);
726 ctx
= (iopte_val(*iopte
) & IOPTE_CONTEXT
) >> 47UL;
729 /* Step 2: Kick data out of streaming buffers. */
730 bus_addr
= sglist
[0].dma_address
& IO_PAGE_MASK
;
732 for_each_sg(sglist
, sg
, nelems
, i
) {
733 if (sg
->dma_length
== 0)
738 npages
= (IO_PAGE_ALIGN(sgprv
->dma_address
+ sgprv
->dma_length
)
739 - bus_addr
) >> IO_PAGE_SHIFT
;
740 strbuf_flush(strbuf
, iommu
, bus_addr
, ctx
, npages
, direction
);
742 spin_unlock_irqrestore(&iommu
->lock
, flags
);
745 static int dma_4u_mapping_error(struct device
*dev
, dma_addr_t dma_addr
)
747 return dma_addr
== SPARC_MAPPING_ERROR
;
750 static int dma_4u_supported(struct device
*dev
, u64 device_mask
)
752 struct iommu
*iommu
= dev
->archdata
.iommu
;
754 if (device_mask
> DMA_BIT_MASK(32))
756 if ((device_mask
& iommu
->dma_addr_mask
) == iommu
->dma_addr_mask
)
760 return pci64_dma_supported(to_pci_dev(dev
), device_mask
);
765 static const struct dma_map_ops sun4u_dma_ops
= {
766 .alloc
= dma_4u_alloc_coherent
,
767 .free
= dma_4u_free_coherent
,
768 .map_page
= dma_4u_map_page
,
769 .unmap_page
= dma_4u_unmap_page
,
770 .map_sg
= dma_4u_map_sg
,
771 .unmap_sg
= dma_4u_unmap_sg
,
772 .sync_single_for_cpu
= dma_4u_sync_single_for_cpu
,
773 .sync_sg_for_cpu
= dma_4u_sync_sg_for_cpu
,
774 .dma_supported
= dma_4u_supported
,
775 .mapping_error
= dma_4u_mapping_error
,
778 const struct dma_map_ops
*dma_ops
= &sun4u_dma_ops
;
779 EXPORT_SYMBOL(dma_ops
);