bus.h revision 1.4 1 1.4 scottr /* $NetBSD: bus.h,v 1.4 1997/02/20 05:53:00 scottr Exp $ */
2 1.1 scottr
3 1.1 scottr /*
4 1.1 scottr * Copyright "g" (c) 1997 Scott Reynolds. All rights reserved.
5 1.1 scottr * Copyright "g" (c) 1996 Jason R. Thorpe. All rights reserved.
6 1.1 scottr *
7 1.1 scottr * Redistribution and use in source and binary forms, with or without
8 1.1 scottr * modification, are permitted provided that the following conditions
9 1.1 scottr * are met:
10 1.1 scottr * 1. Redistributions of source code must retain the above copyright
11 1.1 scottr * notice, this list of conditions and the following disclaimer.
12 1.1 scottr * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 scottr * notice, this list of conditions and the following disclaimer in the
14 1.1 scottr * documentation and/or other materials provided with the distribution.
15 1.1 scottr * 3. All advertising materials mentioning features or use of this software
16 1.1 scottr * must display the following acknowledgement:
17 1.1 scottr * This product includes software developed by Scott Reynolds for the
18 1.1 scottr * NetBSD Project.
19 1.1 scottr * 4. The name of the author may not be used to endorse or promote products
20 1.1 scottr * derived from this software without specific prior written permission
21 1.1 scottr *
22 1.1 scottr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.1 scottr * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.1 scottr * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.1 scottr * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.1 scottr * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.1 scottr * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.1 scottr * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.1 scottr * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.1 scottr * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.1 scottr * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1 scottr */
33 1.1 scottr
34 1.1 scottr #ifndef _MAC68K_BUS_H_
35 1.1 scottr #define _MAC68K_BUS_H_
36 1.1 scottr
37 1.1 scottr /*
38 1.1 scottr * Value for the mac68k bus space tag, not to be used directly by MI code.
39 1.1 scottr */
40 1.1 scottr #define MAC68K_BUS_SPACE_MEM 0 /* space is mem space */
41 1.1 scottr
42 1.1 scottr /*
43 1.1 scottr * Bus address and size types
44 1.1 scottr */
45 1.1 scottr typedef u_long bus_addr_t;
46 1.1 scottr typedef u_long bus_size_t;
47 1.1 scottr
48 1.1 scottr /*
49 1.1 scottr * Access methods for bus resources and address space.
50 1.1 scottr */
51 1.2 scottr typedef int bus_space_tag_t;
52 1.2 scottr typedef u_long bus_space_handle_t;
53 1.1 scottr
54 1.1 scottr int bus_space_map __P((bus_space_tag_t, bus_addr_t, bus_size_t,
55 1.1 scottr int, bus_space_handle_t *));
56 1.1 scottr void bus_space_unmap __P((bus_space_tag_t, bus_space_handle_t,
57 1.1 scottr bus_size_t));
58 1.1 scottr int bus_space_subregion __P((bus_space_tag_t t, bus_space_handle_t bsh,
59 1.1 scottr bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp));
60 1.3 scottr
61 1.3 scottr int bus_space_alloc __P((bus_space_tag_t t, bus_addr_t rstart,
62 1.3 scottr bus_addr_t rend, bus_size_t size, bus_size_t align,
63 1.3 scottr bus_size_t boundary, int cacheable, bus_addr_t *addrp,
64 1.3 scottr bus_space_handle_t *bshp));
65 1.3 scottr void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
66 1.3 scottr bus_size_t size));
67 1.1 scottr
68 1.1 scottr /*
69 1.1 scottr * u_intN_t bus_space_read_N __P((bus_space_tag_t tag,
70 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset));
71 1.1 scottr *
72 1.1 scottr * Read a 1, 2, 4, or 8 byte quantity from bus space
73 1.1 scottr * described by tag/handle/offset.
74 1.1 scottr */
75 1.1 scottr
76 1.1 scottr #define bus_space_read_1(t, h, o) \
77 1.1 scottr ((void) t, (*(volatile u_int8_t *)((h) + (o))))
78 1.1 scottr
79 1.1 scottr #define bus_space_read_2(t, h, o) \
80 1.1 scottr ((void) t, (*(volatile u_int16_t *)((h) + (o))))
81 1.1 scottr
82 1.1 scottr #define bus_space_read_4(t, h, o) \
83 1.1 scottr ((void) t, (*(volatile u_int32_t *)((h) + (o))))
84 1.1 scottr
85 1.1 scottr #if 0 /* Cause a link error for bus_space_read_8 */
86 1.1 scottr #define bus_space_read_8(t, h, o) !!! bus_space_read_8 unimplemented !!!
87 1.1 scottr #endif
88 1.1 scottr
89 1.1 scottr /*
90 1.1 scottr * void bus_space_read_multi_N __P((bus_space_tag_t tag,
91 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
92 1.1 scottr * u_intN_t *addr, size_t count));
93 1.1 scottr *
94 1.1 scottr * Read `count' 1, 2, 4, or 8 byte quantities from bus space
95 1.1 scottr * described by tag/handle/offset and copy into buffer provided.
96 1.1 scottr */
97 1.1 scottr
98 1.1 scottr #define bus_space_read_multi_1(t, h, o, a, c) do { \
99 1.1 scottr __asm __volatile (" \
100 1.1 scottr movl %0,a0 ; \
101 1.1 scottr movl %1,a1 ; \
102 1.1 scottr movl %2,d0 ; \
103 1.1 scottr 1: movb a0@,a1@+ ; \
104 1.1 scottr subql #1,d0 ; \
105 1.1 scottr jne 1b" : \
106 1.1 scottr : \
107 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
108 1.1 scottr "a0","a1","d0"); \
109 1.1 scottr } while (0);
110 1.1 scottr
111 1.1 scottr #define bus_space_read_multi_2(t, h, o, a, c) do { \
112 1.1 scottr __asm __volatile (" \
113 1.1 scottr movl %0,a0 ; \
114 1.1 scottr movl %1,a1 ; \
115 1.1 scottr movl %2,d0 ; \
116 1.1 scottr 1: movw a0@,a1@+ ; \
117 1.1 scottr subql #1,d0 ; \
118 1.1 scottr jne 1b" : \
119 1.1 scottr : \
120 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
121 1.1 scottr "a0","a1","d0"); \
122 1.1 scottr } while (0);
123 1.1 scottr
124 1.1 scottr #define bus_space_read_multi_4(t, h, o, a, c) do { \
125 1.1 scottr __asm __volatile (" \
126 1.1 scottr movl %0,a0 ; \
127 1.1 scottr movl %1,a1 ; \
128 1.1 scottr movl %2,d0 ; \
129 1.1 scottr 1: movl a0@,a1@+ ; \
130 1.1 scottr subql #1,d0 ; \
131 1.1 scottr jne 1b" : \
132 1.1 scottr : \
133 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
134 1.1 scottr "a0","a1","d0"); \
135 1.1 scottr } while (0);
136 1.1 scottr
137 1.1 scottr #if 0 /* Cause a link error for bus_space_read_multi_8 */
138 1.1 scottr #define bus_space_read_multi_8 !!! bus_space_read_multi_8 unimplemented !!!
139 1.1 scottr #endif
140 1.1 scottr
141 1.1 scottr /*
142 1.1 scottr * void bus_space_read_region_N __P((bus_space_tag_t tag,
143 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
144 1.1 scottr * u_intN_t *addr, size_t count));
145 1.1 scottr *
146 1.1 scottr * Read `count' 1, 2, 4, or 8 byte quantities from bus space
147 1.1 scottr * described by tag/handle and starting at `offset' and copy into
148 1.1 scottr * buffer provided.
149 1.1 scottr */
150 1.1 scottr
151 1.1 scottr #define bus_space_read_region_1(t, h, o, a, c) do { \
152 1.1 scottr __asm __volatile (" \
153 1.1 scottr movl %0,a0 ; \
154 1.1 scottr movl %1,a1 ; \
155 1.1 scottr movl %2,d0 ; \
156 1.1 scottr 1: movb a0@+,a1@+ ; \
157 1.1 scottr subql #1,d0 ; \
158 1.1 scottr jne 1b" : \
159 1.1 scottr : \
160 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
161 1.1 scottr "a0","a1","d0"); \
162 1.1 scottr } while (0);
163 1.1 scottr
164 1.1 scottr #define bus_space_read_region_2(t, h, o, a, c) do { \
165 1.1 scottr __asm __volatile (" \
166 1.1 scottr movl %0,a0 ; \
167 1.1 scottr movl %1,a1 ; \
168 1.1 scottr movl %2,d0 ; \
169 1.1 scottr 1: movw a0@+,a1@+ ; \
170 1.1 scottr subql #1,d0 ; \
171 1.1 scottr jne 1b" : \
172 1.1 scottr : \
173 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
174 1.1 scottr "a0","a1","d0"); \
175 1.1 scottr } while (0);
176 1.1 scottr
177 1.1 scottr #define bus_space_read_region_4(t, h, o, a, c) do { \
178 1.1 scottr __asm __volatile (" \
179 1.1 scottr movl %0,a0 ; \
180 1.1 scottr movl %1,a1 ; \
181 1.1 scottr movl %2,d0 ; \
182 1.1 scottr 1: movl a0@+,a1@+ ; \
183 1.1 scottr subql #1,d0 ; \
184 1.1 scottr jne 1b" : \
185 1.1 scottr : \
186 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
187 1.1 scottr "a0","a1","d0"); \
188 1.1 scottr } while (0);
189 1.1 scottr
190 1.1 scottr #if 0 /* Cause a link error for bus_space_read_region_8 */
191 1.1 scottr #define bus_space_read_region_8 !!! bus_space_read_region_8 unimplemented !!!
192 1.1 scottr #endif
193 1.1 scottr
194 1.1 scottr /*
195 1.1 scottr * void bus_space_write_N __P((bus_space_tag_t tag,
196 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
197 1.1 scottr * u_intN_t value));
198 1.1 scottr *
199 1.1 scottr * Write the 1, 2, 4, or 8 byte value `value' to bus space
200 1.1 scottr * described by tag/handle/offset.
201 1.1 scottr */
202 1.1 scottr
203 1.1 scottr #define bus_space_write_1(t, h, o, v) \
204 1.1 scottr ((void) t, ((void)(*(volatile u_int8_t *)((h) + (o)) = (v))))
205 1.1 scottr
206 1.1 scottr #define bus_space_write_2(t, h, o, v) \
207 1.1 scottr ((void) t, ((void)(*(volatile u_int16_t *)((h) + (o)) = (v))))
208 1.1 scottr
209 1.1 scottr #define bus_space_write_4(t, h, o, v) \
210 1.1 scottr ((void) t, ((void)(*(volatile u_int32_t *)((h) + (o)) = (v))))
211 1.1 scottr
212 1.1 scottr #if 0 /* Cause a link error for bus_space_write_8 */
213 1.1 scottr #define bus_space_write_8 !!! bus_space_write_8 not implemented !!!
214 1.1 scottr #endif
215 1.1 scottr
216 1.1 scottr /*
217 1.1 scottr * void bus_space_write_multi_N __P((bus_space_tag_t tag,
218 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
219 1.1 scottr * const u_intN_t *addr, size_t count));
220 1.1 scottr *
221 1.1 scottr * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
222 1.1 scottr * provided to bus space described by tag/handle/offset.
223 1.1 scottr */
224 1.1 scottr
225 1.1 scottr #define bus_space_write_multi_1(t, h, o, a, c) do { \
226 1.1 scottr __asm __volatile (" \
227 1.1 scottr movl %0,a0 ; \
228 1.1 scottr movl %1,a1 ; \
229 1.1 scottr movl %2,d0 ; \
230 1.1 scottr 1: movb a1@+,a0@ ; \
231 1.1 scottr subql #1,d0 ; \
232 1.1 scottr jne 1b" : \
233 1.1 scottr : \
234 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
235 1.1 scottr "a0","a1","d0"); \
236 1.1 scottr } while (0);
237 1.1 scottr
238 1.1 scottr #define bus_space_write_multi_2(t, h, o, a, c) do { \
239 1.1 scottr __asm __volatile (" \
240 1.1 scottr movl %0,a0 ; \
241 1.1 scottr movl %1,a1 ; \
242 1.1 scottr movl %2,d0 ; \
243 1.1 scottr 1: movw a1@+,a0@ ; \
244 1.1 scottr subql #1,d0 ; \
245 1.1 scottr jne 1b" : \
246 1.1 scottr : \
247 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
248 1.1 scottr "a0","a1","d0"); \
249 1.1 scottr } while (0);
250 1.1 scottr
251 1.1 scottr #define bus_space_write_multi_4(t, h, o, a, c) do { \
252 1.1 scottr __asm __volatile (" \
253 1.1 scottr movl %0,a0 ; \
254 1.1 scottr movl %1,a1 ; \
255 1.1 scottr movl %2,d0 ; \
256 1.1 scottr 1: movl a1@+,a0@ ; \
257 1.1 scottr subql #1,d0 ; \
258 1.1 scottr jne 1b" : \
259 1.1 scottr : \
260 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
261 1.1 scottr "a0","a1","d0"); \
262 1.1 scottr } while (0);
263 1.1 scottr
264 1.1 scottr #if 0 /* Cause a link error for bus_space_write_8 */
265 1.1 scottr #define bus_space_write_multi_8(t, h, o, a, c) \
266 1.1 scottr !!! bus_space_write_multi_8 unimplimented !!!
267 1.1 scottr #endif
268 1.1 scottr
269 1.1 scottr /*
270 1.1 scottr * void bus_space_write_region_N __P((bus_space_tag_t tag,
271 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
272 1.1 scottr * const u_intN_t *addr, size_t count));
273 1.1 scottr *
274 1.1 scottr * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
275 1.1 scottr * to bus space described by tag/handle starting at `offset'.
276 1.1 scottr */
277 1.1 scottr
278 1.1 scottr #define bus_space_write_region_1(t, h, o, a, c) do { \
279 1.1 scottr __asm __volatile (" \
280 1.1 scottr movl %0,a0 ; \
281 1.1 scottr movl %1,a1 ; \
282 1.1 scottr movl %2,d0 ; \
283 1.1 scottr 1: movb a1@+,a0@+ ; \
284 1.1 scottr subql #1,d0 ; \
285 1.1 scottr jne 1b" : \
286 1.1 scottr : \
287 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
288 1.1 scottr "a0","a1","d0"); \
289 1.1 scottr } while (0);
290 1.1 scottr
291 1.1 scottr #define bus_space_write_region_2(t, h, o, a, c) do { \
292 1.1 scottr __asm __volatile (" \
293 1.1 scottr movl %0,a0 ; \
294 1.1 scottr movl %1,a1 ; \
295 1.1 scottr movl %2,d0 ; \
296 1.1 scottr 1: movw a1@+,a0@+ ; \
297 1.1 scottr subql #1,d0 ; \
298 1.1 scottr jne 1b" : \
299 1.1 scottr : \
300 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
301 1.1 scottr "a0","a1","d0"); \
302 1.1 scottr } while (0);
303 1.1 scottr
304 1.1 scottr #define bus_space_write_region_4(t, h, o, a, c) do { \
305 1.1 scottr __asm __volatile (" \
306 1.1 scottr movl %0,a0 ; \
307 1.1 scottr movl %1,a1 ; \
308 1.1 scottr movl %2,d0 ; \
309 1.1 scottr 1: movl a1@+,a0@+ ; \
310 1.1 scottr subql #1,d0 ; \
311 1.1 scottr jne 1b" : \
312 1.1 scottr : \
313 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
314 1.1 scottr "a0","a1","d0"); \
315 1.1 scottr } while (0);
316 1.1 scottr
317 1.1 scottr #if 0 /* Cause a link error for bus_space_write_region_8 */
318 1.1 scottr #define bus_space_write_region_8 \
319 1.1 scottr !!! bus_space_write_region_8 unimplemented !!!
320 1.1 scottr #endif
321 1.1 scottr
322 1.1 scottr /*
323 1.1 scottr * void bus_space_set_multi_N __P((bus_space_tag_t tag,
324 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
325 1.1 scottr * size_t count));
326 1.1 scottr *
327 1.1 scottr * Write the 1, 2, 4, or 8 byte value `val' to bus space described
328 1.1 scottr * by tag/handle/offset `count' times.
329 1.1 scottr */
330 1.1 scottr
331 1.4 scottr #define bus_space_set_multi_1(t, h, o, val, c) do { \
332 1.4 scottr __asm __volatile (" \
333 1.4 scottr movl %0,a0 ; \
334 1.4 scottr movl %1,d1 ; \
335 1.4 scottr movl %2,d0 ; \
336 1.4 scottr 1: movb d1,a0@ ; \
337 1.4 scottr subql #1,d0 ; \
338 1.4 scottr jne 1b" : \
339 1.4 scottr : \
340 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
341 1.4 scottr "a0","d0","d1"); \
342 1.4 scottr } while (0);
343 1.4 scottr
344 1.4 scottr #define bus_space_set_multi_2(t, h, o, val, c) do { \
345 1.4 scottr __asm __volatile (" \
346 1.4 scottr movl %0,a0 ; \
347 1.4 scottr movl %1,d1 ; \
348 1.4 scottr movl %2,d0 ; \
349 1.4 scottr 1: movw d1,a0@ ; \
350 1.4 scottr subql #1,d0 ; \
351 1.4 scottr jne 1b" : \
352 1.4 scottr : \
353 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
354 1.4 scottr "a0","d0","d1"); \
355 1.4 scottr } while (0);
356 1.4 scottr
357 1.4 scottr #define bus_space_set_multi_4(t, h, o, val, c) do { \
358 1.4 scottr __asm __volatile (" \
359 1.4 scottr movl %0,a0 ; \
360 1.4 scottr movl %1,d1 ; \
361 1.4 scottr movl %2,d0 ; \
362 1.4 scottr 1: movl d1,a0@ ; \
363 1.4 scottr subql #1,d0 ; \
364 1.4 scottr jne 1b" : \
365 1.4 scottr : \
366 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
367 1.4 scottr "a0","d0","d1"); \
368 1.4 scottr } while (0);
369 1.4 scottr
370 1.4 scottr #if 0 /* Cause a link error for bus_space_set_multi_8 */
371 1.4 scottr #define bus_space_set_multi_8 \
372 1.4 scottr !!! bus_space_set_multi_8 unimplemented !!!
373 1.4 scottr #endif
374 1.1 scottr
375 1.1 scottr /*
376 1.1 scottr * void bus_space_set_region_N __P((bus_space_tag_t tag,
377 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
378 1.1 scottr * size_t count));
379 1.1 scottr *
380 1.1 scottr * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
381 1.1 scottr * by tag/handle starting at `offset'.
382 1.1 scottr */
383 1.1 scottr
384 1.4 scottr #define bus_space_set_region_1(t, h, o, val, c) do { \
385 1.4 scottr __asm __volatile (" \
386 1.4 scottr movl %0,a0 ; \
387 1.4 scottr movl %1,d1 ; \
388 1.4 scottr movl %2,d0 ; \
389 1.4 scottr 1: movb d1,a0@+ ; \
390 1.4 scottr subql #1,d0 ; \
391 1.4 scottr jne 1b" : \
392 1.4 scottr : \
393 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
394 1.4 scottr "a0","d0","d1"); \
395 1.4 scottr } while (0);
396 1.4 scottr
397 1.4 scottr #define bus_space_set_region_2(t, h, o, val, c) do { \
398 1.4 scottr __asm __volatile (" \
399 1.4 scottr movl %0,a0 ; \
400 1.4 scottr movl %1,d1 ; \
401 1.4 scottr movl %2,d0 ; \
402 1.4 scottr 1: movw d1,a0@+ ; \
403 1.4 scottr subql #1,d0 ; \
404 1.4 scottr jne 1b" : \
405 1.4 scottr : \
406 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
407 1.4 scottr "a0","d0","d1"); \
408 1.4 scottr } while (0);
409 1.4 scottr
410 1.4 scottr #define bus_space_set_region_4(t, h, o, val, c) do { \
411 1.4 scottr __asm __volatile (" \
412 1.4 scottr movl %0,a0 ; \
413 1.4 scottr movl %1,d1 ; \
414 1.4 scottr movl %2,d0 ; \
415 1.4 scottr 1: movl d1,a0@+ ; \
416 1.4 scottr subql #1,d0 ; \
417 1.4 scottr jne 1b" : \
418 1.4 scottr : \
419 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
420 1.4 scottr "a0","d0","d1"); \
421 1.4 scottr } while (0);
422 1.4 scottr
423 1.4 scottr #if 0 /* Cause a link error for bus_space_set_region_8 */
424 1.4 scottr #define bus_space_set_region_8 \
425 1.4 scottr !!! bus_space_set_region_8 unimplemented !!!
426 1.4 scottr #endif
427 1.1 scottr
428 1.1 scottr /*
429 1.1 scottr * void bus_space_copy_N __P((bus_space_tag_t tag,
430 1.1 scottr * bus_space_handle_t bsh1, bus_size_t off1,
431 1.1 scottr * bus_space_handle_t bsh2, bus_size_t off2,
432 1.1 scottr * size_t count));
433 1.1 scottr *
434 1.1 scottr * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
435 1.1 scottr * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
436 1.1 scottr */
437 1.1 scottr
438 1.4 scottr #define bus_space_copy_1(t, h1, o1, h2, o2, c) do { \
439 1.4 scottr __asm __volatile (" \
440 1.4 scottr movl %0,a0 ; \
441 1.4 scottr movl %1,a1 ; \
442 1.4 scottr movl %2,d0 ; \
443 1.4 scottr 1: movb a0@+,a1@+ ; \
444 1.4 scottr subql #1,d0 ; \
445 1.4 scottr jne 1b" : \
446 1.4 scottr : \
447 1.4 scottr "r" ((h1) + (o1)), "r" ((h2) + (o2)), "g" (c) : \
448 1.4 scottr "a0","a1","d0"); \
449 1.4 scottr } while (0);
450 1.4 scottr
451 1.4 scottr #define bus_space_copy_2(t, h1, o1, h2, o2, c) do { \
452 1.4 scottr __asm __volatile (" \
453 1.4 scottr movl %0,a0 ; \
454 1.4 scottr movl %1,a1 ; \
455 1.4 scottr movl %2,d0 ; \
456 1.4 scottr 1: movw a0@+,a1@+ ; \
457 1.4 scottr subql #1,d0 ; \
458 1.4 scottr jne 1b" : \
459 1.4 scottr : \
460 1.4 scottr "r" ((h1) + (o1)), "r" ((h2) + (o2)), "g" (c) : \
461 1.4 scottr "a0","a1","d0"); \
462 1.4 scottr } while (0);
463 1.4 scottr
464 1.4 scottr #define bus_space_copy_4(t, h1, o1, h2, o2, c) do { \
465 1.4 scottr __asm __volatile (" \
466 1.4 scottr movl %0,a0 ; \
467 1.4 scottr movl %1,a1 ; \
468 1.4 scottr movl %2,d0 ; \
469 1.4 scottr 1: movl a0@+,a1@+ ; \
470 1.4 scottr subql #1,d0 ; \
471 1.4 scottr jne 1b" : \
472 1.4 scottr : \
473 1.4 scottr "r" ((h1) + (o1)), "r" ((h2) + (o2)), "g" (c) : \
474 1.4 scottr "a0","a1","d0"); \
475 1.4 scottr } while (0);
476 1.4 scottr
477 1.4 scottr #if 0 /* Cause a link error for bus_space_copy_8 */
478 1.4 scottr #define bus_space_copy_8 \
479 1.4 scottr !!! bus_space_copy_8 unimplemented !!!
480 1.4 scottr #endif
481 1.1 scottr
482 1.1 scottr /*
483 1.1 scottr * Bus read/write barrier methods.
484 1.1 scottr *
485 1.1 scottr * void bus_space_barrier __P((bus_space_tag_t tag,
486 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
487 1.1 scottr * bus_size_t len, int flags));
488 1.1 scottr *
489 1.1 scottr * Note: the 680x0 does not currently require barriers, but we must
490 1.1 scottr * provide the flags to MI code.
491 1.1 scottr */
492 1.1 scottr #define bus_space_barrier(t, h, o, l, f) \
493 1.1 scottr ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
494 1.1 scottr #define BUS_BARRIER_READ 0x01 /* force read barrier */
495 1.1 scottr #define BUS_BARRIER_WRITE 0x02 /* force write barrier */
496 1.1 scottr
497 1.1 scottr /*
498 1.1 scottr * Machine-dependent extensions.
499 1.1 scottr */
500 1.1 scottr int bus_probe __P((bus_space_tag_t t, bus_space_handle_t bsh,
501 1.1 scottr bus_size_t offset, int sz));
502 1.1 scottr
503 1.1 scottr #endif /* _MAC68K_BUS_H_ */
504