Remove obsolete #include <linux/config.h>
[safe/jmp/linux-2.6] / drivers / scsi / oktagon_io.S
1 /* -*- mode: asm -*-
2  * Due to problems while transferring data I've put these routines as assembly
3  * code.
4  * Since I'm no PPC assembler guru, the code is just the assembler version of
5
6 int oktag_to_io(long *paddr,long *addr,long len)
7 {
8   long *addr2 = addr;
9   for(len=(len+sizeof(long)-1)/sizeof(long);len--;)
10     *paddr = *addr2++;
11   return addr2 - addr;
12 }
13
14 int oktag_from_io(long *addr,long *paddr,long len)
15 {
16   long *addr2 = addr;
17   for(len=(len+sizeof(long)-1)/sizeof(long);len--;)
18     *addr2++ = *paddr;
19   return addr2 - addr;
20 }
21
22  * assembled using gcc -O2 -S, with two exception catch points where data
23  * is moved to/from the IO register.
24  */
25
26
27 #ifdef CONFIG_APUS
28
29         .file   "oktagon_io.c"
30
31 gcc2_compiled.:
32 /*
33         .section ".text"
34 */
35         .align 2
36         .globl oktag_to_io
37         .type    oktag_to_io,@function
38 oktag_to_io:
39         addi 5,5,3
40         srwi 5,5,2
41         cmpwi 1,5,0
42         mr 9,3
43         mr 3,4
44         addi 5,5,-1
45         bc 12,6,.L3
46 .L5:
47         cmpwi 1,5,0
48         lwz 0,0(3)
49         addi 3,3,4
50         addi 5,5,-1
51 exp1:   stw 0,0(9)
52         bc 4,6,.L5
53 .L3:
54 ret1:   subf 3,4,3
55         srawi 3,3,2
56         blr
57 .Lfe1:
58         .size    oktag_to_io,.Lfe1-oktag_to_io
59         .align 2
60         .globl oktag_from_io
61         .type    oktag_from_io,@function
62 oktag_from_io:
63         addi 5,5,3
64         srwi 5,5,2
65         cmpwi 1,5,0
66         mr 9,3
67         addi 5,5,-1
68         bc 12,6,.L9
69 .L11:
70         cmpwi 1,5,0
71 exp2:   lwz 0,0(4)
72         addi 5,5,-1
73         stw 0,0(3)
74         addi 3,3,4
75         bc 4,6,.L11
76 .L9:
77 ret2:   subf 3,9,3
78         srawi 3,3,2
79         blr
80 .Lfe2:
81         .size    oktag_from_io,.Lfe2-oktag_from_io
82         .ident  "GCC: (GNU) egcs-2.90.29 980515 (egcs-1.0.3 release)"
83
84 /*
85  * Exception table.
86  * Second longword shows where to jump when an exception at the addr the first
87  * longword is pointing to is caught.
88  */
89
90 .section __ex_table,"a"
91         .align  2
92 oktagon_except:
93         .long   exp1,ret1
94         .long   exp2,ret2
95
96 #else
97
98 /*
99 The code which follows is for 680x0 based assembler and is meant for
100 Linux/m68k. It was created by cross compiling the code using the
101 instructions given above. I then added the four labels used in the
102 exception handler table at the bottom of this file.
103 - Kevin <kcozens@interlog.com>
104 */
105
106 #ifdef CONFIG_AMIGA
107
108         .file   "oktagon_io.c"
109         .version        "01.01"
110 gcc2_compiled.:
111 .text
112         .align  2
113 .globl oktag_to_io
114         .type    oktag_to_io,@function
115 oktag_to_io:
116         link.w %a6,#0
117         move.l %d2,-(%sp)
118         move.l 8(%a6),%a1
119         move.l 12(%a6),%d1
120         move.l %d1,%a0
121         move.l 16(%a6),%d0
122         addq.l #3,%d0
123         lsr.l #2,%d0
124         subq.l #1,%d0
125         moveq.l #-1,%d2
126         cmp.l %d0,%d2
127         jbeq .L3
128 .L5:
129 exp1:
130         move.l (%a0)+,(%a1)
131         dbra %d0,.L5
132         clr.w %d0
133         subq.l #1,%d0
134         jbcc .L5
135 .L3:
136 ret1:
137         move.l %a0,%d0
138         sub.l %d1,%d0
139         asr.l #2,%d0
140         move.l -4(%a6),%d2
141         unlk %a6
142         rts
143
144 .Lfe1:
145         .size    oktag_to_io,.Lfe1-oktag_to_io
146         .align  2
147 .globl oktag_from_io
148         .type    oktag_from_io,@function
149 oktag_from_io:
150         link.w %a6,#0
151         move.l %d2,-(%sp)
152         move.l 8(%a6),%d1
153         move.l 12(%a6),%a1
154         move.l %d1,%a0
155         move.l 16(%a6),%d0
156         addq.l #3,%d0
157         lsr.l #2,%d0
158         subq.l #1,%d0
159         moveq.l #-1,%d2
160         cmp.l %d0,%d2
161         jbeq .L9
162 .L11:
163 exp2:
164         move.l (%a1),(%a0)+
165         dbra %d0,.L11
166         clr.w %d0
167         subq.l #1,%d0
168         jbcc .L11
169 .L9:
170 ret2:
171         move.l %a0,%d0
172         sub.l %d1,%d0
173         asr.l #2,%d0
174         move.l -4(%a6),%d2
175         unlk %a6
176         rts
177 .Lfe2:
178         .size    oktag_from_io,.Lfe2-oktag_from_io
179         .ident  "GCC: (GNU) 2.7.2.1"
180
181 /*
182  * Exception table.
183  * Second longword shows where to jump when an exception at the addr the first
184  * longword is pointing to is caught.
185  */
186
187 .section __ex_table,"a"
188         .align  2
189 oktagon_except:
190         .long   exp1,ret1
191         .long   exp2,ret2
192
193 #endif
194 #endif