summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/bus_pc98.h
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>2000-03-29 03:15:22 +0000
committerkato <kato@FreeBSD.org>2000-03-29 03:15:22 +0000
commit7af5f89a60b2c01199275c6b9d0271c6bf342100 (patch)
tree5dc25460c10069bc1ccdfe095d12f26393bd7444 /sys/i386/include/bus_pc98.h
parentbeae0af3f39d85f6aa06dc4e1d97ef7170c32883 (diff)
downloadFreeBSD-src-7af5f89a60b2c01199275c6b9d0271c6bf342100.zip
FreeBSD-src-7af5f89a60b2c01199275c6b9d0271c6bf342100.tar.gz
Added indirect pio into the bus space stuff for the NEC PC-98. bus.h
includes one of bus_at386.h and bus_pc98.h. Becuase only bus_pc98.h supports indirect pio and bus_at386.h is identical to old bus.h, there is no functional change in PC-AT's kernels. That is, it cannot cause performance loss. Submitted by: nyan Reviewed by: imp bde and luoqi provided useful comments for earlier version.
Diffstat (limited to 'sys/i386/include/bus_pc98.h')
-rw-r--r--sys/i386/include/bus_pc98.h636
1 files changed, 490 insertions, 146 deletions
diff --git a/sys/i386/include/bus_pc98.h b/sys/i386/include/bus_pc98.h
index 6617612..5bfce17 100644
--- a/sys/i386/include/bus_pc98.h
+++ b/sys/i386/include/bus_pc98.h
@@ -69,17 +69,19 @@
*/
/* $FreeBSD$ */
-#ifndef _I386_BUS_H_
-#define _I386_BUS_H_
+#ifndef _I386_BUS_PC98_H_
+#define _I386_BUS_PC98_H_
+#include <sys/bus.h>
#include <machine/cpufunc.h>
/*
* To remain compatible with NetBSD's interface, default to both memio and
* pio when neither of them is defined.
*/
-#if !defined(_I386_BUS_PIO_H_) && !defined(_I386_BUS_MEMIO_H_)
+#if !defined(_I386_BUS_PIO_H_) && !defined(_I386_BUS_PIO_IND_H_) && !defined(_I386_BUS_MEMIO_H_)
#define _I386_BUS_PIO_H_
+#define _I386_BUS_PIO_IND_H_
#define _I386_BUS_MEMIO_H_
#endif
@@ -88,6 +90,7 @@
*/
#define I386_BUS_SPACE_IO 0 /* space is i/o space */
#define I386_BUS_SPACE_MEM 1 /* space is mem space */
+#define I386_BUS_SPACE_IO_IND 2 /* space is i/o space */
/*
* Bus address and size types
@@ -107,8 +110,25 @@ typedef u_int bus_size_t;
/*
* Access methods for bus resources and address space.
*/
+struct resource;
+
typedef int bus_space_tag_t;
-typedef u_int bus_space_handle_t;
+typedef struct {
+ bus_addr_t bsh_base;
+ bus_addr_t *bsh_iat;
+ size_t bsh_iatsz;
+ struct resource **bsh_res;
+ size_t bsh_ressz;
+} bus_space_handle_t;
+
+/*
+ * Allocate discontinuous resources for ISA bus.
+ */
+struct resource *
+isa_alloc_resourcev(device_t child, int type, int *rid,
+ bus_addr_t *res, bus_size_t count, u_int flags);
+int
+isa_load_resourcev(struct resource *re, bus_addr_t *res, bus_size_t count);
/*
* Map a region of device bus space into CPU virtual address space.
@@ -151,7 +171,7 @@ int bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart,
void bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t size);
-#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
/*
* Read a 1, 2, 4, or 8 byte quantity from bus space
@@ -170,47 +190,74 @@ static __inline u_int32_t bus_space_read_4(bus_space_tag_t tag,
bus_size_t offset);
static __inline u_int8_t
-bus_space_read_1(bus_space_tag_t tag, bus_space_handle_t handle,
+bus_space_read_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset)
{
-#if defined (_I386_BUS_PIO_H_)
-#if defined (_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- return (inb(handle + offset));
+ return (inb(bsh.bsh_base + offset));
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ return (inb(bsh.bsh_iat[offset]));
#endif
-#if defined (_I386_BUS_MEMIO_H_)
- return (*(volatile u_int8_t *)(handle + offset));
+#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ else
+#endif
+ return (*(volatile u_int8_t *)(bsh.bsh_base + offset));
#endif
}
static __inline u_int16_t
-bus_space_read_2(bus_space_tag_t tag, bus_space_handle_t handle,
+bus_space_read_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- return (inw(handle + offset));
+ return (inw(bsh.bsh_base + offset));
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ return (inw(bsh.bsh_iat[offset]));
#endif
#if defined(_I386_BUS_MEMIO_H_)
- return (*(volatile u_int16_t *)(handle + offset));
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ else
+#endif
+ return (*(volatile u_int16_t *)(bsh.bsh_base + offset));
#endif
}
static __inline u_int32_t
-bus_space_read_4(bus_space_tag_t tag, bus_space_handle_t handle,
+bus_space_read_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- return (inl(handle + offset));
+ return (inl(bsh.bsh_base + offset));
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ return (inl(bsh.bsh_iat[offset]));
#endif
#if defined(_I386_BUS_MEMIO_H_)
- return (*(volatile u_int32_t *)(handle + offset));
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ else
+#endif
+ return (*(volatile u_int32_t *)(bsh.bsh_base + offset));
#endif
}
@@ -242,14 +289,20 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int8_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- insb(bsh + offset, addr, count);
+ insb(bsh.bsh_base + offset, addr, count);
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ insb(bsh.bsh_iat[offset], addr, count);
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
__asm __volatile(" \n\
@@ -258,7 +311,7 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
stosb \n\
loop 1b" :
"=D" (addr), "=c" (count) :
- "r" (bsh + offset), "0" (addr), "1" (count) :
+ "r" (bsh.bsh_base + offset), "0" (addr), "1" (count) :
"%eax", "memory");
}
#endif
@@ -269,14 +322,20 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int16_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- insw(bsh + offset, addr, count);
+ insw(bsh.bsh_base + offset, addr, count);
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ insw(bsh.bsh_iat[offset], addr, count);
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
__asm __volatile(" \n\
@@ -285,7 +344,7 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
stosw \n\
loop 1b" :
"=D" (addr), "=c" (count) :
- "r" (bsh + offset), "0" (addr), "1" (count) :
+ "r" (bsh.bsh_base + offset), "0" (addr), "1" (count) :
"%eax", "memory");
}
#endif
@@ -296,14 +355,20 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int32_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- insl(bsh + offset, addr, count);
+ insl(bsh.bsh_base + offset, addr, count);
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ insl(bsh.bsh_iat[offset], addr, count);
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
__asm __volatile(" \n\
@@ -312,7 +377,7 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
stosl \n\
loop 1b" :
"=D" (addr), "=c" (count) :
- "r" (bsh + offset), "0" (addr), "1" (count) :
+ "r" (bsh.bsh_base + offset), "0" (addr), "1" (count) :
"%eax", "memory");
}
#endif
@@ -348,11 +413,11 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int8_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
1: inb %w2,%%al \n\
@@ -364,12 +429,29 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
"%eax", "memory", "cc");
}
#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ __asm __volatile(" \n\
+ cld \n\
+ 1: movl bsh.bsh_iat(%l2), %%edx \n\
+ inb %%dx,%%al \n\
+ stosb \n\
+ incl %2 \n\
+ loop 1b" :
+ "=D" (addr), "=c" (count), "=b" (offset) :
+ "0" (addr), "1" (count), "2" (offset) :
+ "%eax", "memory", "cc");
+ }
+#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
repne \n\
@@ -386,11 +468,11 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int16_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
1: inw %w2,%%ax \n\
@@ -402,12 +484,29 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
"%eax", "memory", "cc");
}
#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ __asm __volatile(" \n\
+ cld \n\
+ 1: movl bsh.bsh_iat(%l2), %%edx \n\
+ inw %%dx,%%ax \n\
+ stosw \n\
+ addl $2,%2 \n\
+ loop 1b" :
+ "=D" (addr), "=c" (count), "=b" (offset) :
+ "0" (addr), "1" (count), "2" (offset) :
+ "%eax", "memory", "cc");
+ }
+#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
repne \n\
@@ -424,11 +523,11 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int32_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
1: inl %w2,%%eax \n\
@@ -440,12 +539,29 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
"%eax", "memory", "cc");
}
#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ __asm __volatile(" \n\
+ cld \n\
+ 1: movl bsh.bsh_iat(%l2), %%edx \n\
+ inl %%dx,%%eax \n\
+ stosl \n\
+ addl $4,%2 \n\
+ loop 1b" :
+ "=D" (addr), "=c" (count), "=b" (offset) :
+ "0" (addr), "1" (count), "2" (offset) :
+ "%eax", "memory", "cc");
+ }
+#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
repne \n\
@@ -483,16 +599,22 @@ bus_space_write_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int8_t value)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- outb(bsh + offset, value);
+ outb(bsh.bsh_base + offset, value);
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ outb(bsh.bsh_iat[offset], value);
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
- *(volatile u_int8_t *)(bsh + offset) = value;
+ *(volatile u_int8_t *)(bsh.bsh_base + offset) = value;
#endif
}
@@ -501,16 +623,22 @@ bus_space_write_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int16_t value)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- outw(bsh + offset, value);
+ outw(bsh.bsh_base + offset, value);
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ outw(bsh.bsh_iat[offset], value);
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
- *(volatile u_int16_t *)(bsh + offset) = value;
+ *(volatile u_int16_t *)(bsh.bsh_base + offset) = value;
#endif
}
@@ -519,16 +647,22 @@ bus_space_write_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int32_t value)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- outl(bsh + offset, value);
+ outl(bsh.bsh_base + offset, value);
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ outl(bsh.bsh_iat[offset], value);
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
- *(volatile u_int32_t *)(bsh + offset) = value;
+ *(volatile u_int32_t *)(bsh.bsh_base + offset) = value;
#endif
}
@@ -563,14 +697,20 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int8_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- outsb(bsh + offset, addr, count);
+ outsb(bsh.bsh_base + offset, addr, count);
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ outsb(bsh.bsh_iat[offset], addr, count);
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
__asm __volatile(" \n\
@@ -579,7 +719,7 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
movb %%al,(%2) \n\
loop 1b" :
"=S" (addr), "=c" (count) :
- "r" (bsh + offset), "0" (addr), "1" (count) :
+ "r" (bsh.bsh_base + offset), "0" (addr), "1" (count) :
"%eax", "memory", "cc");
}
#endif
@@ -590,14 +730,20 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int16_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- outsw(bsh + offset, addr, count);
+ outsw(bsh.bsh_base + offset, addr, count);
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ outsw(bsh.bsh_iat[offset], addr, count);
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
__asm __volatile(" \n\
@@ -607,7 +753,7 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
movw %%ax,(%2) \n\
loop 1b" :
"=S" (addr), "=c" (count) :
- "r" (bsh + offset), "0" (addr), "1" (count) :
+ "r" (bsh.bsh_base + offset), "0" (addr), "1" (count) :
"%eax", "memory", "cc");
}
#endif
@@ -618,14 +764,20 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int32_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
- outsl(bsh + offset, addr, count);
+ outsl(bsh.bsh_base + offset, addr, count);
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ outsl(bsh.bsh_iat[offset], addr, count);
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
__asm __volatile(" \n\
@@ -634,7 +786,7 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
movl %%eax,(%2) \n\
loop 1b" :
"=S" (addr), "=c" (count) :
- "r" (bsh + offset), "0" (addr), "1" (count) :
+ "r" (bsh.bsh_base + offset), "0" (addr), "1" (count) :
"%eax", "memory", "cc");
}
#endif
@@ -671,11 +823,11 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int8_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
1: lodsb \n\
@@ -687,12 +839,29 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
"%eax", "memory", "cc");
}
#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ __asm __volatile(" \n\
+ cld \n\
+ 1: lodsb \n\
+ movl bsh.bsh_iat(%l0), %%edx \n\
+ outb %%al,%%dx \n\
+ incl %0 \n\
+ loop 1b" :
+ "=b" (offset), "=S" (addr), "=c" (count) :
+ "0" (offset), "1" (addr), "2" (count) :
+ "%eax", "memory", "cc");
+ }
+#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
repne \n\
@@ -709,11 +878,11 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int16_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
1: lodsw \n\
@@ -725,12 +894,29 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
"%eax", "memory", "cc");
}
#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ __asm __volatile(" \n\
+ cld \n\
+ 1: lodsw \n\
+ movl bsh.bsh_iat(%l0), %%edx \n\
+ outw %%ax,%%dx \n\
+ addl $2,%0 \n\
+ loop 1b" :
+ "=b" (offset), "=S" (addr), "=c" (count) :
+ "0" (offset), "1" (addr), "2" (count) :
+ "%eax", "memory", "cc");
+ }
+#endif
#if defined(_I386_BUS_MEMIO_H_)
#if defined(_I386_BUS_PIO_H_)
- else
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
repne \n\
@@ -747,11 +933,11 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, const u_int32_t *addr, size_t count)
{
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
1: lodsl \n\
@@ -763,12 +949,29 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
"%eax", "memory", "cc");
}
#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ __asm __volatile(" \n\
+ cld \n\
+ 1: lodsl \n\
+ movl bsh.bsh_iat(%l0), %%edx \n\
+ outl %%eax,%%dx \n\
+ addl $4,%0 \n\
+ loop 1b" :
+ "=b" (offset), "=S" (addr), "=c" (count) :
+ "0" (offset), "1" (addr), "2" (count) :
+ "%eax", "memory", "cc");
+ }
+#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
- int _port_ = bsh + offset; \
+ int _port_ = bsh.bsh_base + offset; \
__asm __volatile(" \n\
cld \n\
repne \n\
@@ -807,21 +1010,35 @@ static __inline void
bus_space_set_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int8_t value, size_t count)
{
- bus_addr_t addr = bsh + offset;
-
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
+ while (count--)
+ outb(addr, value);
+ }
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ bus_addr_t addr = bsh.bsh_iat[offset];
while (count--)
outb(addr, value);
+ }
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
while (count--)
*(volatile u_int8_t *)(addr) = value;
+ }
#endif
}
@@ -829,21 +1046,35 @@ static __inline void
bus_space_set_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int16_t value, size_t count)
{
- bus_addr_t addr = bsh + offset;
-
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
while (count--)
outw(addr, value);
+ }
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ bus_addr_t addr = bsh.bsh_iat[offset];
+ while (count--)
+ outw(addr, value);
+ }
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
while (count--)
*(volatile u_int16_t *)(addr) = value;
+ }
#endif
}
@@ -851,21 +1082,35 @@ static __inline void
bus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int32_t value, size_t count)
{
- bus_addr_t addr = bsh + offset;
-
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
while (count--)
outl(addr, value);
+ }
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ bus_addr_t addr = bsh.bsh_iat[offset];
+ while (count--)
+ outl(addr, value);
+ }
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
while (count--)
*(volatile u_int32_t *)(addr) = value;
+ }
#endif
}
@@ -895,21 +1140,34 @@ static __inline void
bus_space_set_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int8_t value, size_t count)
{
- bus_addr_t addr = bsh + offset;
-
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
for (; count != 0; count--, addr++)
outb(addr, value);
+ }
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ for (; count != 0; count--, offset++)
+ outb(bsh.bsh_iat[offset], value);
+ }
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
for (; count != 0; count--, addr++)
*(volatile u_int8_t *)(addr) = value;
+ }
#endif
}
@@ -917,21 +1175,34 @@ static __inline void
bus_space_set_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int16_t value, size_t count)
{
- bus_addr_t addr = bsh + offset;
-
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
for (; count != 0; count--, addr += 2)
outw(addr, value);
+ }
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ for (; count != 0; count--, offset += 2)
+ outw(bsh.bsh_iat[offset], value);
+ }
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
for (; count != 0; count--, addr += 2)
*(volatile u_int16_t *)(addr) = value;
+ }
#endif
}
@@ -939,21 +1210,34 @@ static __inline void
bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
bus_size_t offset, u_int32_t value, size_t count)
{
- bus_addr_t addr = bsh + offset;
-
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
for (; count != 0; count--, addr += 4)
outl(addr, value);
+ }
+#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ for (; count != 0; count--, offset += 4)
+ outl(bsh.bsh_iat[offset], value);
+ }
#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
+ {
+ bus_addr_t addr = bsh.bsh_base + offset;
for (; count != 0; count--, addr += 4)
*(volatile u_int32_t *)(addr) = value;
+ }
#endif
}
@@ -989,14 +1273,13 @@ bus_space_copy_region_1(bus_space_tag_t tag, bus_space_handle_t bsh1,
bus_size_t off1, bus_space_handle_t bsh2,
bus_size_t off2, size_t count)
{
- bus_addr_t addr1 = bsh1 + off1;
- bus_addr_t addr2 = bsh2 + off2;
-
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
{
+ bus_addr_t addr1 = bsh1.bsh_base + off1;
+ bus_addr_t addr2 = bsh2.bsh_base + off2;
if (addr1 >= addr2) {
/* src after dest: copy forward */
for (; count != 0; count--, addr1++, addr2++)
@@ -1004,16 +1287,37 @@ bus_space_copy_region_1(bus_space_tag_t tag, bus_space_handle_t bsh1,
} else {
/* dest after src: copy backwards */
for (addr1 += (count - 1), addr2 += (count - 1);
- count != 0; count--, addr1--, addr2--)
+ count != 0; count--, addr1--, addr2--)
outb(addr2, inb(addr1));
}
}
#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ if (bsh1.bsh_iat[off1] >= bsh2.bsh_iat[off2]) {
+ /* src after dest: copy forward */
+ for (; count != 0; count--, off1++, off2++)
+ outb(bsh2.bsh_iat[off2],
+ inb(bsh1.bsh_iat[off1]));
+ } else {
+ /* dest after src: copy backwards */
+ for (off1 += (count - 1), off2 += (count - 1);
+ count != 0; count--, off1--, off2--)
+ outb(bsh2.bsh_iat[off2],
+ inb(bsh1.bsh_iat[off1]));
+ }
+ }
+#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
+ bus_addr_t addr1 = bsh1.bsh_base + off1;
+ bus_addr_t addr2 = bsh2.bsh_base + off2;
if (addr1 >= addr2) {
/* src after dest: copy forward */
for (; count != 0; count--, addr1++, addr2++)
@@ -1022,7 +1326,7 @@ bus_space_copy_region_1(bus_space_tag_t tag, bus_space_handle_t bsh1,
} else {
/* dest after src: copy backwards */
for (addr1 += (count - 1), addr2 += (count - 1);
- count != 0; count--, addr1--, addr2--)
+ count != 0; count--, addr1--, addr2--)
*(volatile u_int8_t *)(addr2) =
*(volatile u_int8_t *)(addr1);
}
@@ -1035,14 +1339,13 @@ bus_space_copy_region_2(bus_space_tag_t tag, bus_space_handle_t bsh1,
bus_size_t off1, bus_space_handle_t bsh2,
bus_size_t off2, size_t count)
{
- bus_addr_t addr1 = bsh1 + off1;
- bus_addr_t addr2 = bsh2 + off2;
-
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
{
+ bus_addr_t addr1 = bsh1.bsh_base + off1;
+ bus_addr_t addr2 = bsh2.bsh_base + off2;
if (addr1 >= addr2) {
/* src after dest: copy forward */
for (; count != 0; count--, addr1 += 2, addr2 += 2)
@@ -1050,16 +1353,37 @@ bus_space_copy_region_2(bus_space_tag_t tag, bus_space_handle_t bsh1,
} else {
/* dest after src: copy backwards */
for (addr1 += 2 * (count - 1), addr2 += 2 * (count - 1);
- count != 0; count--, addr1 -= 2, addr2 -= 2)
+ count != 0; count--, addr1 -= 2, addr2 -= 2)
outw(addr2, inw(addr1));
}
}
#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ if (bsh1.bsh_iat[off1] >= bsh2.bsh_iat[off2]) {
+ /* src after dest: copy forward */
+ for (; count != 0; count--, off1 += 2, off2 += 2)
+ outw(bsh2.bsh_iat[off2],
+ inw(bsh1.bsh_iat[off1]));
+ } else {
+ /* dest after src: copy backwards */
+ for (off1 += 2 * (count - 1), off2 += 2 * (count - 1);
+ count != 0; count--, off1 -= 2, off2 -= 2)
+ outw(bsh2.bsh_iat[off2],
+ inw(bsh1.bsh_iat[off1]));
+ }
+ }
+#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
+ bus_addr_t addr1 = bsh1.bsh_base + off1;
+ bus_addr_t addr2 = bsh2.bsh_base + off2;
if (addr1 >= addr2) {
/* src after dest: copy forward */
for (; count != 0; count--, addr1 += 2, addr2 += 2)
@@ -1068,7 +1392,7 @@ bus_space_copy_region_2(bus_space_tag_t tag, bus_space_handle_t bsh1,
} else {
/* dest after src: copy backwards */
for (addr1 += 2 * (count - 1), addr2 += 2 * (count - 1);
- count != 0; count--, addr1 -= 2, addr2 -= 2)
+ count != 0; count--, addr1 -= 2, addr2 -= 2)
*(volatile u_int16_t *)(addr2) =
*(volatile u_int16_t *)(addr1);
}
@@ -1081,14 +1405,13 @@ bus_space_copy_region_4(bus_space_tag_t tag, bus_space_handle_t bsh1,
bus_size_t off1, bus_space_handle_t bsh2,
bus_size_t off2, size_t count)
{
- bus_addr_t addr1 = bsh1 + off1;
- bus_addr_t addr2 = bsh2 + off2;
-
#if defined(_I386_BUS_PIO_H_)
-#if defined(_I386_BUS_MEMIO_H_)
+#if defined(_I386_BUS_PIO_IND_H_) || defined(_I386_BUS_MEMIO_H_)
if (tag == I386_BUS_SPACE_IO)
#endif
{
+ bus_addr_t addr1 = bsh1.bsh_base + off1;
+ bus_addr_t addr2 = bsh2.bsh_base + off2;
if (addr1 >= addr2) {
/* src after dest: copy forward */
for (; count != 0; count--, addr1 += 4, addr2 += 4)
@@ -1101,11 +1424,32 @@ bus_space_copy_region_4(bus_space_tag_t tag, bus_space_handle_t bsh1,
}
}
#endif
+#if defined(_I386_BUS_PIO_IND_H_)
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_)
+ if (tag == I386_BUS_SPACE_IO_IND)
+#endif
+ {
+ if (bsh1.bsh_iat[off1] >= bsh2.bsh_iat[off2]) {
+ /* src after dest: copy forward */
+ for (; count != 0; count--, off1 += 4, off2 += 4)
+ outl(bsh2.bsh_iat[off2],
+ inl(bsh1.bsh_iat[off1]));
+ } else {
+ /* dest after src: copy backwards */
+ for (off1 += 4 * (count - 1), off2 += 4 * (count - 1);
+ count != 0; count--, off1 -= 4, off2 -= 4)
+ outl(bsh2.bsh_iat[off2],
+ inl(bsh1.bsh_iat[off1]));
+ }
+ }
+#endif
#if defined(_I386_BUS_MEMIO_H_)
-#if defined(_I386_BUS_PIO_H_)
- else
+#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_PIO_IND_H_)
+ if (tag == I386_BUS_SPACE_MEM)
#endif
{
+ bus_addr_t addr1 = bsh1.bsh_base + off1;
+ bus_addr_t addr2 = bsh2.bsh_base + off2;
if (addr1 >= addr2) {
/* src after dest: copy forward */
for (; count != 0; count--, addr1 += 4, addr2 += 4)
@@ -1288,4 +1632,4 @@ void _bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map);
if ((dmamap) != NULL) \
_bus_dmamap_unload(dmat, dmamap)
-#endif /* _I386_BUS_H_ */
+#endif /* _I386_BUS_PC98_H_ */
OpenPOWER on IntegriCloud