This source file includes following definitions.
- dump_dma_regs
- dvma_init
1
2
3
4
5
6 #include <linux/kernel.h>
7 #include <linux/malloc.h>
8
9 #include <asm/oplib.h>
10 #include <asm/contregs.h>
11 #include <asm/sysen.h>
12 #include <asm/delay.h>
13 #include <asm/idprom.h>
14 #include <asm/machines.h>
15 #include <asm/io.h>
16 #include <asm/dma.h>
17 #include <asm/sbus.h>
18 #include <asm/vac-ops.h>
19 #include <asm/vaddrs.h>
20
21 struct Linux_SBus_DMA *dma_chain;
22
23
24 void
25 dump_dma_regs(struct sparc_dma_registers *dregs)
26 {
27 printk("DMA CONTROL<%08lx> ADDR<%08lx> CNT<%08lx> TEST<%08lx>\n",
28 dregs->cond_reg,
29 (unsigned long) dregs->st_addr,
30 (unsigned long) dregs->cnt,
31 (unsigned long) dregs->dma_test);
32 return;
33 }
34
35
36
37 unsigned long
38 dvma_init(struct linux_sbus *sbus, unsigned long memory_start)
39 {
40 struct linux_sbus_device *this_dev;
41 struct Linux_SBus_DMA *dma;
42 struct Linux_SBus_DMA *dchain;
43 static int num_dma=0;
44
45 for_each_sbusdev(this_dev, sbus) {
46 if(strcmp(this_dev->prom_name, "dma") &&
47 strcmp(this_dev->prom_name, "ledma") &&
48 strcmp(this_dev->prom_name, "espdma"))
49 continue;
50
51
52 dma = (struct Linux_SBus_DMA *) memory_start;
53 memory_start += sizeof(struct Linux_SBus_DMA);
54
55 dma->SBus_dev = this_dev;
56
57
58 dchain = dma_chain;
59 if(dchain) {
60 while(dchain->next) dchain=dchain->next;
61 dchain->next=dma;
62 } else {
63
64 dma_chain=dma;
65 }
66 dma->next = 0;
67
68 printk("dma%d: ", num_dma);
69 num_dma++;
70
71
72
73
74 prom_apply_sbus_ranges(dma->SBus_dev->reg_addrs, 0x1);
75 dma->regs = (struct sparc_dma_registers *)
76 sparc_alloc_io (dma->SBus_dev->reg_addrs[0].phys_addr, 0,
77 PAGE_SIZE, "dma",
78 dma->SBus_dev->reg_addrs[0].which_io, 0x0);
79
80 dma->node = dma->SBus_dev->prom_node;
81 dma->running=0;
82 dma->allocated=0;
83 switch((dma->regs->cond_reg)&DMA_DEVICE_ID) {
84 case DMA_VERS0:
85 dma->revision=dvmarev0;
86 printk("Revision 0 ");
87 break;
88 case DMA_ESCV1:
89 dma->revision=dvmaesc1;
90 printk("ESC Revision 1 ");
91 break;
92 case DMA_VERS1:
93 dma->revision=dvmarev1;
94 printk("Revision 1 ");
95 break;
96 case DMA_VERS2:
97 dma->revision=dvmarev2;
98 printk("Revision 2 ");
99 break;
100 case DMA_VERSPLUS:
101 dma->revision=dvmarevplus;
102 printk("Revision 1 PLUS ");
103 break;
104 default:
105 printk("unknown dma version");
106 dma->allocated = 1;
107 break;
108 }
109 printk("\n");
110 #if 0
111 dump_dma_regs(dma->regs);
112 #endif
113 };
114
115 return memory_start;
116 }
117