2 * SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-4-Clause
4 * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
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
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.
33 * Copyright (c) 1997-1999 Eduardo E. Horvath. All rights reserved.
34 * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
35 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions
40 * 1. Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * 2. Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in the
44 * documentation and/or other materials provided with the distribution.
45 * 3. All advertising materials mentioning features or use of this software
46 * must display the following acknowledgement:
47 * This product includes software developed by Christopher G. Demetriou
48 * for the NetBSD Project.
49 * 4. The name of the author may not be used to endorse or promote products
50 * derived from this software without specific prior written permission
52 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
53 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
54 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
55 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
56 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
57 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
61 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 * from: NetBSD: bus.h,v 1.58 2008/04/28 20:23:36 martin Exp
65 * from: FreeBSD: src/sys/alpha/include/bus.h,v 1.9 2001/01/09
70 #ifndef _MACHINE_BUS_H_
71 #define _MACHINE_BUS_H_
73 #ifdef BUS_SPACE_DEBUG
77 #include <machine/_bus.h>
78 #include <machine/cpufunc.h>
81 * Nexus and SBus spaces are non-cached and big endian
82 * (except for RAM and PROM)
84 * PCI spaces are non-cached and little endian
86 #define NEXUS_BUS_SPACE 0
87 #define SBUS_BUS_SPACE 1
88 #define PCI_CONFIG_BUS_SPACE 2
89 #define PCI_IO_BUS_SPACE 3
90 #define PCI_MEMORY_BUS_SPACE 4
91 #define LAST_BUS_SPACE 5
93 extern const int bus_type_asi[];
94 extern const int bus_stream_asi[];
96 #define __BUS_SPACE_HAS_STREAM_METHODS 1
98 #define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF
99 #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
100 #define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFF
101 #define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF
102 #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
103 #define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFF
105 #define BUS_SPACE_UNRESTRICTED (~0)
107 struct bus_space_tag {
113 * Bus space function prototypes.
115 static void bus_space_barrier(bus_space_tag_t, bus_space_handle_t, bus_size_t,
117 static int bus_space_subregion(bus_space_tag_t, bus_space_handle_t,
118 bus_size_t, bus_size_t, bus_space_handle_t *);
121 * Map a region of device bus space into CPU virtual address space.
123 int bus_space_map(bus_space_tag_t tag, bus_addr_t address, bus_size_t size,
124 int flags, bus_space_handle_t *handlep);
127 * Unmap a region of device bus space.
129 void bus_space_unmap(bus_space_tag_t tag, bus_space_handle_t handle,
133 bus_space_barrier(bus_space_tag_t t __unused, bus_space_handle_t h __unused,
134 bus_size_t o __unused, bus_size_t s __unused, int f __unused)
138 * We have lots of alternatives depending on whether we're
139 * synchronizing loads with loads, loads with stores, stores
140 * with loads, or stores with stores. The only ones that seem
141 * generic are #Sync and #MemIssue. We use #Sync for safety.
147 bus_space_subregion(bus_space_tag_t t __unused, bus_space_handle_t h,
148 bus_size_t o __unused, bus_size_t s __unused, bus_space_handle_t *hp)
155 /* flags for bus space map functions */
156 #define BUS_SPACE_MAP_CACHEABLE 0x0001
157 #define BUS_SPACE_MAP_LINEAR 0x0002
158 #define BUS_SPACE_MAP_READONLY 0x0004
159 #define BUS_SPACE_MAP_PREFETCHABLE 0x0008
160 /* placeholders for bus functions... */
161 #define BUS_SPACE_MAP_BUS1 0x0100
162 #define BUS_SPACE_MAP_BUS2 0x0200
163 #define BUS_SPACE_MAP_BUS3 0x0400
164 #define BUS_SPACE_MAP_BUS4 0x0800
166 /* flags for bus_space_barrier() */
167 #define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
168 #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
170 #ifdef BUS_SPACE_DEBUG
171 #define KTR_BUS KTR_SPARE2
172 #define __BUS_DEBUG_ACCESS(h, o, desc, sz) do { \
173 CTR4(KTR_BUS, "bus space: %s %d: handle %#lx, offset %#lx", \
174 (desc), (sz), (h), (o)); \
177 #define __BUS_DEBUG_ACCESS(h, o, desc, sz)
180 static __inline uint8_t
181 bus_space_read_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
184 __BUS_DEBUG_ACCESS(h, o, "read", 1);
185 return (lduba_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
188 static __inline uint16_t
189 bus_space_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
192 __BUS_DEBUG_ACCESS(h, o, "read", 2);
193 return (lduha_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
196 static __inline uint32_t
197 bus_space_read_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
200 __BUS_DEBUG_ACCESS(h, o, "read", 4);
201 return (lduwa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
204 static __inline uint64_t
205 bus_space_read_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
208 __BUS_DEBUG_ACCESS(h, o, "read", 8);
209 return (ldxa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
213 bus_space_read_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
214 uint8_t *a, size_t c)
218 *a++ = bus_space_read_1(t, h, o);
222 bus_space_read_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
223 uint16_t *a, size_t c)
227 *a++ = bus_space_read_2(t, h, o);
231 bus_space_read_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
232 uint32_t *a, size_t c)
236 *a++ = bus_space_read_4(t, h, o);
240 bus_space_read_multi_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
241 uint64_t *a, size_t c)
245 *a++ = bus_space_read_8(t, h, o);
249 bus_space_write_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
253 __BUS_DEBUG_ACCESS(h, o, "write", 1);
254 stba_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
258 bus_space_write_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
262 __BUS_DEBUG_ACCESS(h, o, "write", 2);
263 stha_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
267 bus_space_write_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
271 __BUS_DEBUG_ACCESS(h, o, "write", 4);
272 stwa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
276 bus_space_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
280 __BUS_DEBUG_ACCESS(h, o, "write", 8);
281 stxa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
285 bus_space_write_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
286 const uint8_t *a, size_t c)
290 bus_space_write_1(t, h, o, *a++);
294 bus_space_write_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
295 const uint16_t *a, size_t c)
299 bus_space_write_2(t, h, o, *a++);
303 bus_space_write_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
304 const uint32_t *a, size_t c)
308 bus_space_write_4(t, h, o, *a++);
312 bus_space_write_multi_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
313 const uint64_t *a, size_t c)
317 bus_space_write_8(t, h, o, *a++);
321 bus_space_set_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
326 bus_space_write_1(t, h, o, v);
330 bus_space_set_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
331 uint16_t v, size_t c)
335 bus_space_write_2(t, h, o, v);
339 bus_space_set_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
340 uint32_t v, size_t c)
344 bus_space_write_4(t, h, o, v);
348 bus_space_set_multi_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
349 uint64_t v, size_t c)
353 bus_space_write_8(t, h, o, v);
357 bus_space_read_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
358 uint8_t *a, bus_size_t c)
361 for (; c; a++, c--, o++)
362 *a = bus_space_read_1(t, h, o);
366 bus_space_read_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
367 uint16_t *a, bus_size_t c)
370 for (; c; a++, c--, o += 2)
371 *a = bus_space_read_2(t, h, o);
375 bus_space_read_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
376 uint32_t *a, bus_size_t c)
379 for (; c; a++, c--, o += 4)
380 *a = bus_space_read_4(t, h, o);
384 bus_space_read_region_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
385 uint64_t *a, bus_size_t c)
388 for (; c; a++, c--, o += 8)
389 *a = bus_space_read_8(t, h, o);
393 bus_space_write_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
394 const uint8_t *a, bus_size_t c)
397 for (; c; a++, c--, o++)
398 bus_space_write_1(t, h, o, *a);
402 bus_space_write_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
403 const uint16_t *a, bus_size_t c)
406 for (; c; a++, c--, o += 2)
407 bus_space_write_2(t, h, o, *a);
411 bus_space_write_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
412 const uint32_t *a, bus_size_t c)
415 for (; c; a++, c--, o += 4)
416 bus_space_write_4(t, h, o, *a);
420 bus_space_write_region_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
421 const uint64_t *a, bus_size_t c)
424 for (; c; a++, c--, o += 8)
425 bus_space_write_8(t, h, o, *a);
429 bus_space_set_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
430 const uint8_t v, bus_size_t c)
434 bus_space_write_1(t, h, o, v);
438 bus_space_set_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
439 const uint16_t v, bus_size_t c)
442 for (; c; c--, o += 2)
443 bus_space_write_2(t, h, o, v);
447 bus_space_set_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
448 const uint32_t v, bus_size_t c)
451 for (; c; c--, o += 4)
452 bus_space_write_4(t, h, o, v);
456 bus_space_set_region_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
457 const uint64_t v, bus_size_t c)
460 for (; c; c--, o += 8)
461 bus_space_write_8(t, h, o, v);
465 bus_space_copy_region_1(bus_space_tag_t t, bus_space_handle_t h1,
466 bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
469 for (; c; c--, o1++, o2++)
470 bus_space_write_1(t, h1, o1, bus_space_read_1(t, h2, o2));
474 bus_space_copy_region_2(bus_space_tag_t t, bus_space_handle_t h1,
475 bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
478 for (; c; c--, o1 += 2, o2 += 2)
479 bus_space_write_2(t, h1, o1, bus_space_read_2(t, h2, o2));
483 bus_space_copy_region_4(bus_space_tag_t t, bus_space_handle_t h1,
484 bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
487 for (; c; c--, o1 += 4, o2 += 4)
488 bus_space_write_4(t, h1, o1, bus_space_read_4(t, h2, o2));
492 bus_space_copy_region_8(bus_space_tag_t t, bus_space_handle_t h1,
493 bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
496 for (; c; c--, o1 += 8, o2 += 8)
497 bus_space_write_8(t, h1, o1, bus_space_read_8(t, h2, o2));
500 static __inline uint8_t
501 bus_space_read_stream_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
504 __BUS_DEBUG_ACCESS(h, o, "read stream", 1);
505 return (lduba_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
508 static __inline uint16_t
509 bus_space_read_stream_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
512 __BUS_DEBUG_ACCESS(h, o, "read stream", 2);
513 return (lduha_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
516 static __inline uint32_t
517 bus_space_read_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
520 __BUS_DEBUG_ACCESS(h, o, "read stream", 4);
521 return (lduwa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
524 static __inline uint64_t
525 bus_space_read_stream_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
528 __BUS_DEBUG_ACCESS(h, o, "read stream", 8);
529 return (ldxa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
533 bus_space_read_multi_stream_1(bus_space_tag_t t, bus_space_handle_t h,
534 bus_size_t o, uint8_t *a, size_t c)
538 *a++ = bus_space_read_stream_1(t, h, o);
542 bus_space_read_multi_stream_2(bus_space_tag_t t, bus_space_handle_t h,
543 bus_size_t o, uint16_t *a, size_t c)
547 *a++ = bus_space_read_stream_2(t, h, o);
551 bus_space_read_multi_stream_4(bus_space_tag_t t, bus_space_handle_t h,
552 bus_size_t o, uint32_t *a, size_t c)
556 *a++ = bus_space_read_stream_4(t, h, o);
560 bus_space_read_multi_stream_8(bus_space_tag_t t, bus_space_handle_t h,
561 bus_size_t o, uint64_t *a, size_t c)
565 *a++ = bus_space_read_stream_8(t, h, o);
569 bus_space_write_stream_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
573 __BUS_DEBUG_ACCESS(h, o, "write stream", 1);
574 stba_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
578 bus_space_write_stream_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
582 __BUS_DEBUG_ACCESS(h, o, "write stream", 2);
583 stha_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
587 bus_space_write_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
591 __BUS_DEBUG_ACCESS(h, o, "write stream", 4);
592 stwa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
596 bus_space_write_stream_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
600 __BUS_DEBUG_ACCESS(h, o, "write stream", 8);
601 stxa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
605 bus_space_write_multi_stream_1(bus_space_tag_t t, bus_space_handle_t h,
606 bus_size_t o, const uint8_t *a, size_t c)
610 bus_space_write_stream_1(t, h, o, *a++);
614 bus_space_write_multi_stream_2(bus_space_tag_t t, bus_space_handle_t h,
615 bus_size_t o, const uint16_t *a, size_t c)
619 bus_space_write_stream_2(t, h, o, *a++);
623 bus_space_write_multi_stream_4(bus_space_tag_t t, bus_space_handle_t h,
624 bus_size_t o, const uint32_t *a, size_t c)
628 bus_space_write_stream_4(t, h, o, *a++);
632 bus_space_write_multi_stream_8(bus_space_tag_t t, bus_space_handle_t h,
633 bus_size_t o, const uint64_t *a, size_t c)
637 bus_space_write_stream_8(t, h, o, *a++);
641 bus_space_set_multi_stream_1(bus_space_tag_t t, bus_space_handle_t h,
642 bus_size_t o, uint8_t v, size_t c)
646 bus_space_write_stream_1(t, h, o, v);
650 bus_space_set_multi_stream_2(bus_space_tag_t t, bus_space_handle_t h,
651 bus_size_t o, uint16_t v, size_t c)
655 bus_space_write_stream_2(t, h, o, v);
659 bus_space_set_multi_stream_4(bus_space_tag_t t, bus_space_handle_t h,
660 bus_size_t o, uint32_t v, size_t c)
664 bus_space_write_stream_4(t, h, o, v);
668 bus_space_set_multi_stream_8(bus_space_tag_t t, bus_space_handle_t h,
669 bus_size_t o, uint64_t v, size_t c)
673 bus_space_write_stream_8(t, h, o, v);
677 bus_space_read_region_stream_1(bus_space_tag_t t, bus_space_handle_t h,
678 bus_size_t o, uint8_t *a, bus_size_t c)
681 for (; c; a++, c--, o++)
682 *a = bus_space_read_stream_1(t, h, o);
686 bus_space_read_region_stream_2(bus_space_tag_t t, bus_space_handle_t h,
687 bus_size_t o, uint16_t *a, bus_size_t c)
690 for (; c; a++, c--, o += 2)
691 *a = bus_space_read_stream_2(t, h, o);
695 bus_space_read_region_stream_4(bus_space_tag_t t, bus_space_handle_t h,
696 bus_size_t o, uint32_t *a, bus_size_t c)
699 for (; c; a++, c--, o += 4)
700 *a = bus_space_read_stream_4(t, h, o);
704 bus_space_read_region_stream_8(bus_space_tag_t t, bus_space_handle_t h,
705 bus_size_t o, uint64_t *a, bus_size_t c)
708 for (; c; a++, c--, o += 8)
709 *a = bus_space_read_stream_8(t, h, o);
713 bus_space_write_region_stream_1(bus_space_tag_t t, bus_space_handle_t h,
714 bus_size_t o, const uint8_t *a, bus_size_t c)
717 for (; c; a++, c--, o++)
718 bus_space_write_stream_1(t, h, o, *a);
722 bus_space_write_region_stream_2(bus_space_tag_t t, bus_space_handle_t h,
723 bus_size_t o, const uint16_t *a, bus_size_t c)
726 for (; c; a++, c--, o += 2)
727 bus_space_write_stream_2(t, h, o, *a);
731 bus_space_write_region_stream_4(bus_space_tag_t t, bus_space_handle_t h,
732 bus_size_t o, const uint32_t *a, bus_size_t c)
735 for (; c; a++, c--, o += 4)
736 bus_space_write_stream_4(t, h, o, *a);
740 bus_space_write_region_stream_8(bus_space_tag_t t, bus_space_handle_t h,
741 bus_size_t o, const uint64_t *a, bus_size_t c)
744 for (; c; a++, c--, o += 8)
745 bus_space_write_stream_8(t, h, o, *a);
749 bus_space_set_region_stream_1(bus_space_tag_t t, bus_space_handle_t h,
750 bus_size_t o, const uint8_t v, bus_size_t c)
754 bus_space_write_stream_1(t, h, o, v);
758 bus_space_set_region_stream_2(bus_space_tag_t t, bus_space_handle_t h,
759 bus_size_t o, const uint16_t v, bus_size_t c)
762 for (; c; c--, o += 2)
763 bus_space_write_stream_2(t, h, o, v);
767 bus_space_set_region_stream_4(bus_space_tag_t t, bus_space_handle_t h,
768 bus_size_t o, const uint32_t v, bus_size_t c)
771 for (; c; c--, o += 4)
772 bus_space_write_stream_4(t, h, o, v);
776 bus_space_set_region_stream_8(bus_space_tag_t t, bus_space_handle_t h,
777 bus_size_t o, const uint64_t v, bus_size_t c)
780 for (; c; c--, o += 8)
781 bus_space_write_stream_8(t, h, o, v);
785 bus_space_copy_region_stream_1(bus_space_tag_t t, bus_space_handle_t h1,
786 bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
789 for (; c; c--, o1++, o2++)
790 bus_space_write_stream_1(t, h1, o1, bus_space_read_stream_1(t, h2,
795 bus_space_copy_region_stream_2(bus_space_tag_t t, bus_space_handle_t h1,
796 bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
799 for (; c; c--, o1 += 2, o2 += 2)
800 bus_space_write_stream_2(t, h1, o1, bus_space_read_stream_2(t, h2,
805 bus_space_copy_region_stream_4(bus_space_tag_t t, bus_space_handle_t h1,
806 bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
809 for (; c; c--, o1 += 4, o2 += 4)
810 bus_space_write_stream_4(t, h1, o1, bus_space_read_stream_4(t, h2,
815 bus_space_copy_region_stream_8(bus_space_tag_t t, bus_space_handle_t h1,
816 bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
819 for (; c; c--, o1 += 8, o2 += 8)
820 bus_space_write_stream_8(t, h1, o1, bus_space_read_8(t, h2, o2));
824 bus_space_peek_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
828 __BUS_DEBUG_ACCESS(h, o, "peek", 1);
829 return (fasword8(bus_type_asi[t->bst_type], (caddr_t)(h + o), a));
833 bus_space_peek_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
837 __BUS_DEBUG_ACCESS(h, o, "peek", 2);
838 return (fasword16(bus_type_asi[t->bst_type], (caddr_t)(h + o), a));
842 bus_space_peek_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
846 __BUS_DEBUG_ACCESS(h, o, "peek", 4);
847 return (fasword32(bus_type_asi[t->bst_type], (caddr_t)(h + o), a));
850 #include <machine/bus_dma.h>
852 #endif /* !_MACHINE_BUS_H_ */