Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/include/bus.h
Show First 20 Lines • Show All 274 Lines • ▼ Show 20 Lines | 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) | bus_size_t offset, u_int8_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) | if (tag == X86_BUS_SPACE_IO) | ||||
insb(bsh + offset, addr, count); | insb(bsh + offset, addr, count); | ||||
else { | else { | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: movb (%2),%%al \n\ | 1: movb (%2),%%al \n\ | ||||
stosb \n\ | stosb \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=D" (addr), "=c" (count) : | "=D" (addr), "=c" (count) : | ||||
"r" (bsh + offset), "0" (addr), "1" (count) : | "r" (bsh + offset), "0" (addr), "1" (count) : | ||||
"%eax", "memory"); | "%eax", "memory"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
static __inline void | static __inline void | ||||
bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, | 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) | bus_size_t offset, u_int16_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) | if (tag == X86_BUS_SPACE_IO) | ||||
insw(bsh + offset, addr, count); | insw(bsh + offset, addr, count); | ||||
else { | else { | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: movw (%2),%%ax \n\ | 1: movw (%2),%%ax \n\ | ||||
stosw \n\ | stosw \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=D" (addr), "=c" (count) : | "=D" (addr), "=c" (count) : | ||||
"r" (bsh + offset), "0" (addr), "1" (count) : | "r" (bsh + offset), "0" (addr), "1" (count) : | ||||
"%eax", "memory"); | "%eax", "memory"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
static __inline void | static __inline void | ||||
bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, | 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) | bus_size_t offset, u_int32_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) | if (tag == X86_BUS_SPACE_IO) | ||||
insl(bsh + offset, addr, count); | insl(bsh + offset, addr, count); | ||||
else { | else { | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: movl (%2),%%eax \n\ | 1: movl (%2),%%eax \n\ | ||||
stosl \n\ | stosl \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=D" (addr), "=c" (count) : | "=D" (addr), "=c" (count) : | ||||
"r" (bsh + offset), "0" (addr), "1" (count) : | "r" (bsh + offset), "0" (addr), "1" (count) : | ||||
"%eax", "memory"); | "%eax", "memory"); | ||||
#endif | #endif | ||||
} | } | ||||
Show All 28 Lines | |||||
bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, | 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) | bus_size_t offset, u_int8_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) { | if (tag == X86_BUS_SPACE_IO) { | ||||
int _port_ = bsh + offset; | int _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: inb %w2,%%al \n\ | 1: inb %w2,%%al \n\ | ||||
stosb \n\ | stosb \n\ | ||||
incl %2 \n\ | incl %2 \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=D" (addr), "=c" (count), "=d" (_port_) : | "=D" (addr), "=c" (count), "=d" (_port_) : | ||||
"0" (addr), "1" (count), "2" (_port_) : | "0" (addr), "1" (count), "2" (_port_) : | ||||
"%eax", "memory", "cc"); | "%eax", "memory", "cc"); | ||||
#endif | #endif | ||||
} else { | } else { | ||||
bus_space_handle_t _port_ = bsh + offset; | bus_space_handle_t _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
repne \n\ | repne \n\ | ||||
movsb" : | movsb" : | ||||
"=D" (addr), "=c" (count), "=S" (_port_) : | "=D" (addr), "=c" (count), "=S" (_port_) : | ||||
"0" (addr), "1" (count), "2" (_port_) : | "0" (addr), "1" (count), "2" (_port_) : | ||||
"memory", "cc"); | "memory", "cc"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
static __inline void | static __inline void | ||||
bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, | 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) | bus_size_t offset, u_int16_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) { | if (tag == X86_BUS_SPACE_IO) { | ||||
int _port_ = bsh + offset; | int _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: inw %w2,%%ax \n\ | 1: inw %w2,%%ax \n\ | ||||
stosw \n\ | stosw \n\ | ||||
addl $2,%2 \n\ | addl $2,%2 \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=D" (addr), "=c" (count), "=d" (_port_) : | "=D" (addr), "=c" (count), "=d" (_port_) : | ||||
"0" (addr), "1" (count), "2" (_port_) : | "0" (addr), "1" (count), "2" (_port_) : | ||||
"%eax", "memory", "cc"); | "%eax", "memory", "cc"); | ||||
#endif | #endif | ||||
} else { | } else { | ||||
bus_space_handle_t _port_ = bsh + offset; | bus_space_handle_t _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
repne \n\ | repne \n\ | ||||
movsw" : | movsw" : | ||||
"=D" (addr), "=c" (count), "=S" (_port_) : | "=D" (addr), "=c" (count), "=S" (_port_) : | ||||
"0" (addr), "1" (count), "2" (_port_) : | "0" (addr), "1" (count), "2" (_port_) : | ||||
"memory", "cc"); | "memory", "cc"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
static __inline void | static __inline void | ||||
bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, | 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) | bus_size_t offset, u_int32_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) { | if (tag == X86_BUS_SPACE_IO) { | ||||
int _port_ = bsh + offset; | int _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: inl %w2,%%eax \n\ | 1: inl %w2,%%eax \n\ | ||||
stosl \n\ | stosl \n\ | ||||
addl $4,%2 \n\ | addl $4,%2 \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=D" (addr), "=c" (count), "=d" (_port_) : | "=D" (addr), "=c" (count), "=d" (_port_) : | ||||
"0" (addr), "1" (count), "2" (_port_) : | "0" (addr), "1" (count), "2" (_port_) : | ||||
"%eax", "memory", "cc"); | "%eax", "memory", "cc"); | ||||
#endif | #endif | ||||
} else { | } else { | ||||
bus_space_handle_t _port_ = bsh + offset; | bus_space_handle_t _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
repne \n\ | repne \n\ | ||||
movsl" : | movsl" : | ||||
"=D" (addr), "=c" (count), "=S" (_port_) : | "=D" (addr), "=c" (count), "=S" (_port_) : | ||||
"0" (addr), "1" (count), "2" (_port_) : | "0" (addr), "1" (count), "2" (_port_) : | ||||
"memory", "cc"); | "memory", "cc"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | 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) | bus_size_t offset, const u_int8_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) | if (tag == X86_BUS_SPACE_IO) | ||||
outsb(bsh + offset, addr, count); | outsb(bsh + offset, addr, count); | ||||
else { | else { | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: lodsb \n\ | 1: lodsb \n\ | ||||
movb %%al,(%2) \n\ | movb %%al,(%2) \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=S" (addr), "=c" (count) : | "=S" (addr), "=c" (count) : | ||||
"r" (bsh + offset), "0" (addr), "1" (count) : | "r" (bsh + offset), "0" (addr), "1" (count) : | ||||
"%eax", "memory", "cc"); | "%eax", "memory", "cc"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
static __inline void | static __inline void | ||||
bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, | 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) | bus_size_t offset, const u_int16_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) | if (tag == X86_BUS_SPACE_IO) | ||||
outsw(bsh + offset, addr, count); | outsw(bsh + offset, addr, count); | ||||
else { | else { | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: lodsw \n\ | 1: lodsw \n\ | ||||
movw %%ax,(%2) \n\ | movw %%ax,(%2) \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=S" (addr), "=c" (count) : | "=S" (addr), "=c" (count) : | ||||
"r" (bsh + offset), "0" (addr), "1" (count) : | "r" (bsh + offset), "0" (addr), "1" (count) : | ||||
"%eax", "memory", "cc"); | "%eax", "memory", "cc"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
static __inline void | static __inline void | ||||
bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, | 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) | bus_size_t offset, const u_int32_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) | if (tag == X86_BUS_SPACE_IO) | ||||
outsl(bsh + offset, addr, count); | outsl(bsh + offset, addr, count); | ||||
else { | else { | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: lodsl \n\ | 1: lodsl \n\ | ||||
movl %%eax,(%2) \n\ | movl %%eax,(%2) \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=S" (addr), "=c" (count) : | "=S" (addr), "=c" (count) : | ||||
"r" (bsh + offset), "0" (addr), "1" (count) : | "r" (bsh + offset), "0" (addr), "1" (count) : | ||||
"%eax", "memory", "cc"); | "%eax", "memory", "cc"); | ||||
#endif | #endif | ||||
} | } | ||||
Show All 29 Lines | |||||
bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, | 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) | bus_size_t offset, const u_int8_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) { | if (tag == X86_BUS_SPACE_IO) { | ||||
int _port_ = bsh + offset; | int _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: lodsb \n\ | 1: lodsb \n\ | ||||
outb %%al,%w0 \n\ | outb %%al,%w0 \n\ | ||||
incl %0 \n\ | incl %0 \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=d" (_port_), "=S" (addr), "=c" (count) : | "=d" (_port_), "=S" (addr), "=c" (count) : | ||||
"0" (_port_), "1" (addr), "2" (count) : | "0" (_port_), "1" (addr), "2" (count) : | ||||
"%eax", "memory", "cc"); | "%eax", "memory", "cc"); | ||||
#endif | #endif | ||||
} else { | } else { | ||||
bus_space_handle_t _port_ = bsh + offset; | bus_space_handle_t _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
repne \n\ | repne \n\ | ||||
movsb" : | movsb" : | ||||
"=D" (_port_), "=S" (addr), "=c" (count) : | "=D" (_port_), "=S" (addr), "=c" (count) : | ||||
"0" (_port_), "1" (addr), "2" (count) : | "0" (_port_), "1" (addr), "2" (count) : | ||||
"memory", "cc"); | "memory", "cc"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
static __inline void | static __inline void | ||||
bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, | 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) | bus_size_t offset, const u_int16_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) { | if (tag == X86_BUS_SPACE_IO) { | ||||
int _port_ = bsh + offset; | int _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: lodsw \n\ | 1: lodsw \n\ | ||||
outw %%ax,%w0 \n\ | outw %%ax,%w0 \n\ | ||||
addl $2,%0 \n\ | addl $2,%0 \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=d" (_port_), "=S" (addr), "=c" (count) : | "=d" (_port_), "=S" (addr), "=c" (count) : | ||||
"0" (_port_), "1" (addr), "2" (count) : | "0" (_port_), "1" (addr), "2" (count) : | ||||
"%eax", "memory", "cc"); | "%eax", "memory", "cc"); | ||||
#endif | #endif | ||||
} else { | } else { | ||||
bus_space_handle_t _port_ = bsh + offset; | bus_space_handle_t _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
repne \n\ | repne \n\ | ||||
movsw" : | movsw" : | ||||
"=D" (_port_), "=S" (addr), "=c" (count) : | "=D" (_port_), "=S" (addr), "=c" (count) : | ||||
"0" (_port_), "1" (addr), "2" (count) : | "0" (_port_), "1" (addr), "2" (count) : | ||||
"memory", "cc"); | "memory", "cc"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
static __inline void | static __inline void | ||||
bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, | 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) | bus_size_t offset, const u_int32_t *addr, size_t count) | ||||
{ | { | ||||
if (tag == X86_BUS_SPACE_IO) { | if (tag == X86_BUS_SPACE_IO) { | ||||
int _port_ = bsh + offset; | int _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
1: lodsl \n\ | 1: lodsl \n\ | ||||
outl %%eax,%w0 \n\ | outl %%eax,%w0 \n\ | ||||
addl $4,%0 \n\ | addl $4,%0 \n\ | ||||
loop 1b" : | loop 1b" : | ||||
"=d" (_port_), "=S" (addr), "=c" (count) : | "=d" (_port_), "=S" (addr), "=c" (count) : | ||||
"0" (_port_), "1" (addr), "2" (count) : | "0" (_port_), "1" (addr), "2" (count) : | ||||
"%eax", "memory", "cc"); | "%eax", "memory", "cc"); | ||||
#endif | #endif | ||||
} else { | } else { | ||||
bus_space_handle_t _port_ = bsh + offset; | bus_space_handle_t _port_ = bsh + offset; | ||||
#ifdef __GNUCLIKE_ASM | #ifdef __GNUCLIKE_ASM | ||||
__asm __volatile(" \n\ | __asm __volatile(" \n\ | ||||
cld \n\ | |||||
repne \n\ | repne \n\ | ||||
movsl" : | movsl" : | ||||
"=D" (_port_), "=S" (addr), "=c" (count) : | "=D" (_port_), "=S" (addr), "=c" (count) : | ||||
"0" (_port_), "1" (addr), "2" (count) : | "0" (_port_), "1" (addr), "2" (count) : | ||||
"memory", "cc"); | "memory", "cc"); | ||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 374 Lines • Show Last 20 Lines |