2 * Copyright (c) 2009 Marcel Moolenaar
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 /* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */
30 * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
31 * All rights reserved.
33 * This code is derived from software contributed to The NetBSD Foundation
34 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
35 * NASA Ames Research Center.
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.
46 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
47 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
48 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
49 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
50 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
51 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
52 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
53 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
54 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
55 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
56 * POSSIBILITY OF SUCH DAMAGE.
60 * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
61 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
63 * Redistribution and use in source and binary forms, with or without
64 * modification, are permitted provided that the following conditions
66 * 1. Redistributions of source code must retain the above copyright
67 * notice, this list of conditions and the following disclaimer.
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in the
70 * documentation and/or other materials provided with the distribution.
71 * 3. All advertising materials mentioning features or use of this software
72 * must display the following acknowledgement:
73 * This product includes software developed by Christopher G. Demetriou
74 * for the NetBSD Project.
75 * 4. The name of the author may not be used to endorse or promote products
76 * derived from this software without specific prior written permission
78 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
79 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
80 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
81 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
82 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
83 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
84 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
85 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
86 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
87 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
91 #ifndef _MACHINE_BUS_H_
92 #define _MACHINE_BUS_H_
94 #include <machine/_bus.h>
95 #include <machine/cpufunc.h>
98 * I/O port reads with ia32 semantics.
100 #define inb bus_space_read_io_1
101 #define inw bus_space_read_io_2
102 #define inl bus_space_read_io_4
104 #define outb bus_space_write_io_1
105 #define outw bus_space_write_io_2
106 #define outl bus_space_write_io_4
109 * Values for the ia64 bus space tag, not to be used directly by MI code.
111 #define IA64_BUS_SPACE_IO 0 /* space is i/o space */
112 #define IA64_BUS_SPACE_MEM 1 /* space is mem space */
114 #define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
115 #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
117 #define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF
118 #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
119 #define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFF
120 #define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF
121 #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
122 #define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFF
124 #define BUS_SPACE_UNRESTRICTED (~0)
129 * Map and unmap a region of device bus space into CPU virtual address space.
132 bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
133 bus_space_handle_t *);
136 bus_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t size);
139 * Get a new handle for a subregion of an already-mapped area of bus space.
142 bus_space_subregion(bus_space_tag_t bst, bus_space_handle_t bsh,
143 bus_size_t ofs, bus_size_t size __unused, bus_space_handle_t *nbshp)
151 * Allocate a region of memory that is accessible to devices in bus space.
154 bus_space_alloc(bus_space_tag_t bst, bus_addr_t rstart, bus_addr_t rend,
155 bus_size_t size, bus_size_t align, bus_size_t boundary, int flags,
156 bus_addr_t *addrp, bus_space_handle_t *bshp);
160 * Free a region of bus space accessible memory.
163 bus_space_free(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t size);
167 * Bus read/write barrier method.
170 bus_space_barrier(bus_space_tag_t bst __unused, bus_space_handle_t bsh __unused,
171 bus_size_t ofs __unused, bus_size_t size __unused, int flags __unused)
179 * Read 1 unit of data from bus space described by the tag, handle and ofs
180 * tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
183 uint8_t bus_space_read_io_1(u_long);
184 uint16_t bus_space_read_io_2(u_long);
185 uint32_t bus_space_read_io_4(u_long);
186 uint64_t bus_space_read_io_8(u_long);
188 static __inline uint8_t
189 bus_space_read_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
193 val = (__predict_false(bst == IA64_BUS_SPACE_IO))
194 ? bus_space_read_io_1(bsh + ofs)
195 : ia64_ld1((void *)(bsh + ofs));
199 static __inline uint16_t
200 bus_space_read_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
204 val = (__predict_false(bst == IA64_BUS_SPACE_IO))
205 ? bus_space_read_io_2(bsh + ofs)
206 : ia64_ld2((void *)(bsh + ofs));
210 static __inline uint32_t
211 bus_space_read_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
215 val = (__predict_false(bst == IA64_BUS_SPACE_IO))
216 ? bus_space_read_io_4(bsh + ofs)
217 : ia64_ld4((void *)(bsh + ofs));
221 static __inline uint64_t
222 bus_space_read_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
226 val = (__predict_false(bst == IA64_BUS_SPACE_IO))
227 ? bus_space_read_io_8(bsh + ofs)
228 : ia64_ld8((void *)(bsh + ofs));
234 * Write 1 unit of data to bus space described by the tag, handle and ofs
235 * tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
236 * data is passed by value.
238 void bus_space_write_io_1(u_long, uint8_t);
239 void bus_space_write_io_2(u_long, uint16_t);
240 void bus_space_write_io_4(u_long, uint32_t);
241 void bus_space_write_io_8(u_long, uint64_t);
244 bus_space_write_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
248 if (__predict_false(bst == IA64_BUS_SPACE_IO))
249 bus_space_write_io_1(bsh + ofs, val);
251 ia64_st1((void *)(bsh + ofs), val);
255 bus_space_write_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
259 if (__predict_false(bst == IA64_BUS_SPACE_IO))
260 bus_space_write_io_2(bsh + ofs, val);
262 ia64_st2((void *)(bsh + ofs), val);
266 bus_space_write_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
270 if (__predict_false(bst == IA64_BUS_SPACE_IO))
271 bus_space_write_io_4(bsh + ofs, val);
273 ia64_st4((void *)(bsh + ofs), val);
277 bus_space_write_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
281 if (__predict_false(bst == IA64_BUS_SPACE_IO))
282 bus_space_write_io_8(bsh + ofs, val);
284 ia64_st8((void *)(bsh + ofs), val);
289 * Read count units of data from bus space described by the tag, handle and
290 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
291 * data is returned in the buffer passed by reference.
293 void bus_space_read_multi_io_1(u_long, uint8_t *, size_t);
294 void bus_space_read_multi_io_2(u_long, uint16_t *, size_t);
295 void bus_space_read_multi_io_4(u_long, uint32_t *, size_t);
296 void bus_space_read_multi_io_8(u_long, uint64_t *, size_t);
299 bus_space_read_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
300 bus_size_t ofs, uint8_t *bufp, size_t count)
303 if (__predict_false(bst == IA64_BUS_SPACE_IO))
304 bus_space_read_multi_io_1(bsh + ofs, bufp, count);
307 *bufp++ = ia64_ld1((void *)(bsh + ofs));
312 bus_space_read_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
313 bus_size_t ofs, uint16_t *bufp, size_t count)
316 if (__predict_false(bst == IA64_BUS_SPACE_IO))
317 bus_space_read_multi_io_2(bsh + ofs, bufp, count);
320 *bufp++ = ia64_ld2((void *)(bsh + ofs));
325 bus_space_read_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
326 bus_size_t ofs, uint32_t *bufp, size_t count)
329 if (__predict_false(bst == IA64_BUS_SPACE_IO))
330 bus_space_read_multi_io_4(bsh + ofs, bufp, count);
333 *bufp++ = ia64_ld4((void *)(bsh + ofs));
338 bus_space_read_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
339 bus_size_t ofs, uint64_t *bufp, size_t count)
342 if (__predict_false(bst == IA64_BUS_SPACE_IO))
343 bus_space_read_multi_io_8(bsh + ofs, bufp, count);
346 *bufp++ = ia64_ld8((void *)(bsh + ofs));
352 * Write count units of data to bus space described by the tag, handle and
353 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
354 * data is read from the buffer passed by reference.
356 void bus_space_write_multi_io_1(u_long, const uint8_t *, size_t);
357 void bus_space_write_multi_io_2(u_long, const uint16_t *, size_t);
358 void bus_space_write_multi_io_4(u_long, const uint32_t *, size_t);
359 void bus_space_write_multi_io_8(u_long, const uint64_t *, size_t);
362 bus_space_write_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
363 bus_size_t ofs, const uint8_t *bufp, size_t count)
366 if (__predict_false(bst == IA64_BUS_SPACE_IO))
367 bus_space_write_multi_io_1(bsh + ofs, bufp, count);
370 ia64_st1((void *)(bsh + ofs), *bufp++);
375 bus_space_write_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
376 bus_size_t ofs, const uint16_t *bufp, size_t count)
379 if (__predict_false(bst == IA64_BUS_SPACE_IO))
380 bus_space_write_multi_io_2(bsh + ofs, bufp, count);
383 ia64_st2((void *)(bsh + ofs), *bufp++);
388 bus_space_write_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
389 bus_size_t ofs, const uint32_t *bufp, size_t count)
392 if (__predict_false(bst == IA64_BUS_SPACE_IO))
393 bus_space_write_multi_io_4(bsh + ofs, bufp, count);
396 ia64_st4((void *)(bsh + ofs), *bufp++);
401 bus_space_write_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
402 bus_size_t ofs, const uint64_t *bufp, size_t count)
405 if (__predict_false(bst == IA64_BUS_SPACE_IO))
406 bus_space_write_multi_io_8(bsh + ofs, bufp, count);
409 ia64_st8((void *)(bsh + ofs), *bufp++);
415 * Read count units of data from bus space described by the tag, handle and
416 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
417 * data is written to the buffer passed by reference and read from successive
418 * bus space addresses. Access is unordered.
420 void bus_space_read_region_io_1(u_long, uint8_t *, size_t);
421 void bus_space_read_region_io_2(u_long, uint16_t *, size_t);
422 void bus_space_read_region_io_4(u_long, uint32_t *, size_t);
423 void bus_space_read_region_io_8(u_long, uint64_t *, size_t);
426 bus_space_read_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
427 bus_size_t ofs, uint8_t *bufp, size_t count)
430 if (__predict_false(bst == IA64_BUS_SPACE_IO))
431 bus_space_read_region_io_1(bsh + ofs, bufp, count);
433 uint8_t *bsp = (void *)(bsh + ofs);
435 *bufp++ = ia64_ld1(bsp++);
440 bus_space_read_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
441 bus_size_t ofs, uint16_t *bufp, size_t count)
444 if (__predict_false(bst == IA64_BUS_SPACE_IO))
445 bus_space_read_region_io_2(bsh + ofs, bufp, count);
447 uint16_t *bsp = (void *)(bsh + ofs);
449 *bufp++ = ia64_ld2(bsp++);
454 bus_space_read_region_4(bus_space_tag_t bst, bus_space_handle_t bsh,
455 bus_size_t ofs, uint32_t *bufp, size_t count)
458 if (__predict_false(bst == IA64_BUS_SPACE_IO))
459 bus_space_read_region_io_4(bsh + ofs, bufp, count);
461 uint32_t *bsp = (void *)(bsh + ofs);
463 *bufp++ = ia64_ld4(bsp++);
468 bus_space_read_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
469 bus_size_t ofs, uint64_t *bufp, size_t count)
472 if (__predict_false(bst == IA64_BUS_SPACE_IO))
473 bus_space_read_region_io_8(bsh + ofs, bufp, count);
475 uint64_t *bsp = (void *)(bsh + ofs);
477 *bufp++ = ia64_ld8(bsp++);
483 * Write count units of data from bus space described by the tag, handle and
484 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
485 * data is read from the buffer passed by reference and written to successive
486 * bus space addresses. Access is unordered.
488 void bus_space_write_region_io_1(u_long, const uint8_t *, size_t);
489 void bus_space_write_region_io_2(u_long, const uint16_t *, size_t);
490 void bus_space_write_region_io_4(u_long, const uint32_t *, size_t);
491 void bus_space_write_region_io_8(u_long, const uint64_t *, size_t);
494 bus_space_write_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
495 bus_size_t ofs, const uint8_t *bufp, size_t count)
498 if (__predict_false(bst == IA64_BUS_SPACE_IO))
499 bus_space_write_region_io_1(bsh + ofs, bufp, count);
501 uint8_t *bsp = (void *)(bsh + ofs);
503 ia64_st1(bsp++, *bufp++);
508 bus_space_write_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
509 bus_size_t ofs, const uint16_t *bufp, size_t count)
512 if (__predict_false(bst == IA64_BUS_SPACE_IO))
513 bus_space_write_region_io_2(bsh + ofs, bufp, count);
515 uint16_t *bsp = (void *)(bsh + ofs);
517 ia64_st2(bsp++, *bufp++);
522 bus_space_write_region_4(bus_space_tag_t bst, bus_space_handle_t bsh,
523 bus_size_t ofs, const uint32_t *bufp, size_t count)
526 if (__predict_false(bst == IA64_BUS_SPACE_IO))
527 bus_space_write_region_io_4(bsh + ofs, bufp, count);
529 uint32_t *bsp = (void *)(bsh + ofs);
531 ia64_st4(bsp++, *bufp++);
536 bus_space_write_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
537 bus_size_t ofs, const uint64_t *bufp, size_t count)
540 if (__predict_false(bst == IA64_BUS_SPACE_IO))
541 bus_space_write_region_io_8(bsh + ofs, bufp, count);
543 uint64_t *bsp = (void *)(bsh + ofs);
545 ia64_st8(bsp++, *bufp++);
551 * Write count units of data from bus space described by the tag, handle and
552 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
553 * data is passed by value. Writes are unordered.
556 bus_space_set_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
557 bus_size_t ofs, uint8_t val, size_t count)
561 bus_space_write_1(bst, bsh, ofs, val);
565 bus_space_set_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
566 bus_size_t ofs, uint16_t val, size_t count)
570 bus_space_write_2(bst, bsh, ofs, val);
574 bus_space_set_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
575 bus_size_t ofs, uint32_t val, size_t count)
579 bus_space_write_4(bst, bsh, ofs, val);
583 bus_space_set_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
584 bus_size_t ofs, uint64_t val, size_t count)
588 bus_space_write_8(bst, bsh, ofs, val);
593 * Write count units of data from bus space described by the tag, handle and
594 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
595 * data is passed by value and written to successive bus space addresses.
596 * Writes are unordered.
598 void bus_space_set_region_io_1(u_long, uint8_t, size_t);
599 void bus_space_set_region_io_2(u_long, uint16_t, size_t);
600 void bus_space_set_region_io_4(u_long, uint32_t, size_t);
601 void bus_space_set_region_io_8(u_long, uint64_t, size_t);
604 bus_space_set_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
605 bus_size_t ofs, uint8_t val, size_t count)
608 if (__predict_false(bst == IA64_BUS_SPACE_IO))
609 bus_space_set_region_io_1(bsh + ofs, val, count);
611 uint8_t *bsp = (void *)(bsh + ofs);
613 ia64_st1(bsp++, val);
618 bus_space_set_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
619 bus_size_t ofs, uint16_t val, size_t count)
622 if (__predict_false(bst == IA64_BUS_SPACE_IO))
623 bus_space_set_region_io_2(bsh + ofs, val, count);
625 uint16_t *bsp = (void *)(bsh + ofs);
627 ia64_st2(bsp++, val);
632 bus_space_set_region_4(bus_space_tag_t bst, bus_space_handle_t bsh,
633 bus_size_t ofs, uint32_t val, size_t count)
636 if (__predict_false(bst == IA64_BUS_SPACE_IO))
637 bus_space_set_region_io_4(bsh + ofs, val, count);
639 uint32_t *bsp = (void *)(bsh + ofs);
641 ia64_st4(bsp++, val);
646 bus_space_set_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
647 bus_size_t ofs, uint64_t val, size_t count)
650 if (__predict_false(bst == IA64_BUS_SPACE_IO))
651 bus_space_set_region_io_4(bsh + ofs, val, count);
653 uint64_t *bsp = (void *)(bsh + ofs);
655 ia64_st8(bsp++, val);
661 * Copy count units of data from bus space described by the tag and the first
662 * handle and ofs pair to bus space described by the tag and the second handle
663 * and ofs pair. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes.
664 * The data is read from successive bus space addresses and also written to
665 * successive bus space addresses. Both reads and writes are unordered.
667 void bus_space_copy_region_io_1(u_long, u_long, size_t);
668 void bus_space_copy_region_io_2(u_long, u_long, size_t);
669 void bus_space_copy_region_io_4(u_long, u_long, size_t);
670 void bus_space_copy_region_io_8(u_long, u_long, size_t);
673 bus_space_copy_region_1(bus_space_tag_t bst, bus_space_handle_t sbsh,
674 bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
678 if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
679 bus_space_copy_region_io_1(sbsh + sofs, dbsh + dofs, count);
683 src = (void *)(sbsh + sofs);
684 dst = (void *)(dbsh + dofs);
689 ia64_st1(dst--, ia64_ld1(src--));
692 ia64_st1(dst++, ia64_ld1(src++));
697 bus_space_copy_region_2(bus_space_tag_t bst, bus_space_handle_t sbsh,
698 bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
702 if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
703 bus_space_copy_region_io_2(sbsh + sofs, dbsh + dofs, count);
707 src = (void *)(sbsh + sofs);
708 dst = (void *)(dbsh + dofs);
713 ia64_st2(dst--, ia64_ld2(src--));
716 ia64_st2(dst++, ia64_ld2(src++));
721 bus_space_copy_region_4(bus_space_tag_t bst, bus_space_handle_t sbsh,
722 bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
726 if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
727 bus_space_copy_region_io_4(sbsh + sofs, dbsh + dofs, count);
731 src = (void *)(sbsh + sofs);
732 dst = (void *)(dbsh + dofs);
737 ia64_st4(dst--, ia64_ld4(src--));
740 ia64_st4(dst++, ia64_ld4(src++));
745 bus_space_copy_region_8(bus_space_tag_t bst, bus_space_handle_t sbsh,
746 bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
750 if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
751 bus_space_copy_region_io_8(sbsh + sofs, dbsh + dofs, count);
755 src = (void *)(sbsh + sofs);
756 dst = (void *)(dbsh + dofs);
761 ia64_st8(dst--, ia64_ld8(src--));
764 ia64_st8(dst++, ia64_ld8(src++));
770 * Stream accesses are the same as normal accesses on ia64; there are no
771 * supported bus systems with an endianess different from the host one.
774 #define bus_space_read_stream_1 bus_space_read_1
775 #define bus_space_read_stream_2 bus_space_read_2
776 #define bus_space_read_stream_4 bus_space_read_4
777 #define bus_space_read_stream_8 bus_space_read_8
779 #define bus_space_write_stream_1 bus_space_write_1
780 #define bus_space_write_stream_2 bus_space_write_2
781 #define bus_space_write_stream_4 bus_space_write_4
782 #define bus_space_write_stream_8 bus_space_write_8
784 #define bus_space_read_multi_stream_1 bus_space_read_multi_1
785 #define bus_space_read_multi_stream_2 bus_space_read_multi_2
786 #define bus_space_read_multi_stream_4 bus_space_read_multi_4
787 #define bus_space_read_multi_stream_8 bus_space_read_multi_8
789 #define bus_space_write_multi_stream_1 bus_space_write_multi_1
790 #define bus_space_write_multi_stream_2 bus_space_write_multi_2
791 #define bus_space_write_multi_stream_4 bus_space_write_multi_4
792 #define bus_space_write_multi_stream_8 bus_space_write_multi_8
794 #define bus_space_read_region_stream_1 bus_space_read_region_1
795 #define bus_space_read_region_stream_2 bus_space_read_region_2
796 #define bus_space_read_region_stream_4 bus_space_read_region_4
797 #define bus_space_read_region_stream_8 bus_space_read_region_8
799 #define bus_space_write_region_stream_1 bus_space_write_region_1
800 #define bus_space_write_region_stream_2 bus_space_write_region_2
801 #define bus_space_write_region_stream_4 bus_space_write_region_4
802 #define bus_space_write_region_stream_8 bus_space_write_region_8
804 #define bus_space_set_multi_stream_1 bus_space_set_multi_1
805 #define bus_space_set_multi_stream_2 bus_space_set_multi_2
806 #define bus_space_set_multi_stream_4 bus_space_set_multi_4
807 #define bus_space_set_multi_stream_8 bus_space_set_multi_8
809 #define bus_space_set_region_stream_1 bus_space_set_region_1
810 #define bus_space_set_region_stream_2 bus_space_set_region_2
811 #define bus_space_set_region_stream_4 bus_space_set_region_4
812 #define bus_space_set_region_stream_8 bus_space_set_region_8
814 #define bus_space_copy_region_stream_1 bus_space_copy_region_1
815 #define bus_space_copy_region_stream_2 bus_space_copy_region_2
816 #define bus_space_copy_region_stream_4 bus_space_copy_region_4
817 #define bus_space_copy_region_stream_8 bus_space_copy_region_8
821 #include <machine/bus_dma.h>
823 #endif /* _MACHINE_BUS_H_ */