summaryrefslogtreecommitdiffstats
path: root/sys/ia64/include
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2009-12-30 18:15:25 +0000
committermarcel <marcel@FreeBSD.org>2009-12-30 18:15:25 +0000
commit33f49fd7d2616329eb37a173a60693cb55b3d81e (patch)
treeebb0b1331bf2a43f6fc8b0edfb8d1b40a8a8e178 /sys/ia64/include
parentb5e1bf6b39a54b6002831b1f842627cf421b0794 (diff)
downloadFreeBSD-src-33f49fd7d2616329eb37a173a60693cb55b3d81e.zip
FreeBSD-src-33f49fd7d2616329eb37a173a60693cb55b3d81e.tar.gz
Revamp bus_space access functions:
o Optimize for memory mapped I/O by making all I/O port acceses function calls and marking the test for the IA64_BUS_SPACE_IO tag with __predict_false(). Implement the I/O port access functions in a new file, called bus_machdep.c. o Change the bus_space_handle_t for memory mapped I/O to the virtual address rather than the physical address. This eliminates the PA->VA translation for every I/O access. The handle for I/O port access is still the port number. o Move inb(), outb(), inw(), outw(), inl(), outl(), and their string variants from cpufunc.h and define them in bus.h. On ia64 these are not CPU functions at all. In bus.h they are merely aliases for the new I/O port access functions defined in bus_machdep.h. o Handle the ACPI resource bug in nexus_set_resource(). There we can do it once so that we don't have to worry about it whenever we need to write to an I/O port that is really a memory mapped address. The upshot of this change is that the KBI is better defined and that I/O port access always involves a function call, allowing us to change the actual implementation without breaking the KBI. For memory mapped I/O the virtual address is abstracted, so that we can change the VA->PA mapping in the kernel without causing an KBI breakage. The exception at this time is for bus_space_map() and bus_space_unmap(). MFC after: 1 week.
Diffstat (limited to 'sys/ia64/include')
-rw-r--r--sys/ia64/include/bus.h787
-rw-r--r--sys/ia64/include/cpufunc.h120
2 files changed, 399 insertions, 508 deletions
diff --git a/sys/ia64/include/bus.h b/sys/ia64/include/bus.h
index 80b90ca..981445f 100644
--- a/sys/ia64/include/bus.h
+++ b/sys/ia64/include/bus.h
@@ -1,3 +1,29 @@
+/*-
+ * Copyright (c) 2009 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
/* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */
/*-
@@ -76,11 +102,25 @@
#include <machine/cpufunc.h>
/*
+ * I/O port reads with ia32 semantics.
+ */
+#define inb bus_space_read_io_1
+#define inw bus_space_read_io_2
+#define inl bus_space_read_io_4
+
+#define outb bus_space_write_io_1
+#define outw bus_space_write_io_2
+#define outl bus_space_write_io_4
+
+/*
* Values for the ia64 bus space tag, not to be used directly by MI code.
*/
#define IA64_BUS_SPACE_IO 0 /* space is i/o space */
#define IA64_BUS_SPACE_MEM 1 /* space is mem space */
+#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
+#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
+
#define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF
#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
#define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFF
@@ -90,24 +130,21 @@
#define BUS_SPACE_UNRESTRICTED (~0)
+
/*
* Map a region of device bus space into CPU virtual address space.
*/
-
-static __inline int bus_space_map(bus_space_tag_t t, bus_addr_t addr,
- bus_size_t size, int flags,
- bus_space_handle_t *bshp);
-
static __inline int
-bus_space_map(bus_space_tag_t t __unused, bus_addr_t addr,
- bus_size_t size __unused, int flags __unused,
- bus_space_handle_t *bshp)
+bus_space_map(bus_space_tag_t bst, bus_addr_t addr, bus_size_t size __unused,
+ int flags __unused, bus_space_handle_t *bshp)
{
- *bshp = addr;
+ *bshp = (__predict_false(bst == IA64_BUS_SPACE_IO))
+ ? addr : IA64_PHYS_TO_RR6(addr);
return (0);
}
+
/*
* Unmap a region of device bus space.
*/
@@ -123,7 +160,7 @@ bus_space_unmap(bus_space_tag_t bst __unused, bus_space_handle_t bsh __unused,
*/
static __inline int
bus_space_subregion(bus_space_tag_t bst, bus_space_handle_t bsh,
- bus_size_t ofs, bus_size_t size, bus_space_handle_t *nbshp)
+ bus_size_t ofs, bus_size_t size __unused, bus_space_handle_t *nbshp)
{
*nbshp = bsh + ofs;
return (0);
@@ -149,12 +186,9 @@ bus_space_free(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t size);
/*
* Bus read/write barrier method.
*/
-#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
-#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
-
static __inline void
-bus_space_barrier(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
- bus_size_t size, int flags)
+bus_space_barrier(bus_space_tag_t bst __unused, bus_space_handle_t bsh __unused,
+ bus_size_t ofs __unused, bus_size_t size __unused, int flags __unused)
{
ia64_mf_a();
ia64_mf();
@@ -166,40 +200,53 @@ bus_space_barrier(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
* tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
* data is returned.
*/
+uint8_t bus_space_read_io_1(u_long);
+uint16_t bus_space_read_io_2(u_long);
+uint32_t bus_space_read_io_4(u_long);
+uint64_t bus_space_read_io_8(u_long);
+
static __inline uint8_t
bus_space_read_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
{
- uint8_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- return (ia64_ld1(bsp));
+ uint8_t val;
+
+ val = (__predict_false(bst == IA64_BUS_SPACE_IO))
+ ? bus_space_read_io_1(bsh + ofs)
+ : ia64_ld1((void *)(bsh + ofs));
+ return (val);
}
static __inline uint16_t
bus_space_read_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
{
- uint16_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- return (ia64_ld2(bsp));
+ uint16_t val;
+
+ val = (__predict_false(bst == IA64_BUS_SPACE_IO))
+ ? bus_space_read_io_2(bsh + ofs)
+ : ia64_ld2((void *)(bsh + ofs));
+ return (val);
}
static __inline uint32_t
bus_space_read_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
{
- uint32_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- return (ia64_ld4(bsp));
+ uint32_t val;
+
+ val = (__predict_false(bst == IA64_BUS_SPACE_IO))
+ ? bus_space_read_io_4(bsh + ofs)
+ : ia64_ld4((void *)(bsh + ofs));
+ return (val);
}
static __inline uint64_t
bus_space_read_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
{
- uint64_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- return (ia64_ld8(bsp));
+ uint64_t val;
+
+ val = (__predict_false(bst == IA64_BUS_SPACE_IO))
+ ? bus_space_read_io_8(bsh + ofs)
+ : ia64_ld8((void *)(bsh + ofs));
+ return (val);
}
@@ -208,44 +255,53 @@ bus_space_read_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
* tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
* data is passed by value.
*/
+void bus_space_write_io_1(u_long, uint8_t);
+void bus_space_write_io_2(u_long, uint16_t);
+void bus_space_write_io_4(u_long, uint32_t);
+void bus_space_write_io_8(u_long, uint64_t);
+
static __inline void
bus_space_write_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
uint8_t val)
{
- uint8_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st1(bsp, val);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_io_1(bsh + ofs, val);
+ else
+ ia64_st1((void *)(bsh + ofs), val);
}
static __inline void
bus_space_write_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
uint16_t val)
{
- uint16_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st2(bsp, val);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_io_2(bsh + ofs, val);
+ else
+ ia64_st2((void *)(bsh + ofs), val);
}
static __inline void
bus_space_write_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
uint32_t val)
{
- uint32_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st4(bsp, val);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_io_4(bsh + ofs, val);
+ else
+ ia64_st4((void *)(bsh + ofs), val);
}
static __inline void
bus_space_write_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
uint64_t val)
{
- uint64_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st8(bsp, val);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_io_8(bsh + ofs, val);
+ else
+ ia64_st8((void *)(bsh + ofs), val);
}
@@ -254,48 +310,61 @@ bus_space_write_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs,
* ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
* data is returned in the buffer passed by reference.
*/
+void bus_space_read_multi_io_1(u_long, uint8_t *, size_t);
+void bus_space_read_multi_io_2(u_long, uint16_t *, size_t);
+void bus_space_read_multi_io_4(u_long, uint32_t *, size_t);
+void bus_space_read_multi_io_8(u_long, uint64_t *, size_t);
+
static __inline void
bus_space_read_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint8_t *bufp, size_t count)
{
- uint8_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- while (count-- > 0)
- *bufp++ = ia64_ld1(bsp);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_read_multi_io_1(bsh + ofs, bufp, count);
+ else {
+ while (count-- > 0)
+ *bufp++ = ia64_ld1((void *)(bsh + ofs));
+ }
}
static __inline void
bus_space_read_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint16_t *bufp, size_t count)
{
- uint16_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- while (count-- > 0)
- *bufp++ = ia64_ld2(bsp);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_read_multi_io_2(bsh + ofs, bufp, count);
+ else {
+ while (count-- > 0)
+ *bufp++ = ia64_ld2((void *)(bsh + ofs));
+ }
}
static __inline void
bus_space_read_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint32_t *bufp, size_t count)
{
- uint32_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- while (count-- > 0)
- *bufp++ = ia64_ld4(bsp);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_read_multi_io_4(bsh + ofs, bufp, count);
+ else {
+ while (count-- > 0)
+ *bufp++ = ia64_ld4((void *)(bsh + ofs));
+ }
}
static __inline void
bus_space_read_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint64_t *bufp, size_t count)
{
- uint64_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- while (count-- > 0)
- *bufp++ = ia64_ld8(bsp);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_read_multi_io_8(bsh + ofs, bufp, count);
+ else {
+ while (count-- > 0)
+ *bufp++ = ia64_ld8((void *)(bsh + ofs));
+ }
}
@@ -304,48 +373,61 @@ bus_space_read_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
* ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
* data is read from the buffer passed by reference.
*/
+void bus_space_write_multi_io_1(u_long, const uint8_t *, size_t);
+void bus_space_write_multi_io_2(u_long, const uint16_t *, size_t);
+void bus_space_write_multi_io_4(u_long, const uint32_t *, size_t);
+void bus_space_write_multi_io_8(u_long, const uint64_t *, size_t);
+
static __inline void
bus_space_write_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, const uint8_t *bufp, size_t count)
{
- uint8_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- while (count-- > 0)
- ia64_st1(bsp, *bufp++);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_multi_io_1(bsh + ofs, bufp, count);
+ else {
+ while (count-- > 0)
+ ia64_st1((void *)(bsh + ofs), *bufp++);
+ }
}
static __inline void
bus_space_write_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, const uint16_t *bufp, size_t count)
{
- uint16_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- while (count-- > 0)
- ia64_st2(bsp, *bufp++);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_multi_io_2(bsh + ofs, bufp, count);
+ else {
+ while (count-- > 0)
+ ia64_st2((void *)(bsh + ofs), *bufp++);
+ }
}
static __inline void
bus_space_write_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, const uint32_t *bufp, size_t count)
{
- uint32_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- while (count-- > 0)
- ia64_st4(bsp, *bufp++);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_multi_io_4(bsh + ofs, bufp, count);
+ else {
+ while (count-- > 0)
+ ia64_st4((void *)(bsh + ofs), *bufp++);
+ }
}
static __inline void
bus_space_write_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, const uint64_t *bufp, size_t count)
{
- uint64_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- while (count-- > 0)
- ia64_st8(bsp, *bufp++);
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_multi_io_8(bsh + ofs, bufp, count);
+ else {
+ while (count-- > 0)
+ ia64_st8((void *)(bsh + ofs), *bufp++);
+ }
}
@@ -355,16 +437,22 @@ bus_space_write_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
* data is written to the buffer passed by reference and read from successive
* bus space addresses. Access is unordered.
*/
+void bus_space_read_region_io_1(u_long, uint8_t *, size_t);
+void bus_space_read_region_io_2(u_long, uint16_t *, size_t);
+void bus_space_read_region_io_4(u_long, uint32_t *, size_t);
+void bus_space_read_region_io_8(u_long, uint64_t *, size_t);
+
static __inline void
bus_space_read_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint8_t *bufp, size_t count)
{
- uint8_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- *bufp++ = ia64_ld1(bsp);
- ofs += 1;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_read_region_io_1(bsh + ofs, bufp, count);
+ else {
+ uint8_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ *bufp++ = ia64_ld1(bsp++);
}
}
@@ -372,12 +460,13 @@ static __inline void
bus_space_read_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint16_t *bufp, size_t count)
{
- uint16_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- *bufp++ = ia64_ld2(bsp);
- ofs += 2;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_read_region_io_2(bsh + ofs, bufp, count);
+ else {
+ uint16_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ *bufp++ = ia64_ld2(bsp++);
}
}
@@ -385,12 +474,13 @@ static __inline void
bus_space_read_region_4(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint32_t *bufp, size_t count)
{
- uint32_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- *bufp++ = ia64_ld4(bsp);
- ofs += 4;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_read_region_io_4(bsh + ofs, bufp, count);
+ else {
+ uint32_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ *bufp++ = ia64_ld4(bsp++);
}
}
@@ -398,12 +488,13 @@ static __inline void
bus_space_read_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint64_t *bufp, size_t count)
{
- uint64_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- *bufp++ = ia64_ld8(bsp);
- ofs += 8;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_read_region_io_8(bsh + ofs, bufp, count);
+ else {
+ uint64_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ *bufp++ = ia64_ld8(bsp++);
}
}
@@ -414,16 +505,22 @@ bus_space_read_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
* data is read from the buffer passed by reference and written to successive
* bus space addresses. Access is unordered.
*/
+void bus_space_write_region_io_1(u_long, const uint8_t *, size_t);
+void bus_space_write_region_io_2(u_long, const uint16_t *, size_t);
+void bus_space_write_region_io_4(u_long, const uint32_t *, size_t);
+void bus_space_write_region_io_8(u_long, const uint64_t *, size_t);
+
static __inline void
bus_space_write_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, const uint8_t *bufp, size_t count)
{
- uint8_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st1(bsp, *bufp++);
- ofs += 1;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_region_io_1(bsh + ofs, bufp, count);
+ else {
+ uint8_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ ia64_st1(bsp++, *bufp++);
}
}
@@ -431,12 +528,13 @@ static __inline void
bus_space_write_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, const uint16_t *bufp, size_t count)
{
- uint16_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st2(bsp, *bufp++);
- ofs += 2;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_region_io_2(bsh + ofs, bufp, count);
+ else {
+ uint16_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ ia64_st2(bsp++, *bufp++);
}
}
@@ -444,12 +542,13 @@ static __inline void
bus_space_write_region_4(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, const uint32_t *bufp, size_t count)
{
- uint32_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st4(bsp, *bufp++);
- ofs += 4;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_region_io_4(bsh + ofs, bufp, count);
+ else {
+ uint32_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ ia64_st4(bsp++, *bufp++);
}
}
@@ -457,12 +556,13 @@ static __inline void
bus_space_write_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, const uint64_t *bufp, size_t count)
{
- uint64_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st8(bsp, *bufp++);
- ofs += 8;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_write_region_io_8(bsh + ofs, bufp, count);
+ else {
+ uint64_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ ia64_st8(bsp++, *bufp++);
}
}
@@ -476,44 +576,36 @@ static __inline void
bus_space_set_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint8_t val, size_t count)
{
- uint8_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
+
while (count-- > 0)
- ia64_st1(bsp, val);
+ bus_space_write_1(bst, bsh, ofs, val);
}
static __inline void
bus_space_set_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint16_t val, size_t count)
{
- uint16_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
+
while (count-- > 0)
- ia64_st2(bsp, val);
+ bus_space_write_2(bst, bsh, ofs, val);
}
static __inline void
bus_space_set_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint32_t val, size_t count)
{
- uint32_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
+
while (count-- > 0)
- ia64_st4(bsp, val);
+ bus_space_write_4(bst, bsh, ofs, val);
}
static __inline void
bus_space_set_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint64_t val, size_t count)
{
- uint64_t *bsp;
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
+
while (count-- > 0)
- ia64_st8(bsp, val);
+ bus_space_write_8(bst, bsh, ofs, val);
}
@@ -523,16 +615,22 @@ bus_space_set_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh,
* data is passed by value and written to successive bus space addresses.
* Writes are unordered.
*/
+void bus_space_set_region_io_1(u_long, uint8_t, size_t);
+void bus_space_set_region_io_2(u_long, uint16_t, size_t);
+void bus_space_set_region_io_4(u_long, uint32_t, size_t);
+void bus_space_set_region_io_8(u_long, uint64_t, size_t);
+
static __inline void
bus_space_set_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint8_t val, size_t count)
{
- uint8_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st1(bsp, val);
- ofs += 1;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_set_region_io_1(bsh + ofs, val, count);
+ else {
+ uint8_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ ia64_st1(bsp++, val);
}
}
@@ -540,12 +638,13 @@ static __inline void
bus_space_set_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint16_t val, size_t count)
{
- uint16_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st2(bsp, val);
- ofs += 2;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_set_region_io_2(bsh + ofs, val, count);
+ else {
+ uint16_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ ia64_st2(bsp++, val);
}
}
@@ -553,12 +652,13 @@ static __inline void
bus_space_set_region_4(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint32_t val, size_t count)
{
- uint32_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st4(bsp, val);
- ofs += 4;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_set_region_io_4(bsh + ofs, val, count);
+ else {
+ uint32_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ ia64_st4(bsp++, val);
}
}
@@ -566,12 +666,13 @@ static __inline void
bus_space_set_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
bus_size_t ofs, uint64_t val, size_t count)
{
- uint64_t *bsp;
- while (count-- > 0) {
- bsp = (bst == IA64_BUS_SPACE_IO) ? __PIO_ADDR(bsh + ofs) :
- __MEMIO_ADDR(bsh + ofs);
- ia64_st8(bsp, val);
- ofs += 8;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO))
+ bus_space_set_region_io_4(bsh + ofs, val, count);
+ else {
+ uint64_t *bsp = (void *)(bsh + ofs);
+ while (count-- > 0)
+ ia64_st8(bsp++, val);
}
}
@@ -583,159 +684,104 @@ bus_space_set_region_8(bus_space_tag_t bst, bus_space_handle_t bsh,
* The data is read from successive bus space addresses and also written to
* successive bus space addresses. Both reads and writes are unordered.
*/
+void bus_space_copy_region_io_1(u_long, u_long, size_t);
+void bus_space_copy_region_io_2(u_long, u_long, size_t);
+void bus_space_copy_region_io_4(u_long, u_long, size_t);
+void bus_space_copy_region_io_8(u_long, u_long, size_t);
+
static __inline void
-bus_space_copy_region_1(bus_space_tag_t bst, bus_space_handle_t bsh1,
- bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, size_t count)
+bus_space_copy_region_1(bus_space_tag_t bst, bus_space_handle_t sbsh,
+ bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
{
- bus_addr_t dst, src;
- uint8_t *dstp, *srcp;
- src = bsh1 + ofs1;
- dst = bsh2 + ofs2;
- if (dst > src) {
+ uint8_t *dst, *src;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
+ bus_space_copy_region_io_1(sbsh + sofs, dbsh + dofs, count);
+ return;
+ }
+
+ src = (void *)(sbsh + sofs);
+ dst = (void *)(dbsh + dofs);
+ if (src < dst) {
src += count - 1;
dst += count - 1;
- while (count-- > 0) {
- if (bst == IA64_BUS_SPACE_IO) {
- srcp = __PIO_ADDR(src);
- dstp = __PIO_ADDR(dst);
- } else {
- srcp = __MEMIO_ADDR(src);
- dstp = __MEMIO_ADDR(dst);
- }
- ia64_st1(dstp, ia64_ld1(srcp));
- src -= 1;
- dst -= 1;
- }
+ while (count-- > 0)
+ ia64_st1(dst--, ia64_ld1(src--));
} else {
- while (count-- > 0) {
- if (bst == IA64_BUS_SPACE_IO) {
- srcp = __PIO_ADDR(src);
- dstp = __PIO_ADDR(dst);
- } else {
- srcp = __MEMIO_ADDR(src);
- dstp = __MEMIO_ADDR(dst);
- }
- ia64_st1(dstp, ia64_ld1(srcp));
- src += 1;
- dst += 1;
- }
+ while (count-- > 0)
+ ia64_st1(dst++, ia64_ld1(src++));
}
}
static __inline void
-bus_space_copy_region_2(bus_space_tag_t bst, bus_space_handle_t bsh1,
- bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, size_t count)
-{
- bus_addr_t dst, src;
- uint16_t *dstp, *srcp;
- src = bsh1 + ofs1;
- dst = bsh2 + ofs2;
- if (dst > src) {
- src += (count - 1) << 1;
- dst += (count - 1) << 1;
- while (count-- > 0) {
- if (bst == IA64_BUS_SPACE_IO) {
- srcp = __PIO_ADDR(src);
- dstp = __PIO_ADDR(dst);
- } else {
- srcp = __MEMIO_ADDR(src);
- dstp = __MEMIO_ADDR(dst);
- }
- ia64_st2(dstp, ia64_ld2(srcp));
- src -= 2;
- dst -= 2;
- }
+bus_space_copy_region_2(bus_space_tag_t bst, bus_space_handle_t sbsh,
+ bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
+{
+ uint16_t *dst, *src;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
+ bus_space_copy_region_io_2(sbsh + sofs, dbsh + dofs, count);
+ return;
+ }
+
+ src = (void *)(sbsh + sofs);
+ dst = (void *)(dbsh + dofs);
+ if (src < dst) {
+ src += count - 1;
+ dst += count - 1;
+ while (count-- > 0)
+ ia64_st2(dst--, ia64_ld2(src--));
} else {
- while (count-- > 0) {
- if (bst == IA64_BUS_SPACE_IO) {
- srcp = __PIO_ADDR(src);
- dstp = __PIO_ADDR(dst);
- } else {
- srcp = __MEMIO_ADDR(src);
- dstp = __MEMIO_ADDR(dst);
- }
- ia64_st2(dstp, ia64_ld2(srcp));
- src += 2;
- dst += 2;
- }
+ while (count-- > 0)
+ ia64_st2(dst++, ia64_ld2(src++));
}
}
static __inline void
-bus_space_copy_region_4(bus_space_tag_t bst, bus_space_handle_t bsh1,
- bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, size_t count)
-{
- bus_addr_t dst, src;
- uint32_t *dstp, *srcp;
- src = bsh1 + ofs1;
- dst = bsh2 + ofs2;
- if (dst > src) {
- src += (count - 1) << 2;
- dst += (count - 1) << 2;
- while (count-- > 0) {
- if (bst == IA64_BUS_SPACE_IO) {
- srcp = __PIO_ADDR(src);
- dstp = __PIO_ADDR(dst);
- } else {
- srcp = __MEMIO_ADDR(src);
- dstp = __MEMIO_ADDR(dst);
- }
- ia64_st4(dstp, ia64_ld4(srcp));
- src -= 4;
- dst -= 4;
- }
+bus_space_copy_region_4(bus_space_tag_t bst, bus_space_handle_t sbsh,
+ bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
+{
+ uint32_t *dst, *src;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
+ bus_space_copy_region_io_4(sbsh + sofs, dbsh + dofs, count);
+ return;
+ }
+
+ src = (void *)(sbsh + sofs);
+ dst = (void *)(dbsh + dofs);
+ if (src < dst) {
+ src += count - 1;
+ dst += count - 1;
+ while (count-- > 0)
+ ia64_st4(dst--, ia64_ld4(src--));
} else {
- while (count-- > 0) {
- if (bst == IA64_BUS_SPACE_IO) {
- srcp = __PIO_ADDR(src);
- dstp = __PIO_ADDR(dst);
- } else {
- srcp = __MEMIO_ADDR(src);
- dstp = __MEMIO_ADDR(dst);
- }
- ia64_st4(dstp, ia64_ld4(srcp));
- src += 4;
- dst += 4;
- }
+ while (count-- > 0)
+ ia64_st4(dst++, ia64_ld4(src++));
}
}
static __inline void
-bus_space_copy_region_8(bus_space_tag_t bst, bus_space_handle_t bsh1,
- bus_size_t ofs1, bus_space_handle_t bsh2, bus_size_t ofs2, size_t count)
-{
- bus_addr_t dst, src;
- uint64_t *dstp, *srcp;
- src = bsh1 + ofs1;
- dst = bsh2 + ofs2;
- if (dst > src) {
- src += (count - 1) << 3;
- dst += (count - 1) << 3;
- while (count-- > 0) {
- if (bst == IA64_BUS_SPACE_IO) {
- srcp = __PIO_ADDR(src);
- dstp = __PIO_ADDR(dst);
- } else {
- srcp = __MEMIO_ADDR(src);
- dstp = __MEMIO_ADDR(dst);
- }
- ia64_st8(dstp, ia64_ld8(srcp));
- src -= 8;
- dst -= 8;
- }
+bus_space_copy_region_8(bus_space_tag_t bst, bus_space_handle_t sbsh,
+ bus_size_t sofs, bus_space_handle_t dbsh, bus_size_t dofs, size_t count)
+{
+ uint64_t *dst, *src;
+
+ if (__predict_false(bst == IA64_BUS_SPACE_IO)) {
+ bus_space_copy_region_io_8(sbsh + sofs, dbsh + dofs, count);
+ return;
+ }
+
+ src = (void *)(sbsh + sofs);
+ dst = (void *)(dbsh + dofs);
+ if (src < dst) {
+ src += count - 1;
+ dst += count - 1;
+ while (count-- > 0)
+ ia64_st8(dst--, ia64_ld8(src--));
} else {
- while (count-- > 0) {
- if (bst == IA64_BUS_SPACE_IO) {
- srcp = __PIO_ADDR(src);
- dstp = __PIO_ADDR(dst);
- } else {
- srcp = __MEMIO_ADDR(src);
- dstp = __MEMIO_ADDR(dst);
- }
- ia64_st8(dstp, ia64_ld8(srcp));
- src += 8;
- dst += 8;
- }
+ while (count-- > 0)
+ ia64_st8(dst++, ia64_ld8(src++));
}
}
@@ -744,86 +790,51 @@ bus_space_copy_region_8(bus_space_tag_t bst, bus_space_handle_t bsh1,
* Stream accesses are the same as normal accesses on ia64; there are no
* supported bus systems with an endianess different from the host one.
*/
-#define bus_space_read_stream_1(t, h, o) \
- bus_space_read_1(t, h, o)
-#define bus_space_read_stream_2(t, h, o) \
- bus_space_read_2(t, h, o)
-#define bus_space_read_stream_4(t, h, o) \
- bus_space_read_4(t, h, o)
-#define bus_space_read_stream_8(t, h, o) \
- bus_space_read_8(t, h, o)
-
-#define bus_space_read_multi_stream_1(t, h, o, a, c) \
- bus_space_read_multi_1(t, h, o, a, c)
-#define bus_space_read_multi_stream_2(t, h, o, a, c) \
- bus_space_read_multi_2(t, h, o, a, c)
-#define bus_space_read_multi_stream_4(t, h, o, a, c) \
- bus_space_read_multi_4(t, h, o, a, c)
-#define bus_space_read_multi_stream_8(t, h, o, a, c) \
- bus_space_read_multi_8(t, h, o, a, c)
-
-#define bus_space_write_stream_1(t, h, o, v) \
- bus_space_write_1(t, h, o, v)
-#define bus_space_write_stream_2(t, h, o, v) \
- bus_space_write_2(t, h, o, v)
-#define bus_space_write_stream_4(t, h, o, v) \
- bus_space_write_4(t, h, o, v)
-#define bus_space_write_stream_8(t, h, o, v) \
- bus_space_write_8(t, h, o, v)
-
-#define bus_space_write_multi_stream_1(t, h, o, a, c) \
- bus_space_write_multi_1(t, h, o, a, c)
-#define bus_space_write_multi_stream_2(t, h, o, a, c) \
- bus_space_write_multi_2(t, h, o, a, c)
-#define bus_space_write_multi_stream_4(t, h, o, a, c) \
- bus_space_write_multi_4(t, h, o, a, c)
-#define bus_space_write_multi_stream_8(t, h, o, a, c) \
- bus_space_write_multi_8(t, h, o, a, c)
-
-#define bus_space_set_multi_stream_1(t, h, o, v, c) \
- bus_space_set_multi_1(t, h, o, v, c)
-#define bus_space_set_multi_stream_2(t, h, o, v, c) \
- bus_space_set_multi_2(t, h, o, v, c)
-#define bus_space_set_multi_stream_4(t, h, o, v, c) \
- bus_space_set_multi_4(t, h, o, v, c)
-#define bus_space_set_multi_stream_8(t, h, o, v, c) \
- bus_space_set_multi_8(t, h, o, v, c)
-
-#define bus_space_read_region_stream_1(t, h, o, a, c) \
- bus_space_read_region_1(t, h, o, a, c)
-#define bus_space_read_region_stream_2(t, h, o, a, c) \
- bus_space_read_region_2(t, h, o, a, c)
-#define bus_space_read_region_stream_4(t, h, o, a, c) \
- bus_space_read_region_4(t, h, o, a, c)
-#define bus_space_read_region_stream_8(t, h, o, a, c) \
- bus_space_read_region_8(t, h, o, a, c)
-
-#define bus_space_write_region_stream_1(t, h, o, a, c) \
- bus_space_write_region_1(t, h, o, a, c)
-#define bus_space_write_region_stream_2(t, h, o, a, c) \
- bus_space_write_region_2(t, h, o, a, c)
-#define bus_space_write_region_stream_4(t, h, o, a, c) \
- bus_space_write_region_4(t, h, o, a, c)
-#define bus_space_write_region_stream_8(t, h, o, a, c) \
- bus_space_write_region_8(t, h, o, a, c)
-
-#define bus_space_set_region_stream_1(t, h, o, v, c) \
- bus_space_set_region_1(t, h, o, v, c)
-#define bus_space_set_region_stream_2(t, h, o, v, c) \
- bus_space_set_region_2(t, h, o, v, c)
-#define bus_space_set_region_stream_4(t, h, o, v, c) \
- bus_space_set_region_4(t, h, o, v, c)
-#define bus_space_set_region_stream_8(t, h, o, v, c) \
- bus_space_set_region_8(t, h, o, v, c)
-
-#define bus_space_copy_region_stream_1(t, h1, o1, h2, o2, c) \
- bus_space_copy_region_1(t, h1, o1, h2, o2, c)
-#define bus_space_copy_region_stream_2(t, h1, o1, h2, o2, c) \
- bus_space_copy_region_2(t, h1, o1, h2, o2, c)
-#define bus_space_copy_region_stream_4(t, h1, o1, h2, o2, c) \
- bus_space_copy_region_4(t, h1, o1, h2, o2, c)
-#define bus_space_copy_region_stream_8(t, h1, o1, h2, o2, c) \
- bus_space_copy_region_8(t, h1, o1, h2, o2, c)
+
+#define bus_space_read_stream_1 bus_space_read_1
+#define bus_space_read_stream_2 bus_space_read_2
+#define bus_space_read_stream_4 bus_space_read_4
+#define bus_space_read_stream_8 bus_space_read_8
+
+#define bus_space_write_stream_1 bus_space_write_1
+#define bus_space_write_stream_2 bus_space_write_2
+#define bus_space_write_stream_4 bus_space_write_4
+#define bus_space_write_stream_8 bus_space_write_8
+
+#define bus_space_read_multi_stream_1 bus_space_read_multi_1
+#define bus_space_read_multi_stream_2 bus_space_read_multi_2
+#define bus_space_read_multi_stream_4 bus_space_read_multi_4
+#define bus_space_read_multi_stream_8 bus_space_read_multi_8
+
+#define bus_space_write_multi_stream_1 bus_space_write_multi_1
+#define bus_space_write_multi_stream_2 bus_space_write_multi_2
+#define bus_space_write_multi_stream_4 bus_space_write_multi_4
+#define bus_space_write_multi_stream_8 bus_space_write_multi_8
+
+#define bus_space_read_region_stream_1 bus_space_read_region_1
+#define bus_space_read_region_stream_2 bus_space_read_region_2
+#define bus_space_read_region_stream_4 bus_space_read_region_4
+#define bus_space_read_region_stream_8 bus_space_read_region_8
+
+#define bus_space_write_region_stream_1 bus_space_write_region_1
+#define bus_space_write_region_stream_2 bus_space_write_region_2
+#define bus_space_write_region_stream_4 bus_space_write_region_4
+#define bus_space_write_region_stream_8 bus_space_write_region_8
+
+#define bus_space_set_multi_stream_1 bus_space_set_multi_1
+#define bus_space_set_multi_stream_2 bus_space_set_multi_2
+#define bus_space_set_multi_stream_4 bus_space_set_multi_4
+#define bus_space_set_multi_stream_8 bus_space_set_multi_8
+
+#define bus_space_set_region_stream_1 bus_space_set_region_1
+#define bus_space_set_region_stream_2 bus_space_set_region_2
+#define bus_space_set_region_stream_4 bus_space_set_region_4
+#define bus_space_set_region_stream_8 bus_space_set_region_8
+
+#define bus_space_copy_region_stream_1 bus_space_copy_region_1
+#define bus_space_copy_region_stream_2 bus_space_copy_region_2
+#define bus_space_copy_region_stream_4 bus_space_copy_region_4
+#define bus_space_copy_region_stream_8 bus_space_copy_region_8
#include <machine/bus_dma.h>
diff --git a/sys/ia64/include/cpufunc.h b/sys/ia64/include/cpufunc.h
index fe46911..9ae06a2 100644
--- a/sys/ia64/include/cpufunc.h
+++ b/sys/ia64/include/cpufunc.h
@@ -54,126 +54,6 @@ breakpoint(void)
#define HAVE_INLINE_FFS
#define ffs(x) __builtin_ffs(x)
-#define __MEMIO_ADDR(x) (void*)(IA64_PHYS_TO_RR6(x))
-extern void *ia64_ioport_address(u_int);
-#define __PIO_ADDR(x) ia64_ioport_address(x)
-
-/*
- * I/O port reads with ia32 semantics.
- */
-static __inline uint8_t
-inb(unsigned int port)
-{
- uint8_t v;
-
- ia64_mf();
- v = ia64_ld1(__PIO_ADDR(port));
- ia64_mf_a();
- ia64_mf();
- return (v);
-}
-
-static __inline uint16_t
-inw(unsigned int port)
-{
- uint16_t v;
-
- ia64_mf();
- v = ia64_ld2(__PIO_ADDR(port));
- ia64_mf_a();
- ia64_mf();
- return (v);
-}
-
-static __inline uint32_t
-inl(unsigned int port)
-{
- uint32_t v;
-
- ia64_mf();
- v = ia64_ld4(__PIO_ADDR(port));
- ia64_mf_a();
- ia64_mf();
- return (v);
-}
-
-static __inline void
-insb(unsigned int port, void *addr, size_t count)
-{
- uint8_t *buf = addr;
- while (count--)
- *buf++ = inb(port);
-}
-
-static __inline void
-insw(unsigned int port, void *addr, size_t count)
-{
- uint16_t *buf = addr;
- while (count--)
- *buf++ = inw(port);
-}
-
-static __inline void
-insl(unsigned int port, void *addr, size_t count)
-{
- uint32_t *buf = addr;
- while (count--)
- *buf++ = inl(port);
-}
-
-static __inline void
-outb(unsigned int port, uint8_t data)
-{
-
- ia64_mf();
- ia64_st1(__PIO_ADDR(port), data);
- ia64_mf_a();
- ia64_mf();
-}
-
-static __inline void
-outw(unsigned int port, uint16_t data)
-{
-
- ia64_mf();
- ia64_st2(__PIO_ADDR(port), data);
- ia64_mf_a();
- ia64_mf();
-}
-
-static __inline void
-outl(unsigned int port, uint32_t data)
-{
-
- ia64_mf();
- ia64_st4(__PIO_ADDR(port), data);
- ia64_mf_a();
- ia64_mf();
-}
-
-static __inline void
-outsb(unsigned int port, const void *addr, size_t count)
-{
- const uint8_t *buf = addr;
- while (count--)
- outb(port, *buf++);
-}
-
-static __inline void
-outsw(unsigned int port, const void *addr, size_t count)
-{
- const uint16_t *buf = addr;
- while (count--)
- outw(port, *buf++);
-}
-
-static __inline void
-outsl(unsigned int port, const void *addr, size_t count)
-{
- const uint32_t *buf = addr;
- while (count--)
- outl(port, *buf++);
-}
static __inline void
disable_intr(void)
OpenPOWER on IntegriCloud