summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-12-14 07:08:52 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-12-14 07:08:52 +0000
commit76ffedc03494d66d2d7eeaddf1723c6561a3ce89 (patch)
tree0c3820ea6ebb59919b5d735aa414e31f9e99c841
parentd4fc0becbeef76626d499e9106da16522d3c12e6 (diff)
Cleanup io.h.
-rw-r--r--arch/mips/config.in5
-rw-r--r--arch/mips/defconfig1
-rw-r--r--arch/mips/defconfig-atlas1
-rw-r--r--arch/mips/defconfig-ddb54761
-rw-r--r--arch/mips/defconfig-decstation1
-rw-r--r--arch/mips/defconfig-ev641201
-rw-r--r--arch/mips/defconfig-ev961002
-rw-r--r--arch/mips/defconfig-ip221
-rw-r--r--arch/mips/defconfig-malta1
-rw-r--r--arch/mips/defconfig-rm2001
-rw-r--r--include/asm-mips/io.h123
11 files changed, 61 insertions, 77 deletions
diff --git a/arch/mips/config.in b/arch/mips/config.in
index 5546d730a..49268dd3b 100644
--- a/arch/mips/config.in
+++ b/arch/mips/config.in
@@ -42,12 +42,13 @@ bool 'Support for SNI RM200 PCI' CONFIG_SNI_RM200_PCI
unset CONFIG_ARC32
unset CONFIG_BOARD_SCACHE
unset CONFIG_HAVE_STD_PC_SERIAL_PORT
+unset CONFIG_I8259
unset CONFIG_ISA
unset CONFIG_PCI
unset CONFIG_MIPS_JAZZ
+unset CONFIG_SWAP_IO_SPACE
unset CONFIG_VIDEO_G364
unset CONFIG_PC_KEYB
-unset CONFIG_I8259
define_bool CONFIG_MCA n
define_bool CONFIG_SBUS n
@@ -55,6 +56,7 @@ define_bool CONFIG_SBUS n
if [ "$CONFIG_MIPS_EV96100" = "y" ]; then
define_bool CONFIG_PCI y
define_bool CONFIG_MIPS_GT96100 y
+ define_bool CONFIG_SWAP_IO_SPACE y
fi
if [ "$CONFIG_MIPS_EV64120" = "y" ]; then
define_bool CONFIG_PCI y
@@ -97,6 +99,7 @@ fi
if [ "$CONFIG_PMC_CP7000" = "y" ]; then
define_bool CONFIG_PCI y
define_bool CONFIG_SYSCLK_100 y
+ define_bool CONFIG_SWAP_IO_SPACE y
fi
if [ "$CONFIG_SGI_IP22" = "y" ]; then
define_bool CONFIG_ARC32 y
diff --git a/arch/mips/defconfig b/arch/mips/defconfig
index 305b2fa51..bf1c13cc6 100644
--- a/arch/mips/defconfig
+++ b/arch/mips/defconfig
@@ -22,6 +22,7 @@ CONFIG_EXPERIMENTAL=y
# CONFIG_MIPS_MALTA is not set
# CONFIG_MIPS_MAGNUM_4000 is not set
# CONFIG_OLIVETTI_M700 is not set
+# CONFIG_PMC_CP7000 is not set
CONFIG_SGI_IP22=y
# CONFIG_SNI_RM200_PCI is not set
# CONFIG_MCA is not set
diff --git a/arch/mips/defconfig-atlas b/arch/mips/defconfig-atlas
index c8b10e02a..fd5ac58d5 100644
--- a/arch/mips/defconfig-atlas
+++ b/arch/mips/defconfig-atlas
@@ -22,6 +22,7 @@ CONFIG_MIPS_ATLAS=y
# CONFIG_MIPS_MALTA is not set
# CONFIG_MIPS_MAGNUM_4000 is not set
# CONFIG_OLIVETTI_M700 is not set
+# CONFIG_PMC_CP7000 is not set
# CONFIG_SGI_IP22 is not set
# CONFIG_SNI_RM200_PCI is not set
# CONFIG_MCA is not set
diff --git a/arch/mips/defconfig-ddb5476 b/arch/mips/defconfig-ddb5476
index 047f60d15..55012c74d 100644
--- a/arch/mips/defconfig-ddb5476
+++ b/arch/mips/defconfig-ddb5476
@@ -22,6 +22,7 @@ CONFIG_DDB5476=y
# CONFIG_MIPS_MALTA is not set
# CONFIG_MIPS_MAGNUM_4000 is not set
# CONFIG_OLIVETTI_M700 is not set
+# CONFIG_PMC_CP7000 is not set
# CONFIG_SGI_IP22 is not set
# CONFIG_SNI_RM200_PCI is not set
# CONFIG_MCA is not set
diff --git a/arch/mips/defconfig-decstation b/arch/mips/defconfig-decstation
index 34cf52834..67e1579eb 100644
--- a/arch/mips/defconfig-decstation
+++ b/arch/mips/defconfig-decstation
@@ -22,6 +22,7 @@ CONFIG_DECSTATION=y
# CONFIG_MIPS_MALTA is not set
# CONFIG_MIPS_MAGNUM_4000 is not set
# CONFIG_OLIVETTI_M700 is not set
+# CONFIG_PMC_CP7000 is not set
# CONFIG_SGI_IP22 is not set
# CONFIG_SNI_RM200_PCI is not set
# CONFIG_MCA is not set
diff --git a/arch/mips/defconfig-ev64120 b/arch/mips/defconfig-ev64120
index a92615c6a..d29fc3edd 100644
--- a/arch/mips/defconfig-ev64120
+++ b/arch/mips/defconfig-ev64120
@@ -26,6 +26,7 @@ CONFIG_SYSCLK_100=y
# CONFIG_MIPS_MALTA is not set
# CONFIG_MIPS_MAGNUM_4000 is not set
# CONFIG_OLIVETTI_M700 is not set
+# CONFIG_PMC_CP7000 is not set
# CONFIG_SGI_IP22 is not set
# CONFIG_SNI_RM200_PCI is not set
# CONFIG_MCA is not set
diff --git a/arch/mips/defconfig-ev96100 b/arch/mips/defconfig-ev96100
index 0788919b9..5362d2500 100644
--- a/arch/mips/defconfig-ev96100
+++ b/arch/mips/defconfig-ev96100
@@ -22,12 +22,14 @@ CONFIG_MIPS_EV96100=y
# CONFIG_MIPS_MALTA is not set
# CONFIG_MIPS_MAGNUM_4000 is not set
# CONFIG_OLIVETTI_M700 is not set
+# CONFIG_PMC_CP7000 is not set
# CONFIG_SGI_IP22 is not set
# CONFIG_SNI_RM200_PCI is not set
# CONFIG_MCA is not set
# CONFIG_SBUS is not set
CONFIG_PCI=y
CONFIG_MIPS_GT96100=y
+CONFIG_SWAP_IO_SPACE=y
# CONFIG_ISA is not set
# CONFIG_EISA is not set
# CONFIG_I8259 is not set
diff --git a/arch/mips/defconfig-ip22 b/arch/mips/defconfig-ip22
index 305b2fa51..bf1c13cc6 100644
--- a/arch/mips/defconfig-ip22
+++ b/arch/mips/defconfig-ip22
@@ -22,6 +22,7 @@ CONFIG_EXPERIMENTAL=y
# CONFIG_MIPS_MALTA is not set
# CONFIG_MIPS_MAGNUM_4000 is not set
# CONFIG_OLIVETTI_M700 is not set
+# CONFIG_PMC_CP7000 is not set
CONFIG_SGI_IP22=y
# CONFIG_SNI_RM200_PCI is not set
# CONFIG_MCA is not set
diff --git a/arch/mips/defconfig-malta b/arch/mips/defconfig-malta
index ebb393de3..fbf765903 100644
--- a/arch/mips/defconfig-malta
+++ b/arch/mips/defconfig-malta
@@ -22,6 +22,7 @@ CONFIG_EXPERIMENTAL=y
CONFIG_MIPS_MALTA=y
# CONFIG_MIPS_MAGNUM_4000 is not set
# CONFIG_OLIVETTI_M700 is not set
+# CONFIG_PMC_CP7000 is not set
# CONFIG_SGI_IP22 is not set
# CONFIG_SNI_RM200_PCI is not set
# CONFIG_MCA is not set
diff --git a/arch/mips/defconfig-rm200 b/arch/mips/defconfig-rm200
index 0a015afbc..718e6612a 100644
--- a/arch/mips/defconfig-rm200
+++ b/arch/mips/defconfig-rm200
@@ -22,6 +22,7 @@ CONFIG_EXPERIMENTAL=y
# CONFIG_MIPS_MALTA is not set
# CONFIG_MIPS_MAGNUM_4000 is not set
# CONFIG_OLIVETTI_M700 is not set
+# CONFIG_PMC_CP7000 is not set
# CONFIG_SGI_IP22 is not set
CONFIG_SNI_RM200_PCI=y
# CONFIG_MCA is not set
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index d8b09483d..b10fa8ba7 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -1,5 +1,4 @@
-/* $Id: io.h,v 1.13 2000/02/24 00:13:19 ralf Exp $
- *
+/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
@@ -7,16 +6,37 @@
* Copyright (C) 1994, 1995 Waldorf GmbH
* Copyright (C) 1994 - 2000 Ralf Baechle
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
+ * Copyright (C) 2000 FSMLabs, Inc.
*/
#ifndef _ASM_IO_H
#define _ASM_IO_H
+#include <linux/config.h>
+#include <asm/addrspace.h>
+#include <asm/byteorder.h>
+
/*
* Slowdown I/O port space accesses for antique hardware.
*/
#undef CONF_SLOWDOWN_IO
-#include <asm/addrspace.h>
+/*
+ * Sane hardware offers swapping of I/O space accesses in hardware; less
+ * sane hardware forces software to fiddle with this ...
+ */
+#ifdef CONFIG_SWAP_IO_SPACE
+
+#define __ioswab8(x) (x)
+#define __ioswab16(x) swab16(x)
+#define __ioswab32(x) swab32(x)
+
+#else
+
+#define __ioswab8(x) (x)
+#define __ioswab16(x) (x)
+#define __ioswab32(x) (x)
+
+#endif
/*
* This file contains the definitions for the MIPS counterpart of the
@@ -152,15 +172,15 @@ extern inline void iounmap(void *addr)
* XXX more SNI hacks.
*/
#define readb(addr) (*(volatile unsigned char *)(addr))
-#define readw(addr) (*(volatile unsigned short *)(addr))
-#define readl(addr) (*(volatile unsigned int *)(addr))
+#define readw(addr) __ioswab16((*(volatile unsigned short *)(addr)))
+#define readl(addr) __ioswab32((*(volatile unsigned int *)(addr)))
#define __raw_readb readb
#define __raw_readw readw
#define __raw_readl readl
#define writeb(b,addr) (*(volatile unsigned char *)(addr)) = (b)
-#define writew(b,addr) (*(volatile unsigned short *)(addr)) = (b)
-#define writel(b,addr) (*(volatile unsigned int *)(addr)) = (b)
+#define writew(b,addr) (*(volatile unsigned short *)(addr)) = (__ioswab16(b))
+#define writel(b,addr) (*(volatile unsigned int *)(addr)) = (__ioswab32(b))
#define __raw_writeb writeb
#define __raw_writew writew
#define __raw_writel writel
@@ -226,12 +246,12 @@ extern inline void __out##s(unsigned int value, unsigned int port) {
#define __OUT2(m) \
__asm__ __volatile__ ("s" #m "\t%0,%1(%2)"
-#define __OUT(m,s) \
-__OUT1(s) __OUT2(m) : : "r" (value), "i" (0), "r" (mips_io_port_base+port)); } \
-__OUT1(s##c) __OUT2(m) : : "r" (value), "ir" (port), "r" (mips_io_port_base)); } \
-__OUT1(s##_p) __OUT2(m) : : "r" (value), "i" (0), "r" (mips_io_port_base+port)); \
+#define __OUT(m,s,w) \
+__OUT1(s) __OUT2(m) : : "r" (__ioswab##w(value)), "i" (0), "r" (mips_io_port_base+port)); } \
+__OUT1(s##c) __OUT2(m) : : "r" (__ioswab##w(value)), "ir" (port), "r" (mips_io_port_base)); } \
+__OUT1(s##_p) __OUT2(m) : : "r" (__ioswab##w(value)), "i" (0), "r" (mips_io_port_base+port)); \
SLOW_DOWN_IO; } \
-__OUT1(s##c_p) __OUT2(m) : : "r" (value), "ir" (port), "r" (mips_io_port_base)); \
+__OUT1(s##c_p) __OUT2(m) : : "r" (__ioswab##w(value)), "ir" (port), "r" (mips_io_port_base)); \
SLOW_DOWN_IO; }
#define __IN1(t,s) \
@@ -243,11 +263,11 @@ extern __inline__ t __in##s(unsigned int port) { t _v;
#define __IN2(m) \
__asm__ __volatile__ ("l" #m "\t%0,%1(%2)"
-#define __IN(t,m,s) \
-__IN1(t,s) __IN2(m) : "=r" (_v) : "i" (0), "r" (mips_io_port_base+port)); return _v; } \
-__IN1(t,s##c) __IN2(m) : "=r" (_v) : "ir" (port), "r" (mips_io_port_base)); return _v; } \
-__IN1(t,s##_p) __IN2(m) : "=r" (_v) : "i" (0), "r" (mips_io_port_base+port)); SLOW_DOWN_IO; return _v; } \
-__IN1(t,s##c_p) __IN2(m) : "=r" (_v) : "ir" (port), "r" (mips_io_port_base)); SLOW_DOWN_IO; return _v; }
+#define __IN(t,m,s,w) \
+__IN1(t,s) __IN2(m) : "=r" (_v) : "i" (0), "r" (mips_io_port_base+port)); return __ioswab##w(_v); } \
+__IN1(t,s##c) __IN2(m) : "=r" (_v) : "ir" (port), "r" (mips_io_port_base)); return __ioswab##w(_v); } \
+__IN1(t,s##_p) __IN2(m) : "=r" (_v) : "i" (0), "r" (mips_io_port_base+port)); SLOW_DOWN_IO; return __ioswab##w(_v); } \
+__IN1(t,s##c_p) __IN2(m) : "=r" (_v) : "ir" (port), "r" (mips_io_port_base)); SLOW_DOWN_IO; return __ioswab##w(_v); }
#define __INS1(s) \
extern inline void __ins##s(unsigned int port, void * addr, unsigned long count) {
@@ -268,11 +288,13 @@ __asm__ __volatile__ ( \
#define __INS(m,s,i) \
__INS1(s) __INS2(m) \
: "=r" (addr), "=r" (count) \
- : "0" (addr), "1" (count), "i" (0), "r" (mips_io_port_base+port), "I" (i) \
+ : "0" (addr), "1" (count), "i" (0), \
+ "r" (mips_io_port_base+port), "I" (i) \
: "$1");} \
__INS1(s##c) __INS2(m) \
: "=r" (addr), "=r" (count) \
- : "0" (addr), "1" (count), "ir" (port), "r" (mips_io_port_base), "I" (i) \
+ : "0" (addr), "1" (count), "ir" (port), \
+ "r" (mips_io_port_base), "I" (i) \
: "$1");}
#define __OUTS1(s) \
@@ -301,13 +323,13 @@ __OUTS1(s##c) __OUTS2(m) \
: "0" (addr), "1" (count), "ir" (port), "r" (mips_io_port_base), "I" (i) \
: "$1");}
-__IN(unsigned char,b,b)
-__IN(unsigned short,h,w)
-__IN(unsigned int,w,l)
+__IN(unsigned char,b,b,8)
+__IN(unsigned short,h,w,16)
+__IN(unsigned int,w,l,32)
-__OUT(b,b)
-__OUT(h,w)
-__OUT(w,l)
+__OUT(b,b,8)
+__OUT(h,w,16)
+__OUT(w,l,32)
__INS(b,b,1)
__INS(h,w,2)
@@ -318,56 +340,6 @@ __OUTS(h,w,2)
__OUTS(w,l,4)
-#ifdef CONFIG_MIPS_EV96100
-
-#include <asm/byteorder.h>
-
-#define inb(port) in_8((u8 *)((port)+mips_io_port_base))
-#define outb(val, port) out_8((u8 *)((port)+mips_io_port_base), (val))
-#define inw(port) in_16((u16 *)((port)+mips_io_port_base))
-#define outw(val, port) out_16((u16 *)((port)+mips_io_port_base), (val))
-#define inl(port) in_32((u32 *)((port)+mips_io_port_base))
-#define outl(val, port) out_32((u32 *)((port)+mips_io_port_base), (val))
-
-#define inb_p(port) inb((port))
-#define outb_p(val, port) outb((val), (port))
-#define inw_p(port) inw((port))
-#define outw_p(val, port) outw((val), (port))
-#define inl_p(port) inl((port))
-#define outl_p(val, port) outl((val), (port))
-
-extern inline unsigned char in_8(const unsigned char *addr)
-{
- return *KSEG1ADDR(addr);
-}
-
-extern inline void out_8(unsigned char *addr, unsigned int val)
-{
- *KSEG1ADDR(addr) = (unsigned char)val;
-}
-
-extern inline unsigned short in_16(const unsigned short *addr)
-{
- return (le16_to_cpu(*KSEG1ADDR(addr)));
-}
-
-extern inline void out_16(unsigned short *addr, unsigned int val)
-{
- *KSEG1ADDR(addr) = cpu_to_le16((unsigned short)val);
-}
-
-extern inline unsigned int in_32(const unsigned int *addr)
-{
- return (le32_to_cpu(*KSEG1ADDR(addr)));
-}
-
-extern inline void out_32(unsigned int *addr, unsigned int val)
-{
- *KSEG1ADDR(addr) = cpu_to_le32((unsigned int)val);
-}
-
-#else
-
/*
* Note that due to the way __builtin_constant_p() works, you
* - can't use it inside an inline function (it will never be true)
@@ -463,7 +435,6 @@ extern inline void out_32(unsigned int *addr, unsigned int val)
((__builtin_constant_p((port)) && (port) < 32768) ? \
__inslc((port),(addr),(count)) : \
__insl((port),(addr),(count)))
-#endif
#define IO_SPACE_LIMIT 0xffff