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.
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 the NetBSD
48 * Foundation, Inc. and its contributors.
49 * 4. Neither the name of The NetBSD Foundation nor the names of its
50 * contributors may be used to endorse or promote products derived
51 * from this software without specific prior written permission.
53 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
54 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
55 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
57 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
58 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
59 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
60 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
61 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
62 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
63 * POSSIBILITY OF SUCH DAMAGE.
67 * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
68 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
70 * Redistribution and use in source and binary forms, with or without
71 * modification, are permitted provided that the following conditions
73 * 1. Redistributions of source code must retain the above copyright
74 * notice, this list of conditions and the following disclaimer.
75 * 2. Redistributions in binary form must reproduce the above copyright
76 * notice, this list of conditions and the following disclaimer in the
77 * documentation and/or other materials provided with the distribution.
78 * 3. All advertising materials mentioning features or use of this software
79 * must display the following acknowledgement:
80 * This product includes software developed by Christopher G. Demetriou
81 * for the NetBSD Project.
82 * 4. The name of the author may not be used to endorse or promote products
83 * derived from this software without specific prior written permission
85 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
86 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
87 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
88 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
89 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
90 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
91 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
92 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
93 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
94 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
98 #ifndef _MACHINE_BUS_H_
99 #define _MACHINE_BUS_H_
101 #include <machine/_bus.h>
102 #include <machine/cpufunc.h>
105 * I/O port reads with ia32 semantics.
107 #define inb bus_space_read_io_1
108 #define inw bus_space_read_io_2
109 #define inl bus_space_read_io_4
111 #define outb bus_space_write_io_1
112 #define outw bus_space_write_io_2
113 #define outl bus_space_write_io_4
116 * Values for the ia64 bus space tag, not to be used directly by MI code.
118 #define IA64_BUS_SPACE_IO 0 /* space is i/o space */
119 #define IA64_BUS_SPACE_MEM 1 /* space is mem space */
121 #define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
122 #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
124 #define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF
125 #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
126 #define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFF
127 #define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF
128 #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
129 #define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFF
131 #define BUS_SPACE_UNRESTRICTED (~0)
135 * Map and unmap a region of device bus space into CPU virtual address space.
138 bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
139 bus_space_handle_t *);
142 bus_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t size);
145 * Get a new handle for a subregion of an already-mapped area of bus space.
148 bus_space_subregion(bus_space_tag_t bst, bus_space_handle_t bsh,
149 bus_size_t ofs, bus_size_t size __unused, bus_space_handle_t *nbshp)
157 * Allocate a region of memory that is accessible to devices in bus space.
160 bus_space_alloc(bus_space_tag_t bst, bus_addr_t rstart, bus_addr_t rend,
161 bus_size_t size, bus_size_t align, bus_size_t boundary, int flags,
162 bus_addr_t *addrp, bus_space_handle_t *bshp);
166 * Free a region of bus space accessible memory.
169 bus_space_free(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t size);
173 * Bus read/write barrier method.
176 bus_space_barrier(bus_space_tag_t bst __unused, bus_space_handle_t bsh __unused,
177 bus_size_t ofs __unused, bus_size_t size __unused, int flags __unused)
185 * Read 1 unit of data from bus space described by the tag, handle and ofs
186 * tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
189 uint8_t bus_space_read_io_1(u_long);
190 uint16_t bus_space_read_io_2(u_long);
191 uint32_t bus_space_read_io_4(u_long);
192 uint64_t bus_space_read_io_8(u_long);
194 static __inline uint8_t
195 bus_space_read_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
199 val = (__predict_false(bst == IA64_BUS_SPACE_IO))
200 ? bus_space_read_io_1(bsh + ofs)
201 : ia64_ld1((void *)(bsh + ofs));
205 static __inline uint16_t
206 bus_space_read_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
210 val = (__predict_false(bst == IA64_BUS_SPACE_IO))
211 ? bus_space_read_io_2(bsh + ofs)
212 : ia64_ld2((void *)(bsh + ofs));
216 static __inline uint32_t
217 bus_space_read_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
221 val = (__predict_false(bst == IA64_BUS_SPACE_IO))
222 ? bus_space_read_io_4(bsh + ofs)
223 : ia64_ld4((void *)(bsh + ofs));
227 static __inline uint64_t
228 bus_space_read_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
232 val = (__predict_false(bst == IA64_BUS_SPACE_IO))
233 ? bus_space_read_io_8(bsh + ofs)
234 : ia64_ld8((void *)(bsh + ofs));
240 * Write 1 unit of data to bus space described by the tag, handle and ofs
241 * tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
242 * data is passed by value.
244 void bus_space_write_io_1(u_long, uint8_t);
245 void bus_space_write_io_2(u_long, uint16_t);
246 void bus_space_write_io_4(u_long, uint32_t);
247 void bus_space_write_io_8(u_long, uint64_t);
250 bus_space_write_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
254 if (__predict_false(bst == IA64_BUS_SPACE_IO))
255 bus_space_write_io_1(bsh + ofs, val);
257 ia64_st1((void *)(bsh + ofs), val);
261 bus_space_write_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
265 if (__predict_false(bst == IA64_BUS_SPACE_IO))
266 bus_space_write_io_2(bsh + ofs, val);
268 ia64_st2((void *)(bsh + ofs), val);
272 bus_space_write_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
276 if (__predict_false(bst == IA64_BUS_SPACE_IO))
277 bus_space_write_io_4(bsh + ofs, val);
279 ia64_st4((void *)(bsh + ofs), val);
283 bus_space_write_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
287 if (__predict_false(bst == IA64_BUS_SPACE_IO))
288 bus_space_write_io_8(bsh + ofs, val);
290 ia64_st8((void *)(bsh + ofs), val);
295 * Read count units of data from bus space described by the tag, handle and
296 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
297 * data is returned in the buffer passed by reference.
299 void bus_space_read_multi_io_1(u_long, uint8_t *, size_t);
300 void bus_space_read_multi_io_2(u_long, uint16_t *, size_t);
301 void bus_space_read_multi_io_4(u_long, uint32_t *, size_t);
302 void bus_space_read_multi_io_8(u_long, uint64_t *, size_t);
305 bus_space_read_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
306 bus_size_t ofs, uint8_t *bufp, size_t count)
309 if (__predict_false(bst == IA64_BUS_SPACE_IO))
310 bus_space_read_multi_io_1(bsh + ofs, bufp, count);
313 *bufp++ = ia64_ld1((void *)(bsh + ofs));
318 bus_space_read_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
319 bus_size_t ofs, uint16_t *bufp, size_t count)
322 if (__predict_false(bst == IA64_BUS_SPACE_IO))
323 bus_space_read_multi_io_2(bsh + ofs, bufp, count);
326 *bufp++ = ia64_ld2((void *)(bsh + ofs));
331 bus_space_read_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
332 bus_size_t ofs, uint32_t *bufp, size_t count)
335 if (__predict_false(bst == IA64_BUS_SPACE_IO))
336 bus_space_read_multi_io_4(bsh + ofs, bufp, count);
339 *bufp++ = ia64_ld4((void *)(bsh + ofs));
344 bus_space_read_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
345 bus_size_t ofs, uint64_t *bufp, size_t count)
348 if (__predict_false(bst == IA64_BUS_SPACE_IO))
349 bus_space_read_multi_io_8(bsh + ofs, bufp, count);
352 *bufp++ = ia64_ld8((void *)(bsh + ofs));
358 * Write count units of data to bus space described by the tag, handle and
359 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
360 * data is read from the buffer passed by reference.
362 void bus_space_write_multi_io_1(u_long, const uint8_t *, size_t);
363 void bus_space_write_multi_io_2(u_long, const uint16_t *, size_t);
364 void bus_space_write_multi_io_4(u_long, const uint32_t *, size_t);
365 void bus_space_write_multi_io_8(u_long, const uint64_t *, size_t);
368 bus_space_write_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
369 bus_size_t ofs, const uint8_t *bufp, size_t count)
372 if (__predict_false(bst == IA64_BUS_SPACE_IO))
373 bus_space_write_multi_io_1(bsh + ofs, bufp, count);
376 ia64_st1((void *)(bsh + ofs), *bufp++);
381 bus_space_write_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
382 bus_size_t ofs, const uint16_t *bufp, size_t count)
385 if (__predict_false(bst == IA64_BUS_SPACE_IO))
386 bus_space_write_multi_io_2(bsh + ofs, bufp, count);
389 ia64_st2((void *)(bsh + ofs), *bufp++);
394 bus_space_write_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
395 bus_size_t ofs, const uint32_t *bufp, size_t count)
398 if (__predict_false(bst == IA64_BUS_SPACE_IO))
399 bus_space_write_multi_io_4(bsh + ofs, bufp, count);
402 ia64_st4((void *)(bsh + ofs), *bufp++);
407 bus_space_write_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
408 bus_size_t ofs, const uint64_t *bufp, size_t count)
411 if (__predict_false(bst == IA64_BUS_SPACE_IO))
412 bus_space_write_multi_io_8(bsh + ofs, bufp, count);
415 ia64_st8((void *)(bsh + ofs), *bufp++);
421 * Read count units of data from bus space described by the tag, handle and
422 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
423 * data is written to the buffer passed by reference and read from successive
424 * bus space addresses. Access is unordered.
426 void bus_space_read_region_io_1(u_long, uint8_t *, size_t);
427 void bus_space_read_region_io_2(u_long, uint16_t *, size_t);
428 void bus_space_read_region_io_4(u_long, uint32_t *, size_t);
429 void bus_space_read_region_io_8(u_long, uint64_t *, size_t);
432 bus_space_read_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
433 bus_size_t ofs, uint8_t *bufp, size_t count)
436 if (__predict_false(bst == IA64_BUS_SPACE_IO))
437 bus_space_read_region_io_1(bsh + ofs, bufp, count);
439 uint8_t *bsp = (void *)(bsh + ofs);
441 *bufp++ = ia64_ld1(bsp++);
446 bus_space_read_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
447 bus_size_t ofs, uint16_t *bufp, size_t count)
450 if (__predict_false(bst == IA64_BUS_SPACE_IO))
451 bus_space_read_region_io_2(bsh + ofs, bufp, count);
453 uint16_t *bsp = (void *)(bsh + ofs);
455 *bufp++ = ia64_ld2(bsp++);
460 bus_space_read_region_4(bus_space_tag_t bst, bus_space_handle_t bsh,
461 bus_size_t ofs, uint32_t *bufp, size_t count)
464 if (__predict_false(bst == IA64_BUS_SPACE_IO))
465 bus_space_read_region_io_4(bsh + ofs, bufp, count);
467 uint32_t *bsp = (void *)(bsh + ofs);
469 *bufp++ = ia64_ld4(bsp++);
474 bus_space_read_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
475 bus_size_t ofs, uint64_t *bufp, size_t count)
478 if (__predict_false(bst == IA64_BUS_SPACE_IO))
479 bus_space_read_region_io_8(bsh + ofs, bufp, count);
481 uint64_t *bsp = (void *)(bsh + ofs);
483 *bufp++ = ia64_ld8(bsp++);
489 * Write count units of data from bus space described by the tag, handle and
490 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
491 * data is read from the buffer passed by reference and written to successive
492 * bus space addresses. Access is unordered.
494 void bus_space_write_region_io_1(u_long, const uint8_t *, size_t);
495 void bus_space_write_region_io_2(u_long, const uint16_t *, size_t);
496 void bus_space_write_region_io_4(u_long, const uint32_t *, size_t);
497 void bus_space_write_region_io_8(u_long, const uint64_t *, size_t);
500 bus_space_write_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
501 bus_size_t ofs, const uint8_t *bufp, size_t count)
504 if (__predict_false(bst == IA64_BUS_SPACE_IO))
505 bus_space_write_region_io_1(bsh + ofs, bufp, count);
507 uint8_t *bsp = (void *)(bsh + ofs);
509 ia64_st1(bsp++, *bufp++);
514 bus_space_write_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
515 bus_size_t ofs, const uint16_t *bufp, size_t count)
518 if (__predict_false(bst == IA64_BUS_SPACE_IO))
519 bus_space_write_region_io_2(bsh + ofs, bufp, count);
521 uint16_t *bsp = (void *)(bsh + ofs);
523 ia64_st2(bsp++, *bufp++);
528 bus_space_write_region_4(bus_space_tag_t bst, bus_space_handle_t bsh,
529 bus_size_t ofs, const uint32_t *bufp, size_t count)
532 if (__predict_false(bst == IA64_BUS_SPACE_IO))
533 bus_space_write_region_io_4(bsh + ofs, bufp, count);
535 uint32_t *bsp = (void *)(bsh + ofs);
537 ia64_st4(bsp++, *bufp++);
542 bus_space_write_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
543 bus_size_t ofs, const uint64_t *bufp, size_t count)
546 if (__predict_false(bst == IA64_BUS_SPACE_IO))
547 bus_space_write_region_io_8(bsh + ofs, bufp, count);
549 uint64_t *bsp = (void *)(bsh + ofs);
551 ia64_st8(bsp++, *bufp++);
557 * Write count units of data from bus space described by the tag, handle and
558 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
559 * data is passed by value. Writes are unordered.
562 bus_space_set_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
563 bus_size_t ofs, uint8_t val, size_t count)
567 bus_space_write_1(bst, bsh, ofs, val);
571 bus_space_set_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
572 bus_size_t ofs, uint16_t val, size_t count)
576 bus_space_write_2(bst, bsh, ofs, val);
580 bus_space_set_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
581 bus_size_t ofs, uint32_t val, size_t count)
585 bus_space_write_4(bst, bsh, ofs, val);
589 bus_space_set_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
590 bus_size_t ofs, uint64_t val, size_t count)
594 bus_space_write_8(bst, bsh, ofs, val);
599 * Write count units of data from bus space described by the tag, handle and
600 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
601 * data is passed by value and written to successive bus space addresses.
602 * Writes are unordered.
604 void bus_space_set_region_io_1(u_long, uint8_t, size_t);
605 void bus_space_set_region_io_2(u_long, uint16_t, size_t);
606 void bus_space_set_region_io_4(u_long, uint32_t, size_t);
607 void bus_space_set_region_io_8(u_long, uint64_t, size_t);
610 bus_space_set_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
611 bus_size_t ofs, uint8_t val, size_t count)
614 if (__predict_false(bst == IA64_BUS_SPACE_IO))
615 bus_space_set_region_io_1(bsh + ofs, val, count);
617 uint8_t *bsp = (void *)(bsh + ofs);
619 ia64_st1(bsp++, val);
624 bus_space_set_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
625 bus_size_t ofs, uint16_t val, size_t count)
628 if (__predict_false(bst == IA64_BUS_SPACE_IO))
629 bus_space_set_region_io_2(bsh + ofs, val, count);
631 uint16_t *bsp = (void *)(bsh + ofs);
633 ia64_st2(bsp++, val);
638 bus_space_set_region_4(bus_space_tag_t bst, bus_space_handle_t bsh,
639 bus_size_t ofs, uint32_t val, size_t count)
642 if (__predict_false(bst == IA64_BUS_SPACE_IO))
643 bus_space_set_region_io_4(bsh + ofs, val, count);
645 uint32_t *bsp = (void *)(bsh + ofs);
647 ia64_st4(bsp++, val);
652 bus_space_set_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
653 bus_size_t ofs, uint64_t val, size_t count)
656 if (__predict_false(bst == IA64_BUS_SPACE_IO))
657 bus_space_set_region_io_4(bsh + ofs, val, count);
659 uint64_t *bsp = (void *)(bsh + ofs);
661 ia64_st8(bsp++, val);
667 * Copy count units of data from bus space described by the tag and the first
668 * handle and ofs pair to bus space described by the tag and the second handle
669 * and ofs pair. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes.
670 * The data is read from successive bus space addresses and also written to
671 * successive bus space addresses. Both reads and writes are unordered.
673 void bus_space_copy_region_io_1(u_long, u_long, size_t);
674 void bus_space_copy_region_io_2(u_long, u_long, size_t);
675 void bus_space_copy_region_io_4(u_long, u_long, size_t);
676 void bus_space_copy_region_io_8(u_long, u_long, size_t);
679 bus_space_copy_region_1(bus_space_tag_t bst, bus_space_handle_t sbsh,
680 bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
684 if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
685 bus_space_copy_region_io_1(sbsh + sofs, dbsh + dofs, count);
689 src = (void *)(sbsh + sofs);
690 dst = (void *)(dbsh + dofs);
695 ia64_st1(dst--, ia64_ld1(src--));
698 ia64_st1(dst++, ia64_ld1(src++));
703 bus_space_copy_region_2(bus_space_tag_t bst, bus_space_handle_t sbsh,
704 bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
708 if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
709 bus_space_copy_region_io_2(sbsh + sofs, dbsh + dofs, count);
713 src = (void *)(sbsh + sofs);
714 dst = (void *)(dbsh + dofs);
719 ia64_st2(dst--, ia64_ld2(src--));
722 ia64_st2(dst++, ia64_ld2(src++));
727 bus_space_copy_region_4(bus_space_tag_t bst, bus_space_handle_t sbsh,
728 bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
732 if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
733 bus_space_copy_region_io_4(sbsh + sofs, dbsh + dofs, count);
737 src = (void *)(sbsh + sofs);
738 dst = (void *)(dbsh + dofs);
743 ia64_st4(dst--, ia64_ld4(src--));
746 ia64_st4(dst++, ia64_ld4(src++));
751 bus_space_copy_region_8(bus_space_tag_t bst, bus_space_handle_t sbsh,
752 bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
756 if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
757 bus_space_copy_region_io_8(sbsh + sofs, dbsh + dofs, count);
761 src = (void *)(sbsh + sofs);
762 dst = (void *)(dbsh + dofs);
767 ia64_st8(dst--, ia64_ld8(src--));
770 ia64_st8(dst++, ia64_ld8(src++));
776 * Stream accesses are the same as normal accesses on ia64; there are no
777 * supported bus systems with an endianess different from the host one.
780 #define bus_space_read_stream_1 bus_space_read_1
781 #define bus_space_read_stream_2 bus_space_read_2
782 #define bus_space_read_stream_4 bus_space_read_4
783 #define bus_space_read_stream_8 bus_space_read_8
785 #define bus_space_write_stream_1 bus_space_write_1
786 #define bus_space_write_stream_2 bus_space_write_2
787 #define bus_space_write_stream_4 bus_space_write_4
788 #define bus_space_write_stream_8 bus_space_write_8
790 #define bus_space_read_multi_stream_1 bus_space_read_multi_1
791 #define bus_space_read_multi_stream_2 bus_space_read_multi_2
792 #define bus_space_read_multi_stream_4 bus_space_read_multi_4
793 #define bus_space_read_multi_stream_8 bus_space_read_multi_8
795 #define bus_space_write_multi_stream_1 bus_space_write_multi_1
796 #define bus_space_write_multi_stream_2 bus_space_write_multi_2
797 #define bus_space_write_multi_stream_4 bus_space_write_multi_4
798 #define bus_space_write_multi_stream_8 bus_space_write_multi_8
800 #define bus_space_read_region_stream_1 bus_space_read_region_1
801 #define bus_space_read_region_stream_2 bus_space_read_region_2
802 #define bus_space_read_region_stream_4 bus_space_read_region_4
803 #define bus_space_read_region_stream_8 bus_space_read_region_8
805 #define bus_space_write_region_stream_1 bus_space_write_region_1
806 #define bus_space_write_region_stream_2 bus_space_write_region_2
807 #define bus_space_write_region_stream_4 bus_space_write_region_4
808 #define bus_space_write_region_stream_8 bus_space_write_region_8
810 #define bus_space_set_multi_stream_1 bus_space_set_multi_1
811 #define bus_space_set_multi_stream_2 bus_space_set_multi_2
812 #define bus_space_set_multi_stream_4 bus_space_set_multi_4
813 #define bus_space_set_multi_stream_8 bus_space_set_multi_8
815 #define bus_space_set_region_stream_1 bus_space_set_region_1
816 #define bus_space_set_region_stream_2 bus_space_set_region_2
817 #define bus_space_set_region_stream_4 bus_space_set_region_4
818 #define bus_space_set_region_stream_8 bus_space_set_region_8
820 #define bus_space_copy_region_stream_1 bus_space_copy_region_1
821 #define bus_space_copy_region_stream_2 bus_space_copy_region_2
822 #define bus_space_copy_region_stream_4 bus_space_copy_region_4
823 #define bus_space_copy_region_stream_8 bus_space_copy_region_8
825 #include <machine/bus_dma.h>
827 #endif /* _MACHINE_BUS_H_ */