diff options
Diffstat (limited to 'sys/i386/include/bus.h')
-rw-r--r-- | sys/i386/include/bus.h | 322 |
1 files changed, 42 insertions, 280 deletions
diff --git a/sys/i386/include/bus.h b/sys/i386/include/bus.h index 4fd13ea..b3a9951 100644 --- a/sys/i386/include/bus.h +++ b/sys/i386/include/bus.h @@ -108,15 +108,6 @@ #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_) -#define _I386_BUS_PIO_H_ -#define _I386_BUS_MEMIO_H_ -#endif - -/* * Values for the i386 bus space tag, not to be used directly by MI code. */ #define I386_BUS_SPACE_IO 0 /* space is i/o space */ @@ -208,8 +199,6 @@ bus_space_free(bus_space_tag_t t __unused, bus_space_handle_t bsh __unused, } -#if defined(_I386_BUS_PIO_H_) || defined(_I386_BUS_MEMIO_H_) - /* * Read a 1, 2, 4, or 8 byte quantity from bus space * described by tag/handle/offset. @@ -230,45 +219,30 @@ static __inline u_int8_t bus_space_read_1(bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t offset) { -#if defined (_I386_BUS_PIO_H_) -#if defined (_I386_BUS_MEMIO_H_) + if (tag == I386_BUS_SPACE_IO) -#endif return (inb(handle + offset)); -#endif -#if defined (_I386_BUS_MEMIO_H_) return (*(volatile u_int8_t *)(handle + offset)); -#endif } static __inline u_int16_t bus_space_read_2(bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t offset) { -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) + if (tag == I386_BUS_SPACE_IO) -#endif return (inw(handle + offset)); -#endif -#if defined(_I386_BUS_MEMIO_H_) return (*(volatile u_int16_t *)(handle + offset)); -#endif } static __inline u_int32_t bus_space_read_4(bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t offset) { -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) + if (tag == I386_BUS_SPACE_IO) -#endif return (inl(handle + offset)); -#endif -#if defined(_I386_BUS_MEMIO_H_) return (*(volatile u_int32_t *)(handle + offset)); -#endif } #if 0 /* Cause a link error for bus_space_read_8 */ @@ -298,17 +272,10 @@ static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif insb(bsh + offset, addr, count); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ @@ -324,24 +291,16 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif insw(bsh + offset, addr, count); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ @@ -357,24 +316,16 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif insl(bsh + offset, addr, count); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ @@ -390,7 +341,6 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } #if 0 /* Cause a link error for bus_space_read_multi_8 */ @@ -422,11 +372,8 @@ static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif - { + + if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -443,13 +390,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, # error "no assembler code for your compiler" # endif #endif - } -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + } else { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -465,18 +406,14 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif - { + + if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -493,13 +430,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, # error "no assembler code for your compiler" # endif #endif - } -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + } else { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -515,18 +446,14 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif - { + + if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -543,13 +470,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, # error "no assembler code for your compiler" # endif #endif - } -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + } else { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -565,7 +486,6 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } #if 0 /* Cause a link error for bus_space_read_region_8 */ @@ -593,54 +513,33 @@ static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif outb(bsh + offset, value); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) else -#endif *(volatile u_int8_t *)(bsh + offset) = value; -#endif } static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif outw(bsh + offset, value); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) else -#endif *(volatile u_int16_t *)(bsh + offset) = value; -#endif } static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif outl(bsh + offset, value); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) else -#endif *(volatile u_int32_t *)(bsh + offset) = value; -#endif } #if 0 /* Cause a link error for bus_space_write_8 */ @@ -673,17 +572,10 @@ static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif outsb(bsh + offset, addr, count); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ @@ -699,24 +591,16 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif outsw(bsh + offset, addr, count); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ @@ -732,24 +616,16 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif outsl(bsh + offset, addr, count); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ @@ -765,7 +641,6 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } #if 0 /* Cause a link error for bus_space_write_multi_8 */ @@ -798,11 +673,8 @@ static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif - { + + if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -819,13 +691,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, # error "no assembler code for your compiler" # endif #endif - } -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + } else { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -841,18 +707,14 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif - { + + if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -869,13 +731,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, # error "no assembler code for your compiler" # endif #endif - } -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + } else { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -891,18 +747,14 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } static __inline void 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 (tag == I386_BUS_SPACE_IO) -#endif - { + + if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -919,13 +771,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, # error "no assembler code for your compiler" # endif #endif - } -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + } else { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ @@ -941,7 +787,6 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, # endif #endif } -#endif } #if 0 /* Cause a link error for bus_space_write_region_8 */ @@ -973,20 +818,12 @@ bus_space_set_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, { bus_space_handle_t addr = bsh + offset; -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) if (tag == I386_BUS_SPACE_IO) -#endif while (count--) outb(addr, value); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) else -#endif while (count--) *(volatile u_int8_t *)(addr) = value; -#endif } static __inline void @@ -995,20 +832,12 @@ bus_space_set_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, { bus_space_handle_t addr = bsh + offset; -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) if (tag == I386_BUS_SPACE_IO) -#endif while (count--) outw(addr, value); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) else -#endif while (count--) *(volatile u_int16_t *)(addr) = value; -#endif } static __inline void @@ -1017,20 +846,12 @@ bus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, { bus_space_handle_t addr = bsh + offset; -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) if (tag == I386_BUS_SPACE_IO) -#endif while (count--) outl(addr, value); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) else -#endif while (count--) *(volatile u_int32_t *)(addr) = value; -#endif } #if 0 /* Cause a link error for bus_space_set_multi_8 */ @@ -1061,20 +882,12 @@ bus_space_set_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, { bus_space_handle_t addr = bsh + offset; -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) if (tag == I386_BUS_SPACE_IO) -#endif for (; count != 0; count--, addr++) outb(addr, value); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) else -#endif for (; count != 0; count--, addr++) *(volatile u_int8_t *)(addr) = value; -#endif } static __inline void @@ -1083,20 +896,12 @@ bus_space_set_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, { bus_space_handle_t addr = bsh + offset; -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) if (tag == I386_BUS_SPACE_IO) -#endif for (; count != 0; count--, addr += 2) outw(addr, value); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) else -#endif for (; count != 0; count--, addr += 2) *(volatile u_int16_t *)(addr) = value; -#endif } static __inline void @@ -1105,20 +910,12 @@ bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, { bus_space_handle_t addr = bsh + offset; -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) if (tag == I386_BUS_SPACE_IO) -#endif for (; count != 0; count--, addr += 4) outl(addr, value); -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) else -#endif for (; count != 0; count--, addr += 4) *(volatile u_int32_t *)(addr) = value; -#endif } #if 0 /* Cause a link error for bus_space_set_region_8 */ @@ -1156,11 +953,7 @@ bus_space_copy_region_1(bus_space_tag_t tag, bus_space_handle_t bsh1, bus_space_handle_t addr1 = bsh1 + off1; bus_space_handle_t addr2 = bsh2 + off2; -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) - if (tag == I386_BUS_SPACE_IO) -#endif - { + if (tag == I386_BUS_SPACE_IO) { if (addr1 >= addr2) { /* src after dest: copy forward */ for (; count != 0; count--, addr1++, addr2++) @@ -1171,13 +964,7 @@ bus_space_copy_region_1(bus_space_tag_t tag, bus_space_handle_t bsh1, count != 0; count--, addr1--, addr2--) outb(addr2, inb(addr1)); } - } -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + } else { if (addr1 >= addr2) { /* src after dest: copy forward */ for (; count != 0; count--, addr1++, addr2++) @@ -1191,7 +978,6 @@ bus_space_copy_region_1(bus_space_tag_t tag, bus_space_handle_t bsh1, *(volatile u_int8_t *)(addr1); } } -#endif } static __inline void @@ -1202,11 +988,7 @@ bus_space_copy_region_2(bus_space_tag_t tag, bus_space_handle_t bsh1, bus_space_handle_t addr1 = bsh1 + off1; bus_space_handle_t addr2 = bsh2 + off2; -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) - if (tag == I386_BUS_SPACE_IO) -#endif - { + if (tag == I386_BUS_SPACE_IO) { if (addr1 >= addr2) { /* src after dest: copy forward */ for (; count != 0; count--, addr1 += 2, addr2 += 2) @@ -1217,13 +999,7 @@ bus_space_copy_region_2(bus_space_tag_t tag, bus_space_handle_t bsh1, count != 0; count--, addr1 -= 2, addr2 -= 2) outw(addr2, inw(addr1)); } - } -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + } else { if (addr1 >= addr2) { /* src after dest: copy forward */ for (; count != 0; count--, addr1 += 2, addr2 += 2) @@ -1237,7 +1013,6 @@ bus_space_copy_region_2(bus_space_tag_t tag, bus_space_handle_t bsh1, *(volatile u_int16_t *)(addr1); } } -#endif } static __inline void @@ -1248,11 +1023,7 @@ bus_space_copy_region_4(bus_space_tag_t tag, bus_space_handle_t bsh1, bus_space_handle_t addr1 = bsh1 + off1; bus_space_handle_t addr2 = bsh2 + off2; -#if defined(_I386_BUS_PIO_H_) -#if defined(_I386_BUS_MEMIO_H_) - if (tag == I386_BUS_SPACE_IO) -#endif - { + if (tag == I386_BUS_SPACE_IO) { if (addr1 >= addr2) { /* src after dest: copy forward */ for (; count != 0; count--, addr1 += 4, addr2 += 4) @@ -1263,13 +1034,7 @@ bus_space_copy_region_4(bus_space_tag_t tag, bus_space_handle_t bsh1, count != 0; count--, addr1 -= 4, addr2 -= 4) outl(addr2, inl(addr1)); } - } -#endif -#if defined(_I386_BUS_MEMIO_H_) -#if defined(_I386_BUS_PIO_H_) - else -#endif - { + } else { if (addr1 >= addr2) { /* src after dest: copy forward */ for (; count != 0; count--, addr1 += 4, addr2 += 4) @@ -1283,11 +1048,8 @@ bus_space_copy_region_4(bus_space_tag_t tag, bus_space_handle_t bsh1, *(volatile u_int32_t *)(addr1); } } -#endif } -#endif /* defined(_I386_BUS_PIO_H_) || defined(_I386_MEM_IO_H_) */ - #if 0 /* Cause a link error for bus_space_copy_8 */ #define bus_space_copy_region_8 !!! bus_space_copy_region_8 unimplemented !!! #endif |