1
2 /* dvma support routines */
3
4 #include <linux/kernel.h>
5 #include <linux/mm.h>
6 #include <linux/bootmem.h>
7 #include <linux/list.h>
8 #include <asm/page.h>
9 #include <asm/pgtable.h>
10 #include <asm/sun3mmu.h>
11 #include <asm/dvma.h>
12
13
14 static unsigned long ptelist[120];
15
dvma_page(unsigned long kaddr,unsigned long vaddr)16 inline unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr)
17 {
18 unsigned long pte;
19 unsigned long j;
20 pte_t ptep;
21
22 j = *(volatile unsigned long *)kaddr;
23 *(volatile unsigned long *)kaddr = j;
24
25 ptep = __mk_pte(kaddr, PAGE_KERNEL);
26 pte = pte_val(ptep);
27 // printk("dvma_remap: addr %lx -> %lx pte %08lx len %x\n",
28 // kaddr, vaddr, pte, len);
29 if(ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] != pte) {
30 sun3_put_pte(vaddr, pte);
31 ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] = pte;
32 }
33
34 return (vaddr + (kaddr & ~PAGE_MASK));
35
36 }
37
dvma_map_iommu(unsigned long kaddr,unsigned long baddr,int len)38 int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
39 int len)
40 {
41
42 unsigned long end;
43 unsigned long vaddr;
44
45 vaddr = dvma_btov(baddr);
46
47 end = vaddr + len;
48
49 while(vaddr < end) {
50 dvma_page(kaddr, vaddr);
51 kaddr += PAGE_SIZE;
52 vaddr += PAGE_SIZE;
53 }
54
55 return 0;
56
57 }
58
sun3_dvma_init(void)59 void sun3_dvma_init(void)
60 {
61
62 memset(ptelist, 0, sizeof(ptelist));
63
64
65 }
66