bus.h revision 1.6 1 1.6 scottr /* $NetBSD: bus.h,v 1.6 1997/02/24 05:55:14 scottr Exp $ */
2 1.1 scottr
3 1.1 scottr /*
4 1.5 scottr * Copyright (C) 1997 Scott Reynolds. All rights reserved.
5 1.5 scottr * Copyright (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.5 scottr * This product includes software developed by Scott Reynolds and
18 1.5 scottr * Jason Thorpe for the 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.6 scottr (void) t; \
100 1.1 scottr __asm __volatile (" \
101 1.1 scottr movl %0,a0 ; \
102 1.1 scottr movl %1,a1 ; \
103 1.1 scottr movl %2,d0 ; \
104 1.1 scottr 1: movb a0@,a1@+ ; \
105 1.1 scottr subql #1,d0 ; \
106 1.1 scottr jne 1b" : \
107 1.1 scottr : \
108 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
109 1.1 scottr "a0","a1","d0"); \
110 1.1 scottr } while (0);
111 1.1 scottr
112 1.1 scottr #define bus_space_read_multi_2(t, h, o, a, c) do { \
113 1.6 scottr (void) t; \
114 1.1 scottr __asm __volatile (" \
115 1.1 scottr movl %0,a0 ; \
116 1.1 scottr movl %1,a1 ; \
117 1.1 scottr movl %2,d0 ; \
118 1.1 scottr 1: movw a0@,a1@+ ; \
119 1.1 scottr subql #1,d0 ; \
120 1.1 scottr jne 1b" : \
121 1.1 scottr : \
122 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
123 1.1 scottr "a0","a1","d0"); \
124 1.1 scottr } while (0);
125 1.1 scottr
126 1.1 scottr #define bus_space_read_multi_4(t, h, o, a, c) do { \
127 1.6 scottr (void) t; \
128 1.1 scottr __asm __volatile (" \
129 1.1 scottr movl %0,a0 ; \
130 1.1 scottr movl %1,a1 ; \
131 1.1 scottr movl %2,d0 ; \
132 1.1 scottr 1: movl a0@,a1@+ ; \
133 1.1 scottr subql #1,d0 ; \
134 1.1 scottr jne 1b" : \
135 1.1 scottr : \
136 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
137 1.1 scottr "a0","a1","d0"); \
138 1.1 scottr } while (0);
139 1.1 scottr
140 1.1 scottr #if 0 /* Cause a link error for bus_space_read_multi_8 */
141 1.1 scottr #define bus_space_read_multi_8 !!! bus_space_read_multi_8 unimplemented !!!
142 1.1 scottr #endif
143 1.1 scottr
144 1.1 scottr /*
145 1.1 scottr * void bus_space_read_region_N __P((bus_space_tag_t tag,
146 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
147 1.1 scottr * u_intN_t *addr, size_t count));
148 1.1 scottr *
149 1.1 scottr * Read `count' 1, 2, 4, or 8 byte quantities from bus space
150 1.1 scottr * described by tag/handle and starting at `offset' and copy into
151 1.1 scottr * buffer provided.
152 1.1 scottr */
153 1.1 scottr
154 1.1 scottr #define bus_space_read_region_1(t, h, o, a, c) do { \
155 1.6 scottr (void) t; \
156 1.1 scottr __asm __volatile (" \
157 1.1 scottr movl %0,a0 ; \
158 1.1 scottr movl %1,a1 ; \
159 1.1 scottr movl %2,d0 ; \
160 1.1 scottr 1: movb a0@+,a1@+ ; \
161 1.1 scottr subql #1,d0 ; \
162 1.1 scottr jne 1b" : \
163 1.1 scottr : \
164 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
165 1.1 scottr "a0","a1","d0"); \
166 1.1 scottr } while (0);
167 1.1 scottr
168 1.1 scottr #define bus_space_read_region_2(t, h, o, a, c) do { \
169 1.6 scottr (void) t; \
170 1.1 scottr __asm __volatile (" \
171 1.1 scottr movl %0,a0 ; \
172 1.1 scottr movl %1,a1 ; \
173 1.1 scottr movl %2,d0 ; \
174 1.1 scottr 1: movw a0@+,a1@+ ; \
175 1.1 scottr subql #1,d0 ; \
176 1.1 scottr jne 1b" : \
177 1.1 scottr : \
178 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
179 1.1 scottr "a0","a1","d0"); \
180 1.1 scottr } while (0);
181 1.1 scottr
182 1.1 scottr #define bus_space_read_region_4(t, h, o, a, c) do { \
183 1.6 scottr (void) t; \
184 1.1 scottr __asm __volatile (" \
185 1.1 scottr movl %0,a0 ; \
186 1.1 scottr movl %1,a1 ; \
187 1.1 scottr movl %2,d0 ; \
188 1.1 scottr 1: movl a0@+,a1@+ ; \
189 1.1 scottr subql #1,d0 ; \
190 1.1 scottr jne 1b" : \
191 1.1 scottr : \
192 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
193 1.1 scottr "a0","a1","d0"); \
194 1.1 scottr } while (0);
195 1.1 scottr
196 1.1 scottr #if 0 /* Cause a link error for bus_space_read_region_8 */
197 1.1 scottr #define bus_space_read_region_8 !!! bus_space_read_region_8 unimplemented !!!
198 1.1 scottr #endif
199 1.1 scottr
200 1.1 scottr /*
201 1.1 scottr * void bus_space_write_N __P((bus_space_tag_t tag,
202 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
203 1.1 scottr * u_intN_t value));
204 1.1 scottr *
205 1.1 scottr * Write the 1, 2, 4, or 8 byte value `value' to bus space
206 1.1 scottr * described by tag/handle/offset.
207 1.1 scottr */
208 1.1 scottr
209 1.1 scottr #define bus_space_write_1(t, h, o, v) \
210 1.1 scottr ((void) t, ((void)(*(volatile u_int8_t *)((h) + (o)) = (v))))
211 1.1 scottr
212 1.1 scottr #define bus_space_write_2(t, h, o, v) \
213 1.1 scottr ((void) t, ((void)(*(volatile u_int16_t *)((h) + (o)) = (v))))
214 1.1 scottr
215 1.1 scottr #define bus_space_write_4(t, h, o, v) \
216 1.1 scottr ((void) t, ((void)(*(volatile u_int32_t *)((h) + (o)) = (v))))
217 1.1 scottr
218 1.1 scottr #if 0 /* Cause a link error for bus_space_write_8 */
219 1.1 scottr #define bus_space_write_8 !!! bus_space_write_8 not implemented !!!
220 1.1 scottr #endif
221 1.1 scottr
222 1.1 scottr /*
223 1.1 scottr * void bus_space_write_multi_N __P((bus_space_tag_t tag,
224 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
225 1.1 scottr * const u_intN_t *addr, size_t count));
226 1.1 scottr *
227 1.1 scottr * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
228 1.1 scottr * provided to bus space described by tag/handle/offset.
229 1.1 scottr */
230 1.1 scottr
231 1.1 scottr #define bus_space_write_multi_1(t, h, o, a, c) do { \
232 1.6 scottr (void) t; \
233 1.1 scottr __asm __volatile (" \
234 1.1 scottr movl %0,a0 ; \
235 1.1 scottr movl %1,a1 ; \
236 1.1 scottr movl %2,d0 ; \
237 1.1 scottr 1: movb a1@+,a0@ ; \
238 1.1 scottr subql #1,d0 ; \
239 1.1 scottr jne 1b" : \
240 1.1 scottr : \
241 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
242 1.1 scottr "a0","a1","d0"); \
243 1.1 scottr } while (0);
244 1.1 scottr
245 1.1 scottr #define bus_space_write_multi_2(t, h, o, a, c) do { \
246 1.6 scottr (void) t; \
247 1.1 scottr __asm __volatile (" \
248 1.1 scottr movl %0,a0 ; \
249 1.1 scottr movl %1,a1 ; \
250 1.1 scottr movl %2,d0 ; \
251 1.1 scottr 1: movw a1@+,a0@ ; \
252 1.1 scottr subql #1,d0 ; \
253 1.1 scottr jne 1b" : \
254 1.1 scottr : \
255 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
256 1.1 scottr "a0","a1","d0"); \
257 1.1 scottr } while (0);
258 1.1 scottr
259 1.1 scottr #define bus_space_write_multi_4(t, h, o, a, c) do { \
260 1.6 scottr (void) t; \
261 1.1 scottr __asm __volatile (" \
262 1.1 scottr movl %0,a0 ; \
263 1.1 scottr movl %1,a1 ; \
264 1.1 scottr movl %2,d0 ; \
265 1.1 scottr 1: movl a1@+,a0@ ; \
266 1.1 scottr subql #1,d0 ; \
267 1.1 scottr jne 1b" : \
268 1.1 scottr : \
269 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
270 1.1 scottr "a0","a1","d0"); \
271 1.1 scottr } while (0);
272 1.1 scottr
273 1.1 scottr #if 0 /* Cause a link error for bus_space_write_8 */
274 1.1 scottr #define bus_space_write_multi_8(t, h, o, a, c) \
275 1.1 scottr !!! bus_space_write_multi_8 unimplimented !!!
276 1.1 scottr #endif
277 1.1 scottr
278 1.1 scottr /*
279 1.1 scottr * void bus_space_write_region_N __P((bus_space_tag_t tag,
280 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
281 1.1 scottr * const u_intN_t *addr, size_t count));
282 1.1 scottr *
283 1.1 scottr * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
284 1.1 scottr * to bus space described by tag/handle starting at `offset'.
285 1.1 scottr */
286 1.1 scottr
287 1.1 scottr #define bus_space_write_region_1(t, h, o, a, c) do { \
288 1.6 scottr (void) t; \
289 1.1 scottr __asm __volatile (" \
290 1.1 scottr movl %0,a0 ; \
291 1.1 scottr movl %1,a1 ; \
292 1.1 scottr movl %2,d0 ; \
293 1.1 scottr 1: movb a1@+,a0@+ ; \
294 1.1 scottr subql #1,d0 ; \
295 1.1 scottr jne 1b" : \
296 1.1 scottr : \
297 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
298 1.1 scottr "a0","a1","d0"); \
299 1.1 scottr } while (0);
300 1.1 scottr
301 1.1 scottr #define bus_space_write_region_2(t, h, o, a, c) do { \
302 1.6 scottr (void) t; \
303 1.1 scottr __asm __volatile (" \
304 1.1 scottr movl %0,a0 ; \
305 1.1 scottr movl %1,a1 ; \
306 1.1 scottr movl %2,d0 ; \
307 1.1 scottr 1: movw a1@+,a0@+ ; \
308 1.1 scottr subql #1,d0 ; \
309 1.1 scottr jne 1b" : \
310 1.1 scottr : \
311 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
312 1.1 scottr "a0","a1","d0"); \
313 1.1 scottr } while (0);
314 1.1 scottr
315 1.1 scottr #define bus_space_write_region_4(t, h, o, a, c) do { \
316 1.6 scottr (void) t; \
317 1.1 scottr __asm __volatile (" \
318 1.1 scottr movl %0,a0 ; \
319 1.1 scottr movl %1,a1 ; \
320 1.1 scottr movl %2,d0 ; \
321 1.1 scottr 1: movl a1@+,a0@+ ; \
322 1.1 scottr subql #1,d0 ; \
323 1.1 scottr jne 1b" : \
324 1.1 scottr : \
325 1.1 scottr "r" ((h) + (o)), "g" (a), "g" (c) : \
326 1.1 scottr "a0","a1","d0"); \
327 1.1 scottr } while (0);
328 1.1 scottr
329 1.1 scottr #if 0 /* Cause a link error for bus_space_write_region_8 */
330 1.1 scottr #define bus_space_write_region_8 \
331 1.1 scottr !!! bus_space_write_region_8 unimplemented !!!
332 1.1 scottr #endif
333 1.1 scottr
334 1.1 scottr /*
335 1.1 scottr * void bus_space_set_multi_N __P((bus_space_tag_t tag,
336 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
337 1.1 scottr * size_t count));
338 1.1 scottr *
339 1.1 scottr * Write the 1, 2, 4, or 8 byte value `val' to bus space described
340 1.1 scottr * by tag/handle/offset `count' times.
341 1.1 scottr */
342 1.1 scottr
343 1.4 scottr #define bus_space_set_multi_1(t, h, o, val, c) do { \
344 1.6 scottr (void) t; \
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: movb 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_2(t, h, o, val, c) do { \
358 1.6 scottr (void) t; \
359 1.4 scottr __asm __volatile (" \
360 1.4 scottr movl %0,a0 ; \
361 1.4 scottr movl %1,d1 ; \
362 1.4 scottr movl %2,d0 ; \
363 1.4 scottr 1: movw d1,a0@ ; \
364 1.4 scottr subql #1,d0 ; \
365 1.4 scottr jne 1b" : \
366 1.4 scottr : \
367 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
368 1.4 scottr "a0","d0","d1"); \
369 1.4 scottr } while (0);
370 1.4 scottr
371 1.4 scottr #define bus_space_set_multi_4(t, h, o, val, c) do { \
372 1.6 scottr (void) t; \
373 1.4 scottr __asm __volatile (" \
374 1.4 scottr movl %0,a0 ; \
375 1.4 scottr movl %1,d1 ; \
376 1.4 scottr movl %2,d0 ; \
377 1.4 scottr 1: movl d1,a0@ ; \
378 1.4 scottr subql #1,d0 ; \
379 1.4 scottr jne 1b" : \
380 1.4 scottr : \
381 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
382 1.4 scottr "a0","d0","d1"); \
383 1.4 scottr } while (0);
384 1.4 scottr
385 1.4 scottr #if 0 /* Cause a link error for bus_space_set_multi_8 */
386 1.4 scottr #define bus_space_set_multi_8 \
387 1.4 scottr !!! bus_space_set_multi_8 unimplemented !!!
388 1.4 scottr #endif
389 1.1 scottr
390 1.1 scottr /*
391 1.1 scottr * void bus_space_set_region_N __P((bus_space_tag_t tag,
392 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
393 1.1 scottr * size_t count));
394 1.1 scottr *
395 1.1 scottr * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
396 1.1 scottr * by tag/handle starting at `offset'.
397 1.1 scottr */
398 1.1 scottr
399 1.4 scottr #define bus_space_set_region_1(t, h, o, val, c) do { \
400 1.6 scottr (void) t; \
401 1.4 scottr __asm __volatile (" \
402 1.4 scottr movl %0,a0 ; \
403 1.4 scottr movl %1,d1 ; \
404 1.4 scottr movl %2,d0 ; \
405 1.4 scottr 1: movb d1,a0@+ ; \
406 1.4 scottr subql #1,d0 ; \
407 1.4 scottr jne 1b" : \
408 1.4 scottr : \
409 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
410 1.4 scottr "a0","d0","d1"); \
411 1.4 scottr } while (0);
412 1.4 scottr
413 1.4 scottr #define bus_space_set_region_2(t, h, o, val, c) do { \
414 1.6 scottr (void) t; \
415 1.4 scottr __asm __volatile (" \
416 1.4 scottr movl %0,a0 ; \
417 1.4 scottr movl %1,d1 ; \
418 1.4 scottr movl %2,d0 ; \
419 1.4 scottr 1: movw d1,a0@+ ; \
420 1.4 scottr subql #1,d0 ; \
421 1.4 scottr jne 1b" : \
422 1.4 scottr : \
423 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
424 1.4 scottr "a0","d0","d1"); \
425 1.4 scottr } while (0);
426 1.4 scottr
427 1.4 scottr #define bus_space_set_region_4(t, h, o, val, c) do { \
428 1.6 scottr (void) t; \
429 1.4 scottr __asm __volatile (" \
430 1.4 scottr movl %0,a0 ; \
431 1.4 scottr movl %1,d1 ; \
432 1.4 scottr movl %2,d0 ; \
433 1.4 scottr 1: movl d1,a0@+ ; \
434 1.4 scottr subql #1,d0 ; \
435 1.4 scottr jne 1b" : \
436 1.4 scottr : \
437 1.4 scottr "r" ((h) + (o)), "g" (val), "g" (c) : \
438 1.4 scottr "a0","d0","d1"); \
439 1.4 scottr } while (0);
440 1.4 scottr
441 1.4 scottr #if 0 /* Cause a link error for bus_space_set_region_8 */
442 1.4 scottr #define bus_space_set_region_8 \
443 1.4 scottr !!! bus_space_set_region_8 unimplemented !!!
444 1.4 scottr #endif
445 1.1 scottr
446 1.1 scottr /*
447 1.1 scottr * void bus_space_copy_N __P((bus_space_tag_t tag,
448 1.1 scottr * bus_space_handle_t bsh1, bus_size_t off1,
449 1.1 scottr * bus_space_handle_t bsh2, bus_size_t off2,
450 1.1 scottr * size_t count));
451 1.1 scottr *
452 1.1 scottr * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
453 1.1 scottr * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
454 1.1 scottr */
455 1.1 scottr
456 1.4 scottr #define bus_space_copy_1(t, h1, o1, h2, o2, c) do { \
457 1.6 scottr (void) t; \
458 1.4 scottr __asm __volatile (" \
459 1.4 scottr movl %0,a0 ; \
460 1.4 scottr movl %1,a1 ; \
461 1.4 scottr movl %2,d0 ; \
462 1.4 scottr 1: movb a0@+,a1@+ ; \
463 1.4 scottr subql #1,d0 ; \
464 1.4 scottr jne 1b" : \
465 1.4 scottr : \
466 1.4 scottr "r" ((h1) + (o1)), "r" ((h2) + (o2)), "g" (c) : \
467 1.4 scottr "a0","a1","d0"); \
468 1.4 scottr } while (0);
469 1.4 scottr
470 1.4 scottr #define bus_space_copy_2(t, h1, o1, h2, o2, c) do { \
471 1.6 scottr (void) t; \
472 1.4 scottr __asm __volatile (" \
473 1.4 scottr movl %0,a0 ; \
474 1.4 scottr movl %1,a1 ; \
475 1.4 scottr movl %2,d0 ; \
476 1.4 scottr 1: movw a0@+,a1@+ ; \
477 1.4 scottr subql #1,d0 ; \
478 1.4 scottr jne 1b" : \
479 1.4 scottr : \
480 1.4 scottr "r" ((h1) + (o1)), "r" ((h2) + (o2)), "g" (c) : \
481 1.4 scottr "a0","a1","d0"); \
482 1.4 scottr } while (0);
483 1.4 scottr
484 1.4 scottr #define bus_space_copy_4(t, h1, o1, h2, o2, c) do { \
485 1.6 scottr (void) t; \
486 1.4 scottr __asm __volatile (" \
487 1.4 scottr movl %0,a0 ; \
488 1.4 scottr movl %1,a1 ; \
489 1.4 scottr movl %2,d0 ; \
490 1.4 scottr 1: movl a0@+,a1@+ ; \
491 1.4 scottr subql #1,d0 ; \
492 1.4 scottr jne 1b" : \
493 1.4 scottr : \
494 1.4 scottr "r" ((h1) + (o1)), "r" ((h2) + (o2)), "g" (c) : \
495 1.4 scottr "a0","a1","d0"); \
496 1.4 scottr } while (0);
497 1.4 scottr
498 1.4 scottr #if 0 /* Cause a link error for bus_space_copy_8 */
499 1.4 scottr #define bus_space_copy_8 \
500 1.4 scottr !!! bus_space_copy_8 unimplemented !!!
501 1.4 scottr #endif
502 1.1 scottr
503 1.1 scottr /*
504 1.1 scottr * Bus read/write barrier methods.
505 1.1 scottr *
506 1.1 scottr * void bus_space_barrier __P((bus_space_tag_t tag,
507 1.1 scottr * bus_space_handle_t bsh, bus_size_t offset,
508 1.1 scottr * bus_size_t len, int flags));
509 1.1 scottr *
510 1.1 scottr * Note: the 680x0 does not currently require barriers, but we must
511 1.1 scottr * provide the flags to MI code.
512 1.1 scottr */
513 1.1 scottr #define bus_space_barrier(t, h, o, l, f) \
514 1.1 scottr ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
515 1.1 scottr #define BUS_BARRIER_READ 0x01 /* force read barrier */
516 1.1 scottr #define BUS_BARRIER_WRITE 0x02 /* force write barrier */
517 1.1 scottr
518 1.1 scottr /*
519 1.1 scottr * Machine-dependent extensions.
520 1.1 scottr */
521 1.1 scottr int bus_probe __P((bus_space_tag_t t, bus_space_handle_t bsh,
522 1.1 scottr bus_size_t offset, int sz));
523 1.1 scottr
524 1.1 scottr #endif /* _MAC68K_BUS_H_ */
525