isa_io_asm.S revision 1.1 1 /* $NetBSD: isa_io_asm.S,v 1.1 2004/12/23 04:31:48 joff Exp $ */
2
3 /*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jesse Off.
9 *
10 * This code is derived from software contributed to The NetBSD Foundation
11 * by Mark Brinicombe.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgement:
23 * This product includes software developed by the NetBSD
24 * Foundation, Inc. and its contributors.
25 * 4. Neither the name of The NetBSD Foundation nor the names of its
26 * contributors may be used to endorse or promote products derived
27 * from this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
30 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
31 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
32 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
33 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
34 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
35 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
36 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
37 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 * POSSIBILITY OF SUCH DAMAGE.
40 */
41
42 /*
43 * Copyright 1997
44 * Digital Equipment Corporation. All rights reserved.
45 *
46 * This software is furnished under license and may be used and
47 * copied only in accordance with the following terms and conditions.
48 * Subject to these conditions, you may download, copy, install,
49 * use, modify and distribute this software in source and/or binary
50 * form. No title or ownership is transferred hereby.
51 *
52 * 1) Any source code used, modified or distributed must reproduce
53 * and retain this copyright notice and list of conditions as
54 * they appear in the source file.
55 *
56 * 2) No right is granted to use any trade name, trademark, or logo of
57 * Digital Equipment Corporation. Neither the "Digital Equipment
58 * Corporation" name nor any trademark or logo of Digital Equipment
59 * Corporation may be used to endorse or promote products derived
60 * from this software without the prior written permission of
61 * Digital Equipment Corporation.
62 *
63 * 3) This software is provided "AS-IS" and any express or implied
64 * warranties, including but not limited to, any implied warranties
65 * of merchantability, fitness for a particular purpose, or
66 * non-infringement are disclaimed. In no event shall DIGITAL be
67 * liable for any damages whatsoever, and in particular, DIGITAL
68 * shall not be liable for special, indirect, consequential, or
69 * incidental damages or damages for lost profits, loss of
70 * revenue or loss of use, whether such damages arise in contract,
71 * negligence, tort, under statute, in equity, at law or otherwise,
72 * even if advised of the possibility of such damage.
73 */
74
75 /*
76 * bus_space I/O functions for isa
77 */
78
79 #include <machine/asm.h>
80
81 #ifdef GPROF
82 #define PAUSE nop ; nop ; nop ; nop ; nop
83 #else
84 #define PAUSE
85 #endif
86
87 /*
88 * Note these functions use ARM Architecture V4 instructions as
89 * all current systems with ISA will be using processors that support
90 * V4 or later architectures (SHARK & CATS & TS7XXX)
91 */
92
93 /*
94 * read single
95 */
96
97 ENTRY(isa_bs_r_1)
98 sub r1, r1, #0x4000000 /* 8 bit space is 64Mb below in VA */
99 ldrb r0, [r1, r2]
100 PAUSE
101 mov pc, lr
102
103 ENTRY(isa_bs_r_2)
104 ldrh r0, [r1, r2]
105 PAUSE
106 mov pc, lr
107
108 ENTRY(isa_bs_r_4)
109 ldr r0, [r1, r2]
110 PAUSE
111 mov pc, lr
112
113 /*
114 * read multiple.
115 */
116
117 ENTRY(isa_bs_rm_1)
118 add r0, r1, r2
119 mov r1, r3
120 sub r0, r0, #0x4000000 /* 8 bit space is 64Mb below in VA */
121 ldr r2, [sp, #0]
122 teq r2, #0
123 moveq pc, lr
124
125 Lisa_rm_1_loop:
126 ldrb r3, [r0]
127 strb r3, [r1], #1
128 subs r2, r2, #1
129 bne Lisa_rm_1_loop
130
131 mov pc, lr
132
133 ENTRY(isa_bs_rm_2)
134 add r0, r1, r2
135 mov r1, r3
136 ldr r2, [sp, #0]
137 teq r2, #0
138 moveq pc, lr
139
140 Lisa_rm_2_loop:
141 ldrh r3, [r0]
142 strh r3, [r1], #2
143 subs r2, r2, #1
144 bne Lisa_rm_2_loop
145
146 mov pc, lr
147
148 ENTRY(isa_bs_rm_4)
149 add r0, r1, r2
150 mov r1, r3
151 ldr r2, [sp, #0]
152 teq r2, #0
153 moveq pc, lr
154
155 Lisa_rm_4_loop:
156 ldr r3, [r0]
157 str r3, [r1], #4
158 subs r2, r2, #1
159 bne Lisa_rm_4_loop
160
161 mov pc, lr
162
163 /*
164 * read region.
165 */
166
167 ENTRY(isa_bs_rr_1)
168 add r0, r1, r2
169 mov r1, r3
170 sub r0, r0, #0x4000000 /* 8 bit space is 64Mb below in VA */
171 ldr r2, [sp, #0]
172 teq r2, #0
173 moveq pc, lr
174
175 Lisa_rr_1_loop:
176 ldrb r3, [r0], #1
177 strb r3, [r1], #1
178 subs r2, r2, #1
179 bne Lisa_rr_1_loop
180
181 mov pc, lr
182
183 ENTRY(isa_bs_rr_2)
184 add r0, r1, r2
185 mov r1, r3
186 ldr r2, [sp, #0]
187 teq r2, #0
188 moveq pc, lr
189
190 Lisa_rr_2_loop:
191 ldrh r3, [r0], #2
192 strh r3, [r1], #2
193 subs r2, r2, #1
194 bne Lisa_rr_2_loop
195
196 mov pc, lr
197
198 ENTRY(isa_bs_rr_4)
199 add r0, r1, r2
200 mov r1, r3
201 ldr r2, [sp, #0]
202 teq r2, #0
203 moveq pc, lr
204
205 Lisa_rr_4_loop:
206 ldr r3, [r0], #4
207 str r3, [r1], #4
208 subs r2, r2, #1
209 bne Lisa_rr_4_loop
210
211 mov pc, lr
212
213 /*
214 * write single
215 */
216
217 ENTRY(isa_bs_w_1)
218 sub r1, r1, #0x4000000 /* 8 bit space is 64Mb below in VA */
219 strb r3, [r1, r2]
220 PAUSE
221 mov pc, lr
222
223 ENTRY(isa_bs_w_2)
224 strh r3, [r1, r2]
225 PAUSE
226 mov pc, lr
227
228 ENTRY(isa_bs_w_4)
229 str r3, [r1, r2]
230 PAUSE
231 mov pc, lr
232
233 /*
234 * write multiple
235 */
236
237 ENTRY(isa_bs_wm_1)
238 add r0, r1, r2
239 mov r1, r3
240 sub r0, r0, #0x4000000 /* 8 bit space is 64Mb below in VA */
241 ldr r2, [sp, #0]
242 teq r2, #0
243 moveq pc, lr
244
245 Lisa_wm_1_loop:
246 ldrb r3, [r1], #1
247 strb r3, [r0]
248 subs r2, r2, #1
249 bne Lisa_wm_1_loop
250
251 mov pc, lr
252
253 ENTRY(isa_bs_wm_2)
254 add r0, r1, r2
255 mov r1, r3
256 ldr r2, [sp, #0]
257 teq r2, #0
258 moveq pc, lr
259
260 Lisa_wm_2_loop:
261 ldrh r3, [r1], #2
262 strh r3, [r0]
263 subs r2, r2, #1
264 bne Lisa_wm_2_loop
265
266 mov pc, lr
267
268 ENTRY(isa_bs_wm_4)
269 add r0, r1, r2
270 mov r1, r3
271 ldr r2, [sp, #0]
272 teq r2, #0
273 moveq pc, lr
274
275 Lisa_wm_4_loop:
276 ldr r3, [r1], #4
277 str r3, [r0]
278 subs r2, r2, #1
279 bne Lisa_wm_4_loop
280
281 mov pc, lr
282
283
284 /*
285 * write region.
286 */
287
288 ENTRY(isa_bs_wr_1)
289 add r0, r1, r2
290 mov r1, r3
291 sub r0, r0, #0x4000000 /* 8 bit space is 64Mb below in VA */
292 ldr r2, [sp, #0]
293 teq r2, #0
294 moveq pc, lr
295
296 Lisa_wr_1_loop:
297 ldrb r3, [r1], #1
298 strb r3, [r0], #1
299 subs r2, r2, #1
300 bne Lisa_wr_1_loop
301
302 mov pc, lr
303
304 ENTRY(isa_bs_wr_2)
305 add r0, r1, r2
306 mov r1, r3
307 ldr r2, [sp, #0]
308 teq r2, #0
309 moveq pc, lr
310
311 Lisa_wr_2_loop:
312 ldrh r3, [r1], #2
313 strh r3, [r0], #2
314 subs r2, r2, #1
315 bne Lisa_wr_2_loop
316
317 mov pc, lr
318
319 ENTRY(isa_bs_wr_4)
320 add r0, r1, r2
321 mov r1, r3
322 ldr r2, [sp, #0]
323 teq r2, #0
324 moveq pc, lr
325
326 Lisa_wr_4_loop:
327 ldr r3, [r1], #4
328 str r3, [r0], #4
329 subs r2, r2, #1
330 bne Lisa_wr_4_loop
331
332 mov pc, lr
333
334 /*
335 * Set region
336 */
337
338 ENTRY(isa_bs_sr_2)
339 add r0, r1, r2
340 mov r1, r3
341 ldr r2, [sp, #0]
342 teq r2, #0
343 moveq pc, lr
344
345 Lisa_bs_sr_2_loop:
346 strh r1, [r0], #2
347 subs r2, r2, #1
348 bne Lisa_bs_sr_2_loop
349
350 mov pc, lr
351