No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / mips / include / bus_space.h
blob3b8015bfb46bef97d4ccbb3bd4b72b976467a70d
1 /* $NetBSD: bus_space.h,v 1.4 2008/04/28 20:23:28 martin Exp $ */
3 /*-
4 * Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
34 * Copyright (c) 1996 Carnegie-Mellon University.
35 * All rights reserved.
37 * Author: Chris G. Demetriou
39 * Permission to use, copy, modify and distribute this software and
40 * its documentation is hereby granted, provided that both the copyright
41 * notice and this permission notice appear in all copies of the
42 * software, derivative works or modified versions, and any portions
43 * thereof, and that both notices appear in supporting documentation.
45 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
46 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
47 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
49 * Carnegie Mellon requests users of this software to return to
51 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
52 * School of Computer Science
53 * Carnegie Mellon University
54 * Pittsburgh PA 15213-3890
56 * any improvements or extensions that they make and grant Carnegie the
57 * rights to redistribute these changes.
60 #ifndef _MIPS_BUS_SPACE_H_
61 #define _MIPS_BUS_SPACE_H_
63 #include <sys/types.h>
65 #ifdef _KERNEL
67 #define __BUS_SPACE_HAS_STREAM_METHODS 1
70 * Turn on BUS_SPACE_DEBUG if the global DEBUG option is enabled.
72 #if defined(DEBUG) && !defined(BUS_SPACE_DEBUG)
73 #define BUS_SPACE_DEBUG
74 #endif
76 #ifdef BUS_SPACE_DEBUG
77 #include <sys/systm.h> /* for printf() prototype */
79 * Macros for checking the aligned-ness of pointers passed to bus
80 * space ops. Strict alignment is required by the MIPS architecture,
81 * and a trap will occur if unaligned access is performed. These
82 * may aid in the debugging of a broken device driver by displaying
83 * useful information about the problem.
85 #define __BUS_SPACE_ALIGNED_ADDRESS(p, t) \
86 ((((u_long)(p)) & (sizeof(t)-1)) == 0)
88 #define __BUS_SPACE_ADDRESS_SANITY(p, t, d) \
89 ({ \
90 if (__BUS_SPACE_ALIGNED_ADDRESS((p), t) == 0) { \
91 printf("%s 0x%lx not aligned to %lu bytes %s:%d\n", \
92 d, (u_long)(p), (u_long)sizeof(t), \
93 __FILE__, __LINE__); \
94 } \
95 (void) 0; \
98 #define BUS_SPACE_ALIGNED_POINTER(p, t) __BUS_SPACE_ALIGNED_ADDRESS(p, t)
99 #else
100 #define __BUS_SPACE_ADDRESS_SANITY(p, t, d) (void) 0
101 #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
102 #endif /* BUS_SPACE_DEBUG */
103 #endif /* _KERNEL */
105 struct mips_bus_space_translation;
108 * Addresses (in bus space).
110 typedef paddr_t bus_addr_t;
111 typedef psize_t bus_size_t;
112 #define PRIxBUSADDR PRIxPADDR
113 #define PRIxBUSSIZE PRIxPSIZE
116 * Access methods for bus space.
118 typedef struct mips_bus_space *bus_space_tag_t;
119 typedef intptr_t bus_space_handle_t;
120 #define PRIxBSH PRIxPTR
122 struct mips_bus_space {
123 /* cookie */
124 void *bs_cookie;
126 /* mapping/unmapping */
127 int (*bs_map)(void *, bus_addr_t, bus_size_t, int,
128 bus_space_handle_t *, int);
129 void (*bs_unmap)(void *, bus_space_handle_t, bus_size_t,
130 int);
131 int (*bs_subregion)(void *, bus_space_handle_t, bus_size_t,
132 bus_size_t, bus_space_handle_t *);
134 /* MIPS SPECIFIC MAPPING METHOD */
135 int (*bs_translate)(void *, bus_addr_t, bus_size_t, int,
136 struct mips_bus_space_translation *);
137 int (*bs_get_window)(void *, int,
138 struct mips_bus_space_translation *);
140 /* allocation/deallocation */
141 int (*bs_alloc)(void *, bus_addr_t, bus_addr_t,
142 bus_size_t, bus_size_t, bus_size_t, int,
143 bus_addr_t *, bus_space_handle_t *);
144 void (*bs_free)(void *, bus_space_handle_t, bus_size_t);
146 /* get kernel virtual address */
147 void * (*bs_vaddr)(void *, bus_space_handle_t);
149 /* mmap for user */
150 paddr_t (*bs_mmap)(void *, bus_addr_t, off_t, int, int);
152 /* barrier */
153 void (*bs_barrier)(void *, bus_space_handle_t,
154 bus_size_t, bus_size_t, int);
156 /* read (single) */
157 uint8_t (*bs_r_1)(void *, bus_space_handle_t, bus_size_t);
158 uint16_t (*bs_r_2)(void *, bus_space_handle_t, bus_size_t);
159 uint32_t (*bs_r_4)(void *, bus_space_handle_t, bus_size_t);
160 uint64_t (*bs_r_8)(void *, bus_space_handle_t, bus_size_t);
162 /* read multiple */
163 void (*bs_rm_1)(void *, bus_space_handle_t, bus_size_t,
164 uint8_t *, bus_size_t);
165 void (*bs_rm_2)(void *, bus_space_handle_t, bus_size_t,
166 uint16_t *, bus_size_t);
167 void (*bs_rm_4)(void *, bus_space_handle_t, bus_size_t,
168 uint32_t *, bus_size_t);
169 void (*bs_rm_8)(void *, bus_space_handle_t, bus_size_t,
170 uint64_t *, bus_size_t);
172 /* read region */
173 void (*bs_rr_1)(void *, bus_space_handle_t, bus_size_t,
174 uint8_t *, bus_size_t);
175 void (*bs_rr_2)(void *, bus_space_handle_t, bus_size_t,
176 uint16_t *, bus_size_t);
177 void (*bs_rr_4)(void *, bus_space_handle_t, bus_size_t,
178 uint32_t *, bus_size_t);
179 void (*bs_rr_8)(void *, bus_space_handle_t, bus_size_t,
180 uint64_t *, bus_size_t);
182 /* write (single) */
183 void (*bs_w_1)(void *, bus_space_handle_t, bus_size_t,
184 uint8_t);
185 void (*bs_w_2)(void *, bus_space_handle_t, bus_size_t,
186 uint16_t);
187 void (*bs_w_4)(void *, bus_space_handle_t, bus_size_t,
188 uint32_t);
189 void (*bs_w_8)(void *, bus_space_handle_t, bus_size_t,
190 uint64_t);
192 /* write multiple */
193 void (*bs_wm_1)(void *, bus_space_handle_t, bus_size_t,
194 const uint8_t *, bus_size_t);
195 void (*bs_wm_2)(void *, bus_space_handle_t, bus_size_t,
196 const uint16_t *, bus_size_t);
197 void (*bs_wm_4)(void *, bus_space_handle_t, bus_size_t,
198 const uint32_t *, bus_size_t);
199 void (*bs_wm_8)(void *, bus_space_handle_t, bus_size_t,
200 const uint64_t *, bus_size_t);
202 /* write region */
203 void (*bs_wr_1)(void *, bus_space_handle_t, bus_size_t,
204 const uint8_t *, bus_size_t);
205 void (*bs_wr_2)(void *, bus_space_handle_t, bus_size_t,
206 const uint16_t *, bus_size_t);
207 void (*bs_wr_4)(void *, bus_space_handle_t, bus_size_t,
208 const uint32_t *, bus_size_t);
209 void (*bs_wr_8)(void *, bus_space_handle_t, bus_size_t,
210 const uint64_t *, bus_size_t);
212 /* read (single) stream */
213 uint8_t (*bs_rs_1)(void *, bus_space_handle_t, bus_size_t);
214 uint16_t (*bs_rs_2)(void *, bus_space_handle_t, bus_size_t);
215 uint32_t (*bs_rs_4)(void *, bus_space_handle_t, bus_size_t);
216 uint64_t (*bs_rs_8)(void *, bus_space_handle_t, bus_size_t);
218 /* read multiple stream */
219 void (*bs_rms_1)(void *, bus_space_handle_t, bus_size_t,
220 uint8_t *, bus_size_t);
221 void (*bs_rms_2)(void *, bus_space_handle_t, bus_size_t,
222 uint16_t *, bus_size_t);
223 void (*bs_rms_4)(void *, bus_space_handle_t, bus_size_t,
224 uint32_t *, bus_size_t);
225 void (*bs_rms_8)(void *, bus_space_handle_t, bus_size_t,
226 uint64_t *, bus_size_t);
228 /* read region stream */
229 void (*bs_rrs_1)(void *, bus_space_handle_t, bus_size_t,
230 uint8_t *, bus_size_t);
231 void (*bs_rrs_2)(void *, bus_space_handle_t, bus_size_t,
232 uint16_t *, bus_size_t);
233 void (*bs_rrs_4)(void *, bus_space_handle_t, bus_size_t,
234 uint32_t *, bus_size_t);
235 void (*bs_rrs_8)(void *, bus_space_handle_t, bus_size_t,
236 uint64_t *, bus_size_t);
238 /* write (single) stream */
239 void (*bs_ws_1)(void *, bus_space_handle_t, bus_size_t,
240 uint8_t);
241 void (*bs_ws_2)(void *, bus_space_handle_t, bus_size_t,
242 uint16_t);
243 void (*bs_ws_4)(void *, bus_space_handle_t, bus_size_t,
244 uint32_t);
245 void (*bs_ws_8)(void *, bus_space_handle_t, bus_size_t,
246 uint64_t);
248 /* write multiple stream */
249 void (*bs_wms_1)(void *, bus_space_handle_t, bus_size_t,
250 const uint8_t *, bus_size_t);
251 void (*bs_wms_2)(void *, bus_space_handle_t, bus_size_t,
252 const uint16_t *, bus_size_t);
253 void (*bs_wms_4)(void *, bus_space_handle_t, bus_size_t,
254 const uint32_t *, bus_size_t);
255 void (*bs_wms_8)(void *, bus_space_handle_t, bus_size_t,
256 const uint64_t *, bus_size_t);
258 /* write region stream */
259 void (*bs_wrs_1)(void *, bus_space_handle_t, bus_size_t,
260 const uint8_t *, bus_size_t);
261 void (*bs_wrs_2)(void *, bus_space_handle_t, bus_size_t,
262 const uint16_t *, bus_size_t);
263 void (*bs_wrs_4)(void *, bus_space_handle_t, bus_size_t,
264 const uint32_t *, bus_size_t);
265 void (*bs_wrs_8)(void *, bus_space_handle_t, bus_size_t,
266 const uint64_t *, bus_size_t);
268 /* set multiple */
269 void (*bs_sm_1)(void *, bus_space_handle_t, bus_size_t,
270 uint8_t, bus_size_t);
271 void (*bs_sm_2)(void *, bus_space_handle_t, bus_size_t,
272 uint16_t, bus_size_t);
273 void (*bs_sm_4)(void *, bus_space_handle_t, bus_size_t,
274 uint32_t, bus_size_t);
275 void (*bs_sm_8)(void *, bus_space_handle_t, bus_size_t,
276 uint64_t, bus_size_t);
278 /* set region */
279 void (*bs_sr_1)(void *, bus_space_handle_t, bus_size_t,
280 uint8_t, bus_size_t);
281 void (*bs_sr_2)(void *, bus_space_handle_t, bus_size_t,
282 uint16_t, bus_size_t);
283 void (*bs_sr_4)(void *, bus_space_handle_t, bus_size_t,
284 uint32_t, bus_size_t);
285 void (*bs_sr_8)(void *, bus_space_handle_t, bus_size_t,
286 uint64_t, bus_size_t);
288 /* copy */
289 void (*bs_c_1)(void *, bus_space_handle_t, bus_size_t,
290 bus_space_handle_t, bus_size_t, bus_size_t);
291 void (*bs_c_2)(void *, bus_space_handle_t, bus_size_t,
292 bus_space_handle_t, bus_size_t, bus_size_t);
293 void (*bs_c_4)(void *, bus_space_handle_t, bus_size_t,
294 bus_space_handle_t, bus_size_t, bus_size_t);
295 void (*bs_c_8)(void *, bus_space_handle_t, bus_size_t,
296 bus_space_handle_t, bus_size_t, bus_size_t);
300 * Translation of an MIPS bus address; INTERNAL USE ONLY.
302 struct mips_bus_space_translation {
303 bus_addr_t mbst_bus_start; /* start of bus window */
304 bus_addr_t mbst_bus_end; /* end of bus window */
305 paddr_t mbst_sys_start; /* start of sysBus window */
306 paddr_t mbst_sys_end; /* end of sysBus window */
307 int mbst_align_stride;/* alignment stride */
308 int mbst_flags; /* flags; see below */
311 #ifdef _KERNEL
313 * Utility macros; INTERNAL USE ONLY.
315 #define __bs_c(a,b) __CONCAT(a,b)
316 #define __bs_opname(op,size) __bs_c(__bs_c(__bs_c(bs_,op),_),size)
318 #define __bs_r(type, sz, tn, t, h, o) \
319 (__BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr"), \
320 (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o))
322 #define __bs_w(type, sz, tn, t, h, o, v) \
323 do { \
324 __BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr"); \
325 (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v); \
326 } while (0)
328 #define __bs_nonsingle(type, sz, tn, t, h, o, a, c) \
329 do { \
330 __BUS_SPACE_ADDRESS_SANITY((a), tn, "buffer"); \
331 __BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr"); \
332 (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c); \
333 } while (0)
335 #define __bs_set(type, sz, tn, t, h, o, v, c) \
336 do { \
337 __BUS_SPACE_ADDRESS_SANITY((h) + (o), tn, "bus addr"); \
338 (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v, c); \
339 } while (0)
341 #define __bs_copy(sz, tn, t, h1, o1, h2, o2, cnt) \
342 do { \
343 __BUS_SPACE_ADDRESS_SANITY((h1) + (o1), tn, "bus addr 1"); \
344 __BUS_SPACE_ADDRESS_SANITY((h2) + (o2), tn, "bus addr 2"); \
345 (*(t)->__bs_opname(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt); \
346 } while (0)
350 * Mapping and unmapping operations.
352 #define bus_space_map(t, a, s, f, hp) \
353 (*(t)->bs_map)((t)->bs_cookie, (a), (s), (f), (hp), 1)
354 #define mips_bus_space_map_noacct(t, a, s, f, hp) \
355 (*(t)->bs_map)((t)->bs_cookie, (a), (s), (f), (hp), 0)
356 #define bus_space_unmap(t, h, s) \
357 (*(t)->bs_unmap)((t)->bs_cookie, (h), (s), 1)
358 #define mips_bus_space_unmap_noacct(t, h, s) \
359 (*(t)->bs_unmap)((t)->bs_cookie, (h), (s), 0)
360 #define bus_space_subregion(t, h, o, s, hp) \
361 (*(t)->bs_subregion)((t)->bs_cookie, (h), (o), (s), (hp))
363 #define mips_bus_space_translate(t, a, s, f, bst) \
364 (*(t)->bs_translate)((t)->bs_cookie, (a), (s), (f), (bst))
365 #define mips_bus_space_get_window(t, w, bst) \
366 (*(t)->bs_get_window)((t)->bs_cookie, (w), (bst))
367 #endif /* _KERNEL */
369 #define BUS_SPACE_MAP_CACHEABLE 0x01
370 #define BUS_SPACE_MAP_LINEAR 0x02
371 #define BUS_SPACE_MAP_PREFETCHABLE 0x04
373 #ifdef _KERNEL
375 * Allocation and deallocation operations.
377 #define bus_space_alloc(t, rs, re, s, a, b, f, ap, hp) \
378 (*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b), \
379 (f), (ap), (hp))
380 #define bus_space_free(t, h, s) \
381 (*(t)->bs_free)((t)->bs_cookie, (h), (s))
384 * Get kernel virtual address for ranges mapped BUS_SPACE_MAP_LINEAR.
386 #define bus_space_vaddr(t, h) \
387 (*(t)->bs_vaddr)((t)->bs_cookie, (h))
390 * Mmap bus space for a user application.
392 #define bus_space_mmap(t, a, o, p, f) \
393 (*(t)->bs_mmap)((t)->bs_cookie, (a), (o), (p), (f))
396 * Bus barrier operations.
398 #define bus_space_barrier(t, h, o, l, f) \
399 (*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f))
401 #define BUS_SPACE_BARRIER_READ 0x01
402 #define BUS_SPACE_BARRIER_WRITE 0x02
405 * New style.
407 #define BUS_SPACE_BARRIER_SYNC 0x03
408 #define BUS_SPACE_BARRIER_READ_BEFORE_READ BUS_SPACE_BARRIER_READ
409 #define BUS_SPACE_BARRIER_READ_BEFORE_WRITE BUS_SPACE_BARRIER_READ
410 #define BUS_SPACE_BARRIER_WRITE_BEFORE_READ BUS_SPACE_BARRIER_WRITE
411 #define BUS_SPACE_BARRIER_WRITE_BEFORE_WRITE BUS_SPACE_BARRIER_WRITE
414 * Bus read (single) operations.
416 #define bus_space_read_1(t, h, o) \
417 __bs_r(r,1,uint8_t,(t),(h),(o))
418 #define bus_space_read_2(t, h, o) \
419 __bs_r(r,2,uint16_t,(t),(h),(o))
420 #define bus_space_read_4(t, h, o) \
421 __bs_r(r,4,uint32_t,(t),(h),(o))
422 #define bus_space_read_8(t, h, o) \
423 __bs_r(r,8,uint64_t,(t),(h),(o))
424 #define bus_space_read_stream_1(t, h, o) \
425 __bs_r(rs,1,uint8_t,(t),(h),(o))
426 #define bus_space_read_stream_2(t, h, o) \
427 __bs_r(rs,2,uint16_t,(t),(h),(o))
428 #define bus_space_read_stream_4(t, h, o) \
429 __bs_r(rs,4,uint32_t,(t),(h),(o))
430 #define bus_space_read_stream_8(t, h, o) \
431 __bs_r(rs,8,uint64_t,(t),(h),(o))
435 * Bus read multiple operations.
437 #define bus_space_read_multi_1(t, h, o, a, c) \
438 __bs_nonsingle(rm,1,uint8_t,(t),(h),(o),(a),(c))
439 #define bus_space_read_multi_2(t, h, o, a, c) \
440 __bs_nonsingle(rm,2,uint16_t,(t),(h),(o),(a),(c))
441 #define bus_space_read_multi_4(t, h, o, a, c) \
442 __bs_nonsingle(rm,4,uint32_t,(t),(h),(o),(a),(c))
443 #define bus_space_read_multi_8(t, h, o, a, c) \
444 __bs_nonsingle(rm,8,uint64_t,(t),(h),(o),(a),(c))
445 #define bus_space_read_multi_stream_1(t, h, o, a, c) \
446 __bs_nonsingle(rms,1,uint8_t,(t),(h),(o),(a),(c))
447 #define bus_space_read_multi_stream_2(t, h, o, a, c) \
448 __bs_nonsingle(rms,2,uint16_t,(t),(h),(o),(a),(c))
449 #define bus_space_read_multi_stream_4(t, h, o, a, c) \
450 __bs_nonsingle(rms,4,uint32_t,(t),(h),(o),(a),(c))
451 #define bus_space_read_multi_stream_8(t, h, o, a, c) \
452 __bs_nonsingle(rms,8,uint64_t,(t),(h),(o),(a),(c))
456 * Bus read region operations.
458 #define bus_space_read_region_1(t, h, o, a, c) \
459 __bs_nonsingle(rr,1,uint8_t,(t),(h),(o),(a),(c))
460 #define bus_space_read_region_2(t, h, o, a, c) \
461 __bs_nonsingle(rr,2,uint16_t,(t),(h),(o),(a),(c))
462 #define bus_space_read_region_4(t, h, o, a, c) \
463 __bs_nonsingle(rr,4,uint32_t,(t),(h),(o),(a),(c))
464 #define bus_space_read_region_8(t, h, o, a, c) \
465 __bs_nonsingle(rr,8,uint64_t,(t),(h),(o),(a),(c))
466 #define bus_space_read_region_stream_1(t, h, o, a, c) \
467 __bs_nonsingle(rrs,1,uint8_t,(t),(h),(o),(a),(c))
468 #define bus_space_read_region_stream_2(t, h, o, a, c) \
469 __bs_nonsingle(rrs,2,uint16_t,(t),(h),(o),(a),(c))
470 #define bus_space_read_region_stream_4(t, h, o, a, c) \
471 __bs_nonsingle(rrs,4,uint32_t,(t),(h),(o),(a),(c))
472 #define bus_space_read_region_stream_8(t, h, o, a, c) \
473 __bs_nonsingle(rrs,8,uint64_t,(t),(h),(o),(a),(c))
477 * Bus write (single) operations.
479 #define bus_space_write_1(t, h, o, v) \
480 __bs_w(w,1,uint8_t,(t),(h),(o),(v))
481 #define bus_space_write_2(t, h, o, v) \
482 __bs_w(w,2,uint16_t,(t),(h),(o),(v))
483 #define bus_space_write_4(t, h, o, v) \
484 __bs_w(w,4,uint32_t,(t),(h),(o),(v))
485 #define bus_space_write_8(t, h, o, v) \
486 __bs_w(w,8,uint64_t,(t),(h),(o),(v))
487 #define bus_space_write_stream_1(t, h, o, v) \
488 __bs_w(ws,1,uint8_t,(t),(h),(o),(v))
489 #define bus_space_write_stream_2(t, h, o, v) \
490 __bs_w(ws,2,uint16_t,(t),(h),(o),(v))
491 #define bus_space_write_stream_4(t, h, o, v) \
492 __bs_w(ws,4,uint32_t,(t),(h),(o),(v))
493 #define bus_space_write_stream_8(t, h, o, v) \
494 __bs_w(ws,8,uint64_t,(t),(h),(o),(v))
498 * Bus write multiple operations.
500 #define bus_space_write_multi_1(t, h, o, a, c) \
501 __bs_nonsingle(wm,1,uint8_t,(t),(h),(o),(a),(c))
502 #define bus_space_write_multi_2(t, h, o, a, c) \
503 __bs_nonsingle(wm,2,uint16_t,(t),(h),(o),(a),(c))
504 #define bus_space_write_multi_4(t, h, o, a, c) \
505 __bs_nonsingle(wm,4,uint32_t,(t),(h),(o),(a),(c))
506 #define bus_space_write_multi_8(t, h, o, a, c) \
507 __bs_nonsingle(wm,8,uint64_t,(t),(h),(o),(a),(c))
508 #define bus_space_write_multi_stream_1(t, h, o, a, c) \
509 __bs_nonsingle(wms,1,uint8_t,(t),(h),(o),(a),(c))
510 #define bus_space_write_multi_stream_2(t, h, o, a, c) \
511 __bs_nonsingle(wms,2,uint16_t,(t),(h),(o),(a),(c))
512 #define bus_space_write_multi_stream_4(t, h, o, a, c) \
513 __bs_nonsingle(wms,4,uint32_t,(t),(h),(o),(a),(c))
514 #define bus_space_write_multi_stream_8(t, h, o, a, c) \
515 __bs_nonsingle(wms,8,uint64_t,(t),(h),(o),(a),(c))
519 * Bus write region operations.
521 #define bus_space_write_region_1(t, h, o, a, c) \
522 __bs_nonsingle(wr,1,uint8_t,(t),(h),(o),(a),(c))
523 #define bus_space_write_region_2(t, h, o, a, c) \
524 __bs_nonsingle(wr,2,uint16_t,(t),(h),(o),(a),(c))
525 #define bus_space_write_region_4(t, h, o, a, c) \
526 __bs_nonsingle(wr,4,uint32_t,(t),(h),(o),(a),(c))
527 #define bus_space_write_region_8(t, h, o, a, c) \
528 __bs_nonsingle(wr,8,uint64_t,(t),(h),(o),(a),(c))
529 #define bus_space_write_region_stream_1(t, h, o, a, c) \
530 __bs_nonsingle(wrs,1,uint8_t,(t),(h),(o),(a),(c))
531 #define bus_space_write_region_stream_2(t, h, o, a, c) \
532 __bs_nonsingle(wrs,2,uint16_t,(t),(h),(o),(a),(c))
533 #define bus_space_write_region_stream_4(t, h, o, a, c) \
534 __bs_nonsingle(wrs,4,uint32_t,(t),(h),(o),(a),(c))
535 #define bus_space_write_region_stream_8(t, h, o, a, c) \
536 __bs_nonsingle(wrs,8,uint64_t,(t),(h),(o),(a),(c))
540 * Set multiple operations.
542 #define bus_space_set_multi_1(t, h, o, v, c) \
543 __bs_set(sm,1,uint8_t,(t),(h),(o),(v),(c))
544 #define bus_space_set_multi_2(t, h, o, v, c) \
545 __bs_set(sm,2,uint16_t,(t),(h),(o),(v),(c))
546 #define bus_space_set_multi_4(t, h, o, v, c) \
547 __bs_set(sm,4,uint32_t,(t),(h),(o),(v),(c))
548 #define bus_space_set_multi_8(t, h, o, v, c) \
549 __bs_set(sm,8,uint64_t,(t),(h),(o),(v),(c))
553 * Set region operations.
555 #define bus_space_set_region_1(t, h, o, v, c) \
556 __bs_set(sr,1,uint8_t,(t),(h),(o),(v),(c))
557 #define bus_space_set_region_2(t, h, o, v, c) \
558 __bs_set(sr,2,uint16_t,(t),(h),(o),(v),(c))
559 #define bus_space_set_region_4(t, h, o, v, c) \
560 __bs_set(sr,4,uint32_t,(t),(h),(o),(v),(c))
561 #define bus_space_set_region_8(t, h, o, v, c) \
562 __bs_set(sr,8,uint64_t,(t),(h),(o),(v),(c))
566 * Copy region operations.
568 #define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \
569 __bs_copy(1, uint8_t, (t), (h1), (o1), (h2), (o2), (c))
570 #define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \
571 __bs_copy(2, uint16_t, (t), (h1), (o1), (h2), (o2), (c))
572 #define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \
573 __bs_copy(4, uint32_t, (t), (h1), (o1), (h2), (o2), (c))
574 #define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \
575 __bs_copy(8, uint64_t, (t), (h1), (o1), (h2), (o2), (c))
578 #endif /* _KERNEL */
580 #endif /* _MIPS_BUS_SPACE_H_ */